[Kst] branches/work/kst/pluginify/kst/src
Adam Treat
treat at kde.org
Tue Sep 5 20:39:38 CEST 2006
SVN commit 581226 by treat:
Begin setting up the object plugins like the datasource plugins
M +2 -1 libkstapp/kstdatamanager_i.cpp
M +39 -0 libkstmath/kstdataobject.cpp
M +4 -0 libkstmath/kstdataobject.h
M +1 -2 libkstmath/plugincollection.cpp
M +2 -1 plugins/testplugin/testplugin.h
--- branches/work/kst/pluginify/kst/src/libkstapp/kstdatamanager_i.cpp #581225:581226
@@ -570,7 +570,6 @@
return _yesPixmap;
}
-
KstDataManagerI::KstDataManagerI(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: KstDataManager(parent, name, modal, fl) {
doc = in_doc;
@@ -604,6 +603,8 @@
connect(NewCSD, SIGNAL(clicked()), KstCsdDialogI::globalInstance(), SLOT(show()));
connect(DataView, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)), this, SLOT(contextMenu(QListViewItem*, const QPoint&, int)));
+
+ KstDataObject::pluginList();
}
--- branches/work/kst/pluginify/kst/src/libkstmath/kstdataobject.cpp #581225:581226
@@ -28,6 +28,14 @@
#include <assert.h>
+#include <kdebug.h>
+
+#include <klibloader.h>
+#include <klocale.h>
+#include <kservicetype.h>
+#include <kstdataobject.h>
+#include <kparts/componentfactory.h>
+
#include "ksdebug.h"
#include <klocale.h>
@@ -82,6 +90,37 @@
delete _curveHints;
}
+static QStringList pluginInfo;
+
+// Scans for plugins and stores the information for them
+static void scanPlugins() {
+
+ KstDebug::self()->log(i18n("Scanning for data-object plugins."));
+
+ 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 ) {
+ pluginInfo.append( object->name() );
+ }
+ else
+ kdDebug() << "FAILURE! " << k_funcinfo << " " << err << endl;
+
+ }
+}
+
+QStringList KstDataObject::pluginList() {
+ if (pluginInfo.isEmpty()) {
+ scanPlugins();
+ }
+ kdDebug() << pluginInfo << endl;
+ return pluginInfo;
+}
+
double *KstDataObject::vectorRealloced(KstVectorPtr v, double *memptr, int newSize) const {
if (!v) {
return 0L;
--- branches/work/kst/pluginify/kst/src/libkstmath/kstdataobject.h #581225:581226
@@ -37,6 +37,10 @@
KstDataObject(const KstDataObject& object);
virtual ~KstDataObject();
+ // These static methods are not for plugins to use
+ /** Returns a list of object plugins found on the system. */
+ static QStringList pluginList();
+
virtual QString name() const { return QString::null; }
virtual QString xmlFile() const { return QString::null; }
--- branches/work/kst/pluginify/kst/src/libkstmath/plugincollection.cpp #581225:581226
@@ -25,7 +25,6 @@
#include <klocale.h>
#include <kstandarddirs.h>
-
#include <kdebug.h>
#include <klibloader.h>
@@ -211,7 +210,7 @@
QMap<QString,QString> backup = _installedPluginNames;
_installedPlugins.clear();
_installedPluginNames.clear();
- bool changed = scanDataObjectPlugins();
+ bool changed = /*scanDataObjectPlugins()*/ false;
QStringList dirs = KGlobal::dirs()->resourceDirs("kstplugins");
dirs += KGlobal::dirs()->resourceDirs("kstpluginlib");
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.h #581225:581226
@@ -41,9 +41,10 @@
{
return 0;
}
+
+protected slots:
virtual void _showDialog()
{
- //return 0;
}
private:
More information about the Kst
mailing list