From d7e656e57feb5509389ea0bf8e8e8b1fc3364f00 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 19 Jan 2023 17:49:35 +0100 Subject: [PATCH] Activate window first thing when clicking on notification Currently we enter the room first, which introduces a noticeable delay between clicking the notification and the window being activated --- src/notificationsmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notificationsmanager.cpp b/src/notificationsmanager.cpp index f2b0f03eb..b0a86fcba 100644 --- a/src/notificationsmanager.cpp +++ b/src/notificationsmanager.cpp @@ -70,6 +70,7 @@ void NotificationsManager::postNotification(NeoChatRoom *room, notification->setDefaultAction(i18n("Open NeoChat in this room")); connect(notification, &KNotification::defaultActivated, this, [=]() { + WindowController::instance().showAndRaiseWindow(notification->xdgActivationToken()); if (room->localUser()->id() != Controller::instance().activeConnection()->userId()) { #ifdef QUOTIENT_07 Controller::instance().setActiveConnection(Accounts.get(room->localUser()->id())); @@ -78,7 +79,6 @@ void NotificationsManager::postNotification(NeoChatRoom *room, #endif } RoomManager::instance().enterRoom(room); - WindowController::instance().showAndRaiseWindow(notification->xdgActivationToken()); }); if (canReply) { @@ -108,9 +108,9 @@ void NotificationsManager::postInviteNotification(NeoChatRoom *room, const QStri notification->setFlags(KNotification::Persistent); notification->setDefaultAction(i18n("Open this invitation in NeoChat")); connect(notification, &KNotification::defaultActivated, this, [=]() { + WindowController::instance().showAndRaiseWindow(notification->xdgActivationToken()); notification->close(); RoomManager::instance().enterRoom(room); - WindowController::instance().showAndRaiseWindow(notification->xdgActivationToken()); }); notification->setActions({i18n("Accept Invitation"), i18n("Reject Invitation")}); connect(notification, &KNotification::action1Activated, this, [room, notification]() {