diff --git a/src/plasma/private/associatedapplicationmanager.cpp b/src/plasma/private/associatedapplicationmanager.cpp index 60ba596fd..182f657d5 100644 --- a/src/plasma/private/associatedapplicationmanager.cpp +++ b/src/plasma/private/associatedapplicationmanager.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #if !PLASMA_NO_KIO #include @@ -72,15 +72,8 @@ public: for (i = urlLists.begin(); i != urlLists.end(); ++i) { QAction *a = i.key()->actions()->action("run associated application"); if (a) { - // This gets the current mimetype _and_ a list of its aliases, because aliases() - // do not return the current mimetype in it, so it needs to be prepended, - // especially for the cases where there are no aliases to be returned, - // this would then just return an empty list, returning the generic action even - // when there is a valid mimetype and an associated app - QStringList mimeTypes{mimeDb.mimeTypeForUrl(i.value().first()).name()}; - mimeTypes << mimeDb.mimeTypeForUrl(i.value().first()).aliases(); - - apps = KFileItemActions::associatedApplications(mimeTypes, QString()); + const QString mimeType = mimeDb.mimeTypeForUrl(i.value().first()).name(); + const KService::List apps = KMimeTypeTrader::self()->query(mimeType); if (!apps.isEmpty()) { a->setIcon(QIcon::fromTheme(apps.first()->icon())); a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name())); @@ -149,7 +142,8 @@ void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const QListactions()->action("run associated application"); if (a) { QMimeDatabase mimeDb; - KService::List apps = KFileItemActions::associatedApplications(mimeDb.mimeTypeForUrl(urls.first()).aliases(), QString()); + const QString mimeType = mimeDb.mimeTypeForUrl(urls.first()).name(); + const KService::List apps = KMimeTypeTrader::self()->query(mimeType); if (!apps.isEmpty()) { a->setIcon(QIcon::fromTheme(apps.first()->icon())); a->setText(i18n("Open with %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name()));