diff --git a/runner.cpp b/runner.cpp index 8379c6de5..400c05e58 100644 --- a/runner.cpp +++ b/runner.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "runner.h" @@ -94,4 +95,22 @@ void Runner::runExactMatch() exec( d->term ); } +Runner::List Runner::loadRunners( QWidget* parent ) +{ + List runners; + KService::List offers = KServiceTypeTrader::self()->query( "KRunner/Runner" ); + foreach ( KService::Ptr service, offers ) { + Runner* runner = KService::createInstance( service, parent ); + if ( runner ) { + kDebug() << "loaded runner : " << service->name() << endl ; + runners.append( runner ); + } + else { + kDebug() << "failed to load runner : " << service->name() << endl ; + } + } + + return runners; +} + #include "runner.moc" diff --git a/runner.h b/runner.h index caf595046..9719a7b17 100644 --- a/runner.h +++ b/runner.h @@ -60,6 +60,11 @@ class KDE_EXPORT Runner : public QObject KActionCollection* matches( const QString& term, int max, int offset ); + /** + * Static method is called to load and get a list available of Runners. + */ + static List loadRunners( QWidget* parent ); + signals: /** * When emitted, the interface will update itself to show the new