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 | | |||
310 | /* | ||||
311 | * HACK This is a temporary hack to make sure nothing breaks | ||||
312 | * after D10863 is landed. | ||||
313 | * | ||||
314 | * TODO Remove it when we depend on the Frameworks version | ||||
315 | * which contains the above revision. | ||||
316 | */ | ||||
317 | bool storageIdWasCut = false; | ||||
318 | const QString uncutStorageId = storageId; | ||||
319 | | ||||
320 | if (storageId.startsWith(QLatin1String("org.kde."))) { | ||||
321 | storageId = storageId.right(storageId.length() - 8); | ||||
322 | storageIdWasCut = true; | ||||
323 | } | ||||
324 | | ||||
314 | auto query = UsedResources | 325 | auto query = UsedResources | ||
315 | | RecentlyUsedFirst | 326 | | RecentlyUsedFirst | ||
316 | | Agent(storageId) | 327 | | Agent(storageId) | ||
317 | | Type::any() | 328 | | Type::any() | ||
318 | | Activity::current() | 329 | | Activity::current() | ||
319 | | Url::file(); | 330 | | Url::file(); | ||
320 | 331 | | |||
332 | if (storageIdWasCut) { | ||||
333 | query = query | Agent(uncutStorageId); | ||||
334 | } | ||||
335 | | ||||
321 | ResultSet results(query); | 336 | ResultSet results(query); | ||
322 | 337 | | |||
323 | ResultSet::const_iterator resultIt = results.begin(); | 338 | ResultSet::const_iterator resultIt = results.begin(); | ||
324 | 339 | | |||
325 | int actionCount = 0; | 340 | int actionCount = 0; | ||
326 | 341 | | |||
327 | while (actionCount < 5 && resultIt != results.end()) { | 342 | while (actionCount < 5 && resultIt != results.end()) { | ||
328 | const QString resource = (*resultIt).resource(); | 343 | const QString resource = (*resultIt).resource(); | ||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |