diff options
author | 2022-03-30 18:36:05 +0530 | |
---|---|---|
committer | 2022-03-30 18:36:05 +0530 | |
commit | e800208f2a600bb77c04f012cbbc7ded506fd663 (patch) | |
tree | 2007014e90571501104130fe298b810e3fd444b6 /src | |
parent | d06a4abb4755d0e97e8ef03688bc878117d90b4e (diff) | |
download | whatsie-e800208f2a600bb77c04f012cbbc7ded506fd663.tar.gz whatsie-e800208f2a600bb77c04f012cbbc7ded506fd663.zip |
fix: notification popup click behavior
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.cpp | 28 | ||||
-rw-r--r-- | src/notificationpopup.h | 1 | ||||
-rw-r--r-- | src/settingswidget.cpp | 2 |
3 files changed, 12 insertions, 19 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5a29c60..4433068 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -494,12 +494,10 @@ void MainWindow::notify(QString title, QString message) { } else { auto popup = new NotificationPopup(webEngine); connect(popup, &NotificationPopup::notification_clicked, popup, [=]() { - if (windowState() == Qt::WindowMinimized || - windowState() != Qt::WindowActive) { - activateWindow(); - raise(); - showNormal(); - } + if (windowState().testFlag(Qt::WindowMinimized) || + !windowState().testFlag(Qt::WindowActive)) { + setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); + } }); popup->style()->polish(qApp); popup->setMinimumWidth(300); @@ -812,11 +810,9 @@ void MainWindow::setNotificationPresenter(QWebEngineProfile *profile) { auto popup = new NotificationPopup(webEngine); popup->setObjectName("engineNotifier"); connect(popup, &NotificationPopup::notification_clicked, popup, [=]() { - if (windowState() == Qt::WindowMinimized || - windowState() != Qt::WindowActive) { - activateWindow(); - raise(); - showNormal(); + if (windowState().testFlag(Qt::WindowMinimized) || + !windowState().testFlag(Qt::WindowActive)) { + setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); } }); @@ -834,12 +830,10 @@ void MainWindow::setNotificationPresenter(QWebEngineProfile *profile) { settings.value("notificationTimeOut", 9000).toInt()); trayIcon->disconnect(trayIcon, SIGNAL(messageClicked())); connect(trayIcon, &QSystemTrayIcon::messageClicked, trayIcon, [=]() { - if (windowState() == Qt::WindowMinimized || - windowState() != Qt::WindowActive) { - activateWindow(); - raise(); - showNormal(); - } + if (windowState().testFlag(Qt::WindowMinimized) || + !windowState().testFlag(Qt::WindowActive)) { + setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); + } }); } else { diff --git a/src/notificationpopup.h b/src/notificationpopup.h index ebb587d..07a63f1 100644 --- a/src/notificationpopup.h +++ b/src/notificationpopup.h @@ -133,7 +133,6 @@ protected: void mouseReleaseEvent(QMouseEvent *event) override { QWidget::mouseReleaseEvent(event); if (event->button() == Qt::LeftButton) { - qDebug() << "noti clicked"; emit notification_clicked(); if (notification) notification->click(); diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp index 75e1075..c8764b1 100644 --- a/src/settingswidget.cpp +++ b/src/settingswidget.cpp @@ -518,7 +518,7 @@ void SettingsWidget::on_notificationCombo_currentIndexChanged(int index) { } void SettingsWidget::on_tryNotification_clicked() { - emit notify("This is a test notification..."); + emit notify("This is a long long long test notification......"); } void SettingsWidget::on_automaticThemeCheckBox_toggled(bool checked) { |