summary refs log tree commit diff
path: root/src/timeline/TimelineViewManager.cpp
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2020-04-23 19:22:54 -0400
committerJoseph Donofry <joedonofry@gmail.com>2020-04-23 19:22:54 -0400
commit619d9bc1858b12350d95f64a1340d56f32e28bfe (patch)
tree7c597bbe8f40059b8ef6c935d64f8a69ff107a94 /src/timeline/TimelineViewManager.cpp
parentUpdate versions to 0.7.1 (diff)
parentMerge pull request #173 from Nheko-Reborn/decrypt-sidebar (diff)
downloadnheko-619d9bc1858b12350d95f64a1340d56f32e28bfe.tar.xz
Merge remote-tracking branch 'origin/master' into release-prep-0.7.1
Diffstat (limited to 'src/timeline/TimelineViewManager.cpp')
-rw-r--r--src/timeline/TimelineViewManager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 0a339825..b9565be8 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -17,6 +17,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()
 {
         userColors.clear();
@@ -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,