2022-06-09 15:27:14 +00:00
|
|
|
|
import QtQuick 2.14
|
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
2022-11-25 17:35:30 +00:00
|
|
|
|
import StatusQ.Core.Utils 0.1
|
2022-06-09 15:27:14 +00:00
|
|
|
|
|
2022-12-06 11:19:20 +00:00
|
|
|
|
import AppLayouts.Chat.helpers 1.0
|
2022-06-09 15:27:14 +00:00
|
|
|
|
import utils 1.0
|
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
|
2022-09-07 09:40:25 +00:00
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
2022-12-06 11:19:20 +00:00
|
|
|
|
|
2022-06-09 15:27:14 +00:00
|
|
|
|
import "../../../Chat/controls/community"
|
|
|
|
|
|
2022-12-13 13:09:38 +00:00
|
|
|
|
StatusScrollView {
|
2022-06-09 15:27:14 +00:00
|
|
|
|
id: root
|
|
|
|
|
|
2022-11-25 17:35:30 +00:00
|
|
|
|
property var store
|
|
|
|
|
property int viewWidth: 560 // by design
|
2022-11-24 16:23:54 +00:00
|
|
|
|
property bool isEditState: false
|
|
|
|
|
property bool dirty: {
|
|
|
|
|
|
|
|
|
|
let trick = d.triggerDirtyTool // Trick: Used to force the reevaluation of dirty when an item of the list is updated
|
|
|
|
|
|
|
|
|
|
// Holdings:
|
|
|
|
|
const dirtyHoldingsList = d.checkIfHoldingsDirty()
|
|
|
|
|
|
|
|
|
|
// Permissions:
|
|
|
|
|
let dirtyPermissionObj = false
|
|
|
|
|
if(root.permissionObject && d.dirtyValues.permissionObject.key !== null) {
|
|
|
|
|
dirtyPermissionObj = (d.dirtyValues.permissionObject.key !== root.permissionObject.key) ||
|
|
|
|
|
(d.dirtyValues.permissionObject.text !== root.permissionObject.text) ||
|
|
|
|
|
(d.dirtyValues.permissionObject.imageSource !== root.permissionObject.imageSource)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
dirtyPermissionObj = d.dirtyValues.permissionObject.key !== null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Channels:
|
|
|
|
|
let dirtyChannelsList = false
|
|
|
|
|
|
|
|
|
|
return dirtyHoldingsList || dirtyPermissionObj || dirtyChannelsList || d.dirtyValues.isPrivateDirty
|
|
|
|
|
}
|
|
|
|
|
property bool saveChanges: false
|
|
|
|
|
property bool resetChanges: false
|
|
|
|
|
|
|
|
|
|
property int permissionIndex
|
|
|
|
|
|
|
|
|
|
// roles: type, key, name, amount, imageSource, operator
|
|
|
|
|
property var holdingsModel: ListModel {}
|
|
|
|
|
|
|
|
|
|
// roles: key, text, imageSource
|
|
|
|
|
property var permissionObject
|
|
|
|
|
|
|
|
|
|
// TODO roles:
|
|
|
|
|
property var channelsModel: ListModel {}
|
|
|
|
|
|
|
|
|
|
property bool isPrivate
|
2022-08-23 08:46:37 +00:00
|
|
|
|
|
2022-11-25 17:35:30 +00:00
|
|
|
|
signal permissionCreated()
|
2022-08-23 08:46:37 +00:00
|
|
|
|
|
2022-06-09 15:27:14 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
2022-09-09 22:09:37 +00:00
|
|
|
|
property int permissionType: PermissionTypes.Type.None
|
2022-11-24 16:23:54 +00:00
|
|
|
|
property bool triggerDirtyTool: false // Trick: Used to force the reevaluation of dirty when an item of the list is updated
|
|
|
|
|
|
|
|
|
|
property QtObject dirtyValues: QtObject {
|
|
|
|
|
property ListModel holdingsModel: ListModel {}
|
|
|
|
|
property QtObject permissionObject: QtObject {
|
|
|
|
|
property var key: null
|
|
|
|
|
property string text: ""
|
|
|
|
|
property string imageSource: ""
|
|
|
|
|
}
|
|
|
|
|
property bool isPrivateDirty: false
|
|
|
|
|
|
|
|
|
|
// TODO: Channels
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveChanges() {
|
|
|
|
|
|
|
|
|
|
root.store.editPermission(root.permissionIndex,
|
|
|
|
|
d.dirtyValues.holdingsModel,
|
|
|
|
|
d.dirtyValues.permissionObject,
|
|
|
|
|
root.channelsModel,
|
|
|
|
|
d.dirtyValues.isPrivateDirty ? !root.isPrivate : root.isPrivate)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadInitValues() {
|
|
|
|
|
// Holdings:
|
|
|
|
|
d.dirtyValues.holdingsModel.clear()
|
|
|
|
|
if(root.holdingsModel) {
|
|
|
|
|
for(let i = 0; i < root.holdingsModel.count; i++) {
|
|
|
|
|
let item = root.holdingsModel.get(i)
|
|
|
|
|
let initItem = null
|
|
|
|
|
if(item.shortName) {
|
|
|
|
|
initItem = {
|
|
|
|
|
type: item.type,
|
|
|
|
|
key: item.key,
|
|
|
|
|
name: item.name,
|
|
|
|
|
shortName: item.shortName,
|
|
|
|
|
amount: item.amount,
|
|
|
|
|
imageSource: item.imageSource,
|
|
|
|
|
operator: item.operator
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
initItem = {
|
|
|
|
|
type: item.type,
|
|
|
|
|
key: item.key,
|
|
|
|
|
name: item.name,
|
|
|
|
|
amount: item.amount,
|
|
|
|
|
imageSource: item.imageSource,
|
|
|
|
|
operator: item.operator
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d.dirtyValues.holdingsModel.append(initItem)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Permissions:
|
|
|
|
|
d.dirtyValues.permissionObject.key = root.permissionObject ? root.permissionObject.key : null
|
|
|
|
|
d.dirtyValues.permissionObject.text = root.permissionObject ? root.permissionObject.text : ""
|
|
|
|
|
d.dirtyValues.permissionObject.imageSource = root.permissionObject ? root.permissionObject.imageSource : ""
|
|
|
|
|
|
|
|
|
|
// TODO: Channels
|
|
|
|
|
|
|
|
|
|
// Is private permission
|
|
|
|
|
d.dirtyValues.isPrivateDirty = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkIfHoldingsDirty() {
|
|
|
|
|
let dirty = false
|
|
|
|
|
if(root.holdingsModel) {
|
|
|
|
|
if(root.holdingsModel.count !== d.dirtyValues.holdingsModel.count) {
|
|
|
|
|
dirty = true
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Check element by element
|
|
|
|
|
let equals = 0
|
|
|
|
|
for(let i = 0; i < root.holdingsModel.count; i++) {
|
|
|
|
|
const item1 = root.holdingsModel.get(i)
|
|
|
|
|
for(let j = 0; j < d.dirtyValues.holdingsModel.count; j++) {
|
|
|
|
|
let item2 = d.dirtyValues.holdingsModel.get(j)
|
|
|
|
|
// key, name, shortName, amount, operator
|
|
|
|
|
if((item1.key === item2.key) &&
|
|
|
|
|
(item1.name === item2.name) &&
|
|
|
|
|
(item1.shortName === item2.shortName) &&
|
|
|
|
|
(item1.amount === item2.amount) &&
|
|
|
|
|
(item1.operator === item2.operator)) {
|
|
|
|
|
equals = equals + 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dirty = (equals !== root.holdingsModel.count)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
dirty = (d.dirtyValues.holdingsModel.count !== 0)
|
|
|
|
|
}
|
|
|
|
|
return dirty
|
|
|
|
|
}
|
2022-06-09 15:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentWidth: mainLayout.width
|
|
|
|
|
contentHeight: mainLayout.height
|
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
onSaveChangesChanged: if(saveChanges) d.saveChanges()
|
|
|
|
|
onResetChangesChanged: if(resetChanges) d.loadInitValues()
|
|
|
|
|
onPermissionObjectChanged: d.loadInitValues()
|
|
|
|
|
|
2022-06-09 15:27:14 +00:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: mainLayout
|
2022-11-25 17:35:30 +00:00
|
|
|
|
width: root.viewWidth
|
2022-06-09 15:27:14 +00:00
|
|
|
|
spacing: 0
|
|
|
|
|
CurveSeparatorWithText {
|
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
|
Layout.leftMargin: 14
|
|
|
|
|
text: qsTr("Anyone")
|
|
|
|
|
}
|
|
|
|
|
StatusItemSelector {
|
|
|
|
|
id: tokensSelector
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
icon: Style.svg("contact_verified")
|
|
|
|
|
title: qsTr("Who holds")
|
|
|
|
|
defaultItemText: qsTr("Example: 10 SNT")
|
2022-12-21 13:59:43 +00:00
|
|
|
|
tagLeftPadding: 2
|
|
|
|
|
asset.height: 28
|
|
|
|
|
asset.width: asset.height
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
|
|
|
|
property int editedIndex
|
|
|
|
|
itemsModel: SortFilterProxyModel {
|
2022-11-24 16:23:54 +00:00
|
|
|
|
sourceModel: d.dirtyValues.holdingsModel
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
|
|
|
|
proxyRoles: ExpressionRole {
|
|
|
|
|
name: "text"
|
2022-11-25 17:35:30 +00:00
|
|
|
|
expression: root.store.setHoldingsTextFormat(model.type, model.name, model.amount)
|
2022-09-07 09:40:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HoldingsDropdown {
|
2022-06-09 15:27:14 +00:00
|
|
|
|
id: dropdown
|
2022-08-23 08:46:37 +00:00
|
|
|
|
store: root.store
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
|
|
|
|
function addItem(type, item, amount, operator) {
|
|
|
|
|
const key = item.key
|
2022-11-25 17:35:30 +00:00
|
|
|
|
const name = item.shortName ? item.shortName : item.name
|
2022-09-07 09:40:25 +00:00
|
|
|
|
const imageSource = item.iconSource.toString()
|
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.holdingsModel.append({ type, key, name, amount, imageSource, operator })
|
2022-09-07 09:40:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAddToken: {
|
2022-12-06 11:19:20 +00:00
|
|
|
|
const modelItem = CommunityPermissionsHelpers.getTokenByKey(
|
|
|
|
|
store.tokensModel, key)
|
2022-09-07 09:40:25 +00:00
|
|
|
|
addItem(HoldingTypes.Type.Token, modelItem, amount, operator)
|
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAddCollectible: {
|
2022-12-06 11:19:20 +00:00
|
|
|
|
const modelItem = CommunityPermissionsHelpers.getCollectibleByKey(
|
|
|
|
|
store.collectiblesModel, key)
|
2022-09-07 09:40:25 +00:00
|
|
|
|
addItem(HoldingTypes.Type.Collectible, modelItem, amount, operator)
|
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAddEns: {
|
|
|
|
|
const key = any ? "EnsAny" : "EnsCustom"
|
|
|
|
|
const name = any ? "" : customDomain
|
2022-09-09 22:09:37 +00:00
|
|
|
|
const icon = Style.svg("ensUsernames")
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.holdingsModel.append({type: HoldingTypes.Type.Ens, key, name, amount: 1, imageSource: icon, operator })
|
2022-09-07 09:40:25 +00:00
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUpdateToken: {
|
2022-12-06 11:19:20 +00:00
|
|
|
|
const modelItem = CommunityPermissionsHelpers.getTokenByKey(
|
|
|
|
|
store.tokensModel, key)
|
2022-11-25 17:35:30 +00:00
|
|
|
|
const name = modelItem.shortName ? modelItem.shortName : modelItem.name
|
2022-09-07 09:40:25 +00:00
|
|
|
|
const imageSource = modelItem.iconSource.toString()
|
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.holdingsModel.set(tokensSelector.editedIndex, { type: HoldingTypes.Type.Token, key, name, amount, imageSource })
|
|
|
|
|
d.triggerDirtyTool = !d.triggerDirtyTool
|
2022-06-09 15:27:14 +00:00
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
|
|
|
|
onUpdateCollectible: {
|
2022-12-06 11:19:20 +00:00
|
|
|
|
const modelItem = CommunityPermissionsHelpers.getCollectibleByKey(
|
|
|
|
|
store.collectiblesModel, key)
|
2022-09-07 09:40:25 +00:00
|
|
|
|
const name = modelItem.name
|
|
|
|
|
const imageSource = modelItem.iconSource.toString()
|
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.holdingsModel.set(tokensSelector.editedIndex, { type: HoldingTypes.Type.Collectible, key, name, amount, imageSource })
|
|
|
|
|
d.triggerDirtyTool = !d.triggerDirtyTool
|
2022-09-07 09:40:25 +00:00
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUpdateEns: {
|
|
|
|
|
const key = any ? "EnsAny" : "EnsCustom"
|
|
|
|
|
const name = any ? "" : customDomain
|
2022-09-09 22:09:37 +00:00
|
|
|
|
const icon = Style.svg("ensUsernames")
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.holdingsModel.set(tokensSelector.editedIndex, { type: HoldingTypes.Type.Ens, key, name: name, amount: 1, imageSource: icon })
|
|
|
|
|
d.triggerDirtyTool = !d.triggerDirtyTool
|
2022-09-07 09:40:25 +00:00
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRemoveClicked: {
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.holdingsModel.remove(tokensSelector.editedIndex)
|
2022-09-07 09:40:25 +00:00
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
if (d.dirtyValues.holdingsModel && d.dirtyValues.holdingsModel.count) {
|
|
|
|
|
d.dirtyValues.holdingsModel.set(0, { operator: OperatorsUtils.Operators.None})
|
2022-09-07 09:40:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dropdown.close()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addButton.onClicked: {
|
|
|
|
|
dropdown.parent = tokensSelector.addButton
|
|
|
|
|
dropdown.x = tokensSelector.addButton.width + 4
|
|
|
|
|
dropdown.y = 0
|
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
if (d.dirtyValues.holdingsModel && d.dirtyValues.holdingsModel.count === 0)
|
2022-09-07 09:40:25 +00:00
|
|
|
|
dropdown.openFlow(HoldingsDropdown.FlowType.Add)
|
|
|
|
|
else
|
|
|
|
|
dropdown.openFlow(HoldingsDropdown.FlowType.AddWithOperators)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onItemClicked: {
|
|
|
|
|
if (mouse.button !== Qt.LeftButton)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
dropdown.parent = item
|
|
|
|
|
dropdown.x = mouse.x + 4
|
|
|
|
|
dropdown.y = 1
|
|
|
|
|
|
|
|
|
|
const modelItem = tokensSelector.itemsModel.get(index)
|
|
|
|
|
|
|
|
|
|
switch(modelItem.type) {
|
|
|
|
|
case HoldingTypes.Type.Token:
|
|
|
|
|
dropdown.tokenKey = modelItem.key
|
|
|
|
|
dropdown.tokenAmount = modelItem.amount
|
|
|
|
|
break
|
|
|
|
|
case HoldingTypes.Type.Collectible:
|
|
|
|
|
dropdown.collectibleKey = modelItem.key
|
|
|
|
|
dropdown.collectibleAmount = modelItem.amount
|
|
|
|
|
dropdown.collectiblesSpecificAmount = modelItem.amount !== 1
|
|
|
|
|
break
|
|
|
|
|
case HoldingTypes.Type.Ens:
|
|
|
|
|
dropdown.ensType = modelItem.name ? EnsPanel.EnsType.CustomSubdomain
|
|
|
|
|
: EnsPanel.EnsType.Any
|
|
|
|
|
dropdown.ensDomainName = modelItem.name
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
console.warn("Unsupported holdings type.")
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-15 10:12:38 +00:00
|
|
|
|
dropdown.openFlow(HoldingsDropdown.FlowType.Update)
|
|
|
|
|
dropdown.setActiveTab(modelItem.type)
|
|
|
|
|
|
2022-09-07 09:40:25 +00:00
|
|
|
|
editedIndex = index
|
2022-06-09 15:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.preferredWidth: 2
|
|
|
|
|
Layout.preferredHeight: 24
|
|
|
|
|
color: Style.current.separator
|
|
|
|
|
}
|
|
|
|
|
StatusItemSelector {
|
2022-09-09 22:09:37 +00:00
|
|
|
|
id: permissionsSelector
|
|
|
|
|
|
2022-06-09 15:27:14 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
icon: Style.svg("profile/security")
|
|
|
|
|
iconSize: 24
|
2022-09-09 22:09:37 +00:00
|
|
|
|
useIcons: true
|
2022-06-09 15:27:14 +00:00
|
|
|
|
title: qsTr("Is allowed to")
|
|
|
|
|
defaultItemText: qsTr("Example: View and post")
|
2022-11-24 16:23:54 +00:00
|
|
|
|
itemsModel: d.dirtyValues.permissionObject.key ? d.dirtyValues.permissionObject : null
|
2022-09-09 22:09:37 +00:00
|
|
|
|
|
2022-11-24 16:23:54 +00:00
|
|
|
|
addButton.visible: !root.permissionObject
|
2022-09-09 22:09:37 +00:00
|
|
|
|
|
|
|
|
|
PermissionsDropdown {
|
|
|
|
|
id: permissionsDropdown
|
|
|
|
|
|
|
|
|
|
initialPermissionType: d.permissionType
|
|
|
|
|
|
|
|
|
|
onDone: {
|
|
|
|
|
d.permissionType = permissionType
|
2022-11-24 16:23:54 +00:00
|
|
|
|
d.dirtyValues.permissionObject.key = permissionType
|
|
|
|
|
d.dirtyValues.permissionObject.text = title
|
|
|
|
|
d.dirtyValues.permissionObject.imageSource = asset
|
2022-09-09 22:09:37 +00:00
|
|
|
|
permissionsDropdown.close()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addButton.onClicked: {
|
|
|
|
|
permissionsDropdown.mode = PermissionsDropdown.Mode.Add
|
|
|
|
|
permissionsDropdown.parent = permissionsSelector.addButton
|
|
|
|
|
permissionsDropdown.x = permissionsSelector.addButton.width + 4
|
|
|
|
|
permissionsDropdown.y = 0
|
|
|
|
|
permissionsDropdown.open()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onItemClicked: {
|
|
|
|
|
if (mouse.button !== Qt.LeftButton)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
permissionsDropdown.mode = PermissionsDropdown.Mode.Update
|
|
|
|
|
permissionsDropdown.parent = item
|
|
|
|
|
permissionsDropdown.x = mouse.x + 4
|
|
|
|
|
permissionsDropdown.y = 1
|
|
|
|
|
permissionsDropdown.open()
|
|
|
|
|
}
|
2022-06-09 15:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.preferredWidth: 2
|
|
|
|
|
Layout.preferredHeight: 24
|
|
|
|
|
color: Style.current.separator
|
|
|
|
|
}
|
|
|
|
|
StatusItemSelector {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
icon: Style.svg("create-category")
|
|
|
|
|
iconSize: 24
|
|
|
|
|
title: qsTr("In")
|
|
|
|
|
defaultItemText: qsTr("Example: `#general` channel")
|
|
|
|
|
}
|
|
|
|
|
Separator {
|
|
|
|
|
Layout.topMargin: 24
|
|
|
|
|
}
|
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.topMargin: 12
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
|
spacing: 16
|
|
|
|
|
StatusRoundIcon {
|
2022-08-11 11:55:08 +00:00
|
|
|
|
asset.name: "hide"
|
2022-06-09 15:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
text: qsTr("Private")
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
}
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
text: qsTr("Make this permission private to hide it from members who don’t meet it’s requirements")
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
lineHeight: 1.2
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
clip: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StatusSwitch {
|
2022-11-24 16:23:54 +00:00
|
|
|
|
checked: d.dirtyValues.isPrivateDirty ? !root.isPrivate : root.isPrivate
|
|
|
|
|
onToggled: d.dirtyValues.isPrivateDirty = (root.isPrivate !== checked)
|
2022-06-09 15:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StatusButton {
|
2022-11-24 16:23:54 +00:00
|
|
|
|
visible: !root.isEditState
|
2022-06-09 15:27:14 +00:00
|
|
|
|
Layout.topMargin: 24
|
|
|
|
|
text: qsTr("Create permission")
|
2022-11-24 16:23:54 +00:00
|
|
|
|
enabled: d.dirtyValues.holdingsModel && d.dirtyValues.holdingsModel.count > 0 && d.dirtyValues.permissionObject.key !== null
|
2022-06-09 15:27:14 +00:00
|
|
|
|
Layout.preferredHeight: 44
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
Layout.fillWidth: true
|
2022-08-23 08:46:37 +00:00
|
|
|
|
onClicked: {
|
2022-11-24 16:23:54 +00:00
|
|
|
|
root.store.createPermission(d.dirtyValues.holdingsModel,
|
|
|
|
|
d.dirtyValues.permissionObject,
|
|
|
|
|
d.dirtyValues.isPrivateDirty ? !root.isPrivate : root.isPrivate,
|
|
|
|
|
root.channelsModel)
|
2022-11-25 17:35:30 +00:00
|
|
|
|
root.permissionCreated()
|
2022-08-23 08:46:37 +00:00
|
|
|
|
}
|
2022-06-09 15:27:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|