Changeset View
Changeset View
Standalone View
Standalone View
src/gui/openurljob.cpp
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 57 | public: | |||
---|---|---|---|---|---|
81 | bool m_externalBrowserEnabled = true; | 81 | bool m_externalBrowserEnabled = true; | ||
82 | bool m_followRedirections = true; | 82 | bool m_followRedirections = true; | ||
83 | 83 | | |||
84 | private: | 84 | private: | ||
85 | void executeCommand(); | 85 | void executeCommand(); | ||
86 | bool handleExecutables(const QMimeType &mimeType); | 86 | bool handleExecutables(const QMimeType &mimeType); | ||
87 | void runLink(const QString &filePath, const QString &urlStr, const QString &optionalServiceName); | 87 | void runLink(const QString &filePath, const QString &urlStr, const QString &optionalServiceName); | ||
88 | void showOpenWithDialog(); | 88 | void showOpenWithDialog(); | ||
89 | void startService(const KService::Ptr &service); | 89 | void startService(const KService::Ptr &service, const QList<QUrl> &urls); | ||
90 | void startService(const KService::Ptr &service) | ||||
91 | { | ||||
92 | startService(service, {m_url}); | ||||
93 | } | ||||
90 | }; | 94 | }; | ||
91 | 95 | | |||
92 | KIO::OpenUrlJob::OpenUrlJob(const QUrl &url, QObject *parent) | 96 | KIO::OpenUrlJob::OpenUrlJob(const QUrl &url, QObject *parent) | ||
93 | : KCompositeJob(parent), d(new OpenUrlJobPrivate(url, this)) | 97 | : KCompositeJob(parent), d(new OpenUrlJobPrivate(url, this)) | ||
94 | { | 98 | { | ||
95 | } | 99 | } | ||
96 | 100 | | |||
97 | KIO::OpenUrlJob::OpenUrlJob(const QUrl &url, const QString &mimeType, QObject *parent) | 101 | KIO::OpenUrlJob::OpenUrlJob(const QUrl &url, const QString &mimeType, QObject *parent) | ||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Line(s) | 306 | } else { // it's a file | |||
303 | // Start the timer. Once we get the timer event this | 307 | // Start the timer. Once we get the timer event this | ||
304 | // protocol server is back in the pool and we can reuse it. | 308 | // protocol server is back in the pool and we can reuse it. | ||
305 | // This gives better performance than starting a new slave | 309 | // This gives better performance than starting a new slave | ||
306 | QTimer::singleShot(0, q, [this] { scanFileWithGet(); }); | 310 | QTimer::singleShot(0, q, [this] { scanFileWithGet(); }); | ||
307 | } | 311 | } | ||
308 | }); | 312 | }); | ||
309 | } | 313 | } | ||
310 | 314 | | |||
311 | void KIO::OpenUrlJobPrivate::startService(const KService::Ptr &service) | 315 | void KIO::OpenUrlJobPrivate::startService(const KService::Ptr &service, const QList<QUrl> &urls) | ||
312 | { | 316 | { | ||
313 | KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service, q); | 317 | KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service, q); | ||
314 | job->setUrls({m_url}); | 318 | job->setUrls(urls); | ||
315 | job->setRunFlags(m_deleteTemporaryFile ? KIO::ApplicationLauncherJob::DeleteTemporaryFiles : KIO::ApplicationLauncherJob::RunFlags{}); | 319 | job->setRunFlags(m_deleteTemporaryFile ? KIO::ApplicationLauncherJob::DeleteTemporaryFiles : KIO::ApplicationLauncherJob::RunFlags{}); | ||
316 | job->setSuggestedFileName(m_suggestedFileName); | 320 | job->setSuggestedFileName(m_suggestedFileName); | ||
317 | job->setStartupId(m_startupId); | 321 | job->setStartupId(m_startupId); | ||
318 | job->setUiDelegate(q->uiDelegate()); | 322 | job->setUiDelegate(q->uiDelegate()); | ||
319 | q->addSubjob(job); | 323 | q->addSubjob(job); | ||
320 | job->start(); | 324 | job->start(); | ||
321 | } | 325 | } | ||
322 | 326 | | |||
▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Line(s) | 571 | if (!cfgGroup.hasKey("Type")) { | |||
570 | q->emitResult(); | 574 | q->emitResult(); | ||
571 | return; | 575 | return; | ||
572 | } | 576 | } | ||
573 | if ((cfg.hasApplicationType() | 577 | if ((cfg.hasApplicationType() | ||
574 | || cfg.readType() == QLatin1String("Service")) // for kio_settings | 578 | || cfg.readType() == QLatin1String("Service")) // for kio_settings | ||
575 | && !cfgGroup.readEntry("Exec").isEmpty() | 579 | && !cfgGroup.readEntry("Exec").isEmpty() | ||
576 | && m_runExecutables) { | 580 | && m_runExecutables) { | ||
577 | KService::Ptr service(new KService(filePath)); | 581 | KService::Ptr service(new KService(filePath)); | ||
578 | startService(service); | 582 | startService(service, {}); | ||
579 | return; | 583 | return; | ||
580 | } else if (cfg.hasLinkType()) { | 584 | } else if (cfg.hasLinkType()) { | ||
581 | runLink(filePath, cfg.readUrl(), cfg.desktopGroup().readEntry("X-KDE-LastOpenedWith")); | 585 | runLink(filePath, cfg.readUrl(), cfg.desktopGroup().readEntry("X-KDE-LastOpenedWith")); | ||
582 | return; | 586 | return; | ||
583 | } | 587 | } | ||
584 | } | 588 | } | ||
585 | } | 589 | } | ||
586 | 590 | | |||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |