plugintest: remove dead code
This commit is contained in:
parent
fc673146a6
commit
7a9855ec77
@ -78,11 +78,9 @@ void PluginTest::runMain()
|
|||||||
// qDebug() << " libs are in: " << QCoreApplication::libraryPaths();
|
// qDebug() << " libs are in: " << QCoreApplication::libraryPaths();
|
||||||
// //loadKQPlugin();
|
// //loadKQPlugin();
|
||||||
qDebug() << "::: loadKPlugin() == " << loadKPlugin();
|
qDebug() << "::: loadKPlugin() == " << loadKPlugin();
|
||||||
// qDebug() << " - - - -- - - - - ------------------------------------\n";
|
|
||||||
// qDebug() << "::: loadKService() == " << loadKService();
|
|
||||||
//
|
//
|
||||||
qDebug() << " - - - -- - - - - ------------------------------------\n";
|
qDebug() << " - - - -- - - - - ------------------------------------\n";
|
||||||
qDebug() << "::: loadKFromPlasma() == " << loadFromPlasma();
|
qDebug() << "::: loadFromPlasma() == " << loadFromPlasma();
|
||||||
exit(0);
|
exit(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -125,37 +123,6 @@ bool PluginTest::loadKPlugin()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginTest::loadFromKService(const QString &name)
|
|
||||||
{
|
|
||||||
DataEngine *engine = 0;
|
|
||||||
|
|
||||||
// load the engine, add it to the engines
|
|
||||||
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
|
|
||||||
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/DataEngine"),
|
|
||||||
constraint);
|
|
||||||
QString error;
|
|
||||||
|
|
||||||
if (offers.isEmpty()) {
|
|
||||||
qDebug() << "offers are empty for " << name << " with constraint " << constraint;
|
|
||||||
} else {
|
|
||||||
QVariantList allArgs;
|
|
||||||
allArgs << offers.first()->storageId();
|
|
||||||
QString api = offers.first()->property(QStringLiteral("X-Plasma-API")).toString();
|
|
||||||
if (api.isEmpty()) {
|
|
||||||
if (offers.first()) {
|
|
||||||
KPluginLoader plugin(*offers.first());
|
|
||||||
if (Plasma::isPluginVersionCompatible(plugin)) {
|
|
||||||
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
engine = new DataEngine(KPluginInfo(offers.first()), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return engine != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PluginTest::loadFromPlasma()
|
bool PluginTest::loadFromPlasma()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -210,76 +177,6 @@ void PluginTest::loadKQPlugin()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginTest::loadKService(const QString &name)
|
|
||||||
{
|
|
||||||
// DataEngine *engine = d->isDefaultLoader ? 0 : internalLoadDataEngine(name);
|
|
||||||
// if (engine) {
|
|
||||||
// return engine;
|
|
||||||
// }
|
|
||||||
qDebug() << "Load KService";
|
|
||||||
DataEngine *engine = 0;
|
|
||||||
// load the engine, add it to the engines
|
|
||||||
QString constraint = QStringLiteral("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
|
|
||||||
constraint = QString();
|
|
||||||
KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/DataEngine"),
|
|
||||||
constraint);
|
|
||||||
QString error;
|
|
||||||
|
|
||||||
if (offers.isEmpty()) {
|
|
||||||
qDebug() << "offers are empty for " << name << " with constraint " << constraint;
|
|
||||||
} else {
|
|
||||||
qDebug() << "Found a bunch of stuff";
|
|
||||||
|
|
||||||
QVariantList allArgs;
|
|
||||||
allArgs << offers.first()->storageId();
|
|
||||||
QString api = offers.first()->property(QStringLiteral("X-Plasma-API")).toString();
|
|
||||||
if (api.isEmpty()) {
|
|
||||||
if (offers.first()) {
|
|
||||||
KPluginLoader plugin(*offers.first());
|
|
||||||
if (Plasma::isPluginVersionCompatible(plugin)) {
|
|
||||||
//KPluginInfo::List infos = KPluginInfo::fromServices(offers.first());
|
|
||||||
//qDebug() << " plugininfo:" << info.name();
|
|
||||||
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
|
|
||||||
qDebug() << "DE";
|
|
||||||
if (engine) {
|
|
||||||
engine->connectSource(QStringLiteral("Europe/Amsterdam"), this);
|
|
||||||
qDebug() << "SOURCE: " << engine->sources();
|
|
||||||
//qDebug() << "DataEngine ID: " << engine->pluginInfo().name();
|
|
||||||
} else {
|
|
||||||
qDebug() << "Engine invalid";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qDebug() << "Plugin version incompatible" << plugin.pluginVersion();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
engine = new DataEngine(KPluginInfo(offers.first()), 0);
|
|
||||||
qDebug() << "DataEngine ID (from KPluginINfo): " << engine << engine->pluginInfo().icon() << engine->pluginInfo().name();
|
|
||||||
}
|
|
||||||
QStringList result;
|
|
||||||
foreach (const KService::Ptr &service, offers) {
|
|
||||||
const QString _plugin = service->property(QStringLiteral("X-KDE-PluginInfo-Name"), QVariant::String).toString();
|
|
||||||
qDebug() << "Found plugin: " << _plugin;
|
|
||||||
if (!result.contains(_plugin)) {
|
|
||||||
result << _plugin;
|
|
||||||
//engine = PluginLoader::self()->loadDataEngine(_plugin);
|
|
||||||
//engine = PluginLoader::self()->loadDataEngine(name);
|
|
||||||
//qDebug() << "SOURCE: " << engine->sources();
|
|
||||||
|
|
||||||
//engine->setPluginInfo(service->pluginInfo());
|
|
||||||
//qDebug() << engine->pluginInfo().name();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!engine) {
|
|
||||||
qDebug() << "Couldn't load engine \"" << name << "\". Error given: " << error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return engine != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginTest::dataUpdated(QString s, Plasma::DataEngine::Data d)
|
void PluginTest::dataUpdated(QString s, Plasma::DataEngine::Data d)
|
||||||
{
|
{
|
||||||
qDebug() << "new data for source:" << s << d;
|
qDebug() << "new data for source:" << s << d;
|
||||||
|
@ -44,10 +44,8 @@ public:
|
|||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void runMain();
|
void runMain();
|
||||||
bool loadKPlugin();
|
bool loadKPlugin();
|
||||||
bool loadFromKService(const QString &name = QStringLiteral("time"));
|
|
||||||
bool loadFromPlasma();
|
bool loadFromPlasma();
|
||||||
void loadKQPlugin();
|
void loadKQPlugin();
|
||||||
bool loadKService(const QString &name = QString());
|
|
||||||
void dataUpdated(QString s, Plasma::DataEngine::Data d);
|
void dataUpdated(QString s, Plasma::DataEngine::Data d);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user