[Kst] extragear/graphics/kst/kst/extensions/js

George Staikos staikos at kde.org
Mon Dec 19 17:44:12 CET 2005


SVN commit 489741 by staikos:

make the plugin constructor work


 M  +21 -3     bind_plugin.cpp  
 M  +5 -0      bind_plugin.h  


--- trunk/extragear/graphics/kst/kst/extensions/js/bind_plugin.cpp #489740:489741
@@ -58,9 +58,27 @@
 
 
 KJS::Object KstBindPlugin::construct(KJS::ExecState *exec, const KJS::List& args) {
-  Q_UNUSED(args)
-  abort(); // FIXME: determine a proper constructor for this
-  return KJS::Object(new KstBindPlugin(exec));
+  KstPluginPtr p;
+
+  if (args.size() > 1) {
+    KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
+    exec->setException(eobj);
+    return KJS::Object();
+  }
+
+  p = new KstPlugin;
+
+  if (args.size() > 0) {
+    KstSharedPtr<Plugin> m = extractPluginModule(exec, args[0]);
+    if (!m) {
+      KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
+      exec->setException(eobj);
+      return KJS::Object();
+    }
+    p->setPlugin(m);
+  }
+
+  return KJS::Object(new KstBindPlugin(exec, p));
 }
 
 
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_plugin.h #489740:489741
@@ -35,6 +35,11 @@
 
 class KstBindPlugin : public KstBindDataObject {
   public:
+    /* @constructor
+       @description Main constructor for the Plugini class.  New plugins are
+                    typically invalid until various properties have been set.
+       @optarg PluginModule module The plugin module to use for this plugin.
+    */
     KstBindPlugin(KJS::ExecState *exec, KstPluginPtr d);
     KstBindPlugin(KJS::ExecState *exec, KJS::Object *globalObject = 0L);
     ~KstBindPlugin();


More information about the Kst mailing list