diff ui/mainwindow.cpp @ 1061:db831a204a6b

(issue38) Show error message as messagebox if the window is visible
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 10 Sep 2014 11:05:34 +0200
parents c7db2cc97bad
children 51b97ebc5b06
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Tue Sep 09 18:49:02 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Sep 10 11:05:34 2014 +0200
@@ -475,9 +475,13 @@
 {
     /* 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();
+    if (!isVisible()) {
+        mCurMessage = message;
+        mTrayIcon->show();
+        showMessage();
+    } else {
+        showErrorMessage(tr("Failed to check for updates:") + "\n"  + message);
+    }
     setState(TransferError);
 }
 
@@ -1465,3 +1469,8 @@
     free (inst_dir);
     return;
 }
+
+void MainWindow::showErrorMessage(const QString &msg)
+{
+    QMessageBox::warning(this, tr("TrustBridge error"), msg);
+}

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