[PATCH 1 of 2] Bail if the user is already running the application

Wald Commits scm-commit at wald.intevation.org
Wed Jun 18 15:10:04 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1403096982 -7200
# Node ID 2ea11a95aa4a83c83eeb51d561499be23f3dfc4a
# Parent  957b28a97959c306a2b84d252f4459295ce7a5ee
Bail if the user is already running the application.

diff -r 957b28a97959 -r 2ea11a95aa4a ui/main.cpp
--- a/ui/main.cpp	Wed Jun 18 14:43:56 2014 +0200
+++ b/ui/main.cpp	Wed Jun 18 15:09:42 2014 +0200
@@ -6,6 +6,7 @@
  * See LICENSE.txt for details.
  */
 #include "mainwindow.h"
+#include "processhelp.h"
 
 #include <QApplication>
 #include <QSystemTrayIcon>
@@ -55,6 +56,12 @@
         return 0;
     }
 
+    if (ProcessHelp::otherProcessesExist(APPNAME)) {
+        qDebug() << "Another " << APPNAME << " process is already running. Exiting.";
+        ProcessHelp::activateWindowForProcess(APPNAME);
+        return 0;
+    }
+
     QTranslator translator;
     if (QLocale::system().name() == "C") {
         /* Useful for testing / development as the primary target is german */


More information about the Trustbridge-commits mailing list