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);
}
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);
}

View File

@ -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)