2023-07-04 15:11:41 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
import AppLayouts.Communities.controls 1.0
|
|
|
|
import AppLayouts.Communities.views 1.0
|
|
|
|
import AppLayouts.Communities.helpers 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2023-08-02 17:39:42 +00:00
|
|
|
property bool isEditMode
|
|
|
|
|
|
|
|
property string communityName
|
|
|
|
property string communityIcon
|
|
|
|
|
2023-07-04 15:11:41 +00:00
|
|
|
property var permissionsModel
|
|
|
|
property var assetsModel
|
|
|
|
property var collectiblesModel
|
2023-08-02 17:39:42 +00:00
|
|
|
|
|
|
|
readonly property bool lostPermissionToJoin: d.lostPermissionToJoin
|
|
|
|
readonly property bool lostChannelPermissions: d.lostChannelPermissions
|
2023-07-04 15:11:41 +00:00
|
|
|
|
|
|
|
implicitHeight: permissionsScrollView.contentHeight - permissionsScrollView.anchors.topMargin
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
// UI
|
|
|
|
readonly property int absLeftMargin: 12
|
|
|
|
readonly property color tableBorderColor: Theme.palette.directColor7
|
|
|
|
|
|
|
|
// internal logic
|
2023-08-02 17:39:42 +00:00
|
|
|
readonly property bool lostPermissionToJoin: root.isEditMode && joinPermissionsModel.count && !joinPermissionPanel.tokenCriteriaMet
|
|
|
|
|
2023-07-04 15:11:41 +00:00
|
|
|
readonly property var uniquePermissionChannels:
|
|
|
|
root.permissionsModel && root.permissionsModel.count ?
|
|
|
|
PermissionsHelpers.getUniquePermissionChannels(root.permissionsModel, [PermissionTypes.Type.Read, PermissionTypes.Type.ViewAndPost])
|
|
|
|
: []
|
|
|
|
|
2023-08-02 17:39:42 +00:00
|
|
|
property var initialChannelPermissions
|
|
|
|
|
|
|
|
function getChannelPermissions() {
|
|
|
|
var result = {}
|
|
|
|
for (let i = 0; i < channelPermissionsPanel.count; i++) {
|
|
|
|
const channel = channelPermissionsPanel.itemAt(i)
|
|
|
|
const ckey = channel.channelKey
|
|
|
|
result[ckey] = [channel.readPermissionMet, channel.viewAndPostPermissionMet]
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
readonly property bool lostChannelPermissions: root.isEditMode && d.uniquePermissionChannels.length > 0 && channelPermissionsPanel.anyPermissionLost
|
|
|
|
|
2023-07-04 15:11:41 +00:00
|
|
|
// models
|
|
|
|
readonly property var adminPermissionsModel: SortFilterProxyModel {
|
|
|
|
id: adminPermissionsModel
|
|
|
|
sourceModel: root.permissionsModel
|
|
|
|
function filterPredicate(modelData) {
|
|
|
|
return (modelData.permissionType === Constants.permissionType.admin) &&
|
|
|
|
(modelData.tokenCriteriaMet && !modelData.isPrivate) // admin privs are hidden if criteria not met
|
|
|
|
}
|
|
|
|
filters: ExpressionFilter {
|
|
|
|
expression: adminPermissionsModel.filterPredicate(model)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
readonly property var joinPermissionsModel: SortFilterProxyModel {
|
|
|
|
id: joinPermissionsModel
|
|
|
|
sourceModel: root.permissionsModel
|
|
|
|
function filterPredicate(modelData) {
|
|
|
|
return (modelData.permissionType === Constants.permissionType.member) &&
|
|
|
|
(modelData.tokenCriteriaMet || !modelData.isPrivate)
|
|
|
|
}
|
|
|
|
filters: ExpressionFilter {
|
|
|
|
expression: joinPermissionsModel.filterPredicate(model)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-02 17:39:42 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
d.initialChannelPermissions = d.getChannelPermissions()
|
|
|
|
}
|
|
|
|
|
2023-07-04 15:11:41 +00:00
|
|
|
StatusScrollView {
|
|
|
|
id: permissionsScrollView
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.topMargin: -Style.current.padding
|
|
|
|
contentWidth: availableWidth
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
|
|
|
// header
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.bottomMargin: 4
|
|
|
|
spacing: Style.current.padding
|
|
|
|
StatusRoundedImage {
|
|
|
|
Layout.preferredWidth: 40
|
|
|
|
Layout.preferredHeight: 40
|
|
|
|
Layout.leftMargin: d.absLeftMargin
|
|
|
|
image.source: root.communityIcon
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
font.weight: Font.Medium
|
|
|
|
text: qsTr("Permissions")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// permission types
|
|
|
|
PermissionPanel {
|
2023-08-02 17:39:42 +00:00
|
|
|
id: joinPermissionPanel
|
2023-07-04 15:11:41 +00:00
|
|
|
permissionType: PermissionTypes.Type.Member
|
|
|
|
permissionsModel: d.joinPermissionsModel
|
|
|
|
}
|
|
|
|
PermissionPanel {
|
|
|
|
permissionType: PermissionTypes.Type.Admin
|
|
|
|
permissionsModel: d.adminPermissionsModel
|
|
|
|
}
|
|
|
|
|
|
|
|
Repeater { // channel repeater
|
2023-08-02 17:39:42 +00:00
|
|
|
id: channelPermissionsPanel
|
2023-07-20 18:59:54 +00:00
|
|
|
model: d.uniquePermissionChannels
|
2023-07-04 15:11:41 +00:00
|
|
|
delegate: ChannelPermissionPanel {}
|
2023-08-02 17:39:42 +00:00
|
|
|
readonly property bool anyPermissionLost: {
|
|
|
|
for (let i = 0; i < channelPermissionsPanel.count; i++) {
|
|
|
|
const channel = channelPermissionsPanel.itemAt(i)
|
|
|
|
if (channel && channel.anyPermissionLost)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component PanelBg: Rectangle {
|
|
|
|
color: Theme.palette.statusListItem.backgroundColor
|
|
|
|
border.width: 1
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
radius: Style.current.radius
|
|
|
|
}
|
|
|
|
|
|
|
|
component PanelIcon: StatusRoundIcon {
|
|
|
|
Layout.preferredWidth: 40
|
|
|
|
Layout.preferredHeight: 40
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
asset.name: {
|
|
|
|
switch (permissionType) {
|
|
|
|
case PermissionTypes.Type.Admin:
|
|
|
|
return "admin"
|
|
|
|
case PermissionTypes.Type.Member:
|
|
|
|
return "communities"
|
|
|
|
default:
|
|
|
|
return "channel"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
radius: height/2
|
|
|
|
}
|
|
|
|
|
|
|
|
component PanelHeading: StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.weight: Font.Medium
|
|
|
|
text: {
|
|
|
|
switch (permissionType) {
|
|
|
|
case PermissionTypes.Type.Admin:
|
|
|
|
return qsTr("Become an admin")
|
|
|
|
case PermissionTypes.Type.Member:
|
|
|
|
return qsTr("Join %1").arg(root.communityName)
|
|
|
|
default:
|
2023-07-20 18:59:54 +00:00
|
|
|
return d.uniquePermissionChannels[index][1]
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component SinglePermissionFlow: Flow {
|
2023-08-02 17:39:42 +00:00
|
|
|
Layout.fillWidth: true
|
2023-07-04 15:11:41 +00:00
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
Repeater {
|
|
|
|
model: HoldingsSelectionModel {
|
|
|
|
sourceModel: model.holdingsListModel
|
|
|
|
assetsModel: root.assetsModel
|
|
|
|
collectiblesModel: root.collectiblesModel
|
|
|
|
}
|
|
|
|
delegate: Row {
|
|
|
|
spacing: 4
|
|
|
|
StatusRoundedImage {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
image.source: model.imageSource
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: Theme.tertiaryTextFontSize
|
|
|
|
text: model.text
|
|
|
|
color: model.available ? Theme.palette.successColor1 : Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component PermissionPanel: Control {
|
|
|
|
id: permissionPanel
|
|
|
|
property int permissionType: PermissionTypes.Type.None
|
|
|
|
property var permissionsModel
|
|
|
|
|
|
|
|
readonly property bool tokenCriteriaMet: overallPermissionRow.tokenCriteriaMet
|
|
|
|
|
|
|
|
visible: permissionsModel.count
|
|
|
|
Layout.fillWidth: true
|
|
|
|
padding: d.absLeftMargin
|
|
|
|
background: PanelBg {}
|
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: Style.current.padding
|
|
|
|
PanelIcon {}
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
PanelHeading {}
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: grid.implicitHeight + grid.anchors.margins*2
|
|
|
|
border.width: 1
|
|
|
|
border.color: d.tableBorderColor
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
id: grid
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: Style.current.halfPadding
|
|
|
|
rowSpacing: Style.current.halfPadding
|
|
|
|
columnSpacing: Style.current.halfPadding
|
|
|
|
columns: 2
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: permissionsRepeater
|
|
|
|
|
|
|
|
property int revision
|
2023-08-02 17:39:42 +00:00
|
|
|
onItemAdded: revision++
|
|
|
|
onItemRemoved: revision++
|
2023-07-04 15:11:41 +00:00
|
|
|
|
|
|
|
model: permissionPanel.permissionsModel
|
2023-08-02 17:39:42 +00:00
|
|
|
delegate: ColumnLayout {
|
2023-07-04 15:11:41 +00:00
|
|
|
Layout.column: 0
|
|
|
|
Layout.row: index
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
|
|
|
readonly property bool tokenCriteriaMet: model.tokenCriteriaMet ?? false
|
|
|
|
onTokenCriteriaMetChanged: permissionsRepeater.revision++
|
|
|
|
|
|
|
|
SinglePermissionFlow {}
|
|
|
|
|
|
|
|
Rectangle {
|
2023-08-02 17:39:42 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: -grid.anchors.leftMargin
|
|
|
|
Layout.rightMargin: -grid.anchors.rightMargin
|
|
|
|
Layout.preferredHeight: 1
|
2023-07-04 15:11:41 +00:00
|
|
|
color: d.tableBorderColor
|
|
|
|
visible: index < permissionsRepeater.count - 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
id: overallPermissionRow
|
|
|
|
Layout.column: 1
|
|
|
|
Layout.rowSpan: permissionsRepeater.count || 1
|
|
|
|
Layout.preferredWidth: 110
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
readonly property bool tokenCriteriaMet: {
|
2023-08-02 17:39:42 +00:00
|
|
|
permissionsRepeater.revision
|
|
|
|
for (var i = 0; i < permissionsRepeater.count; i++) { // NB no let/const here b/c of https://bugreports.qt.io/browse/QTBUG-91917
|
2023-07-04 15:11:41 +00:00
|
|
|
var permissionItem = permissionsRepeater.itemAt(i);
|
2023-08-02 17:39:42 +00:00
|
|
|
if (permissionItem && permissionItem.tokenCriteriaMet)
|
2023-07-04 15:11:41 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.preferredWidth: 1
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.topMargin: -Style.current.halfPadding
|
|
|
|
Layout.bottomMargin: -Style.current.halfPadding
|
|
|
|
color: d.tableBorderColor
|
|
|
|
}
|
|
|
|
Row {
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
StatusIcon {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
icon: overallPermissionRow.tokenCriteriaMet ? "tiny/checkmark" : "tiny/secure"
|
2023-08-02 17:39:42 +00:00
|
|
|
color: {
|
|
|
|
if (d.lostPermissionToJoin)
|
|
|
|
return Theme.palette.dangerColor1
|
|
|
|
if (overallPermissionRow.tokenCriteriaMet)
|
|
|
|
return Theme.palette.successColor1
|
|
|
|
return Theme.palette.baseColor1
|
|
|
|
}
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: Theme.tertiaryTextFontSize
|
|
|
|
text: {
|
|
|
|
switch (permissionPanel.permissionType) {
|
|
|
|
case PermissionTypes.Type.Admin:
|
|
|
|
return qsTr("Admin")
|
|
|
|
case PermissionTypes.Type.Member:
|
|
|
|
return qsTr("Join")
|
|
|
|
case PermissionTypes.Type.Read:
|
|
|
|
return qsTr("View only")
|
|
|
|
case PermissionTypes.Type.ViewAndPost:
|
|
|
|
return qsTr("View & post")
|
|
|
|
default:
|
|
|
|
return "???"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-02 17:39:42 +00:00
|
|
|
color: {
|
|
|
|
if (d.lostPermissionToJoin)
|
|
|
|
return Theme.palette.dangerColor1
|
|
|
|
if (overallPermissionRow.tokenCriteriaMet)
|
|
|
|
return Theme.palette.directColor1
|
|
|
|
return Theme.palette.baseColor1
|
|
|
|
}
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component ChannelPermissionPanel: Control {
|
|
|
|
id: channelPermsPanel
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: 10
|
|
|
|
padding: d.absLeftMargin
|
|
|
|
background: PanelBg {}
|
|
|
|
|
2023-08-02 17:39:42 +00:00
|
|
|
readonly property string channelKey: modelData[0]
|
|
|
|
readonly property bool readPermissionMet: channelPermsRepeater.count > 0 ? channelPermsRepeater.itemAt(0).tokenCriteriaMet : false
|
|
|
|
readonly property bool viewAndPostPermissionMet: channelPermsRepeater.count > 1 ? channelPermsRepeater.itemAt(1).tokenCriteriaMet : false
|
|
|
|
readonly property bool anyPermissionLost: channelPermsRepeater.count > 0 ? channelPermsRepeater.itemAt(0).permissionLost || channelPermsRepeater.itemAt(1).permissionLost : false
|
2023-07-04 15:11:41 +00:00
|
|
|
|
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: Style.current.padding
|
|
|
|
PanelIcon {}
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
spacing: Style.current.smallPadding
|
|
|
|
PanelHeading {}
|
|
|
|
Repeater { // permissions repeater
|
2023-08-02 17:39:42 +00:00
|
|
|
id: channelPermsRepeater
|
2023-07-04 15:11:41 +00:00
|
|
|
model: [PermissionTypes.Type.Read, PermissionTypes.Type.ViewAndPost]
|
|
|
|
|
|
|
|
delegate: Rectangle {
|
|
|
|
id: channelPermsSubPanel
|
|
|
|
|
|
|
|
readonly property int permissionType: modelData
|
2023-08-02 17:39:42 +00:00
|
|
|
readonly property alias tokenCriteriaMet: overallPermissionRow2.tokenCriteriaMet
|
|
|
|
readonly property bool permissionLost: d.initialChannelPermissions[channelPermsPanel.channelKey][index] && !tokenCriteriaMet
|
2023-07-04 15:11:41 +00:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: grid2.implicitHeight + grid2.anchors.margins*2
|
|
|
|
border.width: 1
|
|
|
|
border.color: d.tableBorderColor
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
id: grid2
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: Style.current.halfPadding
|
|
|
|
rowSpacing: Style.current.halfPadding
|
|
|
|
columnSpacing: Style.current.halfPadding
|
|
|
|
columns: 2
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: permissionsRepeater2
|
|
|
|
|
|
|
|
property int revision
|
2023-08-02 17:39:42 +00:00
|
|
|
onItemAdded: revision++
|
|
|
|
onItemRemoved: revision++
|
2023-07-04 15:11:41 +00:00
|
|
|
|
|
|
|
model: SortFilterProxyModel {
|
|
|
|
id: channelPermissionsModel
|
|
|
|
sourceModel: root.permissionsModel
|
|
|
|
function filterPredicate(modelData) {
|
|
|
|
return modelData.permissionType === channelPermsSubPanel.permissionType &&
|
|
|
|
!modelData.isPrivate &&
|
|
|
|
ModelUtils.contains(modelData.channelsListModel, "key", channelPermsPanel.channelKey) // filter and group by channel "key"
|
|
|
|
}
|
|
|
|
filters: ExpressionFilter {
|
|
|
|
expression: channelPermissionsModel.filterPredicate(model)
|
|
|
|
}
|
|
|
|
}
|
2023-08-02 17:39:42 +00:00
|
|
|
delegate: ColumnLayout {
|
2023-07-04 15:11:41 +00:00
|
|
|
Layout.column: 0
|
|
|
|
Layout.row: index
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
|
|
|
readonly property bool tokenCriteriaMet: model.tokenCriteriaMet ?? false
|
|
|
|
onTokenCriteriaMetChanged: permissionsRepeater2.revision++
|
|
|
|
|
|
|
|
SinglePermissionFlow {}
|
|
|
|
|
|
|
|
Rectangle {
|
2023-08-02 17:39:42 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: -grid2.anchors.leftMargin
|
|
|
|
Layout.rightMargin: -grid2.anchors.rightMargin
|
|
|
|
Layout.preferredHeight: 1
|
2023-07-04 15:11:41 +00:00
|
|
|
color: d.tableBorderColor
|
|
|
|
visible: index < permissionsRepeater2.count - 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: overallPermissionRow2
|
|
|
|
Layout.column: 1
|
|
|
|
Layout.rowSpan: channelPermissionsModel.count || 1
|
|
|
|
Layout.preferredWidth: 110
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
readonly property bool tokenCriteriaMet: {
|
|
|
|
permissionsRepeater2.revision
|
2023-08-02 17:39:42 +00:00
|
|
|
for (var i = 0; i < permissionsRepeater2.count; i++) { // NB no let/const here b/c of https://bugreports.qt.io/browse/QTBUG-91917
|
2023-07-04 15:11:41 +00:00
|
|
|
const permissionItem = permissionsRepeater2.itemAt(i);
|
2023-08-02 17:39:42 +00:00
|
|
|
if (permissionItem && permissionItem.tokenCriteriaMet)
|
2023-07-04 15:11:41 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.preferredWidth: 1
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.topMargin: -Style.current.halfPadding
|
|
|
|
Layout.bottomMargin: -Style.current.halfPadding
|
|
|
|
color: d.tableBorderColor
|
|
|
|
}
|
|
|
|
Row {
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
StatusIcon {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
icon: overallPermissionRow2.tokenCriteriaMet ? "tiny/checkmark" : "tiny/secure"
|
2023-08-02 17:39:42 +00:00
|
|
|
color: {
|
|
|
|
if (channelPermsSubPanel.permissionLost)
|
|
|
|
return Theme.palette.dangerColor1
|
|
|
|
if (overallPermissionRow2.tokenCriteriaMet)
|
|
|
|
return Theme.palette.successColor1
|
|
|
|
return Theme.palette.baseColor1
|
|
|
|
}
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: Theme.tertiaryTextFontSize
|
|
|
|
text: {
|
|
|
|
switch (channelPermsSubPanel.permissionType) {
|
|
|
|
case PermissionTypes.Type.Read:
|
|
|
|
return qsTr("View only")
|
|
|
|
case PermissionTypes.Type.ViewAndPost:
|
|
|
|
return qsTr("View & post")
|
|
|
|
case PermissionTypes.Type.Moderator:
|
|
|
|
return qsTr("Moderate")
|
|
|
|
default:
|
|
|
|
return "???"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-02 17:39:42 +00:00
|
|
|
color: {
|
|
|
|
if (channelPermsSubPanel.permissionLost)
|
|
|
|
return Theme.palette.dangerColor1
|
|
|
|
if (overallPermissionRow2.tokenCriteriaMet)
|
|
|
|
return Theme.palette.directColor1
|
|
|
|
return Theme.palette.baseColor1
|
|
|
|
}
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|