From e0dbf4f1d80089ff055fa156bf4920680b7c2bf1 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 9 Mar 2010 05:33:40 +0000 Subject: [PATCH] clean up actions svn path=/trunk/KDE/kdebase/runtime/; revision=1100980 --- .../javascript/simplebindings/appletinterface.cpp | 10 ++++++++-- .../javascript/simplejavascriptapplet.cpp | 14 ++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/scriptengines/javascript/simplebindings/appletinterface.cpp b/scriptengines/javascript/simplebindings/appletinterface.cpp index 62f49fb43..effcba6eb 100644 --- a/scriptengines/javascript/simplebindings/appletinterface.cpp +++ b/scriptengines/javascript/simplebindings/appletinterface.cpp @@ -250,8 +250,14 @@ void AppletInterface::setAction(const QString &name, const QString &text, const m_actionSignals->setMapping(action, name); } - action->setIcon(icon.isEmpty() ? QIcon() : KIcon(icon)); - action->setShortcut(shortcut); + if (!icon.isEmpty()) { + action->setIcon(KIcon(icon)); + } + + if (!shortcut.isEmpty()) { + action->setShortcut(shortcut); + } + action->setObjectName(name); } diff --git a/scriptengines/javascript/simplejavascriptapplet.cpp b/scriptengines/javascript/simplejavascriptapplet.cpp index 35a834a87..004781a69 100644 --- a/scriptengines/javascript/simplejavascriptapplet.cpp +++ b/scriptengines/javascript/simplejavascriptapplet.cpp @@ -198,18 +198,8 @@ void SimpleJavaScriptApplet::popupEvent(bool popped) void SimpleJavaScriptApplet::executeAction(const QString &name) { - //callFunction("action_" + name); - QScriptValue fun = m_self.property("action_" + name); - if (fun.isFunction()) { - QScriptContext *ctx = m_engine->pushContext(); - ctx->setActivationObject(m_self); - fun.call(m_self); - m_engine->popContext(); - - if (m_engine->hasUncaughtException()) { - reportError(m_env); - } - } + QScriptValueList args; + callFunction("action_" + name, args); } void SimpleJavaScriptApplet::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)