summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Wilson <alex.wilson@nokia.com>2012-03-05 18:16:58 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-06 06:34:42 +0100
commit9c75d0a91327868b2131d11caea2cd0ccd437711 (patch)
tree57fd3801ec50f4560360cf9f7f741bd5d32afa2b /src
parent95550c8f1292c93ea42d59283394fc4f4d63bf2c (diff)
Support new-style plugins without a "Keys" json property
As per discussion with Lars, intent here was to allow plugins without a "Keys" property to still function correctly, but this particular if statement was blocking any such plugins from being detected. Change-Id: Icb343ca8bd95a508d62565cd816fe2a57a4f82bd Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 566ece77c9..cdc72cf35d 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -128,6 +128,7 @@ void QFactoryLoader::update()
QLibraryPrivate *library = 0;
for (int j = 0; j < plugins.count(); ++j) {
QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
+
if (qt_debug_component()) {
qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
}
@@ -140,7 +141,9 @@ void QFactoryLoader::update()
library->release();
continue;
}
+
QStringList keys;
+ bool metaDataOk = false;
if (library->compatPlugin) {
qWarning("Qt plugin loader: Compatibility plugin '%s', need to load for accessing meta data.",
qPrintable(QDir::toNativeSeparators(fileName)));
@@ -164,10 +167,17 @@ void QFactoryLoader::update()
QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
if (instance && factory && instance->qt_metacast(d->iid))
keys = factory->keys();
+
+ if (!keys.isEmpty())
+ metaDataOk = true;
+
} else {
QString iid = library->metaData.value(QLatin1String("IID")).toString();
if (iid == QLatin1String(d->iid.constData(), d->iid.size())) {
QJsonObject object = library->metaData.value(QLatin1String("MetaData")).toObject();
+ if (!object.isEmpty())
+ metaDataOk = true;
+
QJsonArray k = object.value(QLatin1String("Keys")).toArray();
for (int i = 0; i < k.size(); ++i) {
QString s = k.at(i).toString();
@@ -178,11 +188,12 @@ void QFactoryLoader::update()
qDebug() << "Got keys from plugin meta data" << keys;
}
- if (keys.isEmpty()) {
+ if (!metaDataOk) {
library->unload();
library->release();
continue;
}
+
d->libraryList += library;
for (int k = 0; k < keys.count(); ++k) {
// first come first serve, unless the first