Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/recentusagemodel.cpp
Show First 20 Lines • Show All 337 Lines • ▼ Show 20 Line(s) | 336 | { | |||
---|---|---|---|---|---|
338 | 338 | | |||
339 | bool withinBounds = row >= 0 && row < rowCount(); | 339 | bool withinBounds = row >= 0 && row < rowCount(); | ||
340 | 340 | | |||
341 | if (actionId.isEmpty() && withinBounds) { | 341 | if (actionId.isEmpty() && withinBounds) { | ||
342 | const QString &resource = resourceAt(row); | 342 | const QString &resource = resourceAt(row); | ||
343 | 343 | | |||
344 | if (!resource.startsWith(QLatin1String("applications:"))) { | 344 | if (!resource.startsWith(QLatin1String("applications:"))) { | ||
345 | const QUrl resourceUrl = docData(resource, Kicker::UrlRole).toUrl(); | 345 | const QUrl resourceUrl = docData(resource, Kicker::UrlRole).toUrl(); | ||
346 | const QList<QUrl> urlsList{resourceUrl}; | | |||
347 | 346 | | |||
348 | QMimeDatabase db; | 347 | KRun *run = new KRun(resourceUrl, nullptr); | ||
349 | QMimeType mime = db.mimeTypeForUrl(resourceUrl); | 348 | run->setRunExecutables(false); | ||
350 | KService::Ptr service = KMimeTypeTrader::self()->preferredService(mime.name()); | | |||
351 | if (service) { | | |||
352 | KRun::runApplication(*service, urlsList, nullptr); | | |||
353 | } else { | | |||
354 | QTimer::singleShot(0, [urlsList] { | | |||
355 | KRun::displayOpenWithDialog(urlsList, nullptr); | | |||
356 | }); | | |||
357 | } | | |||
358 | 349 | | |||
359 | return true; | 350 | return true; | ||
360 | } | 351 | } | ||
361 | 352 | | |||
362 | const QString storageId = resource.section(QLatin1Char(':'), 1); | 353 | const QString storageId = resource.section(QLatin1Char(':'), 1); | ||
363 | KService::Ptr service = KService::serviceByStorageId(storageId); | 354 | KService::Ptr service = KService::serviceByStorageId(storageId); | ||
364 | 355 | | |||
365 | if (!service) { | 356 | if (!service) { | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |