[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kexi/3.1] src: Make certain views work in User mode
From: Jaroslaw Staniek <null () kde ! org>
Date: 2018-08-29 22:23:01
Message-ID: E1fv8rd-0003CX-NZ () code ! kde ! org
[Download RAW message or body]
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 <KexiJsonTrader.h>
#include <KDbGlobal>
@@ -41,7 +42,7 @@ static bool isTrue(KPluginMetaData *metaData, const char* fieldName, bool defaul
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 @@ Info::Private::Private(Info *info, const QJsonObject &rootObject)
, 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 @@ Info::Private::Private(Info *info, const QJsonObject &rootObject)
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 @@ 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/KexiPluginMetaData.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 = v.count() >= 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/KexiPluginMetaData.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-specific fields using
- * readStringList(), readTranslatedValue() or readTranslatedString().
- */
- QJsonObject rootObject() const;
-
private:
Q_DISABLE_COPY(KexiPluginMetaData)
class Private;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic