chore(CommunityPermissions): Simplify InDropdown popup (selecting only channels, no add channel button)

This commit is contained in:
Michał Cieślak 2023-01-20 12:08:20 +01:00 committed by Michał
parent e2dadeb15e
commit ecf999eb37
2 changed files with 27 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import QtQuick 2.14 import QtQuick 2.14
import QtQuick.Controls 2.14 import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import AppLayouts.Chat.controls.community 1.0 import AppLayouts.Chat.controls.community 1.0
@ -23,6 +24,9 @@ SplitView {
parent: pane parent: pane
anchors.centerIn: parent anchors.centerIn: parent
allowChoosingEntireCommunity: allowChoosingEntireCommunityCheckBox.checked
showAddChannelButton: showAddChannelButtonCheckBox.checked
communityName: "Socks" communityName: "Socks"
communityImage: ModelsData.icons.socks communityImage: ModelsData.icons.socks
communityColor: "red" communityColor: "red"
@ -53,5 +57,18 @@ SplitView {
SplitView.preferredHeight: 200 SplitView.preferredHeight: 200
logsView.logText: logs.logText logsView.logText: logs.logText
ColumnLayout {
CheckBox {
id: allowChoosingEntireCommunityCheckBox
text: "Allow choosing entire community"
}
CheckBox {
id: showAddChannelButtonCheckBox
text: "Show \"Add channel\" button"
}
}
} }
} }

View File

@ -14,6 +14,9 @@ import SortFilterProxyModel 0.2
StatusDropdown { StatusDropdown {
id: root id: root
property bool allowChoosingEntireCommunity: false
property bool showAddChannelButton: false
property string communityName property string communityName
property string communityImage property string communityImage
property color communityColor property color communityColor
@ -100,6 +103,7 @@ StatusDropdown {
Layout.topMargin: 9 Layout.topMargin: 9
Layout.preferredHeight: 44 Layout.preferredHeight: 44
visible: root.allowChoosingEntireCommunity
title: root.communityName title: root.communityName
subTitle: qsTr("Community") subTitle: qsTr("Community")
@ -147,6 +151,8 @@ StatusDropdown {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 4 - implicitHeight / 2 Layout.topMargin: 4 - implicitHeight / 2
Layout.bottomMargin: 4 - implicitHeight / 2 Layout.bottomMargin: 4 - implicitHeight / 2
visible: root.allowChoosingEntireCommunity
} }
StatusScrollView { StatusScrollView {
@ -154,6 +160,8 @@ StatusDropdown {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: 9 Layout.bottomMargin: 9
Layout.topMargin:
!root.allowChoosingEntireCommunity && !root.allowChoosingEntireCommunity ? 9 : 0
padding: 0 padding: 0
@ -166,6 +174,8 @@ StatusDropdown {
StatusIconTextButton { StatusIconTextButton {
Layout.preferredHeight: 36 Layout.preferredHeight: 36
visible: root.showAddChannelButton
leftPadding: 8 leftPadding: 8
spacing: 8 spacing: 8
statusIcon: "add" statusIcon: "add"