[X2Go-Commits] [x2goclient] 05/59: onmainwindow.{cpp, h}: properly handle scdaemon errors with a message box and close the client.

git-admin at x2go.org git-admin at x2go.org
Wed Jun 3 03:10:41 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit b6d5d540ea99cc5d2271def1d70d5d9173285e61
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Jun 3 01:21:02 2015 +0200

    onmainwindow.{cpp,h}: properly handle scdaemon errors with a message box and close the client.
---
 debian/changelog     |    2 ++
 src/onmainwindow.cpp |   44 ++++++++++++++++++++++++++++++++++++++++++++
 src/onmainwindow.h   |    2 ++
 3 files changed, 48 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index eeff2cf..2399c15 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low
       show_RichText_Generic_MsgBox ().
     - x2goutils.{cpp,h}: new show_RichText_ErrorMsgBox() function as a wrapper
       for show_RichText_Generic_MsgBox() with a critical icon.
+    - onmainwindow.{cpp,h}: properly handle scdaemon errors with a message box
+      and close the client.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Tue, 26 May 2015 21:42:09 +0200
 
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index a26217e..d34c6e7 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -8342,6 +8342,8 @@ void ONMainWindow::slotStartPGPAuth()
               this,
               SLOT (
                   slotScDaemonFinished ( int, QProcess::ExitStatus ) ) );
+    connect (scDaemon, SIGNAL (error (QProcess::ProcessError)), this,
+             SLOT (slotScDaemonError (QProcess::ProcessError)));
     scDaemon->start ( "scdaemon",arguments );
     QTimer::singleShot ( 3000, this, SLOT ( slotCheckScDaemon() ) );
     isScDaemonOk=false;
@@ -8406,6 +8408,48 @@ void ONMainWindow::slotScDaemonFinished ( int , QProcess::ExitStatus )
         slotStartPGPAuth();
 }
 
+void ONMainWindow::slotScDaemonError (QProcess::QProcessError error) {
+    QString main_text ("scdaemon ");
+    QString informative_text;
+
+    switch (error) {
+        case QProcess::FailedToStart: main_text += tr ("failed to start.");
+                                      informative_text = tr ("Check whether the package providing \"scdaemon\" is installed.\n"
+                                                             "The current search path is: ");
+
+                                      QProcessEnvironment tmp_env = QProcessEnvironment::systemEnvironment ();
+
+                                      if (!scDaemon->processEnvironment ().isEmpty ()) {
+                                          tmp_env = scDaemon->processEnvironment ();
+                                      }
+
+                                      informative_text = tmp_env.value ("PATH", "unknown");
+                                      break;
+        case QProcess::Crashed:       main_text += tr ("started, but crashed.");
+                                      break;
+        case QProcess::Timedout:      main_text += tr ("didn't start yet.");
+                                      informative_text = tr ("This error shouldn't come up.");
+                                      break;
+        case QProcess::WriteError:    main_text += tr ("didn't accept a write operation.");
+                                      informative_text = tr ("It is probably not running correctly or crashed in-between.");
+                                      break;
+        case QProcess::ReadError:     main_text = tr ("Unable to read from scdaemon.");
+                                      informative_text = tr ("It is probably not running correctly or crashed in-between.");
+                                      break;
+        case QProcess::UnknownError:
+        default:                      main_text += tr ("experienced an unknown error.");
+    }
+
+    if (!informative_text.isEmpty ()) {
+        informative_text += "\n";
+    }
+
+    informative_text += tr ("X2Go Client will now terminate.\n"
+                            "File a bug report as outlined on the <a href=\"http://wiki.x2go.org/doku.php/wiki:bugs\">bugs wiki page</a>.");
+
+    show_RichText_ErrorMsgBox (main_text, informative_text);
+    closeClient ();
+}
 
 
 void ONMainWindow::slotGpgError()
diff --git a/src/onmainwindow.h b/src/onmainwindow.h
index 7a2a806..18c0094 100644
--- a/src/onmainwindow.h
+++ b/src/onmainwindow.h
@@ -43,6 +43,7 @@
 #include <QSystemTrayIcon>
 #include <QTranslator>
 #include <QLocale>
+#include <QProcessEnvironment>
 #include "sshmasterconnection.h"
 #include "non_modal_messagebox.h"
 
@@ -1115,6 +1116,7 @@ private slots:
                            QProcess::ExitStatus exitStatus );
     void slotScDaemonFinished ( int exitCode,
                                 QProcess::ExitStatus exitStatus );
+    void slotScDaemonError (QProcess::ProcessError error);
     void slotGpgError();
     void slotCheckScDaemon();
     void slotGpgAgentFinished ( int exitCode,

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list