diff --git a/src/core/kexipartinfo.cpp b/src/core/kexipartinfo.cpp --- a/src/core/kexipartinfo.cpp +++ b/src/core/kexipartinfo.cpp @@ -21,6 +21,7 @@ #include "kexipartinfo_p.h" #include "kexipartmanager.h" #include "KexiMainWindowIface.h" +#include #include @@ -41,7 +42,7 @@ return 0 == s.compare(QLatin1String("true"), Qt::CaseInsensitive); } -Info::Private::Private(Info *info, const QJsonObject &rootObject) +Info::Private::Private(Info *info, const QPluginLoader &loader) : untranslatedGroupName(info->value("X-Kexi-GroupName")) , typeName(info->value("X-Kexi-TypeName")) , supportedViewModes(0) @@ -53,7 +54,8 @@ , isPropertyEditorAlwaysVisibleInDesignMode( isTrue(info, "X-Kexi-PropertyEditorAlwaysVisibleInDesignMode", true)) { - groupName = info->readTranslatedString(rootObject, "X-Kexi-GroupName", untranslatedGroupName); + const QJsonObject metaDataObject = KexiJsonTrader::metaDataObjectForPluginLoader(loader); + groupName = info->readTranslatedString(metaDataObject, "X-Kexi-GroupName", untranslatedGroupName); const QStringList serviceTypes = info->serviceTypes(); if (serviceTypes.contains("Kexi/Viewer")) { supportedViewModes |= Kexi::DataViewMode; @@ -65,14 +67,15 @@ supportedViewModes |= Kexi::TextViewMode; } - const QJsonArray userServiceTypes = rootObject.value("X-Kexi-ServiceTypesInUserMode").toArray(); - if (userServiceTypes.contains(QJsonValue("Kexi/Viewer"))) { + const QStringList userServiceTypes = metaDataObject.value("X-Kexi-ServiceTypesInUserMode") + .toString().split(QLatin1Char(',')); // NOTE: toArray() does not work + if (userServiceTypes.contains("Kexi/Viewer")) { supportedUserViewModes |= Kexi::DataViewMode; } - if (userServiceTypes.contains(QJsonValue("Kexi/Designer"))) { + if (userServiceTypes.contains("Kexi/Designer")) { supportedUserViewModes |= Kexi::DesignViewMode; } - if (userServiceTypes.contains(QJsonValue("Kexi/Editor"))) { + if (userServiceTypes.contains("Kexi/Editor")) { supportedUserViewModes |= Kexi::TextViewMode; } } @@ -132,7 +135,7 @@ //} Info::Info(const QPluginLoader &loader) - : KexiPluginMetaData(loader), d(new Private(this, rootObject())) + : KexiPluginMetaData(loader), d(new Private(this, loader)) { } diff --git a/src/core/kexipartinfo_p.h b/src/core/kexipartinfo_p.h --- a/src/core/kexipartinfo_p.h +++ b/src/core/kexipartinfo_p.h @@ -31,7 +31,7 @@ class Q_DECL_HIDDEN Info::Private { public: - Private(Info *info, const QJsonObject &rootObject); + Private(Info *info, const QPluginLoader &loader); //! used in StaticItem class Private(); diff --git a/src/kexiutils/KexiPluginMetaData.h b/src/kexiutils/KexiPluginMetaData.h --- a/src/kexiutils/KexiPluginMetaData.h +++ b/src/kexiutils/KexiPluginMetaData.h @@ -67,12 +67,6 @@ */ void setErrorMessage(const QString& errorMessage); - /** - * @return root object for this plugin, useful to retrieve Kexi-specific fields using - * readStringList(), readTranslatedValue() or readTranslatedString(). - */ - QJsonObject rootObject() const; - private: Q_DISABLE_COPY(KexiPluginMetaData) class Private; diff --git a/src/kexiutils/KexiPluginMetaData.cpp b/src/kexiutils/KexiPluginMetaData.cpp --- a/src/kexiutils/KexiPluginMetaData.cpp +++ b/src/kexiutils/KexiPluginMetaData.cpp @@ -28,8 +28,7 @@ class Q_DECL_HIDDEN KexiPluginMetaData::Private { public: - Private(KexiPluginMetaData *info, const QPluginLoader &loader) - : rootObject(KexiJsonTrader::rootObjectForPluginLoader(loader)) + Private(KexiPluginMetaData *info) { QStringList v(info->version().split('.')); bool ok = v.count() >= 2; @@ -45,16 +44,15 @@ } } - QJsonObject rootObject; QString errorMessage; int majorVersion; int minorVersion; }; //------------------------------ KexiPluginMetaData::KexiPluginMetaData(const QPluginLoader &loader) - : KPluginMetaData(loader), d(new Private(this, loader)) + : KPluginMetaData(loader), d(new Private(this)) { } @@ -87,8 +85,3 @@ { return d->minorVersion; } - -QJsonObject KexiPluginMetaData::rootObject() const -{ - return d->rootObject; -}