Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/plugin/backend.cpp
Show First 20 Lines • Show All 297 Lines • ▼ Show 20 Line(s) | 297 | if (!desktopEntryUrl.isValid() || !desktopEntryUrl.isLocalFile() | |||
---|---|---|---|---|---|
298 | || !KDesktopFile::isDesktopFile(desktopEntryUrl.toLocalFile())) { | 298 | || !KDesktopFile::isDesktopFile(desktopEntryUrl.toLocalFile())) { | ||
299 | return QVariantList(); | 299 | return QVariantList(); | ||
300 | } | 300 | } | ||
301 | 301 | | |||
302 | QVariantList actions; | 302 | QVariantList actions; | ||
303 | QString desktopName = desktopEntryUrl.fileName(); | 303 | QString desktopName = desktopEntryUrl.fileName(); | ||
304 | QString storageId = desktopName; | 304 | QString storageId = desktopName; | ||
305 | 305 | | |||
306 | if (storageId.startsWith(QLatin1String("org.kde."))) { | | |||
307 | storageId = storageId.right(storageId.length() - 8); | | |||
308 | } | | |||
309 | | ||||
310 | if (storageId.endsWith(QLatin1String(".desktop"))) { | 306 | if (storageId.endsWith(QLatin1String(".desktop"))) { | ||
311 | storageId = storageId.left(storageId.length() - 8); | 307 | storageId = storageId.left(storageId.length() - 8); | ||
312 | } | 308 | } | ||
313 | 309 | | |||
314 | auto query = UsedResources | 310 | auto query = UsedResources | ||
315 | | RecentlyUsedFirst | 311 | | RecentlyUsedFirst | ||
316 | | Agent(storageId) | 312 | | Agent(storageId) | ||
317 | | Type::any() | 313 | | Type::any() | ||
318 | | Activity::current() | 314 | | Activity::current() | ||
319 | | Url::file(); | 315 | | Url::file(); | ||
320 | 316 | | |||
317 | // Due to KRecentDocument::add() bug, application name "<app>" could | ||||
318 | // be stored instead of its desktop entry name "org.kde.<app>". Let's | ||||
319 | // check for both in order to get all results for the application. | ||||
320 | if (storageId.startsWith(QLatin1String("org.kde."))) { | ||||
321 | query = query | Agent(storageId.right(storageId.length() - 8)); | ||||
322 | } | ||||
323 | | ||||
321 | ResultSet results(query); | 324 | ResultSet results(query); | ||
322 | 325 | | |||
323 | ResultSet::const_iterator resultIt = results.begin(); | 326 | ResultSet::const_iterator resultIt = results.begin(); | ||
324 | 327 | | |||
325 | int actionCount = 0; | 328 | int actionCount = 0; | ||
326 | 329 | | |||
327 | while (actionCount < 5 && resultIt != results.end()) { | 330 | while (actionCount < 5 && resultIt != results.end()) { | ||
328 | const QString resource = (*resultIt).resource(); | 331 | const QString resource = (*resultIt).resource(); | ||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |