Add support for copying & deleting multiple messages at once
BUG: 496458
This commit is contained in:
committed by
Joshua Goins
parent
0f634ff795
commit
f5d726989f
@@ -229,6 +229,58 @@ Kirigami.Page {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
id: selectedMessagesControl
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
showCloseButton: false
|
||||
visible: root.currentRoom?.selectedMessageCount > 0
|
||||
position: Kirigami.InlineMessage.Position.Header
|
||||
type: Kirigami.MessageType.Positive
|
||||
icon.name: "edit-select-all-symbolic"
|
||||
|
||||
text: i18nc("@info", "Selected Messages: %1", root.currentRoom?.selectedMessageCount)
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action:button", "Copy Conversation")
|
||||
icon.name: "edit-copy"
|
||||
onTriggered: {
|
||||
Clipboard.saveText(root.currentRoom.getFormattedSelectedMessages())
|
||||
showPassiveNotification(i18nc("@info", "Conversation copied to clipboard"));
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action:button", "Delete Messages")
|
||||
icon.name: "trash-empty-symbolic"
|
||||
icon.color: Kirigami.Theme.negativeTextColor
|
||||
enabled: root.currentRoom?.canDeleteSelectedMessages
|
||||
onTriggered: {
|
||||
let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
title: i18nc("@title:dialog", "Remove Messages"),
|
||||
placeholder: i18nc("@info:placeholder", "Optionally give a reason for removing these messages"),
|
||||
actionText: i18nc("@action:button 'Remove' as in 'Remove these messages'", "Remove"),
|
||||
icon: "delete",
|
||||
reporting: false,
|
||||
connection: root.currentRoom.connection,
|
||||
}, {
|
||||
title: i18nc("@title:dialog", "Remove Messages"),
|
||||
width: Kirigami.Units.gridUnit * 25
|
||||
}) as ReasonDialog;
|
||||
dialog.accepted.connect(reason => {
|
||||
root.currentRoom.deleteSelectedMessages(reason);
|
||||
});
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
icon.name: "dialog-close"
|
||||
icon.color: Kirigami.Theme.negativeTextColor
|
||||
onTriggered: root.currentRoom.clearSelectedMessages()
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
id: banner
|
||||
|
||||
|
||||
@@ -604,6 +604,7 @@ QString RoomManager::findSpaceIdForCurrentRoom() const
|
||||
void RoomManager::setCurrentRoom(const QString &roomId)
|
||||
{
|
||||
if (m_currentRoom != nullptr) {
|
||||
m_currentRoom->clearSelectedMessages();
|
||||
m_currentRoom->disconnect(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user