[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: How to spawn a konsole from another app?
From: "Aaron J. Seigo" <aseigo () kde ! org>
Date: 2008-03-08 2:17:18
Message-ID: 200803071917.18255.aseigo () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
On Friday 07 March 2008, Robin Atwood wrote:
> I want to execute a bash script and display the results to the user. Since
would the attached patch have made your life easier/better? if so, i'll submit
it to kde-core-devel for approval.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
["invoke_terminal.diff" (text/x-diff)]
Index: kernel/ktoolinvocation_win.cpp
===================================================================
--- kernel/ktoolinvocation_win.cpp (revision 783024)
+++ kernel/ktoolinvocation_win.cpp (working copy)
@@ -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" );
Index: kernel/ktoolinvocation_x11.cpp
===================================================================
--- kernel/ktoolinvocation_x11.cpp (revision 783024)
+++ kernel/ktoolinvocation_x11.cpp (working copy)
@@ -361,6 +361,28 @@
}
}
+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" );
Index: kernel/ktoolinvocation.h
===================================================================
--- kernel/ktoolinvocation.h (revision 783024)
+++ kernel/ktoolinvocation.h (working copy)
@@ -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
+ */
+ void invokeTerminal(const QString &command, const QByteArray &startup_id = "");
+
public:
/**
* Returns the DBus interface of the service launcher.
["signature.asc" (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic