diff --git a/src/mainwin.cpp b/src/mainwin.cpp index 29a96a49d..493d90966 100644 --- a/src/mainwin.cpp +++ b/src/mainwin.cpp @@ -551,6 +551,10 @@ MainWin::MainWin(bool _onTop, bool _asTool, PsiCon *psi) : reinitAutoHide(); #ifdef USE_TASKBARNOTIFIER d->taskBarNotifier = new TaskBarNotifier(this); +#ifdef Q_OS_WIN + d->taskBarNotifier->enableFlashWindow(d->allInOne + && PsiOptions::instance()->getOption("options.ui.flash-windows").toBool()); +#endif #endif } @@ -589,11 +593,16 @@ void MainWin::optionChanged(const QString &option) if (option == toolbarsStateOptionPath) { loadToolbarsState(); } else if (option == "options.ui.contactlist.css") { - const QString css = PsiOptions::instance()->getOption("options.ui.contactlist.css").toString(); + const QString css = PsiOptions::instance()->getOption(option).toString(); if (!css.isEmpty()) { setStyleSheet(css); } } +#if defined(USE_TASKBARNOTIFIER) && defined(Q_OS_WIN) + else if (d->allInOne && option == "options.ui.flash-windows") { + d->taskBarNotifier->enableFlashWindow(PsiOptions::instance()->getOption(option).toBool()); + } +#endif } void MainWin::registerAction(IconAction *action) diff --git a/src/widgets/taskbarnotifier.cpp b/src/widgets/taskbarnotifier.cpp index 908d71738..c639a2898 100644 --- a/src/widgets/taskbarnotifier.cpp +++ b/src/widgets/taskbarnotifier.cpp @@ -71,6 +71,9 @@ class TaskBarNotifier::Private { #ifdef USE_DBUS void setDesktopPath(const QString &appName); #endif +#ifdef Q_OS_WIN + void setFlashWindow(bool enabled); +#endif private: #ifdef Q_OS_WIN void setTaskBarIcon(const HICON &icon = {}); @@ -92,6 +95,7 @@ class TaskBarNotifier::Private { #ifdef Q_OS_WIN HWND hwnd_; HICON icon_; + bool flashWindow_ = false; #else QImage *image_; #endif @@ -222,6 +226,8 @@ void TaskBarNotifier::Private::sendDBusSignal(bool isVisible, uint number) } #elif defined(Q_OS_WIN) +void TaskBarNotifier::Private::setFlashWindow(bool enabled) { flashWindow_ = enabled; } + void TaskBarNotifier::Private::setTaskBarIcon(const HICON &icon) { if (icon_) @@ -284,9 +290,12 @@ HICON TaskBarNotifier::Private::getHICONfromQImage(const QImage &image) const void TaskBarNotifier::Private::doFlashTaskbarIcon() { FLASHWINFO fi; - fi.cbSize = sizeof(FLASHWINFO); - fi.hwnd = hwnd_; - fi.dwFlags = (urgent_) ? FLASHW_ALL | FLASHW_TIMER : FLASHW_STOP; + fi.cbSize = sizeof(FLASHWINFO); + fi.hwnd = hwnd_; + if (urgent_) + fi.dwFlags = ((flashWindow_) ? FLASHW_ALL : FLASHW_TRAY) | FLASHW_TIMER; + else + fi.dwFlags = FLASHW_STOP; fi.uCount = 0; fi.dwTimeout = 0; FlashWindowEx(&fi); @@ -306,3 +315,11 @@ void TaskBarNotifier::setIconCountCaption(int count) { d->setIconCount(count); } void TaskBarNotifier::removeIconCountCaption() { d->restoreDefaultIcon(); } bool TaskBarNotifier::isActive() { return d->active(); } + +#ifdef Q_OS_WIN +void TaskBarNotifier::enableFlashWindow(bool enabled) +{ + if (d) + d->setFlashWindow(enabled); +} +#endif diff --git a/src/widgets/taskbarnotifier.h b/src/widgets/taskbarnotifier.h index 115253604..d85f846bb 100644 --- a/src/widgets/taskbarnotifier.h +++ b/src/widgets/taskbarnotifier.h @@ -21,6 +21,7 @@ #define TASKBARNOTIFIER_H #include +#include class QWidget; @@ -31,6 +32,9 @@ class TaskBarNotifier { void setIconCountCaption(int count); void removeIconCountCaption(); bool isActive(); +#ifdef Q_OS_WIN + void enableFlashWindow(bool enabled); +#endif private: class Private; diff --git a/version b/version index 16440ca1d..174949e48 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.5.1937 (2024-05-30, 43863b93) +1.5.1938 (2024-05-30, 32df7c5f)