make DataEngineConsumer public API
this will become the prefered way to access DataEngines rather than DataEngineManager which exposes implementation details that need to be manually managed
This commit is contained in:
parent
35590c27eb
commit
97a13a9dbe
@ -108,6 +108,7 @@ set(plasma_LIB_SRCS
|
|||||||
coronabase.cpp
|
coronabase.cpp
|
||||||
datacontainer.cpp
|
datacontainer.cpp
|
||||||
dataengine.cpp
|
dataengine.cpp
|
||||||
|
dataengineconsumer.cpp
|
||||||
dataenginemanager.cpp
|
dataenginemanager.cpp
|
||||||
package.cpp
|
package.cpp
|
||||||
packagestructure.cpp
|
packagestructure.cpp
|
||||||
@ -120,7 +121,6 @@ set(plasma_LIB_SRCS
|
|||||||
private/associatedapplicationmanager.cpp
|
private/associatedapplicationmanager.cpp
|
||||||
private/componentinstaller.cpp
|
private/componentinstaller.cpp
|
||||||
private/datacontainer_p.cpp
|
private/datacontainer_p.cpp
|
||||||
private/dataengineconsumer.cpp
|
|
||||||
private/dataengineservice.cpp
|
private/dataengineservice.cpp
|
||||||
private/effects/halopainter.cpp
|
private/effects/halopainter.cpp
|
||||||
private/effectwatcher.cpp
|
private/effectwatcher.cpp
|
||||||
|
@ -395,11 +395,7 @@ ConfigLoader *Applet::configScheme() const
|
|||||||
|
|
||||||
DataEngine *Applet::dataEngine(const QString &name) const
|
DataEngine *Applet::dataEngine(const QString &name) const
|
||||||
{
|
{
|
||||||
if (d->remoteLocation.isEmpty()) {
|
return d->dataEngine(name, d->remoteLocation);
|
||||||
return d->dataEngine(name);
|
|
||||||
} else {
|
|
||||||
return d->remoteDataEngine(d->remoteLocation, name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Package Applet::package() const
|
Package Applet::package() const
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "containmentactions.h"
|
#include "containmentactions.h"
|
||||||
#include "containment.h"
|
#include "containment.h"
|
||||||
|
|
||||||
#include "private/dataengineconsumer_p.h"
|
|
||||||
#include "private/packages_p.h"
|
#include "private/packages_p.h"
|
||||||
#include "private/containmentactions_p.h"
|
#include "private/containmentactions_p.h"
|
||||||
#include "private/containment_p.h"
|
#include "private/containment_p.h"
|
||||||
@ -36,8 +35,8 @@
|
|||||||
#include <klocalizedstring.h>
|
#include <klocalizedstring.h>
|
||||||
#include <kservicetypetrader.h>
|
#include <kservicetypetrader.h>
|
||||||
|
|
||||||
|
#include "dataengineconsumer.h"
|
||||||
#include <version.h>
|
#include "version.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kplugininfo.h>
|
#include <kplugininfo.h>
|
||||||
#include <kservice.h>
|
#include <kservice.h>
|
||||||
|
#include <kservicetypetrader.h>
|
||||||
#include <kstandarddirs.h>
|
#include <kstandarddirs.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
|
||||||
@ -709,6 +710,48 @@ void DataEnginePrivate::setupScriptSupport()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList DataEngine::listAllEngines(const QString &parentApp)
|
||||||
|
{
|
||||||
|
QString constraint;
|
||||||
|
|
||||||
|
if (parentApp.isEmpty()) {
|
||||||
|
constraint.append("(not exist [X-KDE-ParentApp] or [X-KDE-ParentApp] == '')");
|
||||||
|
} else {
|
||||||
|
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
|
||||||
|
}
|
||||||
|
|
||||||
|
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", constraint);
|
||||||
|
|
||||||
|
QStringList engines;
|
||||||
|
foreach (const KService::Ptr &service, offers) {
|
||||||
|
QString name = service->property("X-KDE-PluginInfo-Name").toString();
|
||||||
|
if (!name.isEmpty()) {
|
||||||
|
engines.append(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return engines;
|
||||||
|
}
|
||||||
|
|
||||||
|
KPluginInfo::List DataEngine::listEngineInfo(const QString &parentApp)
|
||||||
|
{
|
||||||
|
return PluginLoader::self()->listDataEngineInfo(parentApp);
|
||||||
|
}
|
||||||
|
|
||||||
|
KPluginInfo::List DataEngine::listEngineInfoByCategory(const QString &category, const QString &parentApp)
|
||||||
|
{
|
||||||
|
QString constraint = QString("[X-KDE-PluginInfo-Category] == '%1'").arg(category);
|
||||||
|
|
||||||
|
if (parentApp.isEmpty()) {
|
||||||
|
constraint.append(" and not exist [X-KDE-ParentApp]");
|
||||||
|
} else {
|
||||||
|
constraint.append(" and [X-KDE-ParentApp] == '").append(parentApp).append("'");
|
||||||
|
}
|
||||||
|
|
||||||
|
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", constraint);
|
||||||
|
return KPluginInfo::fromServices(offers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
42
dataengine.h
42
dataengine.h
@ -24,6 +24,7 @@
|
|||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
|
#include <kplugininfo.h>
|
||||||
#include <kservice.h>
|
#include <kservice.h>
|
||||||
|
|
||||||
#include <plasma/version.h>
|
#include <plasma/version.h>
|
||||||
@ -245,6 +246,47 @@ NoAlignment) const;
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE Service* createDefaultService(QObject *parent = 0);
|
Q_INVOKABLE Service* createDefaultService(QObject *parent = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a listing of all known DataEngines by name
|
||||||
|
*
|
||||||
|
* @param parentApp the application to filter applets on. Uses the
|
||||||
|
* X-KDE-ParentApp entry (if any) in the plugin info.
|
||||||
|
* The default value of QString() will result in a
|
||||||
|
* list containing only applets not specifically
|
||||||
|
* registered to an application.
|
||||||
|
*/
|
||||||
|
static QStringList listAllEngines(const QString &parentApp = QString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all known DataEngines.
|
||||||
|
*
|
||||||
|
* @param parentApp the application to filter applets on. Uses the
|
||||||
|
* X-KDE-ParentApp entry (if any) in the plugin info.
|
||||||
|
* The default value of QString() will result in a
|
||||||
|
* list containing only applets not specifically
|
||||||
|
* registered to an application.
|
||||||
|
* @return list of DataEngines
|
||||||
|
**/
|
||||||
|
static KPluginInfo::List listEngineInfo(const QString &parentApp = QString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all known DataEngines filtering by category.
|
||||||
|
*
|
||||||
|
* @param category the category to filter applets on. Uses the
|
||||||
|
* X-KDE-PluginInfo-Category entry (if any) in the
|
||||||
|
* plugin info. The value of QString() will
|
||||||
|
* result in a list of engines with an empty category.
|
||||||
|
*
|
||||||
|
* @param parentApp the application to filter applets on. Uses the
|
||||||
|
* X-KDE-ParentApp entry (if any) in the plugin info.
|
||||||
|
* The default value of QString() will result in a
|
||||||
|
* list containing only applets not specifically
|
||||||
|
* registered to an application.
|
||||||
|
* @return list of DataEngines
|
||||||
|
* @since 4.3
|
||||||
|
**/
|
||||||
|
static KPluginInfo::List listEngineInfoByCategory(const QString &category, const QString &parentApp = QString());
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* Emitted when a new data source is created
|
* Emitted when a new data source is created
|
||||||
|
@ -19,30 +19,22 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dataengineconsumer_p.h"
|
#include "dataengineconsumer.h"
|
||||||
|
#include "private/dataengineconsumer_p.h"
|
||||||
|
|
||||||
#include <QtCore/QSet>
|
#include <QSet>
|
||||||
|
#include <qurlpathinfo.h>
|
||||||
|
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include "plasma/dataenginemanager.h"
|
#include "dataenginemanager.h"
|
||||||
#include "plasma/private/remotedataengine_p.h"
|
#include "private/remotedataengine_p.h"
|
||||||
#include <servicejob.h>
|
#include "servicejob.h"
|
||||||
#include <qurlpathinfo.h>
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
ServiceMonitor::ServiceMonitor(DataEngineConsumer *consumer)
|
void DataEngineConsumerPrivate::slotJobFinished(Plasma::ServiceJob *job)
|
||||||
: m_consumer(consumer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ServiceMonitor::~ServiceMonitor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job)
|
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "engine ready!";
|
kDebug() << "engine ready!";
|
||||||
@ -53,7 +45,7 @@ void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job)
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "pair = " << pair;
|
kDebug() << "pair = " << pair;
|
||||||
#endif
|
#endif
|
||||||
if (!m_consumer->m_remoteEngines.contains(pair)) {
|
if (!remoteEngines.contains(pair)) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "engine does not exist yet!";
|
kDebug() << "engine does not exist yet!";
|
||||||
#endif
|
#endif
|
||||||
@ -63,25 +55,25 @@ void ServiceMonitor::slotJobFinished(Plasma::ServiceJob *job)
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "setting location : " << engineLocation.url();
|
kDebug() << "setting location : " << engineLocation.url();
|
||||||
#endif
|
#endif
|
||||||
m_consumer->m_remoteEngines[pair]->setLocation(engineLocation.url());
|
remoteEngines[pair]->setLocation(engineLocation.url());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceMonitor::slotServiceReady(Plasma::Service *plasmoidService)
|
void DataEngineConsumerPrivate::slotServiceReady(Plasma::Service *plasmoidService)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "service ready!";
|
kDebug() << "service ready!";
|
||||||
#endif
|
#endif
|
||||||
if (!m_consumer->m_engineNameForService.contains(plasmoidService)) {
|
if (!engineNameForService.contains(plasmoidService)) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "no engine name for service!";
|
kDebug() << "no engine name for service!";
|
||||||
#endif
|
#endif
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "amount of services in map: " << m_consumer->m_engineNameForService.count();
|
kDebug() << "amount of services in map: " << engineNameForService.count();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "value = " << m_consumer->m_engineNameForService.value(plasmoidService);
|
kDebug() << "value = " << engineNameForService.value(plasmoidService);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,77 +81,81 @@ void ServiceMonitor::slotServiceReady(Plasma::Service *plasmoidService)
|
|||||||
kDebug() << "requesting dataengine!";
|
kDebug() << "requesting dataengine!";
|
||||||
#endif
|
#endif
|
||||||
KConfigGroup op = plasmoidService->operationDescription("DataEngine");
|
KConfigGroup op = plasmoidService->operationDescription("DataEngine");
|
||||||
op.writeEntry("EngineName", m_consumer->m_engineNameForService.value(plasmoidService));
|
op.writeEntry("EngineName", engineNameForService.value(plasmoidService));
|
||||||
plasmoidService->startOperationCall(op);
|
plasmoidService->startOperationCall(op);
|
||||||
connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)),
|
connect(plasmoidService, SIGNAL(finished(Plasma::ServiceJob*)),
|
||||||
this, SLOT(slotJobFinished(Plasma::ServiceJob*)));
|
this, SLOT(slotJobFinished(Plasma::ServiceJob*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
DataEngineConsumer::DataEngineConsumer()
|
DataEngine *DataEngineConsumerPrivate::remoteDataEngine(const QString &name, const QUrl &location)
|
||||||
: m_monitor(new ServiceMonitor(this))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DataEngineConsumer::~DataEngineConsumer()
|
|
||||||
{
|
|
||||||
foreach (const QString &engine, m_loadedEngines) {
|
|
||||||
DataEngineManager::self()->unloadEngine(engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete m_monitor;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataEngine *DataEngineConsumer::dataEngine(const QString &name)
|
|
||||||
{
|
|
||||||
if (m_loadedEngines.contains(name)) {
|
|
||||||
DataEngine *engine = DataEngineManager::self()->engine(name);
|
|
||||||
if (engine->isValid()) {
|
|
||||||
return engine;
|
|
||||||
} else {
|
|
||||||
m_loadedEngines.remove(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DataEngine *engine = DataEngineManager::self()->loadEngine(name);
|
|
||||||
if (engine->isValid()) {
|
|
||||||
m_loadedEngines.insert(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return engine;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataEngine *DataEngineConsumer::remoteDataEngine(const QUrl &location, const QString &name)
|
|
||||||
{
|
{
|
||||||
QPair<QString, QString> pair(location.toString(), name);
|
QPair<QString, QString> pair(location.toString(), name);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "pair = " << pair;
|
kDebug() << "pair = " << pair;
|
||||||
#endif
|
#endif
|
||||||
if (m_remoteEngines.contains(pair)) {
|
if (remoteEngines.contains(pair)) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "existing remote dataengine at " << location;
|
kDebug() << "existing remote dataengine at " << location;
|
||||||
#endif
|
#endif
|
||||||
return m_remoteEngines[pair];
|
return remoteEngines[pair];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "new remote dataengine at " << location;
|
kDebug() << "new remote dataengine at " << location;
|
||||||
#endif
|
#endif
|
||||||
RemoteDataEngine *engine = new RemoteDataEngine(QUrl());
|
RemoteDataEngine *engine = new RemoteDataEngine(QUrl());
|
||||||
m_remoteEngines[pair] = engine;
|
remoteEngines[pair] = engine;
|
||||||
Service *plasmoidService = Service::access(location);
|
Service *plasmoidService = Service::access(location);
|
||||||
plasmoidService->setDestination(location.toString());
|
plasmoidService->setDestination(location.toString());
|
||||||
m_engineNameForService[plasmoidService] = name;
|
engineNameForService[plasmoidService] = name;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kDebug() << "name = " << name;
|
kDebug() << "name = " << name;
|
||||||
#endif
|
#endif
|
||||||
QObject::connect(plasmoidService, SIGNAL(serviceReady(Plasma::Service*)),
|
|
||||||
m_monitor, SLOT(slotServiceReady(Plasma::Service*)));
|
connect(plasmoidService, SIGNAL(serviceReady(Plasma::Service*)),
|
||||||
|
this, SLOT(slotServiceReady(Plasma::Service*)));
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataEngineConsumer::DataEngineConsumer()
|
||||||
|
: d(new DataEngineConsumerPrivate)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
DataEngineConsumer::~DataEngineConsumer()
|
||||||
|
{
|
||||||
|
foreach (const QString &engine, d->loadedEngines) {
|
||||||
|
DataEngineManager::self()->unloadEngine(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataEngine *DataEngineConsumer::dataEngine(const QString &name, const QUrl &location)
|
||||||
|
{
|
||||||
|
if (!location.isEmpty()) {
|
||||||
|
return d->remoteDataEngine(name, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->loadedEngines.contains(name)) {
|
||||||
|
DataEngine *engine = DataEngineManager::self()->engine(name);
|
||||||
|
if (engine->isValid()) {
|
||||||
|
return engine;
|
||||||
|
} else {
|
||||||
|
d->loadedEngines.remove(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DataEngine *engine = DataEngineManager::self()->loadEngine(name);
|
||||||
|
if (engine->isValid()) {
|
||||||
|
d->loadedEngines.insert(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return engine;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#include "moc_dataengineconsumer_p.cpp"
|
#include "private/moc_dataengineconsumer_p.cpp"
|
||||||
|
|
||||||
|
|
@ -158,48 +158,6 @@ void DataEngineManager::unloadEngine(const QString &name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DataEngineManager::listAllEngines(const QString &parentApp)
|
|
||||||
{
|
|
||||||
QString constraint;
|
|
||||||
|
|
||||||
if (parentApp.isEmpty()) {
|
|
||||||
constraint.append("(not exist [X-KDE-ParentApp] or [X-KDE-ParentApp] == '')");
|
|
||||||
} else {
|
|
||||||
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
|
|
||||||
}
|
|
||||||
|
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", constraint);
|
|
||||||
|
|
||||||
QStringList engines;
|
|
||||||
foreach (const KService::Ptr &service, offers) {
|
|
||||||
QString name = service->property("X-KDE-PluginInfo-Name").toString();
|
|
||||||
if (!name.isEmpty()) {
|
|
||||||
engines.append(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return engines;
|
|
||||||
}
|
|
||||||
|
|
||||||
KPluginInfo::List DataEngineManager::listEngineInfo(const QString &parentApp)
|
|
||||||
{
|
|
||||||
return PluginLoader::self()->listDataEngineInfo(parentApp);
|
|
||||||
}
|
|
||||||
|
|
||||||
KPluginInfo::List DataEngineManager::listEngineInfoByCategory(const QString &category, const QString &parentApp)
|
|
||||||
{
|
|
||||||
QString constraint = QString("[X-KDE-PluginInfo-Category] == '%1'").arg(category);
|
|
||||||
|
|
||||||
if (parentApp.isEmpty()) {
|
|
||||||
constraint.append(" and not exist [X-KDE-ParentApp]");
|
|
||||||
} else {
|
|
||||||
constraint.append(" and [X-KDE-ParentApp] == '").append(parentApp).append("'");
|
|
||||||
}
|
|
||||||
|
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/DataEngine", constraint);
|
|
||||||
return KPluginInfo::fromServices(offers);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataEngineManager::timerEvent(QTimerEvent *)
|
void DataEngineManager::timerEvent(QTimerEvent *)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -74,46 +74,6 @@ class PLASMA_EXPORT DataEngineManager: public QObject
|
|||||||
*/
|
*/
|
||||||
void unloadEngine(const QString &name);
|
void unloadEngine(const QString &name);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a listing of all known DataEngines by name
|
|
||||||
*
|
|
||||||
* @param parentApp the application to filter applets on. Uses the
|
|
||||||
* X-KDE-ParentApp entry (if any) in the plugin info.
|
|
||||||
* The default value of QString() will result in a
|
|
||||||
* list containing only applets not specifically
|
|
||||||
* registered to an application.
|
|
||||||
*/
|
|
||||||
static QStringList listAllEngines(const QString &parentApp = QString());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of all known DataEngines.
|
|
||||||
*
|
|
||||||
* @param parentApp the application to filter applets on. Uses the
|
|
||||||
* X-KDE-ParentApp entry (if any) in the plugin info.
|
|
||||||
* The default value of QString() will result in a
|
|
||||||
* list containing only applets not specifically
|
|
||||||
* registered to an application.
|
|
||||||
* @return list of DataEngines
|
|
||||||
**/
|
|
||||||
static KPluginInfo::List listEngineInfo(const QString &parentApp = QString());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of all known DataEngines filtering by category.
|
|
||||||
*
|
|
||||||
* @param category the category to filter applets on. Uses the
|
|
||||||
* X-KDE-PluginInfo-Category entry (if any) in the
|
|
||||||
* plugin info. The value of QString() will
|
|
||||||
* result in a list of engines with an empty category.
|
|
||||||
*
|
|
||||||
* @param parentApp the application to filter applets on. Uses the
|
|
||||||
* X-KDE-ParentApp entry (if any) in the plugin info.
|
|
||||||
* The default value of QString() will result in a
|
|
||||||
* list containing only applets not specifically
|
|
||||||
* registered to an application.
|
|
||||||
* @return list of DataEngines
|
|
||||||
* @since 4.3
|
|
||||||
**/
|
|
||||||
static KPluginInfo::List listEngineInfoByCategory(const QString &category, const QString &parentApp = QString());
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "abstractrunner.h"
|
#include "abstractrunner.h"
|
||||||
#include "containment.h"
|
#include "containment.h"
|
||||||
#include "containmentactions.h"
|
#include "containmentactions.h"
|
||||||
|
#include "dataengine.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "popupapplet.h"
|
#include "popupapplet.h"
|
||||||
#include "private/applet_p.h"
|
#include "private/applet_p.h"
|
||||||
|
@ -295,7 +295,7 @@ protected:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A re-implementable method that allows subclasses to provide additional DataEngines
|
* A re-implementable method that allows subclasses to provide additional DataEngines
|
||||||
* for DataEngineManager::listDataEngines.
|
* for DataEngine::listDataEngines.
|
||||||
*
|
*
|
||||||
* @return list of DataEngines info, or an empty list if none
|
* @return list of DataEngines info, or an empty list if none
|
||||||
**/
|
**/
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
|
|
||||||
#include "dataengineconsumer_p.h"
|
#include "dataengineconsumer.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "plasma/animator.h"
|
#include "plasma/animator.h"
|
||||||
#include "plasma/private/applethandle_p.h"
|
#include "plasma/private/applethandle_p.h"
|
||||||
#include "plasma/private/dataengineconsumer_p.h"
|
#include "plasma/dataengineconsumer.h"
|
||||||
#include "plasma/ui_publish.h"
|
#include "plasma/ui_publish.h"
|
||||||
|
|
||||||
class KKeySequenceWidget;
|
class KKeySequenceWidget;
|
||||||
@ -44,6 +44,7 @@ class AppletScript;
|
|||||||
class Wallpaper;
|
class Wallpaper;
|
||||||
class BusyWidget;
|
class BusyWidget;
|
||||||
class PushButton;
|
class PushButton;
|
||||||
|
class Service;
|
||||||
|
|
||||||
class AppletConfigDialog : public KConfigDialog
|
class AppletConfigDialog : public KConfigDialog
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#ifndef PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
#ifndef PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
||||||
#define PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
#define PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
||||||
|
|
||||||
#include "plasma/private/dataengineconsumer_p.h"
|
#include "dataengineconsumer.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
@ -19,56 +19,38 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PLASMA_DATAENGINECONSUMER_H
|
#ifndef PLASMA_DATAENGINECONSUMER_P_H
|
||||||
#define PLASMA_DATAENGINECONSUMER_H
|
#define PLASMA_DATAENGINECONSUMER_P_H
|
||||||
|
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
|
#include <QtCore/QUrl>
|
||||||
#include <kdebug.h>
|
|
||||||
|
|
||||||
#include "plasma/dataenginemanager.h"
|
#include "plasma/dataenginemanager.h"
|
||||||
#include <servicejob.h>
|
#include "servicejob.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
class DataEngineConsumer;
|
class DataEngineConsumer;
|
||||||
class RemoteDataEngine;
|
class RemoteDataEngine;
|
||||||
|
class ServiceMonitor;
|
||||||
|
|
||||||
class ServiceMonitor : public QObject
|
class DataEngineConsumerPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ServiceMonitor(DataEngineConsumer *consumer);
|
QSet<QString> loadedEngines;
|
||||||
~ServiceMonitor();
|
QMap<QPair<QString, QString>, RemoteDataEngine*> remoteEngines;
|
||||||
|
QMap<Service*, QString> engineNameForService;
|
||||||
|
DataEngine *remoteDataEngine(const QString &name, const QUrl &location);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void slotJobFinished(Plasma::ServiceJob *job);
|
void slotJobFinished(Plasma::ServiceJob *job);
|
||||||
void slotServiceReady(Plasma::Service *service);
|
void slotServiceReady(Plasma::Service *service);
|
||||||
|
|
||||||
private:
|
|
||||||
DataEngineConsumer *m_consumer;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DataEngineConsumer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DataEngineConsumer();
|
|
||||||
~DataEngineConsumer();
|
|
||||||
DataEngine *dataEngine(const QString &name);
|
|
||||||
DataEngine *remoteDataEngine(const QUrl &location, const QString &name);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QSet<QString> m_loadedEngines;
|
|
||||||
QMap<QPair<QString, QString>, RemoteDataEngine*> m_remoteEngines;
|
|
||||||
QMap<Service*, QString> m_engineNameForService;
|
|
||||||
ServiceMonitor *m_monitor;
|
|
||||||
|
|
||||||
friend class ServiceMonitor;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
#include "plasmoidservice_p.h"
|
#include "plasmoidservice_p.h"
|
||||||
|
|
||||||
#include "authorizationmanager_p.h"
|
#include "authorizationmanager_p.h"
|
||||||
#include "dataengineconsumer_p.h"
|
#include "dataengineconsumer.h"
|
||||||
#include "dataengine_p.h"
|
|
||||||
|
|
||||||
#include <plasma/applet.h>
|
#include <plasma/applet.h>
|
||||||
|
#include <plasma/dataengine.h>
|
||||||
|
#include <plasma/private/dataengine_p.h>
|
||||||
#include <plasma/remote/authorizationmanager.h>
|
#include <plasma/remote/authorizationmanager.h>
|
||||||
#include <plasma/remote/authorizationrule.h>
|
#include <plasma/remote/authorizationrule.h>
|
||||||
#include <plasma/service.h>
|
#include <plasma/service.h>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef PLASMOIDSERVICE_H
|
#ifndef PLASMOIDSERVICE_H
|
||||||
#define PLASMOIDSERVICE_H
|
#define PLASMOIDSERVICE_H
|
||||||
|
|
||||||
#include "dataengineconsumer_p.h"
|
#include "dataengineconsumer.h"
|
||||||
|
|
||||||
#include "../package.h"
|
#include "../package.h"
|
||||||
#include "../service.h"
|
#include "../service.h"
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include <QtCore/QRunnable>
|
#include <QtCore/QRunnable>
|
||||||
#include <QtCore/QWeakPointer>
|
#include <QtCore/QWeakPointer>
|
||||||
|
|
||||||
|
#include "plasma/dataengineconsumer.h"
|
||||||
#include "plasma/scripting/wallpaperscript.h"
|
#include "plasma/scripting/wallpaperscript.h"
|
||||||
#include "plasma/private/dataengineconsumer_p.h"
|
|
||||||
#include "plasma/private/wallpaperrenderthread_p.h"
|
#include "plasma/private/wallpaperrenderthread_p.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
|
@ -30,6 +30,11 @@ namespace Plasma
|
|||||||
class RunnerScriptPrivate
|
class RunnerScriptPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
RunnerScriptPrivate()
|
||||||
|
: runner(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
AbstractRunner *runner;
|
AbstractRunner *runner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "pluginloader.h"
|
#include "pluginloader.h"
|
||||||
#include "private/dataengineconsumer_p.h"
|
|
||||||
#include "private/packages_p.h"
|
#include "private/packages_p.h"
|
||||||
#include "private/wallpaper_p.h"
|
#include "private/wallpaper_p.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user