From: Matthieu Gallien Date: Tue, 6 Jun 2023 10:33:34 +0000 (+0200) Subject: addd a cmake option to enable single account desktop client X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~8^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=52ae22496b78f94de49b5eae914b61778f96ae29;p=nextcloud-desktop.git addd a cmake option to enable single account desktop client Signed-off-by: Matthieu Gallien --- diff --git a/NEXTCLOUD.cmake b/NEXTCLOUD.cmake index b48ba5291..1dd12d86b 100644 --- a/NEXTCLOUD.cmake +++ b/NEXTCLOUD.cmake @@ -44,6 +44,8 @@ option( WITH_PROVIDERS "Build with providers list" ON ) option( ENFORCE_VIRTUAL_FILES_SYNC_FOLDER "Enforce use of virtual files sync folder when available" OFF ) +option(ENFORCE_SINGLE_ACCOUNT "Enforce use of a single account in desktop client" OFF) + option( DO_NOT_USE_PROXY "Do not use system wide proxy, instead always do a direct connection to server" OFF ) ## Theming options diff --git a/config.h.in b/config.h.in index 5b91a8338..27b98cbd3 100644 --- a/config.h.in +++ b/config.h.in @@ -36,6 +36,7 @@ #define APPLICATION_URI_HANDLER_SCHEME "@APPLICATION_URI_HANDLER_SCHEME@" #cmakedefine01 ENFORCE_VIRTUAL_FILES_SYNC_FOLDER #cmakedefine DO_NOT_USE_PROXY "@DO_NOT_USE_PROXY@" +#cmakedefine ENFORCE_SINGLE_ACCOUNT "@ENFORCE_SINGLE_ACCOUNT@" #cmakedefine ZLIB_FOUND @ZLIB_FOUND@ diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 00a841bae..2ea725564 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -554,6 +554,11 @@ void ownCloudGui::slotLogout() void ownCloudGui::slotNewAccountWizard() { +#if defined ENFORCE_SINGLE_ACCOUNT + if (!AccountManager::instance()->accounts().isEmpty()) { + return; + } +#endif OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int))); } diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 08872c289..d2f405189 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -490,6 +490,15 @@ bool Systray::isOpen() const return _isOpen; } +bool Systray::enableAddAccount() const +{ +#if defined ENFORCE_SINGLE_ACCOUNT + return AccountManager::instance()->accounts().isEmpty(); +#else + return true; +#endif +} + void Systray::setIsOpen(const bool isOpen) { _isOpen = isOpen; diff --git a/src/gui/systray.h b/src/gui/systray.h index 21607233e..370bebc44 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -69,6 +69,7 @@ class Systray Q_PROPERTY(bool useNormalWindow READ useNormalWindow CONSTANT) Q_PROPERTY(bool syncIsPaused READ syncIsPaused WRITE setSyncIsPaused NOTIFY syncIsPausedChanged) Q_PROPERTY(bool isOpen READ isOpen WRITE setIsOpen NOTIFY isOpenChanged) + Q_PROPERTY(bool enableAddAccount READ enableAddAccount CONSTANT) public: static Systray *instance(); @@ -92,6 +93,8 @@ public: Q_REQUIRED_RESULT bool syncIsPaused() const; Q_REQUIRED_RESULT bool isOpen() const; + [[nodiscard]] bool enableAddAccount() const; + bool raiseDialogs(); signals: diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 7af365970..60ec7748e 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -350,8 +350,9 @@ ApplicationWindow { MenuItem { id: addAccountButton - height: Style.addAccountButtonHeight + height: Systray.enableAddAccount ? Style.addAccountButtonHeight : 0 hoverEnabled: true + visible: Systray.enableAddAccount background: Item { height: parent.height