summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorShootingStarDragons <ShootingStarDragons@protonmail.com>2023-02-01 09:54:01 +0800
committerShootingStarDragons <ShootingStarDragons@protonmail.com>2023-02-01 09:58:46 +0800
commit0e2cc65548880a5446a23dfc4d1098378934f58a (patch)
tree19e44a3d37276420941c28ea48db391a582ba3b8 /src
parentfeat: clean all notifications if exit on linux (diff)
downloadnheko-0e2cc65548880a5446a23dfc4d1098378934f58a.tar.xz
chore: Adjust about function closeAllNotification
Log: maek closeAllNotification on all platform, move
closeAllNotification action to aboutToQuit
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cpp4
-rw-r--r--src/ChatPage.h2
-rw-r--r--src/TrayIcon.cpp10
-rw-r--r--src/main.cpp1
4 files changed, 4 insertions, 13 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp

index 349f8fde..c0705cc6 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp
@@ -1641,10 +1641,10 @@ ChatPage::isRoomActive(const QString &room_id) MainWindow::instance()->windowForRoom(room_id) == QGuiApplication::focusWindow(); } -#if defined (Q_OS_LINUX) void ChatPage::removeAllNotifications() { +#if defined (Q_OS_LINUX) notificationsManager->closeAllNotifications(); -} #endif +} diff --git a/src/ChatPage.h b/src/ChatPage.h
index e6375be8..ffe70496 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h
@@ -84,9 +84,7 @@ public: return pushrules; } -#if defined(Q_OS_LINUX) void removeAllNotifications(); -#endif public slots: bool handleMatrixUri(QString uri); diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp
index 76ccb8fc..1e33ac8d 100644 --- a/src/TrayIcon.cpp +++ b/src/TrayIcon.cpp
@@ -15,9 +15,6 @@ #include "TrayIcon.h" -#if defined(Q_OS_LINUX) -#include "ChatPage.h" -#endif #if defined(Q_OS_MAC) #include <QtMacExtras> #endif @@ -122,12 +119,7 @@ TrayIcon::TrayIcon(const QString &filename, QWindow *parent) quitAction_ = new QAction(tr("Quit"), this); connect(viewAction_, &QAction::triggered, parent, &QWindow::show); - connect(quitAction_, &QAction::triggered, this, [=] { -#if defined(Q_OS_LINUX) - ChatPage::instance()->removeAllNotifications(); -#endif - QApplication::quit(); - }); + connect(quitAction_, &QAction::triggered, this, QApplication::quit); menu->addAction(viewAction_); menu->addAction(quitAction_); diff --git a/src/main.cpp b/src/main.cpp
index 779c7800..1ecb014d 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -350,6 +350,7 @@ main(int argc, char *argv[]) w.show(); QObject::connect(&app, &QApplication::aboutToQuit, &w, [&w]() { + ChatPage::instance()->removeAllNotifications(); w.saveCurrentWindowSize(); if (http::client() != nullptr) { nhlog::net()->debug("shutting down all I/O threads & open connections");