diff --git a/storybook/pages/CommunityPermissionsSettingsPanelPage.qml b/storybook/pages/CommunityPermissionsSettingsPanelPage.qml index 41377132d40..de60e9b3a32 100644 --- a/storybook/pages/CommunityPermissionsSettingsPanelPage.qml +++ b/storybook/pages/CommunityPermissionsSettingsPanelPage.qml @@ -25,6 +25,8 @@ SplitView { topMargin: 50 } store: CommunitiesStore { + readonly property bool isOwner: isOwnerCheckBox.checked + assetsModel: AssetsModel {} collectiblesModel: CollectiblesModel {} channelsModel: ListModel { @@ -80,6 +82,12 @@ SplitView { SplitView.preferredHeight: 150 logsView.logText: logs.logText + + CheckBox { + id: isOwnerCheckBox + + text: "Is owner" + } } } } diff --git a/ui/app/AppLayouts/Chat/controls/community/PermissionListItem.qml b/ui/app/AppLayouts/Chat/controls/community/PermissionListItem.qml index 523bc3e29a1..b3e4344d8be 100644 --- a/ui/app/AppLayouts/Chat/controls/community/PermissionListItem.qml +++ b/ui/app/AppLayouts/Chat/controls/community/PermissionListItem.qml @@ -5,6 +5,8 @@ import StatusQ.Controls 0.1 import QtQuick 2.14 import QtQuick.Controls 2.14 +import utils 1.0 + StatusListItem { id: root @@ -22,10 +24,17 @@ StatusListItem { asset.bgWidth: 32 asset.bgHeight: 32 + Binding on asset.color { + when: !root.enabled + value: Style.current.darkGrey + } + components: [ StatusRadioButton { id: radioButton + visible: root.enabled + // reference to root for better integration with ButtonGroup // by accessing main component via ButtonGroup::checkedButton.item readonly property alias item: root diff --git a/ui/app/AppLayouts/Chat/controls/community/PermissionsDropdown.qml b/ui/app/AppLayouts/Chat/controls/community/PermissionsDropdown.qml index 79ff813f105..016d07002fa 100644 --- a/ui/app/AppLayouts/Chat/controls/community/PermissionsDropdown.qml +++ b/ui/app/AppLayouts/Chat/controls/community/PermissionsDropdown.qml @@ -15,6 +15,8 @@ StatusDropdown { property int mode: PermissionsDropdown.Mode.Add property int initialPermissionType: PermissionTypes.Type.None + property bool disableAdminPermission: false + enum Mode { Add, Update } @@ -93,6 +95,8 @@ StatusDropdown { checked: d.initialPermissionType === permissionType buttonGroup: group + enabled: !root.disableAdminPermission + Layout.fillWidth: true } diff --git a/ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml b/ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml index 6195365400c..ea405d9e827 100644 --- a/ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml +++ b/ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml @@ -3,6 +3,8 @@ import QtQuick 2.0 QtObject { id: root + readonly property bool isOwner: false + property var permissionsModel: ListModel {} // Backend permissions list object model assignment. Please check the current expected data in qml defined in `createPermissions` method property var permissionConflict: QtObject { // Backend conflicts object model assignment. Now mocked data. property bool exists: false diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityNewPermissionView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityNewPermissionView.qml index 28e335b47b9..ba4bcd9e955 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityNewPermissionView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityNewPermissionView.qml @@ -414,6 +414,7 @@ StatusScrollView { id: permissionsDropdown initialPermissionType: d.permissionType + disableAdminPermission: !root.store.isOwner onDone: { d.permissionType = permissionType