parent
7954b0f330
commit
fe7884cd29
|
@ -7,6 +7,7 @@ import AppLayouts.Chat.stores 1.0
|
||||||
SettingsPageLayout {
|
SettingsPageLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property var rootStore
|
||||||
property var store: CommunitiesStore {}
|
property var store: CommunitiesStore {}
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
|
|
||||||
|
@ -133,6 +134,7 @@ SettingsPageLayout {
|
||||||
CommunityNewPermissionView {
|
CommunityNewPermissionView {
|
||||||
id: newPermissionViewItem
|
id: newPermissionViewItem
|
||||||
viewWidth: root.viewWidth
|
viewWidth: root.viewWidth
|
||||||
|
rootStore: root.rootStore
|
||||||
store: root.store
|
store: root.store
|
||||||
onPermissionCreated: root.state = d.permissionsViewState
|
onPermissionCreated: root.state = d.permissionsViewState
|
||||||
isEditState: root.state === d.editPermissionViewState
|
isEditState: root.state === d.editPermissionViewState
|
||||||
|
|
|
@ -237,6 +237,7 @@ StatusSectionLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
CommunityPermissionsSettingsPanel {
|
CommunityPermissionsSettingsPanel {
|
||||||
|
rootStore: root.rootStore
|
||||||
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,9 @@ import "../../../Chat/controls/community"
|
||||||
StatusScrollView {
|
StatusScrollView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property var rootStore
|
||||||
property var store
|
property var store
|
||||||
|
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
property bool isEditState: false
|
property bool isEditState: false
|
||||||
property bool dirty: {
|
property bool dirty: {
|
||||||
|
@ -65,6 +67,10 @@ StatusScrollView {
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
|
||||||
|
readonly property int dropdownHorizontalOffset: 4
|
||||||
|
readonly property int dropdownVerticalOffset: 1
|
||||||
|
|
||||||
property int permissionType: PermissionTypes.Type.None
|
property int permissionType: PermissionTypes.Type.None
|
||||||
property bool triggerDirtyTool: false // Trick: Used to force the reevaluation of dirty when an item of the list is updated
|
property bool triggerDirtyTool: false // Trick: Used to force the reevaluation of dirty when an item of the list is updated
|
||||||
|
|
||||||
|
@ -281,7 +287,7 @@ StatusScrollView {
|
||||||
|
|
||||||
addButton.onClicked: {
|
addButton.onClicked: {
|
||||||
dropdown.parent = tokensSelector.addButton
|
dropdown.parent = tokensSelector.addButton
|
||||||
dropdown.x = tokensSelector.addButton.width + 4
|
dropdown.x = tokensSelector.addButton.width + d.dropdownHorizontalOffset
|
||||||
dropdown.y = 0
|
dropdown.y = 0
|
||||||
|
|
||||||
if (d.dirtyValues.holdingsModel && d.dirtyValues.holdingsModel.count === 0)
|
if (d.dirtyValues.holdingsModel && d.dirtyValues.holdingsModel.count === 0)
|
||||||
|
@ -295,8 +301,8 @@ StatusScrollView {
|
||||||
return
|
return
|
||||||
|
|
||||||
dropdown.parent = item
|
dropdown.parent = item
|
||||||
dropdown.x = mouse.x + 4
|
dropdown.x = mouse.x + d.dropdownHorizontalOffset
|
||||||
dropdown.y = 1
|
dropdown.y = d.dropdownVerticalOffset
|
||||||
|
|
||||||
const modelItem = tokensSelector.itemsModel.get(index)
|
const modelItem = tokensSelector.itemsModel.get(index)
|
||||||
|
|
||||||
|
@ -361,7 +367,8 @@ StatusScrollView {
|
||||||
addButton.onClicked: {
|
addButton.onClicked: {
|
||||||
permissionsDropdown.mode = PermissionsDropdown.Mode.Add
|
permissionsDropdown.mode = PermissionsDropdown.Mode.Add
|
||||||
permissionsDropdown.parent = permissionsSelector.addButton
|
permissionsDropdown.parent = permissionsSelector.addButton
|
||||||
permissionsDropdown.x = permissionsSelector.addButton.width + 4
|
permissionsDropdown.x = permissionsSelector.addButton.width
|
||||||
|
+ d.dropdownHorizontalOffset
|
||||||
permissionsDropdown.y = 0
|
permissionsDropdown.y = 0
|
||||||
permissionsDropdown.open()
|
permissionsDropdown.open()
|
||||||
}
|
}
|
||||||
|
@ -372,8 +379,8 @@ StatusScrollView {
|
||||||
|
|
||||||
permissionsDropdown.mode = PermissionsDropdown.Mode.Update
|
permissionsDropdown.mode = PermissionsDropdown.Mode.Update
|
||||||
permissionsDropdown.parent = item
|
permissionsDropdown.parent = item
|
||||||
permissionsDropdown.x = mouse.x + 4
|
permissionsDropdown.x = mouse.x + d.dropdownHorizontalOffset
|
||||||
permissionsDropdown.y = 1
|
permissionsDropdown.y = d.dropdownVerticalOffset
|
||||||
permissionsDropdown.open()
|
permissionsDropdown.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,11 +391,105 @@ StatusScrollView {
|
||||||
color: Style.current.separator
|
color: Style.current.separator
|
||||||
}
|
}
|
||||||
StatusItemSelector {
|
StatusItemSelector {
|
||||||
|
id: inSelector
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
icon: Style.svg("create-category")
|
icon: Style.svg("create-category")
|
||||||
iconSize: 24
|
iconSize: 24
|
||||||
title: qsTr("In")
|
title: qsTr("In")
|
||||||
defaultItemText: qsTr("Example: `#general` channel")
|
defaultItemText: qsTr("Example: `#general` channel")
|
||||||
|
|
||||||
|
useLetterIdenticons: !wholeCommunitySelected || !inDropdown.communityImage
|
||||||
|
|
||||||
|
property bool wholeCommunitySelected: false
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: inModelCommunity
|
||||||
|
|
||||||
|
readonly property string colorWorkaround: inDropdown.communityData.color
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
append({
|
||||||
|
imageSource: inDropdown.communityData.image,
|
||||||
|
text: inDropdown.communityData.name,
|
||||||
|
operator: OperatorsUtils.Operators.None
|
||||||
|
})
|
||||||
|
|
||||||
|
setProperty(0, "color", colorWorkaround)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: inModelChannels
|
||||||
|
}
|
||||||
|
|
||||||
|
InDropdown {
|
||||||
|
id: inDropdown
|
||||||
|
|
||||||
|
model: root.rootStore.chatCommunitySectionModule.model
|
||||||
|
|
||||||
|
readonly property var communityData: rootStore.mainModuleInst.activeSection
|
||||||
|
|
||||||
|
communityName: communityData.name
|
||||||
|
communityImage: communityData.image
|
||||||
|
communityColor: communityData.color
|
||||||
|
|
||||||
|
onChannelsSelected: {
|
||||||
|
inModelChannels.clear()
|
||||||
|
inSelector.itemsModel = 0
|
||||||
|
inSelector.wholeCommunitySelected = false
|
||||||
|
|
||||||
|
channels.map(channel => {
|
||||||
|
inModelChannels.append({
|
||||||
|
itemId: channel.itemId,
|
||||||
|
text: "#" + channel.name,
|
||||||
|
emoji: channel.emoji,
|
||||||
|
color: channel.color,
|
||||||
|
operator: OperatorsUtils.Operators.None
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
inSelector.itemsModel = inModelChannels
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
|
||||||
|
onCommunitySelected: {
|
||||||
|
inModelChannels.clear()
|
||||||
|
inSelector.wholeCommunitySelected = true
|
||||||
|
inSelector.itemsModel = inModelCommunity
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openInDropdown(parent, x, y) {
|
||||||
|
inDropdown.parent = parent
|
||||||
|
inDropdown.x = x
|
||||||
|
inDropdown.y = y
|
||||||
|
|
||||||
|
const selectedChannels = []
|
||||||
|
|
||||||
|
if (!inSelector.wholeCommunitySelected)
|
||||||
|
for (let i = 0; i < inModelChannels.count; i++)
|
||||||
|
selectedChannels.push(inModelChannels.get(i).itemId)
|
||||||
|
|
||||||
|
inDropdown.setSelectedChannels(selectedChannels)
|
||||||
|
inDropdown.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
addButton.onClicked: {
|
||||||
|
inDropdown.acceptMode = InDropdown.AcceptMode.Add
|
||||||
|
openInDropdown(inSelector.addButton,
|
||||||
|
inSelector.addButton.width + d.dropdownHorizontalOffset, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
onItemClicked: {
|
||||||
|
if (mouse.button !== Qt.LeftButton)
|
||||||
|
return
|
||||||
|
|
||||||
|
inDropdown.acceptMode = InDropdown.AcceptMode.Update
|
||||||
|
openInDropdown(item, mouse.x + d.dropdownHorizontalOffset,
|
||||||
|
d.dropdownVerticalOffset)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Separator {
|
Separator {
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 24
|
||||||
|
|
Loading…
Reference in New Issue