clean up actions

svn path=/trunk/KDE/kdebase/runtime/; revision=1100980
This commit is contained in:
Aaron J. Seigo 2010-03-09 05:33:40 +00:00
parent 791daecc22
commit e0dbf4f1d8
2 changed files with 10 additions and 14 deletions

View File

@ -250,8 +250,14 @@ void AppletInterface::setAction(const QString &name, const QString &text, const
m_actionSignals->setMapping(action, name); m_actionSignals->setMapping(action, name);
} }
action->setIcon(icon.isEmpty() ? QIcon() : KIcon(icon)); if (!icon.isEmpty()) {
action->setShortcut(shortcut); action->setIcon(KIcon(icon));
}
if (!shortcut.isEmpty()) {
action->setShortcut(shortcut);
}
action->setObjectName(name); action->setObjectName(name);
} }

View File

@ -198,18 +198,8 @@ void SimpleJavaScriptApplet::popupEvent(bool popped)
void SimpleJavaScriptApplet::executeAction(const QString &name) void SimpleJavaScriptApplet::executeAction(const QString &name)
{ {
//callFunction("action_" + name); QScriptValueList args;
QScriptValue fun = m_self.property("action_" + name); callFunction("action_" + name, args);
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);
}
}
} }
void SimpleJavaScriptApplet::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect) void SimpleJavaScriptApplet::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)