Add un-encrypted warning icon for messages in encrypted rooms

This commit is contained in:
Joseph Donofry 2020-05-14 20:35:29 -04:00
parent 279bcd1bf2
commit 18f934efad
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
17 changed files with 127 additions and 53 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation>Verschlüsselt</translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -310,7 +315,7 @@ Beispiel: https://mein.server:8787</translation>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation>gelöscht</translation>
</message>
@ -548,7 +553,7 @@ Beispiel: https://mein.server:8787</translation>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation>-- Entschlüsselungsfehler (Fehler bei Kommunikation mit Datenbank) --</translation>
@ -746,7 +751,7 @@ Beispiel: https://mein.server:8787</translation>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation>Antworten</translation>
</message>
@ -799,7 +804,7 @@ Beispiel: https://mein.server:8787</translation>
<translation>Kein Raum geöffnet</translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation>Schließen</translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished"></translation>
@ -742,7 +747,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -795,7 +800,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation>Encrypted</translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -310,7 +315,7 @@ Example: https://server.my:8787</translation>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation>redacted</translation>
</message>
@ -548,7 +553,7 @@ Example: https://server.my:8787</translation>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation>-- Decryption Error (failed to communicate with DB) --</translation>
@ -746,7 +751,7 @@ Example: https://server.my:8787</translation>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation>Reply</translation>
</message>
@ -799,7 +804,7 @@ Example: https://server.my:8787</translation>
<translation>No room open</translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation>Close</translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished">-- Virhe purkaessa salausta (tietokannan kanssa kommunikointi epäonnistui) --</translation>
@ -742,7 +747,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -795,7 +800,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished">Sulje</translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished"></translation>
@ -742,7 +747,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -795,7 +800,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation>-- () --</translation>
@ -741,7 +746,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation></translation>
</message>
@ -794,7 +799,7 @@ Example: https://server.my:8787</source>
<translation></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation></translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished"></translation>
@ -742,7 +747,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -795,7 +800,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished"></translation>
@ -743,7 +748,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -796,7 +801,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished"></translation>
@ -743,7 +748,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -796,7 +801,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished">Закрыть</translation>
</message>

View file

@ -189,10 +189,15 @@
<context>
<name>EncryptionIndicator</name>
<message>
<location filename="../qml/EncryptionIndicator.qml" line="+12"/>
<location filename="../qml/EncryptionIndicator.qml" line="+36"/>
<source>Encrypted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>This message is not encrypted!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteeItem</name>
@ -306,7 +311,7 @@ Example: https://server.my:8787</source>
<context>
<name>MessageDelegate</name>
<message>
<location filename="../qml/delegates/MessageDelegate.qml" line="+64"/>
<location filename="../qml/delegates/MessageDelegate.qml" line="+66"/>
<source>redacted</source>
<translation type="unfinished"></translation>
</message>
@ -544,7 +549,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineModel</name>
<message>
<location filename="../../src/timeline/TimelineModel.cpp" line="+844"/>
<location filename="../../src/timeline/TimelineModel.cpp" line="+853"/>
<source>-- Decryption Error (failed to communicate with DB) --</source>
<comment>Placeholder, when the message can&apos;t be decrypted, because the DB access failed when trying to lookup the session.</comment>
<translation type="unfinished"></translation>
@ -741,7 +746,7 @@ Example: https://server.my:8787</source>
<context>
<name>TimelineRow</name>
<message>
<location filename="../qml/TimelineRow.qml" line="+87"/>
<location filename="../qml/TimelineRow.qml" line="+88"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
@ -794,7 +799,7 @@ Example: https://server.my:8787</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+254"/>
<location line="+256"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>

View file

@ -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!")
}
}

View file

@ -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

View file

@ -14,6 +14,8 @@
<file>icons/ui/double-tick-indicator@2x.png</file>
<file>icons/ui/lock.png</file>
<file>icons/ui/lock@2x.png</file>
<file>icons/ui/unlock.png</file>
<file>icons/ui/unlock@2x.png</file>
<file>icons/ui/clock.png</file>
<file>icons/ui/clock@2x.png</file>
<file>icons/ui/checkmark.png</file>

View file

@ -224,6 +224,7 @@ TimelineModel::roleNames() const
{Id, "id"},
{State, "state"},
{IsEncrypted, "isEncrypted"},
{IsRoomEncrypted, "isRoomEncrypted"},
{ReplyTo, "replyTo"},
{Reactions, "reactions"},
{RoomId, "roomId"},
@ -350,6 +351,9 @@ TimelineModel::data(const QString &id, int role) const
return std::holds_alternative<
mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(events[id]);
}
case IsRoomEncrypted: {
return cache::isRoomEncrypted(room_id_.toStdString());
}
case ReplyTo:
return QVariant(QString::fromStdString(in_reply_to_event(event)));
case Reactions:
@ -387,6 +391,7 @@ TimelineModel::data(const QString &id, int role) const
m.insert(names[Id], data(id, static_cast<int>(Id)));
m.insert(names[State], data(id, static_cast<int>(State)));
m.insert(names[IsEncrypted], data(id, static_cast<int>(IsEncrypted)));
m.insert(names[IsRoomEncrypted], data(id, static_cast<int>(IsRoomEncrypted)));
m.insert(names[ReplyTo], data(id, static_cast<int>(ReplyTo)));
m.insert(names[RoomName], data(id, static_cast<int>(RoomName)));
m.insert(names[RoomTopic], data(id, static_cast<int>(RoomTopic)));

View file

@ -157,6 +157,7 @@ public:
Id,
State,
IsEncrypted,
IsRoomEncrypted,
ReplyTo,
Reactions,
RoomId,