Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/recentusagemodel.cpp
Show First 20 Lines • Show All 323 Lines • ▼ Show 20 Line(s) | 322 | { | |||
---|---|---|---|---|---|
324 | 324 | | |||
325 | bool withinBounds = row >= 0 && row < rowCount(); | 325 | bool withinBounds = row >= 0 && row < rowCount(); | ||
326 | 326 | | |||
327 | if (actionId.isEmpty() && withinBounds) { | 327 | if (actionId.isEmpty() && withinBounds) { | ||
328 | const QString &resource = resourceAt(row); | 328 | const QString &resource = resourceAt(row); | ||
329 | 329 | | |||
330 | if (!resource.startsWith(QLatin1String("applications:"))) { | 330 | if (!resource.startsWith(QLatin1String("applications:"))) { | ||
331 | const QUrl resourceUrl = docData(resource, Kicker::UrlRole).toUrl(); | 331 | const QUrl resourceUrl = docData(resource, Kicker::UrlRole).toUrl(); | ||
332 | const QList<QUrl> urlsList{resourceUrl}; | | |||
333 | 332 | | |||
334 | QMimeDatabase db; | 333 | KRun *run = new KRun(resourceUrl, nullptr); | ||
335 | QMimeType mime = db.mimeTypeForUrl(resourceUrl); | 334 | run->setRunExecutables(false); | ||
336 | KService::Ptr service = KMimeTypeTrader::self()->preferredService(mime.name()); | | |||
337 | if (service) { | | |||
338 | KRun::runApplication(*service, urlsList, nullptr); | | |||
339 | } else { | | |||
340 | QTimer::singleShot(0, [urlsList] { | | |||
341 | KRun::displayOpenWithDialog(urlsList, nullptr); | | |||
342 | }); | | |||
343 | } | | |||
344 | 335 | | |||
345 | return true; | 336 | return true; | ||
346 | } | 337 | } | ||
347 | 338 | | |||
348 | const QString storageId = resource.section(QLatin1Char(':'), 1); | 339 | const QString storageId = resource.section(QLatin1Char(':'), 1); | ||
349 | KService::Ptr service = KService::serviceByStorageId(storageId); | 340 | KService::Ptr service = KService::serviceByStorageId(storageId); | ||
350 | 341 | | |||
351 | if (!service) { | 342 | if (!service) { | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |