From 18f934efad19821bb2932ba687b2f3c42735add2 Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Thu, 14 May 2020 20:35:29 -0400 Subject: Add un-encrypted warning icon for messages in encrypted rooms --- resources/qml/EncryptionIndicator.qml | 19 +++++++++++++++++-- resources/qml/TimelineRow.qml | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'resources/qml') diff --git a/resources/qml/EncryptionIndicator.qml b/resources/qml/EncryptionIndicator.qml index 00fe2ee4..428c2fae 100644 --- a/resources/qml/EncryptionIndicator.qml +++ b/resources/qml/EncryptionIndicator.qml @@ -3,13 +3,14 @@ import QtQuick.Controls 2.1 import im.nheko 1.0 Rectangle { + property bool encrypted: false id: indicator color: "transparent" width: 16 height: 16 ToolTip.visible: ma.containsMouse && indicator.visible - ToolTip.text: qsTr("Encrypted") + ToolTip.text: getEncryptionTooltip() MouseArea{ id: ma @@ -20,7 +21,21 @@ Rectangle { Image { id: stateImg anchors.fill: parent - source: "image://colorimage/:/icons/icons/ui/lock.png?"+colors.buttonText + source: getEncryptionImage() + } + + function getEncryptionImage() { + if (encrypted) + return "image://colorimage/:/icons/icons/ui/lock.png?"+colors.buttonText + else + return "image://colorimage/:/icons/icons/ui/unlock.png?#dd3d3d" + } + + function getEncryptionTooltip() { + if (encrypted) + return qsTr("Encrypted") + else + return qsTr("This message is not encrypted!") } } diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index 22222ef3..8dcd0056 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -66,7 +66,8 @@ MouseArea { } EncryptionIndicator { - visible: model.isEncrypted + visible: model.isRoomEncrypted + encrypted: model.isEncrypted Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.preferredHeight: 16 width: 16 -- cgit 1.5.1