Skip to content

Commit

Permalink
Merge pull request #5773 from nextcloud/bugfix/singleAccountClient
Browse files Browse the repository at this point in the history
addd a cmake option to enable single account desktop client
  • Loading branch information
mgallien committed Jun 8, 2023
2 parents ecb40f2 + 91ea14d commit f11a83c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEXTCLOUD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down
5 changes: 5 additions & 0 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down
9 changes: 9 additions & 0 deletions src/gui/systray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/gui/systray.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -92,6 +93,8 @@ class Systray
Q_REQUIRED_RESULT bool syncIsPaused() const;
Q_REQUIRED_RESULT bool isOpen() const;

[[nodiscard]] bool enableAddAccount() const;

bool raiseDialogs();

signals:
Expand Down
3 changes: 2 additions & 1 deletion src/gui/tray/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f11a83c

Please sign in to comment.