Changeset View
Changeset View
Standalone View
Standalone View
kate/katemainwindow.cpp
Show First 20 Lines • Show All 903 Lines • ▼ Show 20 Line(s) | 894 | { | |||
---|---|---|---|---|---|
904 | menu->clear(); | 904 | menu->clear(); | ||
905 | 905 | | |||
906 | // get a list of appropriate services. | 906 | // get a list of appropriate services. | ||
907 | QMimeDatabase db; | 907 | QMimeDatabase db; | ||
908 | QMimeType mime = db.mimeTypeForName(activeView->document()->mimeType()); | 908 | QMimeType mime = db.mimeTypeForName(activeView->document()->mimeType()); | ||
909 | //qCDebug(LOG_KATE) << "mime type: " << mime.name(); | 909 | //qCDebug(LOG_KATE) << "mime type: " << mime.name(); | ||
910 | 910 | | |||
911 | QAction *a = nullptr; | 911 | QAction *a = nullptr; | ||
912 | KService::List offers = KMimeTypeTrader::self()->query(mime.name(), QStringLiteral("Application")); | 912 | const KService::List offers = KMimeTypeTrader::self()->query(mime.name(), QStringLiteral("Application")); | ||
913 | // add all default open-with-actions except "Kate" | 913 | // add all default open-with-actions except "Kate" | ||
914 | for (KService::List::Iterator it = offers.begin(); it != offers.end(); ++it) { | 914 | for (const auto& service : offers) { | ||
915 | KService::Ptr service = *it; | | |||
916 | if (service->name() == QStringLiteral("Kate")) { | 915 | if (service->name() == QStringLiteral("Kate")) { | ||
917 | continue; | 916 | continue; | ||
918 | } | 917 | } | ||
919 | a = menu->addAction(QIcon::fromTheme(service->icon()), service->name()); | 918 | a = menu->addAction(QIcon::fromTheme(service->icon()), service->name()); | ||
920 | a->setData(service->entryPath()); | 919 | a->setData(service->entryPath()); | ||
921 | } | 920 | } | ||
922 | // append "Other..." to call the KDE "open with" dialog. | 921 | // append "Other..." to call the KDE "open with" dialog. | ||
923 | a = documentOpenWith->menu()->addAction(i18n("&Other...")); | 922 | a = documentOpenWith->menu()->addAction(i18n("&Other...")); | ||
▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines |