diff --git a/CMakeLists.txt b/CMakeLists.txt index 34ea01709..1e8f22e95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(plasma_LIB_SRCS plasma.cpp applet.cpp interface.cpp - runner.cpp + abstractrunner.cpp svg.cpp theme.cpp dataengine.cpp @@ -33,7 +33,7 @@ install(TARGETS plasma DESTINATION ${LIB_INSTALL_DIR} ) install( FILES applet.h plasma.h - runner.h + abstractrunner.h theme.h interface.h dataengine.h @@ -45,3 +45,13 @@ install( FILES widgets/checkbox.h DESTINATION ${INCLUDE_INSTALL_DIR}/plasma ) +install( FILES + includes/Applet + includes/Plasma + includes/AbstractRunner + includes/Theme + includes/Interface + includes/DataEngine + includes/Svg + DESTINATION ${INCLUDE_INSTALL_DIR}/Plasma ) + diff --git a/runner.cpp b/abstractrunner.cpp similarity index 76% rename from runner.cpp rename to abstractrunner.cpp index a77fa719e..928d16858 100644 --- a/runner.cpp +++ b/abstractrunner.cpp @@ -20,15 +20,15 @@ #include #include -#include "runner.h" +#include "abstractrunner.h" namespace Plasma { -class Runner::Private +class AbstractRunner::Private { public: - Private( Runner* runner ) : + Private( AbstractRunner* runner ) : exactMatch( 0 ), actions( new KActionCollection( runner ) ) { @@ -40,33 +40,33 @@ class Runner::Private QString term; }; -Runner::Runner( QObject* parent ) +AbstractRunner::AbstractRunner( QObject* parent ) : QObject( parent ) { d = new Private( this ); } -Runner::~Runner() +AbstractRunner::~AbstractRunner() { delete d; } -bool Runner::hasOptions() +bool AbstractRunner::hasOptions() { return false; } -QWidget* Runner::options() +QWidget* AbstractRunner::options() { return 0; } -QAction* Runner::exactMatch( ) +QAction* AbstractRunner::exactMatch( ) { return d->exactMatch; } -QAction* Runner::exactMatch( const QString& term ) +QAction* AbstractRunner::exactMatch( const QString& term ) { delete d->exactMatch; d->term.clear(); @@ -81,14 +81,14 @@ QAction* Runner::exactMatch( const QString& term ) return d->exactMatch; } -KActionCollection* Runner::matches( const QString& term, int max, int offset ) +KActionCollection* AbstractRunner::matches( const QString& term, int max, int offset ) { d->actions->clear(); fillMatches( d->actions, term, max, offset ); return d->actions; } -void Runner::fillMatches( KActionCollection* matches, +void AbstractRunner::fillMatches( KActionCollection* matches, const QString& term, int max, int offset ) { @@ -98,17 +98,17 @@ void Runner::fillMatches( KActionCollection* matches, Q_UNUSED( offset ); } -void Runner::runExactMatch() +void AbstractRunner::runExactMatch() { exec( d->term ); } -Runner::List Runner::loadRunners( QWidget* parent ) +AbstractRunner::List AbstractRunner::loadRunners( QWidget* parent ) { List runners; KService::List offers = KServiceTypeTrader::self()->query( "KRunner/Runner" ); foreach ( KService::Ptr service, offers ) { - Runner* runner = KService::createInstance( service, parent ); + AbstractRunner* runner = KService::createInstance( service, parent ); if ( runner ) { kDebug() << "loaded runner : " << service->name() << endl ; runners.append( runner ); @@ -123,4 +123,4 @@ Runner::List Runner::loadRunners( QWidget* parent ) } // Plasma namespace -#include "runner.moc" +#include "abstractrunner.moc" diff --git a/runner.h b/abstractrunner.h similarity index 84% rename from runner.h rename to abstractrunner.h index dc12bf2fa..603d93e10 100644 --- a/runner.h +++ b/abstractrunner.h @@ -25,19 +25,25 @@ #include class KActionCollection; +class QAction; namespace Plasma { -class KDE_EXPORT Runner : public QObject +class KDE_EXPORT AbstractRunner : public QObject { Q_OBJECT public: - typedef QList List; + typedef QList List; - explicit Runner( QObject* parent = 0 ); - virtual ~Runner(); + /** + * Constrcuts an Runner object. Since AbstractRunner has pure virtuals, + * this constructor can not be called directly. Rather a subclass must + * be created + */ + explicit AbstractRunner( QObject* parent = 0 ); + virtual ~AbstractRunner(); /** * If the runner can run precisely this term, return a QAction, else @@ -55,6 +61,18 @@ class KDE_EXPORT Runner : public QObject */ QAction* exactMatch( ); + /** + * Requests the runner to find possible matches for the search term. + * Includes basic results paging controls via max and offset. + * + * @param term the search string to use + * @param max maximum number of matches to return + * @param offset the offset into the matched set to start at + * + * @return the collection of actions representing the potential matches + **/ + KActionCollection* matches( const QString& term, int max, int offset ); + /** * If the runner has options that the user can interact with to modify * what happens when exec or one of the actions created in fillMatches @@ -68,8 +86,6 @@ class KDE_EXPORT Runner : public QObject */ virtual QWidget* options( ); - KActionCollection* matches( const QString& term, int max, int offset ); - /** * Static method is called to load and get a list available of Runners. */ diff --git a/includes/AbstractRunner b/includes/AbstractRunner new file mode 100644 index 000000000..1ea8dca59 --- /dev/null +++ b/includes/AbstractRunner @@ -0,0 +1 @@ +#include "../plasma/abstractrunner.h" diff --git a/includes/Applet b/includes/Applet new file mode 100644 index 000000000..3abfc48a8 --- /dev/null +++ b/includes/Applet @@ -0,0 +1,2 @@ +#include "../plasma/applet.h" + diff --git a/includes/DataEngine b/includes/DataEngine new file mode 100644 index 000000000..6cc6993fe --- /dev/null +++ b/includes/DataEngine @@ -0,0 +1 @@ +#include "../plasma/dataengine.h" diff --git a/includes/Interface b/includes/Interface new file mode 100644 index 000000000..6d9d983ec --- /dev/null +++ b/includes/Interface @@ -0,0 +1,2 @@ +#include "../plasma/interface.h" + diff --git a/includes/Plasma b/includes/Plasma new file mode 100644 index 000000000..aef0d79a7 --- /dev/null +++ b/includes/Plasma @@ -0,0 +1 @@ +#include "../plasma/plasma.h" diff --git a/includes/Svg b/includes/Svg new file mode 100644 index 000000000..32d60c935 --- /dev/null +++ b/includes/Svg @@ -0,0 +1 @@ +#include "../plasma/svg.h" diff --git a/includes/Theme b/includes/Theme new file mode 100644 index 000000000..1ac14ea94 --- /dev/null +++ b/includes/Theme @@ -0,0 +1 @@ +#include "../plasma/theme.h"