OSDN Git Service

kmix: replace KProcess with QProcess
authorIvailo Monev <xakepa10@gmail.com>
Thu, 20 Jul 2023 23:34:53 +0000 (02:34 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Thu, 20 Jul 2023 23:34:53 +0000 (02:34 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kmix/apps/kmix.cpp
kmix/apps/kmix.h

index 5e180fe..4766768 100644 (file)
@@ -29,6 +29,7 @@
 #include <QCursor>
 #include <QString>
 #include <QMenuBar>
+#include <QProcess>
 
 // include files for KDE
 #include <KConfigSkeleton>
@@ -48,7 +49,6 @@
 #include <kactioncollection.h>
 #include <ktoggleaction.h>
 #include <ksystemeventfilter.h>
-#include <KProcess>
 #include <KTabWidget>
 
 // KMix
@@ -1270,27 +1270,11 @@ KMixWindow::slotHWInfo()
 void
 KMixWindow::slotKdeAudioSetupExec()
 {
-  QStringList args;
-  args << "kcmshell4" << "kcmplayer";
-  forkExec(args);
-}
-
-void
-KMixWindow::forkExec(const QStringList& args)
-{
-  int pid = KProcess::startDetached(args);
-  if (pid == 0)
-    {
-      static const QString startErrorMessage(
-          i18n("The helper application is either not installed or not working."));
-      QString msg;
-      msg += startErrorMessage;
-      msg += "\n(";
-      msg += args.join(QLatin1String(" "));
-      msg += ')';
-      errorPopup(msg);
-    }
-
+  static const QString kcmshell4 = QString::fromLatin1("kcmshell4");
+  static const QStringList kcmshell4args = QStringList() << QString::fromLatin1("kcmplayer");
+  if (!QProcess::startDetached(kcmshell4, kcmshell4args)) {
+    errorPopup(i18n("The kcmshell4 application is either not installed or not working."));
+  }
 }
 
 void
index 940738e..180ace6 100644 (file)
@@ -92,7 +92,6 @@ public slots:
 private:
    KMixerWidget* findKMWforTab( const QString& tabId );
 
-   void forkExec(const QStringList& args);
    void errorPopup(const QString& msg);
 
    KAction* _actionShowMenubar;