Changeset View
Changeset View
Standalone View
Standalone View
applets/icon/iconapplet.cpp
Show All 34 Lines | |||||
35 | #include <QProcess> | 35 | #include <QProcess> | ||
36 | 36 | | |||
37 | #include <KAuthorized> | 37 | #include <KAuthorized> | ||
38 | #include <KDesktopFile> | 38 | #include <KDesktopFile> | ||
39 | #include <KFileItemActions> | 39 | #include <KFileItemActions> | ||
40 | #include <KFileItemListProperties> | 40 | #include <KFileItemListProperties> | ||
41 | #include <KFileUtils> | 41 | #include <KFileUtils> | ||
42 | #include <KJobWidgets> | 42 | #include <KJobWidgets> | ||
43 | #include <KIO/ApplicationLauncherJob> | ||||
43 | #include <KLocalizedString> | 44 | #include <KLocalizedString> | ||
45 | #include <KNotificationJobUiDelegate> | ||||
44 | #include <KProtocolManager> | 46 | #include <KProtocolManager> | ||
45 | #include <KRun> | 47 | #include <KRun> | ||
46 | 48 | | |||
47 | #include <KIO/DropJob> | 49 | #include <KIO/DropJob> | ||
48 | #include <KIO/FavIconRequestJob> | 50 | #include <KIO/FavIconRequestJob> | ||
49 | #include <KIO/OpenFileManagerWindowJob> | 51 | #include <KIO/OpenFileManagerWindowJob> | ||
50 | #include <KIO/StatJob> | 52 | #include <KIO/StatJob> | ||
51 | 53 | | |||
▲ Show 20 Lines • Show All 292 Lines • ▼ Show 20 Line(s) | 339 | for (const QString &actionName : actions) { | |||
344 | const QString name = actionGroup.readEntry(QStringLiteral("Name")); | 346 | const QString name = actionGroup.readEntry(QStringLiteral("Name")); | ||
345 | const QString exec = actionGroup.readEntry(QStringLiteral("Exec")); | 347 | const QString exec = actionGroup.readEntry(QStringLiteral("Exec")); | ||
346 | if (name.isEmpty() || exec.isEmpty()) { | 348 | if (name.isEmpty() || exec.isEmpty()) { | ||
347 | continue; | 349 | continue; | ||
348 | } | 350 | } | ||
349 | 351 | | |||
350 | QAction *action = new QAction(QIcon::fromTheme(actionGroup.readEntry("Icon")), name, this); | 352 | QAction *action = new QAction(QIcon::fromTheme(actionGroup.readEntry("Icon")), name, this); | ||
351 | connect(action, &QAction::triggered, this, [this, exec] { | 353 | connect(action, &QAction::triggered, this, [this, exec] { | ||
352 | KRun::run(exec, {}, nullptr, m_name, m_iconName); | 354 | KRun::run(exec, {}, nullptr, m_name, m_iconName); | ||
broulik: Just FTR this could also get some `KServiceAction` treatment | |||||
353 | }); | 355 | }); | ||
354 | 356 | | |||
355 | m_jumpListActions << action; | 357 | m_jumpListActions << action; | ||
356 | } | 358 | } | ||
357 | } | 359 | } | ||
358 | 360 | | |||
359 | actions << m_jumpListActions; | 361 | actions << m_jumpListActions; | ||
360 | 362 | | |||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 436 | { | |||
439 | 441 | | |||
440 | if (urls.isEmpty()) { | 442 | if (urls.isEmpty()) { | ||
441 | return; | 443 | return; | ||
442 | } | 444 | } | ||
443 | 445 | | |||
444 | const QString &localPath = m_url.toLocalFile(); | 446 | const QString &localPath = m_url.toLocalFile(); | ||
445 | 447 | | |||
446 | if (KDesktopFile::isDesktopFile(localPath)) { | 448 | if (KDesktopFile::isDesktopFile(localPath)) { | ||
447 | KRun::runService(KService(localPath), urls, nullptr); | 449 | KService::Ptr service(new KService(localPath)); | ||
450 | auto *job = new KIO::ApplicationLauncherJob(service); | ||||
451 | job->setUrls(urls); | ||||
452 | job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled)); | ||||
453 | job->start(); | ||||
448 | return; | 454 | return; | ||
449 | } | 455 | } | ||
450 | 456 | | |||
451 | QMimeDatabase db; | 457 | QMimeDatabase db; | ||
452 | const QMimeType mimeType = db.mimeTypeForUrl(m_url); | 458 | const QMimeType mimeType = db.mimeTypeForUrl(m_url); | ||
453 | 459 | | |||
454 | if (isExecutable(mimeType)) { // isAcceptableDrag has the KAuthorized check for this | 460 | if (isExecutable(mimeType)) { // isAcceptableDrag has the KAuthorized check for this | ||
455 | QProcess::startDetached(m_url.toLocalFile(), QUrl::toStringList(urls)); | 461 | QProcess::startDetached(m_url.toLocalFile(), QUrl::toStringList(urls)); | ||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |
Just FTR this could also get some KServiceAction treatment