but still show a one time tray message to indicate to the user that the
program is still running in the tray if they triggered the window manager
close button.
Signed-off-by: Kel Modderman <kel@otaku42.de>
/* use close() here instead of hide() and allow the
* custom closeEvent handler take care of children */
case QSystemTrayIcon::Trigger:
/* use close() here instead of hide() and allow the
* custom closeEvent handler take care of children */
case QSystemTrayIcon::Trigger:
if (isVisible())
close();
else
if (isVisible())
close();
else
if (tray_icon && tray_icon->isVisible()) {
/* give user a visual hint that the tray icon exists */
if (tray_icon && tray_icon->isVisible()) {
/* give user a visual hint that the tray icon exists */
- if (QSystemTrayIcon::supportsMessages()) {
+ if (!ackTrayIcon && QSystemTrayIcon::supportsMessages()) {
- QTimer::singleShot(1 * 1000, this,
- SLOT(showTrayStatus()));
+ showTrayMessage(QSystemTrayIcon::Information, 3,
+ qAppName() + " will keep running in "
+ "the system tray.");
} else if (!ackTrayIcon) {
QMessageBox::information(this, qAppName() + " systray",
"The program will keep "
} else if (!ackTrayIcon) {
QMessageBox::information(this, qAppName() + " systray",
"The program will keep "
- "running in the system tray."
- " To terminate the program, "
- "choose <b>Quit</b> in the "
- "context menu of the system "
- "tray icon.");
- ackTrayIcon = true;
+ "running in the system "
+ "tray.");
+
+ if (ackTrayIcon)
+ hide();
+ else
+ ackTrayIcon = true;
+
event->ignore();
return;
}
event->ignore();
return;
}