Add view of ignored users and allow unignoring them
This commit is contained in:
@@ -326,6 +326,7 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
|
|||||||
qml/DelegateContextMenu.qml
|
qml/DelegateContextMenu.qml
|
||||||
qml/ShareDialog.qml
|
qml/ShareDialog.qml
|
||||||
qml/FeatureFlagPage.qml
|
qml/FeatureFlagPage.qml
|
||||||
|
qml/IgnoredUsersDialog.qml
|
||||||
RESOURCES
|
RESOURCES
|
||||||
qml/confetti.png
|
qml/confetti.png
|
||||||
qml/glowdot.png
|
qml/glowdot.png
|
||||||
|
|||||||
71
src/qml/IgnoredUsersDialog.qml
Normal file
71
src/qml/IgnoredUsersDialog.qml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
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.neochat
|
||||||
|
|
||||||
|
FormCard.FormCardPage {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
|
title: i18nc("@title", "Ignored Users")
|
||||||
|
|
||||||
|
width: Kirigami.Units.gridUnit * 16
|
||||||
|
height: Kirigami.Units.gridUnit * 32
|
||||||
|
|
||||||
|
FormCard.FormHeader {
|
||||||
|
title: i18nc("@title:group", "Ignored Users")
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormTextDelegate {
|
||||||
|
text: i18nc("Placeholder message when no user is ignored", "You are not ignoring any users")
|
||||||
|
visible: repeater.count === 0
|
||||||
|
}
|
||||||
|
Repeater {
|
||||||
|
id: repeater
|
||||||
|
model: root.connection.ignoredUsers()
|
||||||
|
delegate: FormCard.AbstractFormDelegate {
|
||||||
|
topPadding: Kirigami.Units.smallSpacing
|
||||||
|
bottomPadding: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
background: null
|
||||||
|
contentItem: RowLayout {
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
QQC2.Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: modelData
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Accessible.ignored: true // base class sets this text on root already
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.ToolButton {
|
||||||
|
text: i18nc("@action:button", "Unignore this user")
|
||||||
|
icon.name: "list-remove-symbolic"
|
||||||
|
onClicked: root.connection.removeFromIgnoredUsers(root.connection.user(modelData))
|
||||||
|
display: QQC2.Button.IconOnly
|
||||||
|
QQC2.ToolTip.text: text
|
||||||
|
QQC2.ToolTip.visible: hovered
|
||||||
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.connection
|
||||||
|
function onIgnoredUsersListChanged() {
|
||||||
|
repeater.model = root.connection.ignoredUsers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,4 +33,22 @@ FormCard.FormCardPage {
|
|||||||
description: i18n("Device id")
|
description: i18n("Device id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FormCard.FormHeader {
|
||||||
|
title: i18nc("@title:group", "Ignored Users")
|
||||||
|
}
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormButtonDelegate {
|
||||||
|
text: i18nc("@action:button", "Manage ignored users")
|
||||||
|
onClicked: pageStack.pushDialogLayer(ignoredUsersDialogComponent, {}, {
|
||||||
|
title: i18nc("@title:window", "Ignored Users")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: ignoredUsersDialogComponent
|
||||||
|
IgnoredUsersDialog {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user