Make notifications show the window again

fixes #1329
pull/1347/head
Nicolas Werner 2 years ago
parent 673ca9d6a3
commit 7734c4735a
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 8
      src/ChatPage.cpp
  2. 6
      src/timeline/TimelineViewManager.cpp

@ -144,9 +144,13 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> 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();
}
}

@ -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());
}

Loading…
Cancel
Save