Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Formatting fixes

Co-authored-by: Claudio Cambra <[email protected]>
Signed-off-by: Micke Nordin <[email protected]>
  • Loading branch information
mickenordin and claucambra committed Dec 17, 2023
1 parent 9206d0a commit e7c82fe
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
5 changes: 3 additions & 2 deletions src/gui/wizard/owncloudsetuppage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ int OwncloudSetupPage::nextId() const
return WizardCommon::Page_Flow2AuthCreds;
#ifdef WITH_WEBENGINE
case DetermineAuthTypeJob::WebViewFlow:
if (this->useFlow2)
return WizardCommon::Page_Flow2AuthCreds;
if (this->useFlow2) {
return WizardCommon::Page_Flow2AuthCreds;
}
return WizardCommon::Page_WebView;
#endif // WITH_WEBENGINE
case DetermineAuthTypeJob::NoAuthType:
Expand Down
19 changes: 11 additions & 8 deletions src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
setPage(WizardCommon::Page_Flow2AuthCreds, _flow2CredsPage);
setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage);
#ifdef WITH_WEBENGINE
if(!useFlow2())
setPage(WizardCommon::Page_WebView, _webViewPage);
if (!useFlow2()) {
setPage(WizardCommon::Page_WebView, _webViewPage);
}
#endif // WITH_WEBENGINE

connect(this, &QDialog::finished, this, &OwncloudWizard::basicSetupFinished);
Expand All @@ -79,8 +80,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
connect(_httpCredsPage, &OwncloudHttpCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl);
connect(_flow2CredsPage, &Flow2AuthCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl);
#ifdef WITH_WEBENGINE
if(!useFlow2())
connect(_webViewPage, &WebViewPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl);
if (!useFlow2()) {
connect(_webViewPage, &WebViewPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl);
}
#endif // WITH_WEBENGINE
connect(_advancedSetupPage, &OwncloudAdvancedSetupPage::createLocalAndRemoteFolders,
this, &OwncloudWizard::createLocalAndRemoteFolders);
Expand Down Expand Up @@ -237,8 +239,9 @@ void OwncloudWizard::successfulStep()

#ifdef WITH_WEBENGINE
case WizardCommon::Page_WebView:
if(!this->useFlow2())
_webViewPage->setConnected();
if (!this->useFlow2()) {
_webViewPage->setConnected();
}
break;
#endif // WITH_WEBENGINE

Expand Down Expand Up @@ -280,9 +283,9 @@ void OwncloudWizard::setAuthType(DetermineAuthTypeJob::AuthType type)
#ifdef WITH_WEBENGINE
} else if (type == DetermineAuthTypeJob::WebViewFlow) {
if(this->useFlow2()) {
_credentialsPage = _flow2CredsPage;
_credentialsPage = _flow2CredsPage;
} else {
_credentialsPage = _webViewPage;
_credentialsPage = _webViewPage;
}
#endif // WITH_WEBENGINE
} else { // try Basic auth even for "Unknown"
Expand Down
7 changes: 5 additions & 2 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,13 @@ void ConfigFile::setMoveToTrash(bool isChecked)
setValue(moveToTrashC, isChecked);
}

bool ConfigFile::forceLoginV2() const {
bool ConfigFile::forceLoginV2() const
{
return getValue(forceLoginV2C, QString(), false).toBool();
}
void ConfigFile::setForceLoginV2(bool isChecked) {

void ConfigFile::setForceLoginV2(bool isChecked)
{
setValue(forceLoginV2C, isChecked);
}

Expand Down
23 changes: 12 additions & 11 deletions src/libsync/networkjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,8 @@ bool JsonApiJob::finished()
DetermineAuthTypeJob::DetermineAuthTypeJob(AccountPtr account, QObject *parent)
: QObject(parent)
, _account(account)

{
useFlow2 = ConfigFile().forceLoginV2();
useFlow2 = ConfigFile().forceLoginV2();
}

void DetermineAuthTypeJob::start()
Expand Down Expand Up @@ -1080,11 +1079,11 @@ void DetermineAuthTypeJob::start()
if (flow != QJsonValue::Undefined) {
if (flow.toInt() == 1) {
#ifdef WITH_WEBENGINE
if(!this->useFlow2) {
_resultOldFlow = WebViewFlow;
} else {
qCWarning(lcDetermineAuthTypeJob) << "Server only supports flow1, but this client was configured to only use flow2";
}
if(!this->useFlow2) {
_resultOldFlow = WebViewFlow;
} else {
qCWarning(lcDetermineAuthTypeJob) << "Server only supports flow1, but this client was configured to only use flow2";
}
#else // WITH_WEBENGINE
qCWarning(lcDetermineAuthTypeJob) << "Server does only support flow1, but this client was compiled without support for flow1";
#endif // WITH_WEBENGINE
Expand Down Expand Up @@ -1118,8 +1117,9 @@ void DetermineAuthTypeJob::checkAllDone()
// WebViewFlow > Basic
if (_account->serverVersionInt() >= Account::makeServerVersion(12, 0, 0)) {
result = WebViewFlow;
if(useFlow2)
result = LoginFlowV2;
if (useFlow2) {
result = LoginFlowV2;
}
}
#endif // WITH_WEBENGINE

Expand All @@ -1132,8 +1132,9 @@ void DetermineAuthTypeJob::checkAllDone()
// If we determined that we need the webview flow (GS for example) then we switch to that
if (_resultOldFlow == WebViewFlow) {
result = WebViewFlow;
if(useFlow2)
result = LoginFlowV2;
if (useFlow2) {
result = LoginFlowV2;
}
}
#endif // WITH_WEBENGINE

Expand Down

0 comments on commit e7c82fe

Please sign in to comment.