[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kernel
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-04-01 0:11:06
Message-ID: 1207008666.759404.13635.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 792399 by aseigo:

invokeTerminal.


 M  +11 -0     ktoolinvocation.h  
 M  +24 -0     ktoolinvocation_win.cpp  
 M  +31 -0     ktoolinvocation_x11.cpp  


--- trunk/KDE/kdelibs/kdecore/kernel/ktoolinvocation.h #792398:792399
@@ -145,6 +145,17 @@
    */
   static void invokeBrowser( const QString &url, const QByteArray& startup_id = "" );
 
+  /**
+   * Invokes the standard terminal application.
+   *
+   * @param command the command to execute
+   * @param startup_id for app startup notification, "0" for none,
+   *           "" ( empty string ) is the default
+   *
+   * @since 4.1
+   */
+  static void invokeTerminal(const QString &command, const QByteArray &startup_id = "");
+
 public:
   /**
    * Returns the DBus interface of the service launcher.
--- trunk/KDE/kdelibs/kdecore/kernel/ktoolinvocation_win.cpp #792398:792399
@@ -155,6 +155,30 @@
 */
 }
 
+void KToolInvocation::invokeTerminal(const QString &command, const QByteArray &startup_id)
+{
+/*
+    if (!isMainThreadActive()) {
+        return;
+    }
+
+    KConfigGroup confGroup( KGlobal::config(), "General" );
+    QString exec = confGroup.readPathEntry("TerminalApplication", "konsole");
+    exec = exec + " -e " + command;
+
+    QStringList cmdTokens = KShell::splitArgs(command);
+    QString cmd = cmdTokens.takeFirst();
+
+    QString error;
+    if (kdeinitExec(cmd, cmdTokens, &error, NULL, startup_id ))
+    {
+      KMessage::message(KMessage::Error,
+                      i18n("Could not launch the mail client:\n\n%1", error),
+                      i18n("Could not Launch Mail Client"));
+    }
+*/
+}
+
 void KToolInvocation::startKdeinit()
 {
    KComponentData inst( "startkdeinitlock" );
--- trunk/KDE/kdelibs/kdecore/kernel/ktoolinvocation_x11.cpp #792398:792399
@@ -361,6 +361,37 @@
     }
 }
 
+void KToolInvocation::invokeTerminal(const QString &command, const QByteArray &startup_id)
+{
+    if (!isMainThreadActive()) {
+        return;
+    }
+
+    KConfigGroup confGroup( KGlobal::config(), "General" );
+    QString exec = confGroup.readPathEntry("TerminalApplication", "konsole");
+
+    if (exec == "konsole") {
+        exec += " --noclose";
+    } else if (exec == "xterm") {
+        exec += " -hold";
+    }
+
+    if (!command.isEmpty()) {
+        exec += " -e " + command;
+    }
+
+    QStringList cmdTokens = KShell::splitArgs(exec);
+    QString cmd = cmdTokens.takeFirst();
+
+    QString error;
+    if (kdeinitExec(cmd, cmdTokens, &error, NULL, startup_id ))
+    {
+      KMessage::message(KMessage::Error,
+                      i18n("Could not launch the terminal client:\n\n%1", error),
+                      i18n("Could not Launch Terminal Client"));
+    }
+}
+
 void KToolInvocation::startKdeinit()
 {
   KComponentData inst( "startkdeinitlock" );
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic