changeset 961:423e31ac656e

Delay the tray icon after the download Otherwise it would show up for a very short time if you close the application after download.
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 28 Aug 2014 11:25:55 +0200
parents 64c0e15935c8
children 0a4f7235e759
files ui/mainwindow.cpp
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Thu Aug 28 10:44:08 2014 +0200
+++ b/ui/mainwindow.cpp	Thu Aug 28 11:25:55 2014 +0200
@@ -157,7 +157,15 @@
     if (mCurMessage.isEmpty()) {
         return;
     }
-    if (mCurState == NewSoftwareAvailable || !isVisible()) {
+
+    if (!mTrayIcon->isVisible() && !mTrayIcon->isAlternative()) {
+        mTrayIcon->show();
+        /* When the message is shown before the tray icon is fully visble
+         * and becoming visible may be delayed on some desktop environments
+         * the message will pop up somehere on the screen and not over
+         * the trayicon. So we delay here.*/
+        QTimer::singleShot(2000, this, SLOT(showMessage()));
+    } else if (mCurState == NewSoftwareAvailable || !isVisible()) {
         mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage,
                                QSystemTrayIcon::Information, 10000);
         mMessageTimer->start(); // Restart the timer so that we don't spam
@@ -446,6 +454,7 @@
     /* TODO logging and handle error according to a plan */
     syslog_error_printf ("Failed to check for updates: %s", message.toUtf8().constData());
     mCurMessage = message;
+    mTrayIcon->show();
     showMessage();
     setState(TransferError);
 }
@@ -471,7 +480,6 @@
 
     mTrayIcon->setIcon(trayImg);
     setWindowIcon(trayImg);
-    mTrayIcon->show();
     mTrayIcon->setToolTip(tr("TrustBridge"));
 
     connect(mTrayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));

http://wald.intevation.org/projects/trustbridge/