Add a way to view banned and invited users
This commit is contained in:
@@ -52,6 +52,7 @@ ecm_add_qml_module(Settings GENERATE_PLUGIN_SOURCE
|
||||
RoomAdvancedPage.qml
|
||||
KeyboardShortcutsPage.qml
|
||||
Members.qml
|
||||
MembersList.qml
|
||||
SOURCES
|
||||
colorschemer.cpp
|
||||
threepidaddhelper.cpp
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
||||
import org.kde.kitemmodels
|
||||
|
||||
import org.kde.neochat
|
||||
import io.github.quotient_im.libquotient
|
||||
|
||||
FormCard.FormCardPage {
|
||||
id: root
|
||||
@@ -28,6 +29,63 @@ FormCard.FormCardPage {
|
||||
showMute: false
|
||||
}
|
||||
|
||||
Component {
|
||||
id: bannedMembersPage
|
||||
MembersList {
|
||||
title: i18nc("@title", "Banned Members")
|
||||
membership: Quotient.MembershipMask.Ban
|
||||
room: root.room
|
||||
confirmationTitle: i18nc("@title:dialog", "Unban User")
|
||||
confirmationSubtitle: i18nc("@info %1 is a matrix ID", "Do you really want to unban %1?", currentMemberId)
|
||||
icon: "checkmark-symbolic"
|
||||
actionText: i18nc("@action:button", "Unban…")
|
||||
actionConfirmationText: i18nc("@action:button", "Unban")
|
||||
actionVisible: root.room.canSendState("ban")
|
||||
|
||||
onActionTaken: memberId => root.room.unban(memberId)
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: invitedMembersPage
|
||||
MembersList {
|
||||
title: i18nc("@title", "Invited Members")
|
||||
membership: Quotient.MembershipMask.Invite
|
||||
room: root.room
|
||||
confirmationTitle: i18nc("@title:dialog", "Uninvite User")
|
||||
confirmationSubtitle: i18nc("@info %1 is a matrix ID", "Do you really want to uninvite %1?", currentMemberId)
|
||||
icon: "im-ban-kick-user-symbolic"
|
||||
actionText: i18nc("@action:button", "Uninvite…")
|
||||
actionConfirmationText: i18nc("@action:button", "Uninvite")
|
||||
actionVisible: root.room.canSendState("kick")
|
||||
|
||||
onActionTaken: memberId => root.room.kickMember(memberId, "Revoked invite")
|
||||
}
|
||||
}
|
||||
|
||||
FormCard.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing * 4
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
id: bannedMemberDelegate
|
||||
|
||||
icon.name: "im-ban-user-symbolic"
|
||||
text: i18nc("@action:button", "Banned Members")
|
||||
onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).layers.push(bannedMembersPage)
|
||||
}
|
||||
FormCard.FormDelegateSeparator {
|
||||
above: bannedMemberDelegate
|
||||
below: inviteMemberDelegate
|
||||
}
|
||||
FormCard.FormButtonDelegate {
|
||||
id: inviteMemberDelegate
|
||||
|
||||
icon.name: "list-add-user-symbolic"
|
||||
text: i18nc("@action:button", "Invited Members")
|
||||
onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).layers.push(invitedMembersPage)
|
||||
}
|
||||
}
|
||||
|
||||
FormCard.FormHeader {
|
||||
title: i18nc("@title", "Privileged Members")
|
||||
visible: !root.loading
|
||||
@@ -103,6 +161,7 @@ FormCard.FormCardPage {
|
||||
id: userListFilterModel
|
||||
sourceModel: RoomManager.userListModel
|
||||
filterText: userListSearchField.text
|
||||
membership: Quotient.MembershipMask.Join
|
||||
|
||||
onFilterTextChanged: {
|
||||
if (filterText.length > 0 && !userListSearchPopup.visible) {
|
||||
|
||||
95
src/settings/MembersList.qml
Normal file
95
src/settings/MembersList.qml
Normal file
@@ -0,0 +1,95 @@
|
||||
// SPDX-FileCopyrightText: 2026 Joshua Goins <josh@redstrate.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
import org.kde.kirigamiaddons.delegates as Delegates
|
||||
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
||||
import org.kde.kitemmodels
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
|
||||
FormCard.FormCardPage {
|
||||
id: root
|
||||
|
||||
required property NeoChatRoom room
|
||||
property alias membership: userFilterModel.membership
|
||||
property alias confirmationTitle: actionDialog.title
|
||||
property alias confirmationSubtitle: actionDialog.subtitle
|
||||
property string currentMemberId
|
||||
required property string icon
|
||||
required property string actionText
|
||||
required property string actionConfirmationText
|
||||
required property bool actionVisible
|
||||
|
||||
signal actionTaken(memberId: string)
|
||||
|
||||
FormCard.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing * 4
|
||||
Layout.fillWidth: true
|
||||
|
||||
FormCard.FormPlaceholderMessageDelegate {
|
||||
text: i18nc("@info:placeholder", "No members")
|
||||
visible: userRepeater.count === 0
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: userRepeater
|
||||
|
||||
model: UserFilterModel {
|
||||
id: userFilterModel
|
||||
sourceModel: RoomManager.userListModel
|
||||
allowEmpty: true
|
||||
}
|
||||
|
||||
delegate: FormCard.FormTextDelegate {
|
||||
id: userDelegate
|
||||
|
||||
required property string userId
|
||||
|
||||
text: userId
|
||||
textItem.textFormat: Text.PlainText
|
||||
|
||||
contentItem.children: RowLayout {
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
|
||||
QQC2.Button {
|
||||
icon.name: root.icon
|
||||
visible: root.actionVisible
|
||||
text: root.actionText
|
||||
|
||||
onClicked: {
|
||||
root.currentMemberId = userDelegate.userId;
|
||||
actionDialog.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.PromptDialog {
|
||||
id: actionDialog
|
||||
|
||||
parent: root.QQC2.Overlay.overlay
|
||||
footer: QQC2.DialogButtonBox {
|
||||
standardButtons: QQC2.Dialog.Cancel
|
||||
|
||||
QQC2.Button {
|
||||
icon.name: root.icon
|
||||
text: root.actionConfirmationText
|
||||
|
||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||
}
|
||||
}
|
||||
|
||||
onAccepted: root.actionTaken(root.currentMemberId)
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
import Quotient
|
||||
import io.github.quotient_im.libquotient
|
||||
|
||||
FormCard.FormCardPage {
|
||||
id: root
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
import org.kde.kirigamiaddons.labs.components as Components
|
||||
|
||||
import Quotient
|
||||
import io.github.quotient_im.libquotient
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user