Move Runner plugins code out of Interface::loadPlugins and into Runner
as indicated in Tasks. A simple static function does the job IMHO, but if we want something like a RunnerLoader/Trader class (which can also load a specified single runner?) I can work on that. One more question in mind :). Should we make all runners loadable in runtime? svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=638445
This commit is contained in:
parent
585852a0de
commit
248e733a1f
19
runner.cpp
19
runner.cpp
@ -18,6 +18,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <KActionCollection>
|
||||
#include <KServiceTypeTrader>
|
||||
|
||||
#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<Runner>( 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"
|
||||
|
5
runner.h
5
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
|
||||
|
Loading…
Reference in New Issue
Block a user