diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 89e02d4cb..cd352786a 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -705,18 +705,27 @@ bool AppletInterface::eventFilter(QObject *watched, QEvent *event) return false; } + ContainmentInterface *ci = c->property("_plasma_graphicObject").value(); + if (!ci) { + return false; + } + //the plugin can be a single action or a context menu //Don't have an action list? execute as single action //and set the event position as action data 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(watched)->window() != ci->window()) { + return true; + } + QAction *action = plugin->contextualActions().first(); action->setData(e->globalPos()); action->trigger(); return true; } - ContainmentInterface *ci = c->property("_plasma_graphicObject").value(); - QMenu desktopMenu; ci->addAppletActions(desktopMenu, applet(), event);