summaryrefslogtreecommitdiff
path: root/libopie2/examples/opiecore/oplugins/oplugins.cpp
blob: 4aa2da5d2ba0e99248d133d3893db5c47ef4fb10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
    */
}