-rw-r--r-- | libopie2/examples/opiecore/oplugins/oplugins.cpp | 37 | ||||
-rw-r--r-- | libopie2/examples/opiecore/oplugins/oplugins.pro | 11 |
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 @@ | |||
1 | /* | ||
2 | * You may copy, modify and or distribute without any limitation | ||
3 | */ | ||
4 | #include <opie2/odebug.h> | ||
5 | #include <opie2/opluginloader.h> | ||
6 | |||
7 | #include <opie2/todayplugininterface.h> | ||
8 | |||
9 | using Opie::Core::OPluginItem; | ||
10 | using Opie::Core::OGenericPluginLoader; | ||
11 | |||
12 | void debugLst( const OPluginItem::List& lst ) { | ||
13 | for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) | ||
14 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; | ||
15 | } | ||
16 | |||
17 | |||
18 | int main( void ) { | ||
19 | OGenericPluginLoader loader( "today", true ); | ||
20 | loader.setAutoDelete( true ); | ||
21 | |||
22 | odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl; | ||
23 | |||
24 | OPluginItem::List lst = loader.allAvailable( true ); | ||
25 | debugLst( lst ); | ||
26 | |||
27 | lst = loader.filtered( true ); | ||
28 | debugLst( lst ); | ||
29 | |||
30 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | ||
31 | QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface ); | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * now it's autodelete so cleaned up for us | ||
36 | */ | ||
37 | } | ||
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 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG += qt warn_on | ||
3 | |||
4 | SOURCES = oplugins.cpp | ||
5 | |||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | DEPENDSPATH += $(OPIEDIR)/include | ||
8 | |||
9 | LIBS += -lopiecore2 | ||
10 | |||
11 | include ( $(OPIEDIR)/include.pro ) | ||