Changeset View
Changeset View
Standalone View
Standalone View
addons/filetree/katefiletree.cpp
Show First 20 Lines • Show All 289 Lines • ▼ Show 20 Line(s) | 289 | if (!doc) { | |||
---|---|---|---|---|---|
290 | return; | 290 | return; | ||
291 | } | 291 | } | ||
292 | 292 | | |||
293 | // get a list of appropriate services. | 293 | // get a list of appropriate services. | ||
294 | QMimeDatabase db; | 294 | QMimeDatabase db; | ||
295 | QMimeType mime = db.mimeTypeForName(doc->mimeType()); | 295 | QMimeType mime = db.mimeTypeForName(doc->mimeType()); | ||
296 | 296 | | |||
297 | QAction *a = nullptr; | 297 | QAction *a = nullptr; | ||
298 | KService::List offers = KMimeTypeTrader::self()->query(mime.name(), QStringLiteral("Application")); | 298 | const KService::List offers = KMimeTypeTrader::self()->query(mime.name(), QStringLiteral("Application")); | ||
299 | // for each one, insert a menu item... | 299 | // for each one, insert a menu item... | ||
300 | for (KService::List::Iterator it = offers.begin(); it != offers.end(); ++it) { | 300 | for (const auto& service : offers) { | ||
301 | KService::Ptr service = *it; | | |||
302 | if (service->name() == QLatin1String("Kate")) { | 301 | if (service->name() == QLatin1String("Kate")) { | ||
303 | continue; | 302 | continue; | ||
304 | } | 303 | } | ||
305 | a = menu->addAction(QIcon::fromTheme(service->icon()), service->name()); | 304 | a = menu->addAction(QIcon::fromTheme(service->icon()), service->name()); | ||
306 | a->setData(service->entryPath()); | 305 | a->setData(service->entryPath()); | ||
307 | } | 306 | } | ||
308 | // append "Other..." to call the KDE "open with" dialog. | 307 | // append "Other..." to call the KDE "open with" dialog. | ||
309 | a = menu->addAction(i18n("&Other...")); | 308 | a = menu->addAction(i18n("&Other...")); | ||
▲ Show 20 Lines • Show All 423 Lines • Show Last 20 Lines |