Changeset View
Changeset View
Standalone View
Standalone View
src/gui/openurljob.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 57 | public: | |||
---|---|---|---|---|---|
75 | QString m_suggestedFileName; | 75 | QString m_suggestedFileName; | ||
76 | QByteArray m_startupId; | 76 | QByteArray m_startupId; | ||
77 | QString m_mimeTypeName; | 77 | QString m_mimeTypeName; | ||
78 | KService::Ptr m_preferredService; | 78 | KService::Ptr m_preferredService; | ||
79 | bool m_deleteTemporaryFile = false; | 79 | bool m_deleteTemporaryFile = false; | ||
80 | bool m_runExecutables = false; | 80 | bool m_runExecutables = false; | ||
81 | bool m_externalBrowserEnabled = true; | 81 | bool m_externalBrowserEnabled = true; | ||
82 | bool m_followRedirections = true; | 82 | bool m_followRedirections = true; | ||
83 | bool m_showOpenWithDialog = false; | ||||
83 | 84 | | |||
84 | private: | 85 | private: | ||
85 | void executeCommand(); | 86 | void executeCommand(); | ||
86 | bool handleExecutables(const QMimeType &mimeType); | 87 | bool handleExecutables(const QMimeType &mimeType); | ||
87 | void runLink(const QString &filePath, const QString &urlStr, const QString &optionalServiceName); | 88 | void runLink(const QString &filePath, const QString &urlStr, const QString &optionalServiceName); | ||
88 | void showOpenWithDialog(); | 89 | void showOpenWithDialog(); | ||
89 | void startService(const KService::Ptr &service); | 90 | void startService(const KService::Ptr &service); | ||
90 | }; | 91 | }; | ||
Show All 38 Lines | 129 | { | |||
129 | d->m_externalBrowserEnabled = b; | 130 | d->m_externalBrowserEnabled = b; | ||
130 | } | 131 | } | ||
131 | 132 | | |||
132 | void KIO::OpenUrlJob::setFollowRedirections(bool b) | 133 | void KIO::OpenUrlJob::setFollowRedirections(bool b) | ||
133 | { | 134 | { | ||
134 | d->m_followRedirections = b; | 135 | d->m_followRedirections = b; | ||
135 | } | 136 | } | ||
136 | 137 | | |||
138 | void KIO::OpenUrlJob::setShowOpenWithDialog(bool b) | ||||
139 | { | ||||
140 | d->m_showOpenWithDialog = b; | ||||
141 | } | ||||
142 | | ||||
137 | static bool checkNeedPortalSupport() | 143 | static bool checkNeedPortalSupport() | ||
138 | { | 144 | { | ||
139 | return !(QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() | 145 | return !(QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() | ||
140 | || qEnvironmentVariableIsSet("SNAP")); | 146 | || qEnvironmentVariableIsSet("SNAP")); | ||
141 | } | 147 | } | ||
142 | 148 | | |||
143 | void KIO::OpenUrlJob::start() | 149 | void KIO::OpenUrlJob::start() | ||
144 | { | 150 | { | ||
▲ Show 20 Lines • Show All 399 Lines • ▼ Show 20 Line(s) | |||||
544 | { | 550 | { | ||
545 | // Tell the app, in case it wants us to stop here | 551 | // Tell the app, in case it wants us to stop here | ||
546 | Q_EMIT q->mimeTypeFound(m_mimeTypeName); | 552 | Q_EMIT q->mimeTypeFound(m_mimeTypeName); | ||
547 | if (q->error() == KJob::KilledJobError) { | 553 | if (q->error() == KJob::KilledJobError) { | ||
548 | q->emitResult(); | 554 | q->emitResult(); | ||
549 | return; | 555 | return; | ||
550 | } | 556 | } | ||
551 | 557 | | |||
558 | if (m_showOpenWithDialog) { | ||||
559 | showOpenWithDialog(); | ||||
560 | return; | ||||
561 | } | ||||
562 | | ||||
552 | // Support for preferred service setting, see setPreferredService | 563 | // Support for preferred service setting, see setPreferredService | ||
553 | if (m_preferredService && m_preferredService->hasMimeType(m_mimeTypeName)) { | 564 | if (m_preferredService && m_preferredService->hasMimeType(m_mimeTypeName)) { | ||
554 | startService(m_preferredService); | 565 | startService(m_preferredService); | ||
555 | return; | 566 | return; | ||
556 | } | 567 | } | ||
557 | 568 | | |||
558 | // Local desktop file | 569 | // Local desktop file | ||
559 | if (m_url.isLocalFile() && m_mimeTypeName == QLatin1String("application/x-desktop")) { | 570 | if (m_url.isLocalFile() && m_mimeTypeName == QLatin1String("application/x-desktop")) { | ||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |