Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-3.0] Allow server URL to be pre-defined without enforcing it #2465

Merged
merged 1 commit into from Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion NEXTCLOUD.cmake
Expand Up @@ -6,7 +6,8 @@ set( APPLICATION_VENDOR "Nextcloud GmbH" )
set( APPLICATION_UPDATE_URL "https://updates.nextcloud.org/client/" CACHE STRING "URL for updater" )
set( APPLICATION_HELP_URL "" CACHE STRING "URL for the help menu" )
set( APPLICATION_ICON_NAME "Nextcloud" )
set( APPLICATION_SERVER_URL "" CACHE STRING "URL for the server to use. If entered the server can only connect to this instance" )
set( APPLICATION_SERVER_URL "" CACHE STRING "URL for the server to use. If entered, the UI field will be pre-filled with it" )
set( APPLICATION_SERVER_URL_ENFORCE ON ) # If set and APPLICATION_SERVER_URL is defined, the server can only connect to the pre-defined URL
set( APPLICATION_REV_DOMAIN "com.nextcloud.desktopclient" )

set( LINUX_PACKAGE_SHORTNAME "nextcloud" )
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Expand Up @@ -21,6 +21,7 @@
#cmakedefine APPLICATION_HELP_URL "@APPLICATION_HELP_URL@"
#cmakedefine APPLICATION_ICON_NAME "@APPLICATION_ICON_NAME@"
#cmakedefine APPLICATION_SERVER_URL "@APPLICATION_SERVER_URL@"
#cmakedefine APPLICATION_SERVER_URL_ENFORCE "@APPLICATION_SERVER_URL_ENFORCE@"
#cmakedefine LINUX_APPLICATION_ID "@LINUX_APPLICATION_ID@"
#cmakedefine APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "@APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR@"
#cmakedefine APPLICATION_WIZARD_HEADER_TITLE_COLOR "@APPLICATION_WIZARD_HEADER_TITLE_COLOR@"
Expand Down
6 changes: 5 additions & 1 deletion src/gui/wizard/owncloudsetuppage.cpp
Expand Up @@ -51,7 +51,7 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent)
if (theme->overrideServerUrl().isEmpty()) {
_ui.leUrl->setPostfix(theme->wizardUrlPostfix());
_ui.leUrl->setPlaceholderText(theme->wizardUrlHint());
} else {
} else if (Theme::instance()->forceOverrideServerUrl()) {
_ui.leUrl->setEnabled(false);
}

Expand Down Expand Up @@ -213,6 +213,10 @@ void OwncloudSetupPage::initializePage()
// immediately.
if (Theme::instance()->overrideServerUrl().isEmpty()) {
_ui.leUrl->setFocus();
} else if (!Theme::instance()->forceOverrideServerUrl()) {
if (nextButton) {
nextButton->setFocus();
}
} else {
setCommitPage(true);
// Hack: setCommitPage() changes caption, but after an error this page could still be visible
Expand Down
9 changes: 9 additions & 0 deletions src/libsync/theme.cpp
Expand Up @@ -269,6 +269,15 @@ QString Theme::overrideServerUrl() const
#endif
}

bool Theme::forceOverrideServerUrl() const
{
#ifdef APPLICATION_SERVER_URL_ENFORCE
return true;
#else
return false;
#endif
}

QString Theme::forceConfigAuthType() const
{
return QString();
Expand Down
9 changes: 8 additions & 1 deletion src/libsync/theme.h
Expand Up @@ -149,10 +149,17 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject
/**
* Setting a value here will pre-define the server url.
*
* The respective UI controls will be disabled
* The respective UI controls will be disabled only if forceOverrideServerUrl() is true
*/
virtual QString overrideServerUrl() const;

/**
* Enforce a pre-defined server url.
*
* When true, the respective UI controls will be disabled
*/
virtual bool forceOverrideServerUrl() const;

/**
* This is only usefull when previous version had a different overrideServerUrl
* with a different auth type in that case You should then specify "http" or "shibboleth".
Expand Down