summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-25 10:29:30 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-25 10:29:30 +0530
commit043737c8cb0f6ef058bc8578a566a6c5c218e231 (patch)
tree897c5a5922e6ca5f04543bab7068e531eb3c1e7d /src
parentEnsure we ask for confirmation when clicking on a matrix uri (diff)
downloadnheko-043737c8cb0f6ef058bc8578a566a6c5c218e231.tar.xz
navigate to newly created rooms
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cpp13
-rw-r--r--src/ChatPage.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 9ba2cc87..aae9271d 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -253,6 +253,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
           this, &ChatPage::updateGroupsInfo, communitiesList_, &CommunitiesList::setCommunities);
 
         connect(this, &ChatPage::leftRoom, this, &ChatPage::removeRoom);
+        connect(this, &ChatPage::newRoom, this, &ChatPage::changeRoom, Qt::QueuedConnection);
         connect(this, &ChatPage::notificationsRetrieved, this, &ChatPage::sendNotifications);
         connect(this,
                 &ChatPage::highlightedNotifsRetrieved,
@@ -967,8 +968,9 @@ ChatPage::createRoom(const mtx::requests::CreateRoom &req)
                           return;
                   }
 
-                  emit showNotification(
-                    tr("Room %1 created.").arg(QString::fromStdString(res.room_id.to_string())));
+                  QString newRoomId = QString::fromStdString(res.room_id.to_string());
+                  emit showNotification(tr("Room %1 created.").arg(newRoomId));
+                  emit newRoom(newRoomId);
           });
 }
 
@@ -990,6 +992,13 @@ ChatPage::leaveRoom(const QString &room_id)
 }
 
 void
+ChatPage::changeRoom(const QString &room_id)
+{
+        view_manager_->setHistoryView(room_id);
+        room_list_->highlightSelectedRoom(room_id);
+}
+
+void
 ChatPage::inviteUser(QString userid, QString reason)
 {
         auto room = current_room_;
diff --git a/src/ChatPage.h b/src/ChatPage.h
index 917bd785..dc6b8299 100644
--- a/src/ChatPage.h
+++ b/src/ChatPage.h
@@ -154,6 +154,7 @@ signals:
         void tryInitialSyncCb();
         void newSyncResponse(const mtx::responses::Sync &res);
         void leftRoom(const QString &room_id);
+        void newRoom(const QString &room_id);
 
         void initializeRoomList(QMap<QString, RoomInfo>);
         void initializeViews(const mtx::responses::Rooms &rooms);
@@ -201,6 +202,7 @@ signals:
 private slots:
         void logout();
         void removeRoom(const QString &room_id);
+        void changeRoom(const QString &room_id);
         void dropToLoginPage(const QString &msg);
 
         void handleSyncResponse(const mtx::responses::Sync &res);