From 7734c4735acc8a5c91c38b83a14dec1827ccc64c Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 1 Feb 2023 18:24:25 +0100 Subject: [PATCH] Make notifications show the window again fixes #1329 --- src/ChatPage.cpp | 8 ++++++++ src/timeline/TimelineViewManager.cpp | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index cf44ae00..04523578 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -144,9 +144,13 @@ ChatPage::ChatPage(QSharedPointer userSettings, QObject *parent) Q_UNUSED(eventid) auto exWin = MainWindow::instance()->windowForRoom(roomid); if (exWin) { + exWin->setVisible(true); + exWin->raise(); exWin->requestActivate(); } else { view_manager_->rooms()->setCurrentRoom(roomid); + MainWindow::instance()->setVisible(true); + MainWindow::instance()->raise(); MainWindow::instance()->requestActivate(); } }); @@ -1621,9 +1625,13 @@ ChatPage::sendNotificationReply(const QString &roomid, const QString &eventid, c view_manager_->queueReply(roomid, eventid, body); auto exWin = MainWindow::instance()->windowForRoom(roomid); if (exWin) { + exWin->setVisible(true); + exWin->raise(); exWin->requestActivate(); } else { view_manager_->rooms()->setCurrentRoom(roomid); + MainWindow::instance()->setVisible(true); + MainWindow::instance()->raise(); MainWindow::instance()->requestActivate(); } } diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 5d08e05e..0d5f788b 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -233,9 +233,13 @@ TimelineViewManager::showEvent(const QString &room_id, const QString &event_id) if (auto room = rooms_->getRoomById(room_id)) { auto exWin = MainWindow::instance()->windowForRoom(room_id); if (exWin) { + exWin->setVisible(true); + exWin->raise(); exWin->requestActivate(); - } else if (rooms_->currentRoom() != room) { + } else { rooms_->setCurrentRoom(room_id); + MainWindow::instance()->setVisible(true); + MainWindow::instance()->raise(); MainWindow::instance()->requestActivate(); nhlog::ui()->info("Activated room {}", room_id.toStdString()); }