action in containment as well

This commit is contained in:
Marco Martin 2014-08-08 16:09:36 +02:00
parent 2642fc3329
commit 52bc83a65a
2 changed files with 10 additions and 6 deletions

View File

@ -122,7 +122,7 @@ void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const QList<Q
KService::List apps = KFileItemActions::associatedApplications(mimeDb.mimeTypeForUrl(urls.first()).aliases(), QString());
if (!apps.isEmpty()) {
a->setIcon(QIcon::fromTheme(apps.first()->icon()));
a->setText(i18n("Open in %1", apps.first()->genericName()));
a->setText(i18n("Open in %1", apps.first()->genericName().isEmpty() ? apps.first()->genericName() : apps.first()->name()));
}
}
}

View File

@ -750,6 +750,11 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
}
if (!applet->failedToLaunch()) {
QAction *runAssociatedApplication = applet->actions()->action("run associated application");
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication);
}
QAction *configureApplet = applet->actions()->action("configure");
if (configureApplet && configureApplet->isEnabled()) {
desktopMenu.addAction(configureApplet);
@ -758,11 +763,6 @@ void ContainmentInterface::addAppletActions(QMenu &desktopMenu, Plasma::Applet *
if (appletAlternatives && appletAlternatives->isEnabled()) {
desktopMenu.addAction(appletAlternatives);
}
QAction *runAssociatedApplication = applet->actions()->action("run associated application");
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication);
}
}
QMenu *containmentMenu = new QMenu(i18nc("%1 is the name of the containment", "%1 Options", m_containment->title()), &desktopMenu);
@ -845,6 +845,10 @@ void ContainmentInterface::addContainmentActions(QMenu &desktopMenu, QEvent *eve
desktopMenu.addAction(m_containment->actions()->action("configure"));
}
} else {
QAction *runAssociatedApplication = m_containment->actions()->action("run associated application");
if (runAssociatedApplication && runAssociatedApplication->isEnabled()) {
desktopMenu.addAction(runAssociatedApplication);
}
desktopMenu.addActions(actions);
}