class KRun


Definition#include <krun.h>
InheritsQObject
Annotated List
Files
Globals
Hierarchy
Index
Main

Public Methods

Signals

Public Static Methods


Detailed Description

Implements a generic runner, i.e. the 'exec' functionality of KDE

It can execute any desktop entry, as well as any file, using default binding (service) or another bound service.

 KRun ( const KURL& url, mode_t mode = 0, bool isLocalFile = false, bool showProgressInfo = true )

Create a KRun object to run the preferred application for a file/URL. KRun will first determine the type of the file, and will then run the associated application.

Parameters:
urlthe URL of the file or directory to 'run'
modeThe st_mode field of <tt>struct stat</tt>. If you don't know this set it to 0.
isLocalFile If this parameter is set to false then url is examined to find out whether it is a local URL or not. This flag is just used to improve speed, since the function KURL::isLocalFile is a bit slow.
showProgressInfo Whether to show progress information when determining the type of the file (i.e. when using KIO::stat and KIO::mimetype) Before you set this to false to avoid a dialog box, think about a very slow FTP server... It is always better to provide progress info in such cases.

KRun ()

[virtual]

Destructor. Don't call it yourself, since a KRun object auto-deletes itself.

bool  hasError ()

[const]

bool  hasFinished ()

[const]

bool  autoDelete ()

[const]

By default auto deletion is on.

void  setAutoDelete (bool b)

pid_t  run ( const KService& _service, const KURL::List& _urls )

[static]

Open a list of URLs with a certain service.

Parameters:
_urlsthe list of URLs, can be empty (app launched without argument)

pid_t  run ( const QString& _exec, const KURL::List& _urls, const QString& _name = QString::null, const QString& _icon = QString::null, const QString& _mini_icon = QString::null, const QString& _desktop_file = QString::null )

[static]

Open a list of URLs with.

Parameters:
_execThe name of the executable, for example "/usr/bin/netscape".
_nameThe logical name of the application, for example "Netscape 4.06".
_iconThe icon which should be used by the application.
_miniiconThe icon which should be used by the application.

pid_t  runURL ( const KURL& _url, const QString& _mimetype )

[static]

Open the given URL.

This function is used after the mime type is found out. It will search for all services which can handle the mime type and call run() afterwards.

pid_t  runCommand ( QString cmd )

[static]

Run the given command and notifies kicker of the starting of the application.

Use only when you know the full command line. Otherwise use the other static methods, or KRun's constructor.

Parameters:
cmdthe full command (unquoted) line to run, see run()

pid_t  runCommand ( const QString& cmd, const QString & execName, const QString & )

[static]

Same as the other runCommand, but it also takes the name of the binary, to display an error message in case it couldn't find it. The last argument is now unused but kept for binary compatibility.

void  shellQuote ( QString &_str )

[static]

Quotes a string for the shell

void  finished ()

[signal]

void  error ()

[signal]

protected slots: void  slotTimeout ()

[signal]

void  slotScanFinished ( KIO::Job * )

[signal]

void  slotStatResult ( KIO::Job * )

[signal]

protected: void  init ()

[virtual signal]

void  scanFile ()

[virtual signal]

void  foundMimeType ( const QString& _type )

[virtual signal]

Called if the mimetype has been detected. The function checks whether the document and appends the gzip protocol to the URL. Otherwise runURL is called to finish the job.

void  killJob ()

[virtual signal]

pid_t  runOldApplication ( const QString& _exec, const KURL::List& _urls, bool _allow_multiple )

[static signal]

For remote URLs to be opened with apps that don't support remote URLs. Uses kfmexec.

pid_t  run ( const QString& _cmd )

[static signal]

Runs a shell command.

_cmd must be a quoted shell command. You must not append "&" to it, since the function will do that for you. An example is "<tt>greet 'Hello Torben'</tt>".

Returns: PID of running command, 0 if it could not be started, 0 - (PID of running command) if command was unsafe for map notification.

void  clientStarted ( const QString & execName, const QString & iconName, pid_t pid, const QString & binaryName, bool compliant)

[static signal]

Sends a DCOP signal to Kicker's taskbar to indicate that an application has been started.

Parameters:
execNameName of the app binary.
iconNameName of that app's mini icon.
resNameApplication's res_name, usually equivalent to execName.
pidPID of the KShellProcess that is executing the binary.

QString  binaryName ( const QString & execLine )

[static signal]

Extracts binary name from Exec command line