diff --git a/resources/icons/ui/unlock.png b/resources/icons/ui/unlock.png new file mode 100644 index 00000000..90e4602a Binary files /dev/null and b/resources/icons/ui/unlock.png differ diff --git a/resources/icons/ui/unlock@2x.png b/resources/icons/ui/unlock@2x.png new file mode 100644 index 00000000..8df18143 Binary files /dev/null and b/resources/icons/ui/unlock@2x.png differ diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index fcbf8b31..2b5a5393 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted Verschlüsselt + + + This message is not encrypted! + + InviteeItem @@ -310,7 +315,7 @@ Beispiel: https://mein.server:8787 MessageDelegate - + redacted gelöscht @@ -548,7 +553,7 @@ Beispiel: https://mein.server:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. -- Entschlüsselungsfehler (Fehler bei Kommunikation mit Datenbank) -- @@ -746,7 +751,7 @@ Beispiel: https://mein.server:8787 TimelineRow - + Reply Antworten @@ -799,7 +804,7 @@ Beispiel: https://mein.server:8787 Kein Raum geöffnet - + Close Schließen diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 39ed1442..a6e4ff7d 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. @@ -742,7 +747,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -795,7 +800,7 @@ Example: https://server.my:8787 - + Close diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index e7631462..1fd9b86c 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted Encrypted + + + This message is not encrypted! + + InviteeItem @@ -310,7 +315,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted redacted @@ -548,7 +553,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. -- Decryption Error (failed to communicate with DB) -- @@ -746,7 +751,7 @@ Example: https://server.my:8787 TimelineRow - + Reply Reply @@ -799,7 +804,7 @@ Example: https://server.my:8787 No room open - + Close Close diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index 01b9d75d..069fb6b2 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. -- Virhe purkaessa salausta (tietokannan kanssa kommunikointi epäonnistui) -- @@ -742,7 +747,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -795,7 +800,7 @@ Example: https://server.my:8787 - + Close Sulje diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index 9e47702b..d50b5fb8 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. @@ -742,7 +747,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -795,7 +800,7 @@ Example: https://server.my:8787 - + Close diff --git a/resources/langs/nheko_ja.ts b/resources/langs/nheko_ja.ts index 049c4189..63522065 100644 --- a/resources/langs/nheko_ja.ts +++ b/resources/langs/nheko_ja.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted 暗号化されています + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted 編集済み @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. -- 復号エラー (データベースと通信できませんでした) -- @@ -741,7 +746,7 @@ Example: https://server.my:8787 TimelineRow - + Reply 返信 @@ -794,7 +799,7 @@ Example: https://server.my:8787 部屋が開いていません - + Close 閉じる diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index 205de986..2c3eeee3 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. @@ -742,7 +747,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -795,7 +800,7 @@ Example: https://server.my:8787 - + Close diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index c089a5b4..f68ca8b3 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. @@ -743,7 +748,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -796,7 +801,7 @@ Example: https://server.my:8787 - + Close diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index 761110f0..95f75081 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. @@ -743,7 +748,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -796,7 +801,7 @@ Example: https://server.my:8787 - + Close Закрыть diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 5b080b74..6b6c0646 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -189,10 +189,15 @@ EncryptionIndicator - + Encrypted + + + This message is not encrypted! + + InviteeItem @@ -306,7 +311,7 @@ Example: https://server.my:8787 MessageDelegate - + redacted @@ -544,7 +549,7 @@ Example: https://server.my:8787 TimelineModel - + -- Decryption Error (failed to communicate with DB) -- Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session. @@ -741,7 +746,7 @@ Example: https://server.my:8787 TimelineRow - + Reply @@ -794,7 +799,7 @@ Example: https://server.my:8787 - + Close 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 diff --git a/resources/res.qrc b/resources/res.qrc index 64a5b3cb..a57d0416 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -14,6 +14,8 @@ icons/ui/double-tick-indicator@2x.png icons/ui/lock.png icons/ui/lock@2x.png + icons/ui/unlock.png + icons/ui/unlock@2x.png icons/ui/clock.png icons/ui/clock@2x.png icons/ui/checkmark.png diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index b7e90034..6e653f10 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -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>(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(Id))); m.insert(names[State], data(id, static_cast(State))); m.insert(names[IsEncrypted], data(id, static_cast(IsEncrypted))); + m.insert(names[IsRoomEncrypted], data(id, static_cast(IsRoomEncrypted))); m.insert(names[ReplyTo], data(id, static_cast(ReplyTo))); m.insert(names[RoomName], data(id, static_cast(RoomName))); m.insert(names[RoomTopic], data(id, static_cast(RoomTopic))); diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index a737aac7..0e9ddb72 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -157,6 +157,7 @@ public: Id, State, IsEncrypted, + IsRoomEncrypted, ReplyTo, Reactions, RoomId,