KIO
krun.cpp
Go to the documentation of this file.
122 bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool tempFile, bool runExecutables, const QString& suggestedFileName, const QByteArray& asn)
128 i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>", Qt::escape(u.prettyUrl())));
139 return (KRun::runCommand(KShell::quoteArg(u.toLocalFile()), QString(), QString(), window, asn, u.directory())); // just execute the url as a command
179 // As KDE on windows doesnt know about the windows default applications offers will be empty in nearly all cases.
185 // Hmm, in fact KOpenWithDialog::setServiceType already guesses the mimetype from the first URL of the list...
407 QStringList KRun::processDesktopExec(const KService &_service, const KUrl::List& _urls, bool tempFiles, const QString& suggestedFileName)
422 kWarning() << "KRun: syntax error in command" << _service.exec() << ", service" << _service.name();
454 if (!isProtocolInSupportedList(*it, appSupportedProtocols) && !KProtocolInfo::isHelperProtocol(*it)) {
529 QStringList execlist = KShell::splitArgs(exec, KShell::AbortOnMeta | KShell::TildeExpand, &err);
580 static bool runCommandInternal(KProcess* proc, const KService* service, const QString& executable,
597 #ifdef Q_WS_X11 // Startup notification doesn't work with QT/E, service isn't needed without Startup notification
601 bool startup_notify = (asn != "0" && KRun::checkStartupNotify(QString() /*unused*/, service, &silent, &wmclass));
651 bool KRun::checkStartupNotify(const QString& /*binName*/, const KService* service, bool* silent_arg, QByteArray* wmclass_arg)
916 QPixmap warningIcon(KIconLoader::global()->loadIcon("dialog-warning", KIconLoader::NoGroup, KIconLoader::SizeHuge));
1043 bool KRun::run(const QString& _exec, const KUrl::List& _urls, QWidget* window, const QString& _name,
1073 bool KRun::runCommand(const QString& cmd, const QString &execName, const QString & iconName, QWidget* window, const QByteArray& asn)
1161 if (!d->m_externalBrowser.isEmpty() && d->m_strURL.protocol().startsWith(QLatin1String("http"))) {
1193 // Unknown mimetype because the file is unreadable, no point in showing an open-with dialog (#261002)
1241 KIO::StatJob *job = KIO::stat(d->m_strURL, KIO::StatJob::SourceSide, 0 /* no details */, flags);
1422 kWarning(7010) << "get() didn't emit a mimetype! Probably a kioslave bug, please check the implementation of" << url().protocol();
1510 if (!KRun::runUrl(d->m_strURL, type, d->m_window, false /*tempfile*/, d->m_runExecutables, d->m_suggestedFileName, d->m_asn)) {
1574 d->m_externalBrowser = KConfigGroup(KGlobal::config(), "General").readEntry("BrowserApplication");
1735 KProcessRunner::KProcessRunner(KProcess * p, const QString & executable, const KStartupInfoId& _id) :
virtual void setWindow(QWidget *window)
Associate this job with a window given by window.
Definition: jobuidelegate.cpp:58
static void resetStartupEnv()
void setShellCommand(const QString &cmd)
void message(KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
QString i18n(const char *text)
bool kill(KillVerbosity verbosity=Quietly)
QString readPathEntry(const QString &pKey, const QString &aDefault) const
static bool run(const KService &service, const KUrl::List &urls, QWidget *window, bool tempFiles=false, const QString &suggestedFileName=QString(), const QByteArray &asn=QByteArray())
Open a list of URLs with a certain service (application).
Definition: krun.cpp:978
void setEnableExternalBrowser(bool b)
Sets whether the external webbrowser setting should be honoured.
Definition: krun.cpp:1571
const char header[]
QString directory(const DirectoryOptions &options=IgnoreTrailingSlash) const
void slotTimeout()
All following protected slots are used by subclasses of KRun!
Definition: krun.cpp:1324
virtual void foundMimeType(const QString &type)
Called if the mimetype has been detected.
Definition: krun.cpp:1466
static bool runTempService(const KService &_service, const KUrl::List &_urls, QWidget *window, bool tempFiles, const QString &suggestedFileName, const QByteArray &asn)
Definition: krun.cpp:694
void setDoScanFile(bool scanFile)
Indicate that the next action is to scan the file.
Definition: krun.cpp:1659
static QString realFilePath(const QString &filename)
static KIconLoader * global()
static Ptr serviceByDesktopName(const QString &_name)
int timeout
KRun(const KUrl &url, QWidget *window, mode_t mode=0, bool isLocalFile=false, bool showProgressInfo=true, const QByteArray &asn=QByteArray())
Definition: krun.cpp:1095
MimetypeJob * mimetype(const KUrl &url, JobFlags flags=DefaultFlags)
Find mimetype for one file or directory.
Definition: job.cpp:1872
void setRunExecutables(bool b)
Sets whether executables, .desktop files or shell scripts should be run by KRun.
Definition: krun.cpp:1586
void slotProcessExited(int, QProcess::ExitStatus)
Definition: krun.cpp:1783
QVariant property(const QString &_name, QVariant::Type t) const
virtual bool open(OpenMode flags=QIODevice::ReadWrite)
File type, part of the mode returned by stat (for a link, this returns the file type of the pointed i...
Definition: udsentry.h:181
TransferJob * get(const KUrl &url, LoadType reload=NoReload, JobFlags flags=DefaultFlags)
Get (a.k.a.
Definition: job.cpp:1371
int stat(const QString &path, KDE_struct_stat *buf)
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
StatJob * stat(const KUrl &url, JobFlags flags=DefaultFlags)
Find all details for one file or directory.
Definition: job.cpp:924
static QStringList processDesktopExec(const KService &_service, const KUrl::List &_urls, bool tempFiles=false, const QString &suggestedFileName=QString())
Processes a Exec= line as found in .desktop files.
Definition: krun.cpp:407
QString genericName() const
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:440
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
A local file path if the ioslave display files sitting on the local filesystem (but in another hierar...
Definition: udsentry.h:166
QString terminalOptions() const
bool substituteUid() const
static void add(const KUrl &url)
Add a new item to the Recent Document menu.
Definition: krecentdocument.cpp:88
void abort()
void setBin(const QString &bin)
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
static bool checkStartupNotify(const QString &binName, const KService *service, bool *silent_arg, QByteArray *wmclass_arg)
Definition: krun.cpp:651
void setName(const QString &name)
void ref()
bool run(const KUrl &_url, bool _is_local)
Invokes the default action for the desktop entry.
Definition: kdesktopfileactions.cpp:54
bool isApplication() const
QString i18nc(const char *ctxt, const char *text)
KSharedConfigPtr config()
QString exec() const
void setPath(const QString &path)
void slotScanMimeType(KIO::Job *, const QString &type)
This slot is called when the scan job has found out the mime type.
Definition: krun.cpp:1419
QStringList splitArgs(const QString &cmd, Options flags=NoOptions, Errors *err=0)
static bool isAuthorizedDesktopFile(const QString &path)
QString path() const
Show the progress info GUI, no Resume and no Overwrite.
Definition: jobclasses.h:46
static bool displayNativeOpenWithDialog(const KUrl::List &lst, QWidget *window, bool tempFiles, const QString &suggestedFileName, const QByteArray &asn)
Definition: krun_win.cpp:82
static bool sendChange(const KStartupInfoId &id, const KStartupInfoData &data)
static bool isExecutableFile(const KUrl &url, const QString &mimetype)
Returns whether the url of mimetype is executable.
Definition: krun.cpp:100
static int currentDesktop()
static int startServiceByDesktopPath(const QString &_name, const QString &URL, QString *error=0, QString *serviceName=0, int *pid=0, const QByteArray &startup_id=QByteArray(), bool noWait=false)
QString errorString() const
void setDescription(const QString &descr)
static bool sendStartup(const KStartupInfoId &id, const KStartupInfoData &data)
void deref()
static bool isExecutable(const QString &serviceType)
Returns whether serviceType refers to an executable program instead of a data file.
Definition: krun.cpp:1601
void setIcon(const QString &icon)
bool authorizeUrlAction(const QString &action, const KUrl &baseUrl, const KUrl &destUrl)
KSharedPtr< KService > Ptr
QString protocol() const
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
const QString & name() const
QString buildErrorString(int errorCode, const QString &errorText)
Returns a translated error message for errorCode using the additional error information provided by e...
Definition: global.cpp:164
void setSilent(TriState state)
static bool runCommand(const QString &cmd, QWidget *window)
Run the given shell command and notifies KDE of the starting of the application.
Definition: krun.cpp:1051
virtual void slotStatResult(KJob *)
This slot is called when the 'stat' job has finished.
Definition: krun.cpp:1358
Errors
static bool runCommandInternal(KProcess *proc, const KService *service, const QString &executable, const QString &userVisibleName, const QString &iconName, QWidget *window, const QByteArray &asn)
Definition: krun.cpp:580
static KMimeTypeTrader * self()
static QString defaultMimetype(const KUrl &url)
Returns default mimetype for this URL based on the protocol.
Definition: kprotocolmanager.cpp:1169
void setSuggestedFileName(const QString &fileName)
Sets the file name to use in the case of downloading the file to a tempfile in order to give to a non...
Definition: krun.cpp:1591
void setHostname(const QByteArray &hostname=QByteArray())
void slotScanFinished(KJob *)
This slot is called when the scan job is finished.
Definition: krun.cpp:1428
static int run(KProcess *, const QString &executable, const KStartupInfoId &id)
Definition: krun.cpp:1726
Definition: krun_p.h:37
static QString protocolClass(const QString &protocol)
void start()
static bool displayOpenWithDialog(const KUrl::List &lst, QWidget *window, bool tempFiles=false, const QString &suggestedFileName=QString(), const QByteArray &asn=QByteArray())
Display the Open-With dialog for those URLs, and run the chosen application.
Definition: krun.cpp:193
void setApplicationId(const QString &desktop)
bool allowMultipleFiles() const
QString username() const
void mimeTypeDetermined(const QString &mimeType)
Call this from subclasses when you have determined the mimetype.
Definition: krun.cpp:1451
QString quoteArg(const QString &arg)
QString icon() const
static bool supportsReading(const KUrl &url)
Returns whether the protocol can retrieve data from URLs.
Definition: kprotocolmanager.cpp:1050
bool terminal() const
bool finalize()
static bool sendFinish(const KStartupInfoId &id)
static QString exec(const QString &protocol)
static KUrl mostLocalUrl(const KUrl &url, QWidget *window)
Tries to map a local URL for the given URL.
Definition: netaccess.cpp:234
static bool isHelperProtocol(const KUrl &url)
Definition: global.h:209
void setPreferredService(const QString &desktopEntryName)
Set the preferred service for opening this URL, after its mimetype will have been found by KRun...
Definition: krun.cpp:1581
static QStringList supportedProtocols(const KService &_service)
Definition: krun.cpp:370
static bool runUrl(const KUrl &url, const QString &mimetype, QWidget *window, bool tempFile=false, bool runExecutables=true, const QString &suggestedFileName=QString(), const QByteArray &asn=QByteArray())
Open the given URL.
Definition: krun.cpp:122
void setWMClass(const QByteArray &wmclass)
static bool makeServiceExecutable(const KService &service, QWidget *window)
Definition: krun.cpp:892
QString suggestedFileName() const
Suggested file name given by the server (e.g.
Definition: krun.cpp:1596
static QByteArray createNewStartupId()
QString desktopEntryName() const
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
static QString findExe(const QString &appname, const QString &pathstr=QString(), SearchOptions options=NoSearchOptions)
void setFileName(const QString &filename)
Definition: job.h:29
QStringList toStringList() const
Definition: global.h:255
virtual void init()
All following protected methods are used by subclasses of KRun!
Definition: krun.cpp:1133
QString query() const
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
bool authorize(const QString &genericAction)
QString joinArgs(const QStringList &args)
static bool isProtocolInSupportedList(const KUrl &url, const QStringList &supportedProtocols)
Definition: krun.cpp:400
KGuiItem cont()
int pid() const
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
A mime type; the slave should set it if it's known.
Definition: udsentry.h:192
Definition: jobclasses.h:446
static bool supportsListing(const KUrl &url)
Returns whether the protocol can list files/objects.
Definition: kprotocolmanager.cpp:1032
The transfer job pumps data into and/or out of a Slave.
Definition: jobclasses.h:555
void setProgressInfo(bool progressInfo)
Sets whether progress information shall be shown.
Definition: krun.cpp:1624
static void publishSlaveOnHold()
Send the slave that was put on hold back to KLauncher.
Definition: scheduler.cpp:830
bool isLocalFile() const
void setDesktop(int desktop)
void init(const KUrl &url, QWidget *window, mode_t mode, bool isLocalFile, bool showProgressInfo, const QByteArray &asn)
Definition: krun.cpp:1104
void initId(const QByteArray &id="")
bool hasMimeType(const KServiceType *mimeTypePtr) const
T readEntry(const QString &key, const T &aDefault) const
void addPid(pid_t pid)
static QDebug kFatal(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
static QString binaryName(const QString &execLine, bool removePath)
Given a full command line (e.g.
Definition: krun.cpp:568
static void error(QWidget *parent, const QString &text, const QString &caption=QString())
Definition: kmessageboxwrapper.h:33
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
bool authorizeKAction(const QString &action)
KService::Ptr preferredService(const QString &mimeType, const QString &genericServiceType=QString::fromLatin1("Application"))
static KUrl::List resolveURLs(const KUrl::List &_urls, const KService &_service)
Definition: krun.cpp:739
Definition: krun_p.h:77
void setLaunchedBy(WId window)
static Ptr serviceByStorageId(const QString &_storageId)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.