Fix AssociatedApplicationManager lookup when a mimetype has no aliases
QMimeType::aliases() does not return the main mimetype in the returned list and so when there are no aliases for a mimetype, there would be no associated application found as it would be querying for empty mimetype. This now always prepends the current mimetype to the list for which the apps are queried. REVIEW: 123779 BUG: 340326 FIXED-IN: 5.11 CHANGELOG: Fix AssociatedApplicationManager lookup when a mimetype has no aliases Change-Id: I322b03f2ac17fa4c0eb70fc3354c65a0f7a5e34c
This commit is contained in:
parent
c0c56191db
commit
37590e2d2b
@ -72,7 +72,15 @@ public:
|
||||
for (i = urlLists.begin(); i != urlLists.end(); ++i) {
|
||||
QAction *a = i.key()->actions()->action("run associated application");
|
||||
if (a) {
|
||||
apps = KFileItemActions::associatedApplications(mimeDb.mimeTypeForUrl(i.value().first()).aliases(), QString());
|
||||
// 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());
|
||||
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()));
|
||||
|
Loading…
Reference in New Issue
Block a user