Sort screen saver error messages
authorPaulo Lieuthier <paulolieuthier@gmail.com>
Mon, 15 Jun 2015 22:09:14 +0000 (19:09 -0300)
committerPaulo Lieuthier <paulolieuthier@gmail.com>
Mon, 15 Jun 2015 22:09:53 +0000 (19:09 -0300)
Fixes lxde/lxqt#13.

lxqtscreensaver.cpp
lxqtscreensaver.h

index fe26779..1051b2a 100644 (file)
@@ -64,38 +64,16 @@ void ScreenSaver::xdgProcess_finished(int err, QProcess::ExitStatus status)
 {
     QWidget *p = qobject_cast<QWidget*>(parent());
 
-    if (status == QProcess::CrashExit)
-    {
-        QMessageBox::warning(p,
-                             tr("Screen Saver Activation Error"),
-                             tr("An error occurred starting screensaver. "
-                                "xdg-screensaver cannot be started due its crash.")
-                            );
-    }
-    else if (err == -2)
-    {
-        QMessageBox::warning(p,
-                             tr("Screen Saver Activation Error"),
-                             tr("An error occurred starting screensaver. "
-                                "xdg-screensaver is not installed correctly.")
-                            );
-    }
-    else if (err == -1)
-    {
-        QMessageBox::warning(p,
-                             tr("Screen Saver Activation Error"),
-                             tr("An error occurred starting screensaver. "
-                                "xdg-screensaver cannot be started.")
-                            );
-    }
-    else if (err == 0)
+    // http://portland.freedesktop.org/xdg-utils-1.1.0-rc1/scripts/xdg-screensaver
+
+    if (err == QProcess::NormalExit) // QProcess::NormalExit = 0
     {
         emit activated();
     }
     else if (err == 1)
     {
         QMessageBox::warning(p,
-                             tr("Screen Saver Activation Error"),
+                             tr("Screen Saver Error"),
                              tr("An error occurred starting screensaver. "
                                 "Syntax error in xdg-screensaver arguments.")
                             );
@@ -122,7 +100,7 @@ void ScreenSaver::xdgProcess_finished(int err, QProcess::ExitStatus status)
         QMessageBox::warning(p,
                              tr("Screen Saver Activation Error"),
                              tr("An error occurred starting screensaver. "
-                                "Unknown error - undocumented return value from xdg-screensaver=%1.").arg(err)
+                                "Unknown error - undocumented return value from xdg-screensaver%1.").arg(err)
                             );
     }
     emit done();
index 6290a5e..4884693 100644 (file)
 #ifndef SCREENSAVER_H
 #define SCREENSAVER_H
 
-#include <QProcess>
-#include <QObject>
 #include "lxqtglobals.h"
+#include <QObject>
+#include <QProcess>
 #include <QAction>
 
-class QProcess;
-
 namespace LxQt
 {