Ignore single actions on popups

Changelog: Sticky notes no longer appear when middle clicking a plasmoid popup

REVIEW: 122623
BUG: 344309
This commit is contained in:
Kai Uwe Broulik 2015-02-18 14:35:21 +01:00
parent a717bac7a4
commit e823ec8488

View File

@ -705,18 +705,27 @@ bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
return false; return false;
} }
ContainmentInterface *ci = c->property("_plasma_graphicObject").value<ContainmentInterface *>();
if (!ci) {
return false;
}
//the plugin can be a single action or a context menu //the plugin can be a single action or a context menu
//Don't have an action list? execute as single action //Don't have an action list? execute as single action
//and set the event position as action data //and set the event position as action data
if (plugin->contextualActions().length() == 1) { if (plugin->contextualActions().length() == 1) {
// but first check whether we are not a popup
// we don't want to randomly creates applets without confirmation
if (static_cast<QQuickItem *>(watched)->window() != ci->window()) {
return true;
}
QAction *action = plugin->contextualActions().first(); QAction *action = plugin->contextualActions().first();
action->setData(e->globalPos()); action->setData(e->globalPos());
action->trigger(); action->trigger();
return true; return true;
} }
ContainmentInterface *ci = c->property("_plasma_graphicObject").value<ContainmentInterface *>();
QMenu desktopMenu; QMenu desktopMenu;
ci->addAppletActions(desktopMenu, applet(), event); ci->addAppletActions(desktopMenu, applet(), event);