From 1fc4fd0a0c067cb9900c8ebda273d65e0d140fd3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 19 Dec 2017 09:38:53 +0100 Subject: Custom component metadata mechanism. --- framework/src/CMakeLists.txt | 3 --- framework/src/accounts/accountfactory.cpp | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'framework/src') diff --git a/framework/src/CMakeLists.txt b/framework/src/CMakeLists.txt index 09a4c22d..9d4e238e 100644 --- a/framework/src/CMakeLists.txt +++ b/framework/src/CMakeLists.txt @@ -12,9 +12,6 @@ set(CMAKE_CXX_VISIBILITY_PRESET default) include_directories(. domain/mime/mimetreeparser domain/ domain/mime) -set(SRCS -) - add_library(kubeframework SHARED settings/settings.cpp domain/maillistmodel.cpp diff --git a/framework/src/accounts/accountfactory.cpp b/framework/src/accounts/accountfactory.cpp index 2babeb5d..5d3c35fc 100644 --- a/framework/src/accounts/accountfactory.cpp +++ b/framework/src/accounts/accountfactory.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include @@ -60,16 +62,22 @@ void AccountFactory::loadPackage() } return QString{}; }(); + mUiPath.clear(); + mLoginUi.clear(); + mRequiresKeyring = false; if (pluginPath.isEmpty()) { qWarning() << "Failed to load account package: " << "org.kube.accounts." + mAccountType; - mUiPath.clear(); - mLoginUi.clear(); - mRequiresKeyring = true; } else { mUiPath = pluginPath + "/AccountSettings.qml"; mLoginUi = pluginPath + "/Login.qml"; - //FIXME - mRequiresKeyring = true; + if (QFileInfo::exists(pluginPath + "/metadata.json")) { + QFile file{pluginPath + "/metadata.json"}; + file.open(QIODevice::ReadOnly); + auto json = QJsonDocument::fromJson(file.readAll()); + mRequiresKeyring = json.object().value("RequiresKeyring").toBool(true); + } else { + mRequiresKeyring = true; + } } emit accountLoaded(); } -- cgit v1.2.3