summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2021-08-16 17:16:17 -0400
committerJoseph Donofry <joedonofry@gmail.com>2021-08-16 17:16:17 -0400
commit093f9f9e338f7898a2e3e3ed5673952639015cab (patch)
tree4117da7ddaf1bb2c2e3dbd8b51277343142f799c /src/timeline
parentMerge origin/master and fix conflicts (diff)
parentUpdate qt5 path in macos deploy.sh script (diff)
downloadnheko-093f9f9e338f7898a2e3e3ed5673952639015cab.tar.xz
Merge remote-tracking branch 'nheko-im/master' into video_player_enhancements
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineModel.cpp19
-rw-r--r--src/timeline/TimelineModel.h3
-rw-r--r--src/timeline/TimelineViewManager.cpp8
-rw-r--r--src/timeline/TimelineViewManager.h4
4 files changed, 28 insertions, 6 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 99e00a67..79c28edf 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -310,7 +310,7 @@ qml_mtx_events::fromRoomEventType(qml_mtx_events::EventType t)
                 return mtx::events::EventType::RoomMessage;
                 //! m.image_pack, currently im.ponies.room_emotes
         case qml_mtx_events::ImagePackInRoom:
-                return mtx::events::EventType::ImagePackRooms;
+                return mtx::events::EventType::ImagePackInRoom;
         //! m.image_pack, currently im.ponies.user_emotes
         case qml_mtx_events::ImagePackInAccountData:
                 return mtx::events::EventType::ImagePackInAccountData;
@@ -418,6 +418,14 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
                 &events,
                 &EventStore::enableKeyRequests);
 
+        connect(this, &TimelineModel::encryptionChanged, this, &TimelineModel::trustlevelChanged);
+        connect(
+          this, &TimelineModel::roomMemberCountChanged, this, &TimelineModel::trustlevelChanged);
+        connect(cache::client(),
+                &Cache::verificationStatusChanged,
+                this,
+                &TimelineModel::trustlevelChanged);
+
         showEventTimer.callOnTimeout(this, &TimelineModel::scrollTimerEvent);
 }
 
@@ -1993,6 +2001,15 @@ TimelineModel::roomTopic() const
                   QString::fromStdString(info[room_id_].topic).toHtmlEscaped()));
 }
 
+crypto::Trust
+TimelineModel::trustlevel() const
+{
+        if (!isEncrypted_)
+                return crypto::Trust::Unverified;
+
+        return cache::client()->roomVerificationStatus(room_id_.toStdString());
+}
+
 int
 TimelineModel::roomMemberCount() const
 {
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index ad7cfbbb..aa07fe01 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -175,6 +175,7 @@ class TimelineModel : public QAbstractListModel
         Q_PROPERTY(int roomMemberCount READ roomMemberCount NOTIFY roomMemberCountChanged)
         Q_PROPERTY(bool isEncrypted READ isEncrypted NOTIFY encryptionChanged)
         Q_PROPERTY(bool isSpace READ isSpace CONSTANT)
+        Q_PROPERTY(int trustlevel READ trustlevel NOTIFY trustlevelChanged)
         Q_PROPERTY(InputBar *input READ input CONSTANT)
         Q_PROPERTY(Permissions *permissions READ permissions NOTIFY permissionsChanged)
 
@@ -287,6 +288,7 @@ public:
         DescInfo lastMessage() const { return lastMessage_; }
         bool isSpace() const { return isSpace_; }
         bool isEncrypted() const { return isEncrypted_; }
+        crypto::Trust trustlevel() const;
         int roomMemberCount() const;
 
 public slots:
@@ -372,6 +374,7 @@ signals:
         void updateFlowEventId(std::string event_id);
 
         void encryptionChanged();
+        void trustlevelChanged();
         void roomNameChanged();
         void plainRoomNameChanged();
         void roomTopicChanged();
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index b23ed278..906e328f 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -375,10 +375,12 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
 }
 
 void
-TimelineViewManager::openRoomMembers(QString room_id)
+TimelineViewManager::openRoomMembers(TimelineModel *room)
 {
-        MemberList *memberList = new MemberList(room_id, this);
-        emit openRoomMembersDialog(memberList);
+        if (!room)
+                return;
+        MemberList *memberList = new MemberList(room->roomId(), this);
+        emit openRoomMembersDialog(memberList, room);
 }
 
 void
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 54e3a935..4dd5e996 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -66,7 +66,7 @@ public:
         Q_INVOKABLE QString userPresence(QString id) const;
         Q_INVOKABLE QString userStatus(QString id) const;
 
-        Q_INVOKABLE void openRoomMembers(QString room_id);
+        Q_INVOKABLE void openRoomMembers(TimelineModel *room);
         Q_INVOKABLE void openRoomSettings(QString room_id);
         Q_INVOKABLE void openInviteUsers(QString roomId);
         Q_INVOKABLE void openGlobalUserProfile(QString userId);
@@ -92,7 +92,7 @@ signals:
         void focusChanged();
         void focusInput();
         void openImageOverlayInternalCb(QString eventId, QImage img);
-        void openRoomMembersDialog(MemberList *members);
+        void openRoomMembersDialog(MemberList *members, TimelineModel *room);
         void openRoomSettingsDialog(RoomSettings *settings);
         void openInviteUsersDialog(InviteesModel *invitees);
         void openProfile(UserProfile *profile);