KIO
openurljob.cpp
75 void runLink(const QString &filePath, const QString &urlStr, const QString &optionalServiceName);
143 const QString error = !d->m_url.isValid() ? d->m_url.errorString() : d->m_url.toDisplayString();
228 KService::Ptr externalBrowser = KApplicationTrader::preferredService(QStringLiteral("x-scheme-handler/https"));
230 externalBrowser = KApplicationTrader::preferredService(QStringLiteral("x-scheme-handler/http"));
237 const QString browserApp = KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("General")).readEntry("BrowserApplication");
263 const KService::Ptr service = KApplicationTrader::preferredService(QLatin1String("x-scheme-handler/") + m_url.scheme());
285 job->setRunFlags(m_deleteTemporaryFile ? KIO::ApplicationLauncherJob::DeleteTemporaryFiles : KIO::ApplicationLauncherJob::RunFlags{});
292void KIO::OpenUrlJobPrivate::runLink(const QString &filePath, const QString &urlStr, const QString &optionalServiceName)
296 q->setErrorText(i18n("The desktop entry file\n%1\nis of type Link but has no URL=... entry.", filePath));
334 return (mimeType.inherits(QStringLiteral("application/x-executable")) || mimeType.inherits(QStringLiteral("application/x-ms-dos-executable")));
341 return (mimeType.inherits(QStringLiteral("application/x-executable")) && mimeType.inherits(QStringLiteral("text/plain")));
410 q->setErrorText(i18n("For security reasons, launching executables is not allowed in this context."));
436 auto *untrustedProgramHandler = KIO::delegateExtension<KIO::UntrustedProgramHandlerInterface *>(q);
440 q->setErrorText(i18n("The program \"%1\" needs to have executable permission before it can be launched.", filePath));
444 QObject::connect(untrustedProgramHandler, &KIO::UntrustedProgramHandlerInterface::result, q, [=, this](bool result) {
525 if (m_url.fileName() == QLatin1String(".directory") || m_mimeTypeName == QLatin1String("application/x-theme")) {
548 if ((cfg.hasApplicationType() || cfg.readType() == QLatin1String("Service"))) { // kio_settings lets users run Type=Service desktop files
618 const QStringList disallowedWrappers = {QStringLiteral("xdg-open"), QStringLiteral("kde-open")};
650 if (!openWithHandler || QOperatingSystemVersion::currentType() == QOperatingSystemVersion::Windows) {
651 // As KDE on windows doesn't know about the windows default applications, offers will be empty in nearly all cases.
667 QObject::connect(openWithHandler, &KIO::OpenWithHandlerInterface::serviceSelected, q, [this](const KService::Ptr &service) {
678void KIO::OpenUrlJobPrivate::showOpenOrExecuteFileDialog(std::function<void(bool)> dialogFinished)
686 if (isTextScript(mimeType) || mimeType.inherits(QStringLiteral("application/x-desktop"))) { // Open text-based ones in the default app
690 q->setErrorText(i18n("The program \"%1\" could not be launched.", m_url.toDisplayString(QUrl::PreferLocalFile)));
696 QObject::connect(openOrExecuteFileHandler, &KIO::OpenOrExecuteFileInterface::canceled, q, [this]() {
701 QObject::connect(openOrExecuteFileHandler, &KIO::OpenOrExecuteFileInterface::executeFile, q, [this, dialogFinished](bool shouldExecute) {
static Q_INVOKABLE bool authorize(const QString &action)
static Q_INVOKABLE bool authorizeAction(const QString &action)
virtual bool addSubjob(KJob *job)
bool hasKey(const char *key) const
QString readEntry(const char *key, const char *aDefault=nullptr) const
ApplicationLauncherJob runs an application and watches it while running.
Definition applicationlauncherjob.h:55
void setSuggestedFileName(const QString &suggestedFileName)
Sets the file name to use in the case of downloading the file to a tempfile in order to give to a non...
Definition applicationlauncherjob.cpp:109
@ DeleteTemporaryFiles
the URLs passed to the service will be deleted when it exits (if the URLs are local files)
Definition applicationlauncherjob.h:106
void setRunFlags(RunFlags runFlags)
Specifies various flags.
Definition applicationlauncherjob.cpp:104
void setStartupId(const QByteArray &startupId)
Sets the platform-specific startup id of the application launch.
Definition applicationlauncherjob.cpp:114
void setUrls(const QList< QUrl > &urls)
Specifies the URLs to be passed to the application.
Definition applicationlauncherjob.cpp:99
CommandLauncherJob runs a command and watches it while running.
Definition commandlauncherjob.h:45
void setWorkingDirectory(const QString &workingDirectory)
Sets the working directory from which to run the command.
Definition commandlauncherjob.cpp:79
void setStartupId(const QByteArray &startupId)
Sets the platform-specific startup id of the command launch.
Definition commandlauncherjob.cpp:74
static bool hasSchemeHandler(const QUrl &url)
Returns true if protocol should be opened by a "handler" application, i.e. an application associated ...
Definition desktopexecparser.cpp:220
MimeTypeFinderJob finds out the MIME type of a URL.
Definition mimetypefinderjob.h:29
void executeFile(bool enable)
Emitted by promptUserOpenOrExecute() once the user chooses an action.
void canceled()
Emitted by promptUserOpenOrExecute() if user selects cancel.
void setSuggestedFileName(const QString &suggestedFileName)
Sets the file name to use in the case of downloading the file to a tempfile, in order to give it to a...
Definition openurljob.cpp:110
void setDeleteTemporaryFile(bool b)
Specifies that the URL passed to the application will be deleted when it exits (if the URL is a local...
Definition openurljob.cpp:105
void setEnableExternalBrowser(bool b)
Sets whether the external webbrowser setting should be honoured.
Definition openurljob.cpp:130
void setFollowRedirections(bool b)
Sets whether the job should follow URL redirections.
Definition openurljob.cpp:135
void setRunExecutables(bool allow)
Set this to true if this class should allow the user to run executables.
Definition openurljob.cpp:120
void mimeTypeFound(const QString &mimeType)
Emitted when the MIME type is determined.
OpenUrlJob(const QUrl &url, QObject *parent=nullptr)
Creates an OpenUrlJob in order to open a URL.
Definition openurljob.cpp:88
static bool isExecutableFile(const QUrl &url, const QString &mimetypeName)
Returns whether the url of mimetype is executable.
Definition openurljob.cpp:350
void setShowOpenOrExecuteDialog(bool b)
Set this to true if this class should show a dialog to ask the user about how to handle various types...
Definition openurljob.cpp:125
void setStartupId(const QByteArray &startupId)
Sets the platform-specific startup id of the application launch.
Definition openurljob.cpp:115
void serviceSelected(const KService::Ptr &service)
Emitted by promptUserForApplication() once the user chooses an application.
void handled()
Emitted by promptUserForApplication() if it fully handled it including launching the app.
void canceled()
Emitted by promptUserForApplication() if the user canceled the application selection dialog.
void result(bool confirmed)
Implementations of this interface must emit result in showUntrustedProgramWarning.
void setErrorText(const QString &errorText)
void emitResult()
int error() const
void result(KJob *job)
void setError(int errorCode)
void setCapabilities(Capabilities capabilities)
Killable
QString errorText() const
static QString exec(const QString &protocol)
Returns the library / executable to open for the protocol protocol Example : "kio_ftp",...
Definition kprotocolinfo.cpp:211
static bool isHelperProtocol(const QUrl &url)
Returns whether the protocol can act as a helper protocol.
Definition kprotocolinfo.cpp:306
static QString defaultMimetype(const QUrl &url)
Returns default MIME type for this URL based on the protocol.
Definition kprotocolmanager.cpp:349
static Ptr serviceByStorageId(const QString &_storageId)
QString storageId() const
static Ptr serviceByDesktopName(const QString &_name)
QString exec() const
bool hasMimeType(const QString &mimeType) const
QString i18n(const char *text, const TYPE &arg...)
KSERVICE_EXPORT KService::Ptr preferredService(const QString &mimeType)
KCALUTILS_EXPORT QString mimeType()
KIOCORE_EXPORT QString buildErrorString(int errorCode, const QString &errorText)
Returns a translated error message for errorCode using the additional error information provided by e...
Definition job_error.cpp:31
T delegateExtension(KJob *job)
Returns the child of the job's uiDelegate() that implements the given extension, or nullptr if none w...
Definition jobuidelegatefactory.h:89
KCOREADDONS_EXPORT bool isInside()
bool authorizeUrlAction(const QString &action, const QUrl &baseURL, const QUrl &destURL)
Returns whether a certain URL related action is authorized.
Definition kurlauthorized.cpp:24
bool openUrl(const QUrl &url)
bool isExecutable() const const
QMimeType mimeTypeForName(const QString &nameOrAlias) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
OSType currentType()
void clear()
bool isEmpty() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QStringView mid(qsizetype start, qsizetype length) const const
RemoveFilename
QUrl adjusted(FormattingOptions options) const const
QString fileName(ComponentFormattingOptions options) const const
QUrl fromUserInput(const QString &userInput, const QString &workingDirectory, UserInputResolutionOptions options)
bool isLocalFile() const const
QString scheme() const const
QString toDisplayString(FormattingOptions options) const const
QString toLocalFile() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.