summaryrefslogtreecommitdiff
path: root/libopie2/examples
authorzecke <zecke>2004-05-11 21:58:26 (UTC)
committer zecke <zecke>2004-05-11 21:58:26 (UTC)
commit81104f00cb87962333a024d3fa5ff6cf3d8d7d83 (patch) (side-by-side diff)
treea2cf80b7c2a340e7e24692ced55155e2e907cf77 /libopie2/examples
parente58a9f83f1bd385aad687daa166077602e921494 (diff)
downloadopie-81104f00cb87962333a024d3fa5ff6cf3d8d7d83.zip
opie-81104f00cb87962333a024d3fa5ff6cf3d8d7d83.tar.gz
opie-81104f00cb87962333a024d3fa5ff6cf3d8d7d83.tar.bz2
-Woot The OpluginLoader successfully loaded and unloaded the Today Plugins
-Now when GUI and manager is done I'll see if sorting and disabling also works No leak, no memcorruption when running the test case
Diffstat (limited to 'libopie2/examples') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opiecore/oplugins/oplugins.cpp37
-rw-r--r--libopie2/examples/opiecore/oplugins/oplugins.pro11
2 files changed, 48 insertions, 0 deletions
diff --git a/libopie2/examples/opiecore/oplugins/oplugins.cpp b/libopie2/examples/opiecore/oplugins/oplugins.cpp
new file mode 100644
index 0000000..4aa2da5
--- a/dev/null
+++ b/libopie2/examples/opiecore/oplugins/oplugins.cpp
@@ -0,0 +1,37 @@
+/*
+ * You may copy, modify and or distribute without any limitation
+ */
+#include <opie2/odebug.h>
+#include <opie2/opluginloader.h>
+
+#include <opie2/todayplugininterface.h>
+
+using Opie::Core::OPluginItem;
+using Opie::Core::OGenericPluginLoader;
+
+void debugLst( const OPluginItem::List& lst ) {
+ for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
+ odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl;
+}
+
+
+int main( void ) {
+ OGenericPluginLoader loader( "today", true );
+ loader.setAutoDelete( true );
+
+ odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl;
+
+ OPluginItem::List lst = loader.allAvailable( true );
+ debugLst( lst );
+
+ lst = loader.filtered( true );
+ debugLst( lst );
+
+ for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
+ QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface );
+ }
+
+ /*
+ * now it's autodelete so cleaned up for us
+ */
+}
diff --git a/libopie2/examples/opiecore/oplugins/oplugins.pro b/libopie2/examples/opiecore/oplugins/oplugins.pro
new file mode 100644
index 0000000..7286de9
--- a/dev/null
+++ b/libopie2/examples/opiecore/oplugins/oplugins.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+CONFIG += qt warn_on
+
+SOURCES = oplugins.cpp
+
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDSPATH += $(OPIEDIR)/include
+
+LIBS += -lopiecore2
+
+include ( $(OPIEDIR)/include.pro )