Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Jyrki Gadinger <[email protected]>
  • Loading branch information
nilsding committed Feb 14, 2025
1 parent 2a3bdd5 commit 70f1ff1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/gui/connectionvalidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,20 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply)
stat = CredentialsWrong;

} else if (reply->error() != QNetworkReply::NoError) {
_errors << job->errorStringParsingBody();
QByteArray body;

Check warning on line 224 in src/gui/connectionvalidator.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/connectionvalidator.cpp:224:20 [cppcoreguidelines-init-variables]

variable 'body' is not initialized
_errors << job->errorStringParsingBody(&body);

const int httpStatus =
reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (httpStatus == 503) {
_errors.clear();
stat = ServiceUnavailable;
} else if (httpStatus == 403) {
const auto davException = job->errorStringParsingBodyException(body);
if (davException == QStringLiteral(R"(OCA\TermsOfService\TermsNotSignedException)")) {
qCInfo(lcConnectionValidator) << "The terms of service need to be signed";
stat = NeedToSignTermsOfService;
}
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

namespace OCC {

const auto termsNotSignedExceptionC = QStringLiteral("OCA\\TermsOfService\\TermsNotSignedException");

OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent)
: QObject(parent)
, _ocWizard(new OwncloudWizard)
Expand Down Expand Up @@ -431,8 +429,9 @@ void OwncloudSetupWizard::slotAuthError()
errorMsg = tr("Access forbidden by server. To verify that you have proper access, "
"<a href=\"%1\">click here</a> to access the service with your browser.")
.arg(Utility::escape(_ocWizard->account()->url().toString()));
} else if (!davException.first.isEmpty() && davException.first == termsNotSignedExceptionC) {
} else if (!davException.first.isEmpty() && davException.first == QStringLiteral(R"(OCA\TermsOfService\TermsNotSignedException)")) {
qCInfo(lcWizard) << "Terms of service not accepted yet!";
// TODO: it would be cool to display a new wizard page containing the terms of service
errorMsg = tr("Please accept the <a href=\"%1\">Terms of Service</a> with your browser and try again.")
.arg(Utility::escape(_ocWizard->account()->url().toString()));
} else {
Expand Down
10 changes: 10 additions & 0 deletions src/gui/tray/syncstatussummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "syncstatussummary.h"
#include "accountfwd.h"
#include "accountstate.h"
#include "folderman.h"
#include "navigationpanehelper.h"
#include "networkjobs.h"
Expand Down Expand Up @@ -124,6 +125,10 @@ void SyncStatusSummary::setSyncStateForFolder(const Folder *folder)
setTotalFiles(0);
setSyncStatusString(tr("Offline"));
setSyncStatusDetailString("");
if (_accountState->state() == AccountState::NeedToSignTermsOfService)
{
setSyncStatusDetailString(tr("You need to accept the terms of service"));
}
setSyncIcon(Theme::instance()->folderOffline());
return;
}
Expand Down Expand Up @@ -340,6 +345,11 @@ void SyncStatusSummary::setSyncStateToConnectedState()
setSyncStatusDetailString("");
if (_accountState && !_accountState->isConnected()) {
setSyncStatusString(tr("Offline"));
// TODO: remove this, this is intentionally in caps to see that this is temporary
if (_accountState->state() == AccountState::NeedToSignTermsOfService)
{
setSyncStatusDetailString(tr("NEEDS TOS <a href=\"%1\">click here</a>").arg(_accountState->account()->url().toString()));
}
setSyncIcon(Theme::instance()->folderOffline());
} else {
setSyncStatusString(tr("All synced!"));
Expand Down

0 comments on commit 70f1ff1

Please sign in to comment.