summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorkamathmanu <manuriddle@gmail.com>2021-08-07 21:20:43 +0000
committerGitHub <noreply@github.com>2021-08-07 21:20:43 +0000
commit2dfccda73c44d97e9e3e52db3e03315e8ef656a5 (patch)
tree52c9855610cbdf6f6284cfacbaba07f676a0f621 /resources/qml/delegates
parentFix Duplicate fetched chunk (diff)
parentShow encryption errors in qml and add request keys button (diff)
downloadnheko-2dfccda73c44d97e9e3e52db3e03315e8ef656a5.tar.xz
Merge branch 'master' into nhekoRoomDirectory
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/Encrypted.qml48
-rw-r--r--resources/qml/delegates/MessageDelegate.qml11
-rw-r--r--resources/qml/delegates/Reply.qml4
3 files changed, 62 insertions, 1 deletions
diff --git a/resources/qml/delegates/Encrypted.qml b/resources/qml/delegates/Encrypted.qml
new file mode 100644

index 00000000..cd00a9d4 --- /dev/null +++ b/resources/qml/delegates/Encrypted.qml
@@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import ".." +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.2 +import im.nheko 1.0 + +ColumnLayout { + id: r + + required property int encryptionError + required property string eventId + + width: parent ? parent.width : undefined + + MatrixText { + text: { + switch (encryptionError) { + case Olm.MissingSession: + return qsTr("There is no key to unlock this message. We requested the key automatically, but you can try requesting it again if you are impatient."); + case Olm.MissingSessionIndex: + return qsTr("This message couldn't be decrypted, because we only have a key for newer messages. You can try requesting access to this message."); + case Olm.DbError: + return qsTr("There was an internal error reading the decryption key from the database."); + case Olm.DecryptionFailed: + return qsTr("There was an error decrypting this message."); + case Olm.ParsingFailed: + return qsTr("The message couldn't be parsed."); + case Olm.ReplayAttack: + return qsTr("The encryption key was reused! Someone is possibly trying to insert false messages into this chat!"); + default: + return qsTr("Unknown decryption error"); + } + } + color: Nheko.colors.buttonText + width: r ? r.width : undefined + } + + Button { + palette: Nheko.colors + visible: encryptionError == Olm.MissingSession || encryptionError == Olm.MissingSessionIndex + text: qsTr("Request key") + onClicked: room.requestKeyForEvent(eventId) + } + +} diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index a98c2a8b..a8bdf183 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml
@@ -29,6 +29,7 @@ Item { required property string roomTopic required property string roomName required property string callType + required property int encryptionError required property int relatedEventCacheBuster height: chooser.childrenRect.height @@ -190,6 +191,16 @@ Item { } DelegateChoice { + roleValue: MtxEvent.Encrypted + + Encrypted { + encryptionError: d.encryptionError + eventId: d.eventId + } + + } + + DelegateChoice { roleValue: MtxEvent.Name NoticeMessage { diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 75e3d617..8bbce10e 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -5,7 +5,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 +import QtQuick.Window 2.13 import im.nheko 1.0 Item { @@ -30,6 +30,7 @@ Item { property string roomTopic property string roomName property string callType + property int encryptionError property int relatedEventCacheBuster width: parent.width @@ -97,6 +98,7 @@ Item { roomName: r.roomName callType: r.callType relatedEventCacheBuster: r.relatedEventCacheBuster + encryptionError: r.encryptionError enabled: false width: parent.width isReply: true