[Kst] branches/work/kst/pluginify/kst/src

Adam Treat treat at kde.org
Tue Sep 5 21:54:45 CEST 2006


SVN commit 581252 by treat:

These plugins will no longer need an xml file describing
their config widget gui...


 M  +0 -1      libkstmath/kstdataobject.h  
 M  +1 -50     libkstmath/plugincollection.cpp  
 M  +0 -2      libkstmath/plugincollection.h  
 M  +0 -2      plugins/testplugin/testplugin.cpp  
 M  +0 -2      plugins/testplugin/testplugin.h  


--- branches/work/kst/pluginify/kst/src/libkstmath/kstdataobject.h #581251:581252
@@ -45,7 +45,6 @@
     static KstDataObjectPtr plugin( const QString &name );
 
     virtual QString name() const { return QString::null; }
-    virtual QString xmlFile() const { return QString::null; }
 
     virtual UpdateType update(int updateCounter = -1) = 0;
     virtual const QString& typeString() const { return _typeString; }
--- branches/work/kst/pluginify/kst/src/libkstmath/plugincollection.cpp #581251:581252
@@ -25,14 +25,6 @@
 #include <klocale.h>
 #include <kstandarddirs.h>
 
-#include <kdebug.h>
-
-#include <klibloader.h>
-#include <klocale.h>
-#include <kservicetype.h>
-#include <kstdataobject.h>
-#include <kparts/componentfactory.h>
-
 #include <qdir.h>
 #include <qregexp.h>
 
@@ -210,7 +202,7 @@
   QMap<QString,QString> backup = _installedPluginNames;
   _installedPlugins.clear();
   _installedPluginNames.clear();
-  bool changed = /*scanDataObjectPlugins()*/ false;
+  bool changed = false;
 
   QStringList dirs = KGlobal::dirs()->resourceDirs("kstplugins");
   dirs += KGlobal::dirs()->resourceDirs("kstpluginlib");
@@ -266,47 +258,6 @@
   }
 }
 
-// Scans for plugins and stores the information for them in "pluginInfo"
-bool PluginCollection::scanDataObjectPlugins() {
-
-  KstDebug::self()->log(i18n("Scanning for data-object plugins."));
-
-  QMap<QString,QString> backup = _installedPluginNames;
-  bool changed = false;
-
-  KService::List sl = KServiceType::offers("Kst Data Object");
-  for (KService::List::ConstIterator it = sl.begin(); it != sl.end(); ++it) {
-    int err = 0;
-    KService::Ptr service = ( *it );
-    KstDataObject *object =
-        KParts::ComponentFactory::createInstanceFromService<KstDataObject>( service, 0, "",
-                                                                            QStringList(), &err );
-    if ( object ) {
-        int status = _parser->parseFile( object->xmlFile() );
-        if (status == 0) {
-        // dupe? - prefer earlier installations
-        if (_installedPluginNames.contains(_parser->data()._name)) {
-          continue;
-        }
-        _installedPlugins[object->xmlFile()] = _parser->data();
-        _installedPluginNames[_parser->data()._name] = object->xmlFile();
-        if (!backup.contains(_parser->data()._name)) {
-          emit pluginInstalled(_parser->data()._name);
-          changed = true;
-        } else {
-          backup.remove(_parser->data()._name);
-        }
-      } else {
-        KstDebug::self()->log(i18n("Error [%2] parsing XML file '%1'; skipping.").arg(object->xmlFile()).arg(status), KstDebug::Warning);
-      }
-    }
-    else
-        kdDebug() << "FAILURE! " << k_funcinfo << " " << err << endl;
-
-  }
-  return changed; //changed
-}
-
 int PluginCollection::deletePlugin(const QString& xmlfile, const QString& object) {
   QString pname = _installedPlugins[xmlfile]._name;
   QFile::remove(xmlfile);
--- branches/work/kst/pluginify/kst/src/libkstmath/plugincollection.h #581251:581252
@@ -111,8 +111,6 @@
     mutable QMap<QString, QString> _installedPluginNames;
     void scanPlugins() ;
     void loadPluginsFor(const QString& path);
-
-    bool scanDataObjectPlugins();
 };
 
 
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.cpp #581251:581252
@@ -17,7 +17,6 @@
 #include "testplugin.h"
 
 #include <kdebug.h>
-#include <kstandarddirs.h>
 #include <kgenericfactory.h>
 
 K_EXPORT_COMPONENT_FACTORY( kstobject_testplugin,
@@ -27,7 +26,6 @@
     : KstDataObject() {
 
     _name = "testplugin";
-    _xmlFile =  locate("data", "kstplugins/" + _name + ".xml");
 }
 
 TestPlugin::~TestPlugin() {
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.h #581251:581252
@@ -29,7 +29,6 @@
     virtual ~TestPlugin();
 
     virtual QString name() const { return _name; }
-    virtual QString xmlFile() const { return _xmlFile; }
 
     virtual KstObject::UpdateType update(int)
     {
@@ -52,7 +51,6 @@
 
 private:
     QString _name;
-    QString _xmlFile;
 };
 
 #endif


More information about the Kst mailing list