Move contextualActionsAboutToShow to Applet
Applet contains the menu actions, therefore reloading the menu should happen in Applet not AppletInterface. With AppletInterface being a dumb wrapper. This exposes functionality to anyone who overrides Applet, but also will also allows system tray to emit this signal without having to use private API. Change-Id: I95e65de315744a78a82ebba2a954e4f3ae1bd7b2 REVIEW: 127217
This commit is contained in:
parent
e1e58332e7
commit
88ec6de113
@ -426,6 +426,13 @@ Q_SIGNALS:
|
||||
void userConfiguringChanged(bool configuring);
|
||||
|
||||
//ACTIONS
|
||||
/**
|
||||
* Emitted just before the contextual actions are about to show
|
||||
* For instance just before the context menu containing the actions
|
||||
* added with setAction() is shown
|
||||
*/
|
||||
void contextualActionsAboutToShow();
|
||||
|
||||
/**
|
||||
* Emitted when activation is requested due to, for example, a global
|
||||
* keyboard shortcut. By default the wiget is given focus.
|
||||
|
@ -71,6 +71,9 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
|
||||
connect(applet(), &Plasma::Applet::userConfiguringChanged,
|
||||
this, &AppletInterface::userConfiguringChanged);
|
||||
|
||||
connect(applet(), &Plasma::Applet::contextualActionsAboutToShow,
|
||||
this, &AppletInterface::contextualActionsAboutToShow);
|
||||
|
||||
connect(applet(), &Plasma::Applet::statusChanged,
|
||||
this, &AppletInterface::statusChanged);
|
||||
|
||||
|
@ -924,7 +924,6 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
|
||||
if (AppletInterface *ai = qobject_cast<AppletInterface *>(appletObject)) {
|
||||
if (ai->isVisible() && ai->contains(ai->mapFromItem(this, event->posF()))) {
|
||||
applet = ai->applet();
|
||||
emit ai->contextualActionsAboutToShow();
|
||||
break;
|
||||
} else {
|
||||
ai = 0;
|
||||
@ -938,9 +937,10 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
|
||||
m_contextMenu = &desktopMenu;
|
||||
|
||||
if (applet) {
|
||||
emit applet->contextualActionsAboutToShow();
|
||||
addAppletActions(desktopMenu, applet, event);
|
||||
} else {
|
||||
emit contextualActionsAboutToShow();
|
||||
emit m_containment->contextualActionsAboutToShow();
|
||||
addContainmentActions(desktopMenu, event);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user