Show a placeholder for encrypted messages
Tells the user that the message could not be decrypted because the key was not shared with the device. At the moment, this is technically not completely correct, but it will be when libQuotient supports reading encrypted messages
This commit is contained in:
19
imports/NeoChat/Component/Timeline/EncryptedDelegate.qml
Normal file
19
imports/NeoChat/Component/Timeline/EncryptedDelegate.qml
Normal file
@@ -0,0 +1,19 @@
|
||||
// SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
TextEdit {
|
||||
text: i18n("This message is encrypted and the sender has not shared the key with this device.")
|
||||
color: Kirigami.Theme.disabledTextColor
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize
|
||||
selectByMouse: !Kirigami.Settings.isMobile
|
||||
readOnly: true
|
||||
wrapMode: Text.WordWrap
|
||||
textFormat: Text.RichText
|
||||
width: messageContainer.bubbleMaxWidth
|
||||
}
|
||||
@@ -8,3 +8,4 @@ FileDelegate 1.0 FileDelegate.qml
|
||||
VideoDelegate 1.0 VideoDelegate.qml
|
||||
ReactionDelegate 1.0 ReactionDelegate.qml
|
||||
AudioDelegate 1.0 AudioDelegate.qml
|
||||
EncryptedDelegate 1.0 EncryptedDelegate.qml
|
||||
@@ -557,6 +557,22 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "encrypted"
|
||||
delegate: TimelineContainer {
|
||||
id: encryptedContainer
|
||||
width: messageListView.width
|
||||
isLoaded: timelineDelegateChooser.delegateLoaded
|
||||
|
||||
innerObject: EncryptedDelegate {
|
||||
Layout.fillWidth: Config.compactLayout
|
||||
Layout.maximumWidth: encryptedContainer.bubbleMaxWidth
|
||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||
Layout.leftMargin: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "readMarker"
|
||||
delegate: QQC2.ItemDelegate {
|
||||
|
||||
1
res.qrc
1
res.qrc
@@ -40,6 +40,7 @@
|
||||
<file>imports/NeoChat/Component/Timeline/AudioDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/FileDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/ImageDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Timeline/EncryptedDelegate.qml</file>
|
||||
<file>imports/NeoChat/Component/Login/qmldir</file>
|
||||
<file>imports/NeoChat/Component/Login/LoginStep.qml</file>
|
||||
<file>imports/NeoChat/Component/Login/Login.qml</file>
|
||||
|
||||
@@ -490,6 +490,9 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
if (evt.isStateEvent()) {
|
||||
return "state";
|
||||
}
|
||||
if (is<const EncryptedEvent>(evt)) {
|
||||
return "encrypted";
|
||||
}
|
||||
|
||||
return "other";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user