addd a cmake option to enable single account desktop client

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2023-06-06 12:33:34 +02:00 committed by Matthieu Gallien
parent ecb40f28e7
commit 91ea14d49e
6 changed files with 22 additions and 1 deletions

View file

@ -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

View file

@ -37,6 +37,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@

View file

@ -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)));
}

View file

@ -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;

View file

@ -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:

View file

@ -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