Don't show "Alternatives" menu by default

And only enable it in the contextMenuAboutToShow connection.

We currently enable/disable the menu in this slot, but we default to it
on. This meant other users of actions() that can't correctly emit
contextMenuAboutToShow gain an extra entry which might not be relevant.

REVIEW: 129263
This commit is contained in:
David Edmundson 2016-10-26 11:54:02 +01:00
parent 96bb3e7645
commit c246588999

View File

@ -189,6 +189,7 @@ void AppletPrivate::init(const QString &_packagePath, const QVariantList &args)
if (!q->isContainment()) { if (!q->isContainment()) {
QAction *a = new QAction(QIcon::fromTheme(QStringLiteral("preferences-desktop-default-applications")), i18n("Alternatives..."), q); QAction *a = new QAction(QIcon::fromTheme(QStringLiteral("preferences-desktop-default-applications")), i18n("Alternatives..."), q);
a->setVisible(false);
q->actions()->addAction(QStringLiteral("alternatives"), a); q->actions()->addAction(QStringLiteral("alternatives"), a);
QObject::connect(a, &QAction::triggered,[=] { QObject::connect(a, &QAction::triggered,[=] {
if (q->containment()) { if (q->containment()) {