Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/actionlist.cpp
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Line(s) | 180 | if (ContainmentInterface::mayAddLauncher(appletInterface, ContainmentInterface::TaskManager, service->entryPath())) { | |||
---|---|---|---|---|---|
181 | ContainmentInterface::addLauncher(appletInterface, ContainmentInterface::TaskManager, service->entryPath()); | 181 | ContainmentInterface::addLauncher(appletInterface, ContainmentInterface::TaskManager, service->entryPath()); | ||
182 | } | 182 | } | ||
183 | return true; | 183 | return true; | ||
184 | } | 184 | } | ||
185 | 185 | | |||
186 | return false; | 186 | return false; | ||
187 | } | 187 | } | ||
188 | 188 | | |||
189 | // HACK TEMP FIXME TODO IVAN | | |||
190 | QString storageIdFromService(KService::Ptr service) | 189 | QString storageIdFromService(KService::Ptr service) | ||
191 | { | 190 | { | ||
192 | QString storageId = service->storageId(); | 191 | QString storageId = service->storageId(); | ||
193 | 192 | | |||
194 | if (storageId.startsWith("org.kde.")) { | | |||
195 | storageId = storageId.right(storageId.length() - 8); | | |||
196 | } | | |||
197 | | ||||
198 | if (storageId.endsWith(".desktop")) { | 193 | if (storageId.endsWith(".desktop")) { | ||
199 | storageId = storageId.left(storageId.length() - 8); | 194 | storageId = storageId.left(storageId.length() - 8); | ||
200 | } | 195 | } | ||
201 | 196 | | |||
202 | return storageId; | 197 | return storageId; | ||
203 | } | 198 | } | ||
204 | 199 | | |||
205 | QVariantList jumpListActions(KService::Ptr service) | 200 | QVariantList jumpListActions(KService::Ptr service) | ||
Show All 35 Lines | 224 | { | |||
241 | 236 | | |||
242 | auto query = UsedResources | 237 | auto query = UsedResources | ||
243 | | RecentlyUsedFirst | 238 | | RecentlyUsedFirst | ||
244 | | Agent(storageId) | 239 | | Agent(storageId) | ||
245 | | Type::any() | 240 | | Type::any() | ||
246 | | Activity::current() | 241 | | Activity::current() | ||
247 | | Url::file(); | 242 | | Url::file(); | ||
248 | 243 | | |||
244 | // Due to KRecentDocument::add() bug, application name "<app>" could | ||||
245 | // be stored instead of its desktop entry name "org.kde.<app>". Let's | ||||
246 | // check for both in order to get all results for the application. | ||||
247 | if (storageId.startsWith("org.kde.")) { | ||||
248 | query = query | Agent(storageId.right(storageId.length() - 8)); | ||||
249 | } | ||||
250 | | ||||
249 | ResultSet results(query); | 251 | ResultSet results(query); | ||
250 | 252 | | |||
251 | ResultSet::const_iterator resultIt; | 253 | ResultSet::const_iterator resultIt; | ||
252 | resultIt = results.begin(); | 254 | resultIt = results.begin(); | ||
253 | 255 | | |||
254 | while (list.count() < 6 && resultIt != results.end()) { | 256 | while (list.count() < 6 && resultIt != results.end()) { | ||
255 | const QString resource = (*resultIt).resource(); | 257 | const QString resource = (*resultIt).resource(); | ||
256 | const QUrl url(resource); | 258 | const QUrl url(resource); | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 295 | if (actionId == "_kicker_forgetRecentDocuments") { | |||
298 | } | 300 | } | ||
299 | 301 | | |||
300 | auto query = UsedResources | 302 | auto query = UsedResources | ||
301 | | Agent(storageId) | 303 | | Agent(storageId) | ||
302 | | Type::any() | 304 | | Type::any() | ||
303 | | Activity::current() | 305 | | Activity::current() | ||
304 | | Url::file(); | 306 | | Url::file(); | ||
305 | 307 | | |||
308 | // Due to KRecentDocument::add() bug, application name "<app>" could | ||||
309 | // be stored instead of its desktop entry name "org.kde.<app>". Let's | ||||
310 | // check for both in order to get all results for the application. | ||||
311 | if (storageId.startsWith("org.kde.")) { | ||||
312 | query = query | Agent(storageId.right(storageId.length() - 8)); | ||||
broulik: I would prefer `mid(8)` | |||||
313 | } | ||||
314 | | ||||
306 | KAStats::forgetResources(query); | 315 | KAStats::forgetResources(query); | ||
307 | 316 | | |||
308 | return false; | 317 | return false; | ||
309 | } | 318 | } | ||
310 | 319 | | |||
311 | QString argument = _argument.toString(); | 320 | QString argument = _argument.toString(); | ||
312 | 321 | | |||
313 | if (argument.isEmpty()) { | 322 | if (argument.isEmpty()) { | ||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |
I would prefer mid(8)