diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df23883895d2..4a333dbddfdb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,13 @@ if(NO_SHIBBOLETH) add_definitions(-DNO_SHIBBOLETH=1) endif() +# Disable webengine-based components +option(NO_WEBENGINE "Build without webflow / flow2 support so QtWebEngine isn't required" OFF) +if(NO_WEBENGINE) + message("Compiling without webengine") + add_definitions(-DNO_WEBENGINE=1) +endif() + if(APPLE) set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a79edfcfb7c7f..c8ef114a41ff0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,11 @@ endif() set(synclib_NAME ${APPLICATION_EXECUTABLE}sync) -find_package(Qt5 5.12 COMPONENTS Core Network Xml Concurrent WebEngineWidgets WebEngine REQUIRED) +find_package(Qt5 5.12 COMPONENTS Core Network Xml Concurrent REQUIRED) + +if(NOT NO_WEBENGINE) + find_package(Qt5 5.12 COMPONENTS WebEngineWidgets WebEngine REQUIRED) +endif() if(NOT TOKEN_AUTH_ONLY) find_package(Qt5Keychain REQUIRED) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 2f1e99e2bac8d..c4ab437b12053 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -112,8 +112,6 @@ set(client_SRCS creds/httpcredentialsgui.cpp creds/oauth.cpp creds/flow2auth.cpp - creds/webflowcredentials.cpp - creds/webflowcredentialsdialog.cpp wizard/postfixlineedit.cpp wizard/abstractcredswizardpage.cpp wizard/owncloudadvancedsetuppage.cpp @@ -126,8 +124,6 @@ set(client_SRCS wizard/owncloudwizardcommon.cpp wizard/owncloudwizard.cpp wizard/owncloudwizardresultpage.cpp - wizard/webviewpage.cpp - wizard/webview.cpp wizard/slideshow.cpp ) @@ -148,6 +144,15 @@ IF(BUILD_UPDATER) ) endif() +IF(NOT NO_WEBENGINE) + list(APPEND client_SRCS + creds/webflowcredentials.cpp + creds/webflowcredentialsdialog.cpp + wizard/webviewpage.cpp + wizard/webview.cpp + ) +endif() + IF( APPLE ) list(APPEND client_SRCS cocoainitializer_mac.mm) list(APPEND client_SRCS socketapisocket_mac.mm) @@ -314,8 +319,11 @@ set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE};${CMAKE_INSTALL_RPATH}" ) -target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::WebEngineWidgets) +target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml Qt5::Qml Qt5::Quick Qt5::QuickControls2) target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} ) +IF(NOT NO_WEBENGINE) + target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::WebEngineWidgets ) +endif() IF(BUILD_UPDATER) target_link_libraries( ${APPLICATION_EXECUTABLE} updater ) endif() diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index 34c4cbc3e33cc..372c52f4440c0 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -253,6 +253,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings) acc->setUrl(urlConfig.toUrl()); } +#ifndef NO_WEBENGINE // Migrate to webflow if (authType == QLatin1String("http")) { authType = "webflow"; @@ -266,6 +267,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings) settings.remove(key); } } +#endif qCInfo(lcAccountManager) << "Account for" << acc->url() << "using auth type" << authType; diff --git a/src/gui/creds/credentialsfactory.cpp b/src/gui/creds/credentialsfactory.cpp index 6062f70eba726..723196d0882ea 100644 --- a/src/gui/creds/credentialsfactory.cpp +++ b/src/gui/creds/credentialsfactory.cpp @@ -21,7 +21,9 @@ #ifndef NO_SHIBBOLETH #include "creds/shibbolethcredentials.h" #endif +#ifndef NO_WEBENGINE #include "creds/webflowcredentials.h" +#endif namespace OCC { @@ -40,8 +42,10 @@ namespace CredentialsFactory { } else if (type == "shibboleth") { return new ShibbolethCredentials; #endif +#ifndef NO_WEBENGINE } else if (type == "webflow") { return new WebFlowCredentials; +#endif } else { qCWarning(lcGuiCredentials, "Unknown credentials type: %s", qPrintable(type)); return new DummyCredentials; diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 71f1c19c91d34..d997125a8570d 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -139,7 +139,11 @@ void OwncloudSetupPage::slotLogin() void OwncloudSetupPage::slotGotoProviderList() { _ocWizard->setRegistration(true); +#ifndef NO_WEBENGINE _ocWizard->setAuthType(DetermineAuthTypeJob::AuthType::WebViewFlow); +#else + _ocWizard->setAuthType(DetermineAuthTypeJob::AuthType::Basic); +#endif _authTypeKnown = true; _checking = false; emit completeChanged(); diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index 912222dca7647..7d9780c4c5e87 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -27,7 +27,9 @@ #endif #include "wizard/owncloudadvancedsetuppage.h" #include "wizard/owncloudwizardresultpage.h" +#ifndef NO_WEBENGINE #include "wizard/webviewpage.h" +#endif #include "wizard/flow2authcredspage.h" #include "QProgressIndicator.h" @@ -53,7 +55,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) , _flow2CredsPage(new Flow2AuthCredsPage) , _advancedSetupPage(new OwncloudAdvancedSetupPage) , _resultPage(new OwncloudWizardResultPage) +#ifndef NO_WEBENGINE , _webViewPage(new WebViewPage(this)) +#endif { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setPage(WizardCommon::Page_ServerSetup, _setupPage); @@ -65,7 +69,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) #endif setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage); setPage(WizardCommon::Page_Result, _resultPage); +#ifndef NO_WEBENGINE setPage(WizardCommon::Page_WebView, _webViewPage); +#endif connect(this, &QDialog::finished, this, &OwncloudWizard::basicSetupFinished); @@ -81,7 +87,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) #ifndef NO_SHIBBOLETH connect(_shibbolethCredsPage, &OwncloudShibbolethCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl); #endif +#ifndef NO_WEBENGINE connect(_webViewPage, &WebViewPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl); +#endif connect(_advancedSetupPage, &OwncloudAdvancedSetupPage::createLocalAndRemoteFolders, this, &OwncloudWizard::createLocalAndRemoteFolders); connect(this, &QWizard::customButtonClicked, this, &OwncloudWizard::skipFolderConfiguration); @@ -187,9 +195,11 @@ void OwncloudWizard::successfulStep() break; #endif +#ifndef NO_WEBENGINE case WizardCommon::Page_WebView: _webViewPage->setConnected(); break; +#endif case WizardCommon::Page_AdvancedSetup: _advancedSetupPage->directoriesCreated(); @@ -216,8 +226,10 @@ void OwncloudWizard::setAuthType(DetermineAuthTypeJob::AuthType type) _credentialsPage = _browserCredsPage; } else if (type == DetermineAuthTypeJob::LoginFlowV2) { _credentialsPage = _flow2CredsPage; +#ifndef NO_WEBENGINE } else if (type == DetermineAuthTypeJob::WebViewFlow) { _credentialsPage = _webViewPage; +#endif } else { // try Basic auth even for "Unknown" _credentialsPage = _httpCredsPage; } @@ -242,7 +254,10 @@ void OwncloudWizard::slotCurrentPageChanged(int id) } setOption(QWizard::HaveCustomButton1, id == WizardCommon::Page_AdvancedSetup); - if (id == WizardCommon::Page_AdvancedSetup && (_credentialsPage == _browserCredsPage || _credentialsPage == _flow2CredsPage)) { + if (id == WizardCommon::Page_AdvancedSetup + && (_credentialsPage == _browserCredsPage + || _credentialsPage == _flow2CredsPage + )) { // For OAuth, disable the back button in the Page_AdvancedSetup because we don't want // to re-open the browser. button(QWizard::BackButton)->setEnabled(false); diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index ee6161ca55d9d..1a5574c6db1bf 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -39,7 +39,9 @@ class OwncloudAdvancedSetupPage; class OwncloudWizardResultPage; class AbstractCredentials; class AbstractCredentialsWizardPage; +#ifndef NO_WEBENGINE class WebViewPage; +#endif class Flow2AuthCredsPage; /** @@ -118,7 +120,9 @@ public slots: OwncloudAdvancedSetupPage *_advancedSetupPage; OwncloudWizardResultPage *_resultPage; AbstractCredentialsWizardPage *_credentialsPage = nullptr; +#ifndef NO_WEBENGINE WebViewPage *_webViewPage; +#endif QStringList _setupLog; diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index d40ccede4764c..0125f778b982a 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -966,12 +966,20 @@ void DetermineAuthTypeJob::checkAllDone() // WebViewFlow > OAuth > Shib > Basic if (_account->serverVersionInt() >= Account::makeServerVersion(12, 0, 0)) { +#ifndef NO_WEBENGINE result = WebViewFlow; +#else + result = Basic; +#endif } // LoginFlowV2 > WebViewFlow > OAuth > Shib > Basic if (_account->serverVersionInt() >= Account::makeServerVersion(16, 0, 0)) { +#ifndef NO_WEBENGINE result = LoginFlowV2; +#else + result = Basic; +#endif } // If we determined that we need the webview flow (GS for example) then we switch to that