From kde-commits Wed Aug 29 22:23:01 2018 From: Jaroslaw Staniek Date: Wed, 29 Aug 2018 22:23:01 +0000 To: kde-commits Subject: [kexi/3.1] src: Make certain views work in User mode Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=153558139709902 Git commit d194b984ac8b051e86e9b8ce3aa7eeb321f923b8 by Jaroslaw Staniek. Committed on 29/08/2018 at 22:22. Pushed by staniek into branch '3.1'. Make certain views work in User mode Summary: BUG:396875 Test Plan: See the bug description Reviewers: piggz Reviewed By: piggz Subscribers: Kexi-Devel-list Tags: #kexi Differential Revision: https://phabricator.kde.org/D14402 M +10 -7 src/core/kexipartinfo.cpp M +1 -1 src/core/kexipartinfo_p.h M +2 -9 src/kexiutils/KexiPluginMetaData.cpp M +0 -6 src/kexiutils/KexiPluginMetaData.h https://commits.kde.org/kexi/d194b984ac8b051e86e9b8ce3aa7eeb321f923b8 diff --git a/src/core/kexipartinfo.cpp b/src/core/kexipartinfo.cpp index 1a472a707..14f656ec1 100644 --- 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 @@ static bool isTrue(KPluginMetaData *metaData, const char*= fieldName, bool defaul return 0 =3D=3D 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 @@ Info::Private::Private(Info *info, const QJsonObject &roo= tObject) , isPropertyEditorAlwaysVisibleInDesignMode( isTrue(info, "X-Kexi-PropertyEditorAlwaysVisibleInDesignMode", t= rue)) { - groupName =3D info->readTranslatedString(rootObject, "X-Kexi-GroupName= ", untranslatedGroupName); + const QJsonObject metaDataObject =3D KexiJsonTrader::metaDataObjectFor= PluginLoader(loader); + groupName =3D info->readTranslatedString(metaDataObject, "X-Kexi-Group= Name", untranslatedGroupName); const QStringList serviceTypes =3D info->serviceTypes(); if (serviceTypes.contains("Kexi/Viewer")) { supportedViewModes |=3D Kexi::DataViewMode; @@ -65,14 +67,15 @@ Info::Private::Private(Info *info, const QJsonObject &r= ootObject) supportedViewModes |=3D Kexi::TextViewMode; } = - const QJsonArray userServiceTypes =3D rootObject.value("X-Kexi-Service= TypesInUserMode").toArray(); - if (userServiceTypes.contains(QJsonValue("Kexi/Viewer"))) { + const QStringList userServiceTypes =3D metaDataObject.value("X-Kexi-Se= rviceTypesInUserMode") + .toString().split(QLatin1Char(',')); // NOTE: toArray() does n= ot work + if (userServiceTypes.contains("Kexi/Viewer")) { supportedUserViewModes |=3D Kexi::DataViewMode; } - if (userServiceTypes.contains(QJsonValue("Kexi/Designer"))) { + if (userServiceTypes.contains("Kexi/Designer")) { supportedUserViewModes |=3D Kexi::DesignViewMode; } - if (userServiceTypes.contains(QJsonValue("Kexi/Editor"))) { + if (userServiceTypes.contains("Kexi/Editor")) { supportedUserViewModes |=3D Kexi::TextViewMode; } } @@ -132,7 +135,7 @@ void KexiNewObjectAction::slotTriggered() //} = 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 index c8872e752..0889d32c1 100644 --- a/src/core/kexipartinfo_p.h +++ b/src/core/kexipartinfo_p.h @@ -31,7 +31,7 @@ namespace KexiPart 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.cpp b/src/kexiutils/KexiPlugi= nMetaData.cpp index b6fff25aa..94b313fd6 100644 --- 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 =3D v.count() >=3D 2; @@ -45,7 +44,6 @@ public: } } = - QJsonObject rootObject; QString errorMessage; int majorVersion; int minorVersion; @@ -54,7 +52,7 @@ public: //------------------------------ = KexiPluginMetaData::KexiPluginMetaData(const QPluginLoader &loader) - : KPluginMetaData(loader), d(new Private(this, loader)) + : KPluginMetaData(loader), d(new Private(this)) { } = @@ -87,8 +85,3 @@ int KexiPluginMetaData::minorVersion() const { return d->minorVersion; } - -QJsonObject KexiPluginMetaData::rootObject() const -{ - return d->rootObject; -} diff --git a/src/kexiutils/KexiPluginMetaData.h b/src/kexiutils/KexiPluginM= etaData.h index 8e6bd6724..808ac5a6c 100644 --- a/src/kexiutils/KexiPluginMetaData.h +++ b/src/kexiutils/KexiPluginMetaData.h @@ -67,12 +67,6 @@ protected: */ void setErrorMessage(const QString& errorMessage); = - /** - * @return root object for this plugin, useful to retrieve Kexi-specif= ic fields using - * readStringList(), readTranslatedValue() or readTranslatedString(). - */ - QJsonObject rootObject() const; - private: Q_DISABLE_COPY(KexiPluginMetaData) class Private;