mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Merge pull request #7406 from nextcloud/backport/7404/stable-3.14
[stable-3.14] improve again state tracking with terms of service app
This commit is contained in:
commit
95e5aed566
5 changed files with 25 additions and 16 deletions
|
@ -359,12 +359,7 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_lastConnectionValidatorStatus == ConnectionValidator::NeedToSignTermsOfService && status == ConnectionValidator::Connected) ||
|
const auto oldConnectionValidatorStatus = _lastConnectionValidatorStatus;
|
||||||
(status == ConnectionValidator::NeedToSignTermsOfService && _lastConnectionValidatorStatus != status)) {
|
|
||||||
|
|
||||||
emit termsOfServiceChanged(_account);
|
|
||||||
}
|
|
||||||
|
|
||||||
_lastConnectionValidatorStatus = status;
|
_lastConnectionValidatorStatus = status;
|
||||||
|
|
||||||
// Come online gradually from 503, captive portal(redirection) or maintenance mode
|
// Come online gradually from 503, captive portal(redirection) or maintenance mode
|
||||||
|
@ -449,6 +444,12 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
|
||||||
setState(NeedToSignTermsOfService);
|
setState(NeedToSignTermsOfService);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((oldConnectionValidatorStatus == ConnectionValidator::NeedToSignTermsOfService && status == ConnectionValidator::Connected) ||
|
||||||
|
(status == ConnectionValidator::NeedToSignTermsOfService && oldConnectionValidatorStatus != status)) {
|
||||||
|
|
||||||
|
emit termsOfServiceChanged(_account, status == ConnectionValidator::NeedToSignTermsOfService ? AccountState::NeedToSignTermsOfService : AccountState::Connected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountState::slotHandleRemoteWipeCheck()
|
void AccountState::slotHandleRemoteWipeCheck()
|
||||||
|
|
|
@ -195,7 +195,7 @@ signals:
|
||||||
void hasFetchedNavigationApps();
|
void hasFetchedNavigationApps();
|
||||||
void statusChanged();
|
void statusChanged();
|
||||||
void desktopNotificationsAllowedChanged();
|
void desktopNotificationsAllowedChanged();
|
||||||
void termsOfServiceChanged(OCC::AccountPtr account);
|
void termsOfServiceChanged(OCC::AccountPtr account, AccountState::State state);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void slotConnectionValidatorResult(OCC::ConnectionValidator::Status status, const QStringList &errors);
|
void slotConnectionValidatorResult(OCC::ConnectionValidator::Status status, const QStringList &errors);
|
||||||
|
|
|
@ -378,25 +378,29 @@ void TermsOfServiceChecker::start()
|
||||||
|
|
||||||
void TermsOfServiceChecker::slotServerTermsOfServiceRecieved(const QJsonDocument &reply)
|
void TermsOfServiceChecker::slotServerTermsOfServiceRecieved(const QJsonDocument &reply)
|
||||||
{
|
{
|
||||||
qCDebug(lcConnectionValidator) << "Terms of service status" << reply;
|
qCInfo(lcConnectionValidator) << "Terms of service status" << reply;
|
||||||
|
|
||||||
if (reply.object().contains("ocs")) {
|
if (reply.object().contains("ocs")) {
|
||||||
const auto needToSign = !reply.object().value("ocs").toObject().value("data").toObject().value("hasSigned").toBool(false);
|
const auto needToSign = !reply.object().value("ocs").toObject().value("data").toObject().value("hasSigned").toBool(false);
|
||||||
if (needToSign != _needToSign) {
|
if (needToSign != _needToSign) {
|
||||||
|
qCInfo(lcConnectionValidator) << "_needToSign" << (_needToSign ? "need to sign" : "no need to sign");
|
||||||
_needToSign = needToSign;
|
_needToSign = needToSign;
|
||||||
emit needToSignChanged();
|
emit needToSignChanged();
|
||||||
}
|
}
|
||||||
} else if (_needToSign) {
|
} else if (_needToSign) {
|
||||||
_needToSign = false;
|
_needToSign = false;
|
||||||
|
qCInfo(lcConnectionValidator) << "_needToSign" << (_needToSign ? "need to sign" : "no need to sign");
|
||||||
emit needToSignChanged();
|
emit needToSignChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCInfo(lcConnectionValidator) << "done";
|
||||||
emit done();
|
emit done();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TermsOfServiceChecker::checkServerTermsOfService()
|
void TermsOfServiceChecker::checkServerTermsOfService()
|
||||||
{
|
{
|
||||||
if (!_account) {
|
if (!_account) {
|
||||||
|
qCInfo(lcConnectionValidator) << "done";
|
||||||
emit done();
|
emit done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,14 +285,17 @@ void ownCloudGui::slotTrayMessageIfServerUnsupported(Account *account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ownCloudGui::slotNeedToAcceptTermsOfService(OCC::AccountPtr account)
|
void ownCloudGui::slotNeedToAcceptTermsOfService(OCC::AccountPtr account,
|
||||||
|
AccountState::State state)
|
||||||
{
|
{
|
||||||
slotShowTrayMessage(
|
if (state == AccountState::NeedToSignTermsOfService) {
|
||||||
tr("Terms of service"),
|
slotShowTrayMessage(
|
||||||
tr("Your account %1 requires you to accept the terms of service of your server. "
|
tr("Terms of service"),
|
||||||
"You will be redirected to %2 to acknowledge that you have read it and agrees with it.")
|
tr("Your account %1 requires you to accept the terms of service of your server. "
|
||||||
.arg(account->displayName(), account->url().toString()));
|
"You will be redirected to %2 to acknowledge that you have read it and agrees with it.")
|
||||||
QDesktopServices::openUrl(account->url());
|
.arg(account->displayName(), account->url().toString()));
|
||||||
|
QDesktopServices::openUrl(account->url());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ownCloudGui::slotComputeOverallSyncStatus()
|
void ownCloudGui::slotComputeOverallSyncStatus()
|
||||||
|
|
|
@ -94,7 +94,8 @@ public slots:
|
||||||
void slotOpenPath(const QString &path);
|
void slotOpenPath(const QString &path);
|
||||||
void slotAccountStateChanged();
|
void slotAccountStateChanged();
|
||||||
void slotTrayMessageIfServerUnsupported(OCC::Account *account);
|
void slotTrayMessageIfServerUnsupported(OCC::Account *account);
|
||||||
void slotNeedToAcceptTermsOfService(OCC::AccountPtr account);
|
void slotNeedToAcceptTermsOfService(OCC::AccountPtr account,
|
||||||
|
OCC::AccountState::State state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a share dialog for a file or folder.
|
* Open a share dialog for a file or folder.
|
||||||
|
|
Loading…
Reference in a new issue