[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/plasma/scriptengines/javascript
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-03-31 21:32:27
Message-ID: 20100331213227.71143AC888 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1109723 by aseigo:

save some code; if profiling later shows it too expensive to set up the args lists \
for some of these calls, then we can check for the existence of the callbacks after \
first script evaluation and go from there


 M  +4 -39     simplejavascriptapplet.cpp  


--- trunk/KDE/kdebase/runtime/plasma/scriptengines/javascript/simplejavascriptapplet.cpp \
#1109722:1109723 @@ -140,21 +140,7 @@
 
 void SimpleJavaScriptApplet::configChanged()
 {
-    QScriptValue fun = m_self.property("configChanged");
-    if (!fun.isFunction()) {
-        kDebug() << "Script: plasmoid.configChanged is not a function, " << \
                fun.toString();
-        return;
-    }
-
-    QScriptContext *ctx = m_engine->pushContext();
-    ctx->setActivationObject(m_self);
-    //kDebug() << "calling plasmoid";
-    fun.call(m_self);
-    m_engine->popContext();
-
-    if (m_engine->hasUncaughtException()) {
-        reportError(m_env);
-    }
+    callFunction("configChanged");
 }
 
 void SimpleJavaScriptApplet::dataUpdated(const QString &name, const DataEngine::Data \
&data) @@ -173,8 +159,7 @@
 
 void SimpleJavaScriptApplet::activate()
 {
-    QScriptValueList args;
-    callFunction("activate", args);
+    callFunction("activate");
 }
 
 void SimpleJavaScriptApplet::popupEvent(bool popped)
@@ -186,36 +171,16 @@
 
 void SimpleJavaScriptApplet::executeAction(const QString &name)
 {
-    QScriptValueList args;
-    callFunction("action_" + name, args);
+    callFunction("action_" + name);
 }
 
 void SimpleJavaScriptApplet::paintInterface(QPainter *p, const \
QStyleOptionGraphicsItem *option, const QRect &contentsRect)  {
-    Q_UNUSED(option)
-    Q_UNUSED(contentsRect)
-
-    //kDebug() << "paintInterface() (c++)";
-    QScriptValue fun = m_self.property("paintInterface");
-    if (!fun.isFunction()) {
-        //kDebug() << "Script: paintInterface is not a function, " << \
                fun.toString();
-        AppletScript::paintInterface(p, option, contentsRect);
-        return;
-    }
-
     QScriptValueList args;
     args << m_engine->toScriptValue(p);
     args << m_engine->toScriptValue(const_cast<QStyleOptionGraphicsItem*>(option));
     args << m_engine->toScriptValue(QRectF(contentsRect));
-
-    QScriptContext *ctx = m_engine->pushContext();
-    ctx->setActivationObject(m_self);
-    fun.call(m_self, args);
-    m_engine->popContext();
-
-    if (m_engine->hasUncaughtException()) {
-        reportError(m_env);
-    }
+    callFunction("paintInterface", args);
 }
 
 QList<QAction*> SimpleJavaScriptApplet::contextualActions()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic