From 043737c8cb0f6ef058bc8578a566a6c5c218e231 Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Thu, 25 Feb 2021 10:29:30 +0530 Subject: navigate to newly created rooms --- src/ChatPage.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/ChatPage.cpp') 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, 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); }); } @@ -989,6 +991,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) { -- cgit 1.5.1