From afaaeb6dc16315c78091653a2662be41781ddfd3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 17 Apr 2018 14:17:39 +0200 Subject: Set the list of available account plugins from cmake --- CMakeLists.txt | 1 + components/CMakeLists.txt | 12 ++++++++++++ components/accounts/AccountConfiguration.qml.in | 26 +++++++++++++++++++++++++ components/accounts/qmldir | 1 + views/accounts/qml/View.qml | 2 +- 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 components/accounts/AccountConfiguration.qml.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 321cacf7..b5059760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ cmake_policy(SET CMP0063 NEW) option(EXPERIMENTAL_VIEWS "Install experimental views" OFF) #Do not enable this unless you actually distribute a custom extension. option(ENABLE_EXTENSION "Enable custom kube extensions" OFF) +set(AVAILABLE_ACCOUNT_PLUGINS "kolabnow" "imap" "maildir" "gmail" CACHE STRING "List of enabled account plugins (provide as semicolon separated string)" ) include(CPack) include(FeatureSummary) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 9ae2824d..1f477a4d 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -10,4 +10,16 @@ endmacro(install_qml_component) install_qml_component(kube) add_subdirectory(kube/tests) install_qml_component(accounts) + + +#Convert list to comma-separated and quoted list. +set(_AVAILABLE_ACCOUNT_PLUGINS ${AVAILABLE_ACCOUNT_PLUGINS}) +set(AVAILABLE_ACCOUNT_PLUGINS "") +foreach(PLUGIN ${_AVAILABLE_ACCOUNT_PLUGINS}) + set(AVAILABLE_ACCOUNT_PLUGINS "${AVAILABLE_ACCOUNT_PLUGINS}, \"${PLUGIN}\"") +endforeach() +string(SUBSTRING "${AVAILABLE_ACCOUNT_PLUGINS}" 2 -1 AVAILABLE_ACCOUNT_PLUGINS) + +configure_file(accounts/AccountConfiguration.qml.in accounts/AccountConfiguration.qml) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/accounts/AccountConfiguration.qml DESTINATION ${QML_INSTALL_DIR}/org/kube/components/accounts) install_qml_component(mailviewer) diff --git a/components/accounts/AccountConfiguration.qml.in b/components/accounts/AccountConfiguration.qml.in new file mode 100644 index 00000000..58c70b59 --- /dev/null +++ b/components/accounts/AccountConfiguration.qml.in @@ -0,0 +1,26 @@ +/* + Copyright (C) 2018 Christian Mollekopf, + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +pragma Singleton + +import QtQuick 2.7 + +Item { + property var availableAccountPlugins: [@AVAILABLE_ACCOUNT_PLUGINS@] +} + diff --git a/components/accounts/qmldir b/components/accounts/qmldir index 24759d6a..26d2c9b6 100644 --- a/components/accounts/qmldir +++ b/components/accounts/qmldir @@ -2,3 +2,4 @@ module org.kube.components.accounts Accounts 1.0 Accounts.qml AccountWizard 1.0 AccountWizard.qml +singleton AccountConfiguration 1.0 AccountConfiguration.qml diff --git a/views/accounts/qml/View.qml b/views/accounts/qml/View.qml index 0bdab979..00fa845f 100644 --- a/views/accounts/qml/View.qml +++ b/views/accounts/qml/View.qml @@ -26,7 +26,7 @@ import org.kube.components.accounts 1.0 as KubeAccounts FocusScope { id: root //Defines available account types. - property var availableAccountPlugins: ["kolabnow", "imap", "maildir", "gmail"] + property var availableAccountPlugins: KubeAccounts.AccountConfiguration.availableAccountPlugins //Defines whether more than one account is supported. property bool singleAccountMode: availableAccountPlugins.length == 1 -- cgit v1.2.3