Cleanup Permissions page
This commit is contained in:
@@ -62,6 +62,10 @@ ecm_add_qml_module(Settings GENERATE_PLUGIN_SOURCE
|
|||||||
models/pushrulemodel.cpp
|
models/pushrulemodel.cpp
|
||||||
models/roomsortparametermodel.cpp
|
models/roomsortparametermodel.cpp
|
||||||
models/threepidmodel.cpp
|
models/threepidmodel.cpp
|
||||||
|
DEPENDENCIES
|
||||||
|
QtCore
|
||||||
|
io.github.quotient_im.libquotient
|
||||||
|
org.kde.neochat.libneochat
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
|
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
|
||||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
@@ -29,7 +31,7 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
title: i18n("Privileged Users")
|
title: i18nc("@title", "Privileged Users")
|
||||||
visible: permissions.count > 0
|
visible: permissions.count > 0
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
@@ -60,7 +62,7 @@ FormCard.FormCardPage {
|
|||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
id: powerLevelLabel
|
id: powerLevelLabel
|
||||||
text: privilegedUserDelegate.powerLevelString
|
text: privilegedUserDelegate.powerLevelString
|
||||||
visible: !room.canSendState("m.room.power_levels") || (room.memberEffectivePowerLevel(room.localMember.id) <= privilegedUserDelegate.powerLevel && privilegedUserDelegate.userId != room.localMember.id)
|
visible: !root.room.canSendState("m.room.power_levels") || (root.room.memberEffectivePowerLevel(root.room.localMember.id) <= privilegedUserDelegate.powerLevel && privilegedUserDelegate.userId != root.room.localMember.id)
|
||||||
color: Kirigami.Theme.disabledTextColor
|
color: Kirigami.Theme.disabledTextColor
|
||||||
}
|
}
|
||||||
QQC2.ComboBox {
|
QQC2.ComboBox {
|
||||||
@@ -78,7 +80,7 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onActivated: {
|
onActivated: {
|
||||||
room.setUserPowerLevel(userId, currentValue);
|
root.room.setUserPowerLevel(privilegedUserDelegate.userId, currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +91,7 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
FormCard.AbstractFormDelegate {
|
FormCard.AbstractFormDelegate {
|
||||||
id: userListSearchCard
|
id: userListSearchCard
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
|
|
||||||
contentItem: Kirigami.SearchField {
|
contentItem: Kirigami.SearchField {
|
||||||
id: userListSearchField
|
id: userListSearchField
|
||||||
@@ -101,10 +103,7 @@ FormCard.FormCardPage {
|
|||||||
Keys.onUpPressed: userListView.decrementCurrentIndex()
|
Keys.onUpPressed: userListView.decrementCurrentIndex()
|
||||||
Keys.onDownPressed: userListView.incrementCurrentIndex()
|
Keys.onDownPressed: userListView.incrementCurrentIndex()
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: (userListView.itemAtIndex(userListView.currentIndex) as Delegates.RoundedItemDelegate).action.trigger()
|
||||||
let currentUser = userListView.itemAtIndex(userListView.currentIndex);
|
|
||||||
currentUser.action.trigger();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
QQC2.Popup {
|
QQC2.Popup {
|
||||||
id: userListSearchPopup
|
id: userListSearchPopup
|
||||||
@@ -207,19 +206,16 @@ FormCard.FormCardPage {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
userListSearchPopup.close();
|
userListSearchPopup.close();
|
||||||
let dialog = powerLevelDialog.createObject(root.QQC2.Overlay.overlay, {
|
(powerLevelDialog.createObject(root.QQC2.Overlay.overlay, {
|
||||||
room: root.room,
|
room: root.room,
|
||||||
userId: userListItem.userId,
|
userId: userListItem.userId,
|
||||||
powerLevel: userListItem.powerLevel
|
powerLevel: userListItem.powerLevel
|
||||||
});
|
}) as PowerLevelDialog).open();
|
||||||
dialog.open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: powerLevelDialog
|
id: powerLevelDialog
|
||||||
PowerLevelDialog {
|
PowerLevelDialog {}
|
||||||
id: powerLevelDialog
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,11 +225,11 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
title: i18n("Default permissions")
|
title: i18nc("@title", "Default permissions")
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
Repeater {
|
Repeater {
|
||||||
model: KSortFilterProxyModel {
|
model: KSortFilterProxyModel {
|
||||||
sourceModel: root.permissionsModel
|
sourceModel: root.permissionsModel
|
||||||
@@ -269,11 +265,11 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
title: i18n("Basic permissions")
|
title: i18nc("@title", "Basic permissions")
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
Repeater {
|
Repeater {
|
||||||
model: KSortFilterProxyModel {
|
model: KSortFilterProxyModel {
|
||||||
sourceModel: root.permissionsModel
|
sourceModel: root.permissionsModel
|
||||||
@@ -309,11 +305,11 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
title: i18n("Event permissions")
|
title: i18nc("@title", "Event permissions")
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
visible: room.canSendState("m.room.power_levels")
|
visible: root.room.canSendState("m.room.power_levels")
|
||||||
Repeater {
|
Repeater {
|
||||||
model: KSortFilterProxyModel {
|
model: KSortFilterProxyModel {
|
||||||
sourceModel: root.permissionsModel
|
sourceModel: root.permissionsModel
|
||||||
@@ -343,7 +339,7 @@ FormCard.FormCardPage {
|
|||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
|
onCurrentValueChanged: if (root.room.canSendState("m.room.power_levels")) {
|
||||||
root.permissionsModel.setPowerLevel(type, currentValue);
|
root.permissionsModel.setPowerLevel(type, currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,7 +353,7 @@ FormCard.FormCardPage {
|
|||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
placeholderText: i18n("Event Type…")
|
placeholderText: i18nc("@placeholder", "Event Type…")
|
||||||
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown
|
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown
|
||||||
|
|
||||||
rightActions: Kirigami.Action {
|
rightActions: Kirigami.Action {
|
||||||
@@ -383,7 +379,7 @@ FormCard.FormCardPage {
|
|||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
id: addButton
|
id: addButton
|
||||||
|
|
||||||
text: i18n("Add keyword")
|
text: i18nc("@action:button", "Add keyword")
|
||||||
Accessible.name: text
|
Accessible.name: text
|
||||||
icon.name: "list-add"
|
icon.name: "list-add"
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
|
|||||||
Reference in New Issue
Block a user