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

View File

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

View File

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

View File

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

View File

@ -50,6 +50,11 @@ class KDE_EXPORT Runner : public QObject
*/
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
* 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;
}
QString Theme::imagePath( const QString& name ) const
QString Theme::image( const QString& name ) const
{
return KStandardDirs::locate( "data", "desktoptheme/" +
d->themeName +

View File

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