|
|
To open files with their associated applications in KDE, use KRun.
It can execute any desktop entry, as well as any file, using the default application or another application "bound" to the file type.
You need to create an instance of KFileOpenWithHandler before, so that in case the mime-type of the file is unknown, or if there is no application associated, KRun will bring up the "open with" dialog. Example: KFileOpenWithHandler fowh; new KRun( url );
In that example, the mimetype of the file is not known by the application, so a KRun instance must be created. It will determine the mimetype by itself. If the mimetype is known, or if you even know the service (application) to use for this file, use one of the static methods.
|
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:
url | the URL of the file or directory to 'run' |
mode | The 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. |
|
[virtual]
Destructor. Don't call it yourself, since a KRun object auto-deletes itself.
bool |
[const]
bool |
[const]
bool |
[const]
By default auto deletion is on.
void |
pid_t |
[static]
Open a list of URLs with a certain service.
Parameters:
_urls | the list of URLs, can be empty (app launched without argument) |
pid_t |
[static]
Open a list of URLs with.
Parameters:
_exec | The name of the executable, for example "/usr/bin/netscape". |
_name | The logical name of the application, for example "Netscape 4.06". |
_icon | The icon which should be used by the application. |
_miniicon | The icon which should be used by the application. |
pid_t |
[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 |
[static]
Run the given shell command and notifies kicker of the starting of the application. If the program to be called doesn't exist, an error box will be displayed.
_cmd must be a shell command. You must not append "&" to it, since the function will do that for you.
Use only when you know the full command line. Otherwise use the other static methods, or KRun's constructor.
Returns: PID of running command, 0 if it could not be started, 0 - (PID of running command) if command was unsafe for map notification.
pid_t |
[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 |
[static]
Quotes a string for the shell
void |
[signal]
void |
[signal]
void |
[protected slots: slot]
void |
[protected slots: slot]
void |
[protected slots: slot]
void |
[protected: virtual]
void |
[protected: virtual]
void |
[protected: virtual]
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 |
[protected: virtual]
KURL |
[protected: ]
bool |
[protected: ]
bool |
[protected: ]
bool |
[protected: ]
bool |
[protected: ]
KIO::Job * |
[protected: ]
QTimer |
[protected: ]
bool |
[protected: ]
bool |
[protected: ]
bool |
[protected: ]
bool |
[protected: ]
mode_t |
[protected: ]
KRunPrivate * |
[protected: ]
pid_t |
[protected: static]
For remote URLs to be opened with apps that don't support remote URLs. Uses kfmexec.
pid_t |
[protected: static]
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 |
[protected: static]
Send a DCOP signal to indicate that an application has been started.
If the translated name of the application is unavailable, the binary name may be used for the `name' parameter.
If the name of the mini icon used for the application is unknown, QString::null may be passed for the `iconName' parameter.
If the application does not comply with the NET_WM protocol (it does not set NET_WM_PID on a window at startup,) but you do know that it will set a specific string in WM_CLASS.res_name, then you may pass that name in the `resName' parameter.
If the application is known to comply with the NET_WM protocol, pass true for the `compliant' parameter.
Applications that are NET_WM compliant work perfectly with app-starting notification.
Applications that are not NET_WM compliant but do set WM_CLASS.res_name will work almost correctly. The only side-effect of non-compliance is that in some uncommon cases the app-starting indication may end prematurely for this app, plus others starting in parallel which have specified the same WM_CLASS.res_name.
Applications that are neither NET_WM compliant nor set WM_CLASS.res_name will still have app-starting notification. The side-effect is that for this app and any other non-compliant apps starting in parallel with this (which also do not set WM_CLASS.res_name), the app-start indication may end prematurely.
Parameters:
name | Translated name of the app. |
iconName | Name of the app's mini icon. |
pid | PID of the running process. |
resName | Name that will be set in WM_CLASS.res_name on startup. |
compliant | Application complies with the NET_WM protocol. |
screen | On multihead displays, this is the screen that the application was run on. |
QString |
[protected: static]
Extracts binary name from Exec command line
Parameters:
execLine | the command line |
removePath | if true, /usr/bin/konqueror will be returned as "konqueror" if false, it will be returned with the path. |
Generated by: marc@yogi on Tue Mar 27 13:07:59 2001, using kdoc 2.0a48. |