let's use KPluginInfo

some api refinements

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=639363
This commit is contained in:
Aaron J. Seigo 2007-03-05 00:07:21 +00:00
parent c360489500
commit 454c29f187
7 changed files with 29 additions and 15 deletions

View File

@ -22,7 +22,9 @@
#include <QStringList> #include <QStringList>
#include <QTimer> #include <QTimer>
#include <KPluginInfo>
#include <KStandardDirs> #include <KStandardDirs>
#include <KService>
#include "applet.h" #include "applet.h"
#include "interface.h" #include "interface.h"
@ -34,10 +36,10 @@ class Applet::Private
{ {
public: public:
Private( KService::Ptr appletDescription, int uniqueID ) Private( KService::Ptr appletDescription, int uniqueID )
: id( uniqueID ), : appletId( uniqueID ),
globalConfig( 0 ), globalConfig( 0 ),
appletConfig( 0 ), appletConfig( 0 ),
appletDescription(appletDescription) appletDescription( new KPluginInfo( appletDescription ) )
{ } { }
~Private() ~Private()
@ -45,23 +47,25 @@ class Applet::Private
foreach ( const QString& engine, loadedEngines ) { foreach ( const QString& engine, loadedEngines ) {
Interface::self()->unloadDataEngine( engine ); Interface::self()->unloadDataEngine( engine );
} }
delete appletDescription;
} }
int id; int appletId;
KSharedConfig::Ptr globalConfig; KSharedConfig::Ptr globalConfig;
KSharedConfig::Ptr appletConfig; KSharedConfig::Ptr appletConfig;
KService::Ptr appletDescription; KPluginInfo* appletDescription;
QList<QObject*> watchedForFocus; QList<QObject*> watchedForFocus;
QStringList loadedEngines; QStringList loadedEngines;
}; };
Applet::Applet( QGraphicsItem *parent, Applet::Applet( QGraphicsItem *parent,
KService::Ptr appletDescription, QString serviceID,
int id ) int appletId )
: QWidget( 0 ), : QWidget( 0 ),
QGraphicsItemGroup( parent ), QGraphicsItemGroup( parent )
d( new Private( appletDescription, id ) )
{ {
KService::Ptr service = KService::serviceByStorageId( serviceID );
d = new Private( service, appletId );
} }
Applet::~Applet() Applet::~Applet()
@ -112,12 +116,12 @@ void Applet::constraintsUpdated()
QString Applet::globalName() const QString Applet::globalName() const
{ {
return d->appletDescription->library(); return d->appletDescription->service()->library();
} }
QString Applet::instanceName() const QString Applet::instanceName() const
{ {
return d->appletDescription->library() + QString::number( d->id ); return d->appletDescription->service()->library() + QString::number( d->appletId );
} }
void Applet::watchForFocus(QObject *widget, bool watch) void Applet::watchForFocus(QObject *widget, bool watch)

View File

@ -23,7 +23,6 @@
#include <QWidget> #include <QWidget>
#include <ksharedconfig.h> #include <ksharedconfig.h>
#include <kservice.h>
#include "plasma.h" #include "plasma.h"
@ -38,8 +37,8 @@ class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
typedef QList<Applet*> List; typedef QList<Applet*> List;
Applet( QGraphicsItem* parent, Applet( QGraphicsItem* parent,
KService::Ptr appletDescription, QString serviceId,
int id ); int appletId );
~Applet(); ~Applet();
/** /**

View File

@ -39,6 +39,7 @@ class KDE_EXPORT DataSource : public QObject
public: public:
typedef QHash<QString, DataSource*> Dict; typedef QHash<QString, DataSource*> Dict;
typedef QHash<QString, QVariant> Data; typedef QHash<QString, QVariant> Data;
typedef QHash<QString, Dict> Grouping;
explicit DataSource(QObject* parent = 0); explicit DataSource(QObject* parent = 0);
virtual ~DataSource(); virtual ~DataSource();

View File

@ -61,6 +61,11 @@ QWidget* Runner::options()
return 0; return 0;
} }
QAction* Runner::exactMatch( )
{
return d->exactMatch;
}
QAction* Runner::exactMatch( const QString& term ) QAction* Runner::exactMatch( const QString& term )
{ {
delete d->exactMatch; delete d->exactMatch;

View File

@ -50,6 +50,11 @@ class KDE_EXPORT Runner : public QObject
*/ */
QAction* exactMatch( const QString& command ); QAction* exactMatch( const QString& command );
/**
* @return the last action generated by exactMatch( const QString& )
*/
QAction* exactMatch( );
/** /**
* If the runner has options that the user can interact with to modify * 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 * what happens when exec or one of the actions created in fillMatches

View File

@ -54,7 +54,7 @@ QString Theme::themeName() const
return d->themeName; return d->themeName;
} }
QString Theme::imagePath( const QString& name ) const QString Theme::image( const QString& name ) const
{ {
return KStandardDirs::locate( "data", "desktoptheme/" + return KStandardDirs::locate( "data", "desktoptheme/" +
d->themeName + d->themeName +

View File

@ -35,7 +35,7 @@ class KDE_EXPORT Theme : public QObject
~Theme(); ~Theme();
QString themeName() const; QString themeName() const;
QString imagePath( const QString& name ) const; QString image( const QString& name ) const;
signals: signals:
void changed(); void changed();