diff options
author | Joseph Donofry <joedonofry@gmail.com> | 2020-04-23 19:05:44 -0400 |
---|---|---|
committer | Joseph Donofry <joedonofry@gmail.com> | 2020-04-23 19:05:44 -0400 |
commit | 994edb836c0e812933cabf5e0b57f2f8aaaba9a7 (patch) | |
tree | 981be524b41498e0d18df43d29270efbed808474 | |
parent | b00e624fb0a988d69175c0126f98c96a00b9244f (diff) |
Change how decrypt value is retrieved from settings
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | src/timeline/TimelineModel.cpp | 6 | ||||
-rw-r--r-- | src/timeline/TimelineModel.h | 3 | ||||
-rw-r--r-- | src/timeline/TimelineViewManager.cpp | 3 |
4 files changed, 13 insertions, 3 deletions
@@ -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/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index ff1f324e..75819532 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -514,6 +514,12 @@ TimelineModel::updateLastMessage() { // Get the user setting to show decrypted messages in side bar bool decrypt = QSettings().value("user/decrypt_sidebar", true).toBool(); + updateLastMessage(decrypt); +} + +void +TimelineModel::updateLastMessage(bool decrypt) +{ for (auto it = eventOrder.begin(); it != eventOrder.end(); ++it) { auto event = events.value(*it); if (auto e = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 98b183f6..135b31ff 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -189,7 +189,7 @@ public: Q_INVOKABLE void cacheMedia(QString eventId); Q_INVOKABLE bool saveMedia(QString eventId) const; - void updateLastMessage(); + void updateLastMessage(bool); void addEvents(const mtx::responses::Timeline &events); template<class T> void sendMessage(const T &msg); @@ -259,6 +259,7 @@ private: const mtx::responses::ClaimKeys &res, mtx::http::RequestErr err); void readEvent(const std::string &id); + void updateLastMessage(); QHash<QString, mtx::events::collections::TimelineEvents> events; QSet<QString> read; diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 4562dd67..3c870e36 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -19,12 +19,13 @@ 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->updateLastMessage(); + ptr->updateLastMessage(decrypt); } } } |