diff --git a/.gitignore b/.gitignore index 6d1786795fbf210a069891975c6606c58c2999fd..5f6725dbccc66ae71829c53a368f3b6ea48bd265 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ cscope* /.ccls-cache /.exrc .gdb_history +.hunter # GTAGS GTAGS @@ -70,7 +71,8 @@ install_manifest.txt .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* diff --git a/CHANGELOG.md b/CHANGELOG.md index 93a4d9d7cfa809c7cc21a3fa2081e8c4f4797bba..d9670fa591226b832e686dbadcad777d85f018c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,9 @@ - Fix display of images sent by the user (thank you, wnereiz and not-chicken for reporting) - Fix crash when trying to maximize image, that wasn't downloaded yet. -- Fix Binding restorMode flooding logs on Qt 5.14.2+ +- Fix Binding restoreMode flooding logs on Qt 5.14.2+ - Fix with some qml styles hidden menu items leave empty space +- Fix encrypted messages not showing a user in the sidebar - Fix hangs when generating colors with some system theme color schemes (#172) ## [0.7.0] -- 2020-04-19 diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index 259b5c869d8f0acb57d348170c98018c658139fd..a97c3fb3d8b953ec20d44569a1b0a7c5f1750a0c 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation>-- Entschlüsselungsfehler (Fehler bei Kommunikation mit Datenbank) --</translation> @@ -779,7 +779,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Ins Benachrichtigungsfeld minimieren</translation> </message> @@ -800,6 +800,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation>Entschlüssele Nachrichten in der Raumliste</translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -859,7 +864,7 @@ <translation>Gerätefingerabdruck</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation>Sitzungsschlüssel</translation> </message> @@ -879,22 +884,22 @@ <translation>VERSCHLÃœSSELUNG</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>ALLGEMEINES</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation>Emojischriftart</translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation>Öffne Sessions Datei</translation> </message> diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 4ce7e6e44be10cb73d44bac8cd55c814c22b0097..1f4c355c3dd884e3c4239d47972fbdbe3172222b 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation type="unfinished"></translation> @@ -779,7 +779,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Ελαχιστοποίηση</translation> </message> @@ -800,6 +800,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -859,7 +864,7 @@ <translation type="unfinished"></translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation type="unfinished"></translation> </message> @@ -879,22 +884,22 @@ <translation type="unfinished"></translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>ΓΕÎΙΚΑ</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation type="unfinished"></translation> </message> diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index f7b3b093ced22009a9d40c5f25bc8004ea50e6f1..52eb4a4c1efdfa57aea94f76cefc1f9f3b821099 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation>-- Decryption Error (failed to communicate with DB) --</translation> @@ -779,7 +779,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Minimize to tray</translation> </message> @@ -800,6 +800,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation>Show buttons in timeline</translation> </message> @@ -859,7 +864,7 @@ <translation>Device Fingerprint</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation>Session Keys</translation> </message> @@ -879,22 +884,22 @@ <translation>ENCRYPTION</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>GENERAL</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation>INTERFACE</translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation>Emoji Font Family</translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation>Open Sessions File</translation> </message> diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index eab4771b80f2b1b735b5d242f0d0f95b2f0f4db0..3ab797d83ad849f5db6c43e4bfdc36a3ed896ed0 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can'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> @@ -779,7 +779,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Pienennä ilmoitusalueelle</translation> </message> @@ -800,6 +800,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -859,7 +864,7 @@ <translation>Laitteen sormenjälki</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation>Istunnon avaimet</translation> </message> @@ -879,22 +884,22 @@ <translation>SALAUS</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>YLEISET ASETUKSET</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation>Avaa Istuntoavaintiedosto</translation> </message> diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index 472f8c7fa772c47ee752d7f660b87fbbe9a187e1..f90ff8c0f2ba765311384da7c0a8d99a83a1a873 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -472,7 +472,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation type="unfinished"></translation> @@ -780,7 +780,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Réduire à la barre des tâches</translation> </message> @@ -801,6 +801,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -860,7 +865,7 @@ <translation type="unfinished"></translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation type="unfinished"></translation> </message> @@ -880,22 +885,22 @@ <translation type="unfinished"></translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>GÉNÉRAL</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation type="unfinished"></translation> </message> diff --git a/resources/langs/nheko_ja.ts b/resources/langs/nheko_ja.ts index d3194b42fafe87de025b909de76e6f38db8fe410..884ca3579830987924e0853aeb6121ce3d064c60 100644 --- a/resources/langs/nheko_ja.ts +++ b/resources/langs/nheko_ja.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation>-- 復å·ã‚¨ãƒ©ãƒ¼ (データベースã¨é€šä¿¡ã§ãã¾ã›ã‚“ã§ã—ãŸ) --</translation> @@ -778,7 +778,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>トレイã¸æœ€å°åŒ–</translation> </message> @@ -799,6 +799,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -858,7 +863,7 @@ <translation>デãƒã‚¤ã‚¹ã®æŒ‡ç´‹</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation>セッションéµ</translation> </message> @@ -878,22 +883,22 @@ <translation>æš—å·åŒ–</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>全般</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation>セッションファイルを開ã</translation> </message> diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index cb4f68e8923e741338ed32fe3200b3989f606716..88b25e7fb700ca1bc7480cabbbcff975d7fe8103 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation type="unfinished"></translation> @@ -779,7 +779,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Minimaliseren naar systeemvak</translation> </message> @@ -800,6 +800,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -859,7 +864,7 @@ <translation type="unfinished"></translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation type="unfinished"></translation> </message> @@ -879,22 +884,22 @@ <translation type="unfinished"></translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>ALGEMEEN</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation type="unfinished"></translation> </message> diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index 9fb3bae6ee2dae8c2a7236b8d08438c77222af8d..749e172bf4bdf39f5eb7f25ef6b56218f5cfbd3a 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation type="unfinished"></translation> @@ -780,7 +780,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Zminimalizuj do paska zadaÅ„</translation> </message> @@ -801,6 +801,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -860,7 +865,7 @@ <translation>Odcisk palca urzÄ…dzenia</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation type="unfinished"></translation> </message> @@ -880,22 +885,22 @@ <translation>SZYFROWANIE</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>OGÓLNE</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation type="unfinished"></translation> </message> diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index f48fccf3b1dbb1e4d292058b490b240b23f377bc..05240613596baed900ad924363881ffa96f5969c 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation type="unfinished"></translation> @@ -780,7 +780,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>Сворачивать в ÑиÑтемную панель</translation> </message> @@ -801,6 +801,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -860,7 +865,7 @@ <translation>Отпечаток уÑтройÑтва</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation>Ключи ÑеанÑа</translation> </message> @@ -880,22 +885,22 @@ <translation>ШИФРОВÐÐИЕ</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>ГЛÐÐ’ÐОЕ</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation>Открыть файл ÑеанÑов</translation> </message> diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 63b677347cc7990031bf7f5b6aba52f4e18339ed..b6fe6d1d7216b80fa05c968d4c4287c6e9c06bc9 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -471,7 +471,7 @@ <context> <name>TimelineModel</name> <message> - <location filename="../../src/timeline/TimelineModel.cpp" line="+754"/> + <location filename="../../src/timeline/TimelineModel.cpp" line="+766"/> <source>-- Decryption Error (failed to communicate with DB) --</source> <comment>Placeholder, when the message can't be decrypted, because the DB access failed when trying to lookup the session.</comment> <translation type="unfinished"></translation> @@ -778,7 +778,7 @@ <context> <name>UserSettingsPage</name> <message> - <location filename="../../src/UserSettingsPage.cpp" line="+333"/> + <location filename="../../src/UserSettingsPage.cpp" line="+335"/> <source>Minimize to tray</source> <translation>最å°åŒ–至托盘</translation> </message> @@ -799,6 +799,11 @@ </message> <message> <location line="+2"/> + <source>Decrypt messages in sidebar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> <source>Show buttons in timeline</source> <translation type="unfinished"></translation> </message> @@ -858,7 +863,7 @@ <translation>设备指纹</translation> </message> <message> - <location line="-58"/> + <location line="-59"/> <source>Session Keys</source> <translation>会è¯å¯†é’¥</translation> </message> @@ -878,22 +883,22 @@ <translation>åŠ å¯†</translation> </message> <message> - <location line="-62"/> + <location line="-63"/> <source>GENERAL</source> <translation>通用</translation> </message> <message> - <location line="+24"/> + <location line="+25"/> <source>INTERFACE</source> <translation type="unfinished"></translation> </message> <message> - <location line="+107"/> + <location line="+108"/> <source>Emoji Font Family</source> <translation type="unfinished"></translation> </message> <message> - <location line="+152"/> + <location line="+158"/> <source>Open Sessions File</source> <translation>打开会è¯æ–‡ä»¶</translation> </message> diff --git a/src/ChatPage.h b/src/ChatPage.h index 5182ab99cfcac33a6f72b1b6ad564f537de58178..46630692d07b81cb9a26557f7dc7878ed7feeee8 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h @@ -153,6 +153,7 @@ signals: void updateGroupsInfo(const mtx::responses::JoinedGroups &groups); void themeChanged(); + void decryptSidebarChanged(); private slots: void showUnreadMessageNotification(int count); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index fb64f0fe9ff13e9085b15c1ec075ae33f859a23f..c6abdca28ec9eab3134e34961c804acd656c0b8d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -117,6 +117,10 @@ MainWindow::MainWindow(QWidget *parent) userSettingsPage_, SIGNAL(trayOptionChanged(bool)), trayIcon_, SLOT(setVisible(bool))); connect( userSettingsPage_, &UserSettingsPage::themeChanged, chat_page_, &ChatPage::themeChanged); + connect(userSettingsPage_, + &UserSettingsPage::decryptSidebarChanged, + chat_page_, + &ChatPage::decryptSidebarChanged); connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, diff --git a/src/Olm.cpp b/src/Olm.cpp index 78b16be7784e2b8d871c8155dc760578f858f7a4..c8e4c13ceff3a9f5d7c22a0a4adeb9c38b631110 100644 --- a/src/Olm.cpp +++ b/src/Olm.cpp @@ -184,7 +184,7 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id, data.relates_to = relation; auto message_index = olm_outbound_group_session_message_index(res.session); - nhlog::crypto()->info("next message_index {}", message_index); + nhlog::crypto()->debug("next message_index {}", message_index); // We need to re-pickle the session after we send a message to save the new message_index. cache::updateOutboundMegolmSession(room_id, message_index); diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index b4f4cb4578d40247ca1907ab88260805740914ec..4db883f5bdfdce0b8f3d3e54627e3ebbb91e3a6b 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -63,6 +63,7 @@ UserSettings::load() theme_ = settings.value("user/theme", defaultTheme_).toString(); font_ = settings.value("user/font_family", "default").toString(); avatarCircles_ = settings.value("user/avatar_circles", true).toBool(); + decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool(); emojiFont_ = settings.value("user/emoji_font_family", "default").toString(); baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); @@ -167,7 +168,7 @@ UserSettings::save() settings.endGroup(); settings.setValue("avatar_circles", avatarCircles_); - + settings.setValue("decrypt_sidebar", decryptSidebar_); settings.setValue("font_size", baseFontSize_); settings.setValue("typing_notifications", isTypingNotificationsEnabled_); settings.setValue("minor_events", sortByImportance_); @@ -230,6 +231,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge trayToggle_ = new Toggle{this}; startInTrayToggle_ = new Toggle{this}; avatarCircles_ = new Toggle{this}; + decryptSidebar_ = new Toggle(this); groupViewToggle_ = new Toggle{this}; timelineButtonsToggle_ = new Toggle{this}; typingNotifications_ = new Toggle{this}; @@ -335,6 +337,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge formLayout_->addRow(new HorizontalLine{this}); boxWrap(tr("Circular Avatars"), avatarCircles_); boxWrap(tr("Group's sidebar"), groupViewToggle_); + boxWrap(tr("Decrypt messages in sidebar"), decryptSidebar_); boxWrap(tr("Show buttons in timeline"), timelineButtonsToggle_); boxWrap(tr("Typing notifications"), typingNotifications_); boxWrap(tr("Sort rooms by unreads"), sortByImportance_); @@ -427,6 +430,11 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge settings_->setGroupView(!isDisabled); }); + connect(decryptSidebar_, &Toggle::toggled, this, [this](bool isDisabled) { + settings_->setDecryptSidebar(!isDisabled); + emit decryptSidebarChanged(); + }); + connect(avatarCircles_, &Toggle::toggled, this, [this](bool isDisabled) { settings_->setAvatarCircles(!isDisabled); }); @@ -479,6 +487,7 @@ UserSettingsPage::showEvent(QShowEvent *) trayToggle_->setState(!settings_->isTrayEnabled()); startInTrayToggle_->setState(!settings_->isStartInTrayEnabled()); groupViewToggle_->setState(!settings_->isGroupViewEnabled()); + decryptSidebar_->setState(!settings_->isDecryptSidebarEnabled()); avatarCircles_->setState(!settings_->isAvatarCirclesEnabled()); typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); sortByImportance_->setState(!settings_->isSortByImportanceEnabled()); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index 1c20214e3362c838e21b0f05f73f1d67f34966e8..6b9834eac126f29755dc1e95dbfe1a8a44181993 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -111,11 +111,18 @@ public: save(); } + void setDecryptSidebar(bool state) + { + decryptSidebar_ = state; + save(); + } + QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; } bool isTrayEnabled() const { return isTrayEnabled_; } bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; } bool isGroupViewEnabled() const { return isGroupViewEnabled_; } bool isAvatarCirclesEnabled() const { return avatarCircles_; } + bool isDecryptSidebarEnabled() const { return decryptSidebar_; } bool isMarkdownEnabled() const { return isMarkdownEnabled_; } bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; } bool isSortByImportanceEnabled() const { return sortByImportance_; } @@ -147,6 +154,7 @@ private: bool isReadReceiptsEnabled_; bool hasDesktopNotifications_; bool avatarCircles_; + bool decryptSidebar_; double baseFontSize_; QString font_; QString emojiFont_; @@ -175,6 +183,7 @@ signals: void moveBack(); void trayOptionChanged(bool value); void themeChanged(); + void decryptSidebarChanged(); private slots: void importSessionKeys(); @@ -199,6 +208,7 @@ private: Toggle *markdownEnabled_; Toggle *desktopNotifications_; Toggle *avatarCircles_; + Toggle *decryptSidebar_; QLabel *deviceFingerprintValue_; QLabel *deviceIdValue_; diff --git a/src/Utils.cpp b/src/Utils.cpp index 62a1a3c87e95d68b7b4cd54d91196e0a96acb504..cd615c24294fd28c625a4b3b11e2a3baa0e889af 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -179,8 +179,9 @@ utils::getMessageDescription(const TimelineEvent &event, const auto ts = QDateTime::fromMSecsSinceEpoch(msg->origin_server_ts); DescInfo info; - info.userid = sender; - info.body = QString(" %1").arg(messageDescription<Encrypted>()); + info.userid = sender; + info.body = QString(" %1").arg( + messageDescription<Encrypted>(username, "", sender == localUser)); info.timestamp = utils::descriptiveTime(ts); info.event_id = QString::fromStdString(msg->event_id); info.datetime = ts; diff --git a/src/Utils.h b/src/Utils.h index a3854dd872d8b7ba96a87175a3c7671569018e5b..663d5a38d0791395c78c53aa0d11f7b459b76be5 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -306,5 +306,4 @@ centerWidget(QWidget *widget, QWidget *parent); void restoreCombobox(QComboBox *combo, const QString &value); - } diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index bb7939459a2b6cf0002d3134fbf1b9b2d250e94c..e3a1a7819126440597b7a98a756ef3506bb0b2d2 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -8,6 +8,7 @@ #include <QFileDialog> #include <QMimeDatabase> #include <QRegularExpression> +#include <QSettings> #include <QStandardPaths> #include "ChatPage.h" @@ -476,14 +477,14 @@ TimelineModel::addEvents(const mtx::responses::Timeline &timeline) std::vector<QString> ids = internalAddEvents(timeline.events); - if (ids.empty()) - return; - - beginInsertRows(QModelIndex(), 0, static_cast<int>(ids.size() - 1)); - this->eventOrder.insert(this->eventOrder.begin(), ids.rbegin(), ids.rend()); - endInsertRows(); + if (!ids.empty()) { + beginInsertRows(QModelIndex(), 0, static_cast<int>(ids.size() - 1)); + this->eventOrder.insert(this->eventOrder.begin(), ids.rbegin(), ids.rend()); + endInsertRows(); + } - updateLastMessage(); + if (!timeline.events.empty()) + updateLastMessage(); } template<typename T> @@ -501,6 +502,13 @@ isMessage(const mtx::events::Event<T> &) return false; } +template<typename T> +auto +isMessage(const mtx::events::EncryptedEvent<T> &) +{ + return true; +} + void TimelineModel::updateLastMessage() { @@ -508,7 +516,9 @@ TimelineModel::updateLastMessage() auto event = events.value(*it); if (auto e = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( &event)) { - event = decryptEvent(*e).event; + if (decryptDescription) { + event = decryptEvent(*e).event; + } } if (!std::visit([](const auto &e) -> bool { return isMessage(e); }, event)) diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 84e9ec26e903445492b1b89e8fe76c895dc6ca67..ae468c09e8d13272167d59c19f47b06400e09aeb 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -189,6 +189,7 @@ public: Q_INVOKABLE void cacheMedia(QString eventId); Q_INVOKABLE bool saveMedia(QString eventId) const; + void updateLastMessage(); void addEvents(const mtx::responses::Timeline &events); template<class T> void sendMessage(const T &msg); @@ -223,6 +224,7 @@ public slots: emit replyChanged(reply_); } } + void setDecryptDescription(bool decrypt) { decryptDescription = decrypt; } private slots: // Add old events at the top of the timeline. @@ -257,7 +259,6 @@ private: const std::string &user_id, const mtx::responses::ClaimKeys &res, mtx::http::RequestErr err); - void updateLastMessage(); void readEvent(const std::string &id); QHash<QString, mtx::events::collections::TimelineEvents> events; @@ -270,6 +271,7 @@ private: bool isInitialSync = true; bool paginationInProgress = false; + bool decryptDescription = true; QString currentId; QString reply_; diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 0a339825312fb233a780fab360d77c0bb338238c..b9565be87b0ac995c5860ba47aa9d40e588fe13c 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -16,6 +16,21 @@ Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents) +void +TimelineViewManager::updateEncryptedDescriptions() +{ + auto decrypt = settings->isDecryptSidebarEnabled(); + QHash<QString, QSharedPointer<TimelineModel>>::iterator i; + for (i = models.begin(); i != models.end(); ++i) { + auto ptr = i.value(); + + if (!ptr.isNull()) { + ptr->setDecryptDescription(decrypt); + ptr->updateLastMessage(); + } + } +} + void TimelineViewManager::updateColorPalette() { @@ -83,6 +98,10 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin &ChatPage::themeChanged, this, &TimelineViewManager::updateColorPalette); + connect(dynamic_cast<ChatPage *>(parent), + &ChatPage::decryptSidebarChanged, + this, + &TimelineViewManager::updateEncryptedDescriptions); } void @@ -114,6 +133,8 @@ TimelineViewManager::addRoom(const QString &room_id) { if (!models.contains(room_id)) { QSharedPointer<TimelineModel> newRoom(new TimelineModel(this, room_id)); + newRoom->setDecryptDescription(settings->isDecryptSidebarEnabled()); + connect(newRoom.data(), &TimelineModel::newEncryptedImage, imgProvider, diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 122e4aec3a39b301b26a8a297023d849a3dca894..45a603afba301eec0dcf8e6b2519529f71310430 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -84,6 +84,7 @@ public slots: const QString &url, const QString &mime, uint64_t dsize); + void updateEncryptedDescriptions(); private: #ifdef USE_QUICK_VIEW