mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 12:38:48 +03:00
Merge pull request #1341 from Decodetalkers/ft_clean_notify
clean all notifications if exit on linux
This commit is contained in:
commit
539db70fd5
5 changed files with 23 additions and 0 deletions
|
@ -1648,3 +1648,11 @@ ChatPage::isRoomActive(const QString &room_id)
|
||||||
return QGuiApplication::focusWindow() && QGuiApplication::focusWindow()->isActive() &&
|
return QGuiApplication::focusWindow() && QGuiApplication::focusWindow()->isActive() &&
|
||||||
MainWindow::instance()->windowForRoom(room_id) == QGuiApplication::focusWindow();
|
MainWindow::instance()->windowForRoom(room_id) == QGuiApplication::focusWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ChatPage::removeAllNotifications()
|
||||||
|
{
|
||||||
|
#if defined (Q_OS_LINUX)
|
||||||
|
notificationsManager->closeAllNotifications();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -84,6 +84,8 @@ public:
|
||||||
return pushrules;
|
return pushrules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeAllNotifications();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool handleMatrixUri(QString uri);
|
bool handleMatrixUri(QString uri);
|
||||||
bool handleMatrixUri(const QUrl &uri);
|
bool handleMatrixUri(const QUrl &uri);
|
||||||
|
|
|
@ -350,6 +350,7 @@ main(int argc, char *argv[])
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
QObject::connect(&app, &QApplication::aboutToQuit, &w, [&w]() {
|
QObject::connect(&app, &QApplication::aboutToQuit, &w, [&w]() {
|
||||||
|
ChatPage::instance()->removeAllNotifications();
|
||||||
w.saveCurrentWindowSize();
|
w.saveCurrentWindowSize();
|
||||||
if (http::client() != nullptr) {
|
if (http::client() != nullptr) {
|
||||||
nhlog::net()->debug("shutting down all I/O threads & open connections");
|
nhlog::net()->debug("shutting down all I/O threads & open connections");
|
||||||
|
|
|
@ -55,6 +55,9 @@ public slots:
|
||||||
#if defined(NHEKO_DBUS_SYS)
|
#if defined(NHEKO_DBUS_SYS)
|
||||||
public:
|
public:
|
||||||
void closeNotifications(QString roomId);
|
void closeNotifications(QString roomId);
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
void closeAllNotifications();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDBusInterface dbus;
|
QDBusInterface dbus;
|
||||||
|
|
|
@ -271,3 +271,12 @@ NotificationsManager::notificationClosed(uint id, uint reason)
|
||||||
Q_UNUSED(reason);
|
Q_UNUSED(reason);
|
||||||
notificationIds.remove(id);
|
notificationIds.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NotificationsManager::closeAllNotifications()
|
||||||
|
{
|
||||||
|
for (auto id : notificationIds.keys()) {
|
||||||
|
closeNotification(id);
|
||||||
|
notificationIds.remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue