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:25 -0400
committerGitHub <noreply@github.com>2020-04-23 19:22:25 -0400
commit4e3b190ac7e8fc8d87cda6832a623296afd1b90e (patch)
treead0a74770e31310134d3c39198f4675326a14df6 /src/timeline/TimelineViewManager.cpp
parentTerminate user color calculation, when no solution can be found (diff)
parentChange decrypt setting again (diff)
downloadnheko-4e3b190ac7e8fc8d87cda6832a623296afd1b90e.tar.xz
Merge pull request #173 from Nheko-Reborn/decrypt-sidebar
Decrypt sidebar setting added to user settings
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,