mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Do not send account details to File Provider extension through socket controller if account not ready
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
d6126f477f
commit
6d1fe0b4f7
2 changed files with 35 additions and 0 deletions
|
@ -135,11 +135,44 @@ void FileProviderSocketController::requestFileProviderDomainInfo() const
|
|||
sendMessage(requestMessage);
|
||||
}
|
||||
|
||||
void FileProviderSocketController::slotAccountStateChanged(const AccountState::State state)
|
||||
{
|
||||
switch(state) {
|
||||
case AccountState::Disconnected:
|
||||
case AccountState::ConfigurationError:
|
||||
case AccountState::NetworkError:
|
||||
case AccountState::ServiceUnavailable:
|
||||
case AccountState::MaintenanceMode:
|
||||
// Do nothing, File Provider will by itself figure out connection issue
|
||||
break;
|
||||
case AccountState::SignedOut:
|
||||
case AccountState::AskingCredentials:
|
||||
// Notify File Provider that it should show the not authenticated message
|
||||
break;
|
||||
case AccountState::Connected:
|
||||
// Provide credentials
|
||||
sendAccountDetails();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FileProviderSocketController::sendAccountDetails() const
|
||||
{
|
||||
Q_ASSERT(_accountState);
|
||||
const auto account = _accountState->account();
|
||||
Q_ASSERT(account);
|
||||
|
||||
qCDebug(lcFileProviderSocketController) << "About to send account details to file provider extension"
|
||||
<< account->displayName();
|
||||
|
||||
connect(_accountState.data(), &AccountState::stateChanged, this, &FileProviderSocketController::slotAccountStateChanged);
|
||||
|
||||
if (!_accountState->isConnected()) {
|
||||
qCDebug(lcFileProviderSocketController) << "Not sending account details yet as account is not connected"
|
||||
<< account->displayName();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto credentials = account->credentials();
|
||||
Q_ASSERT(credentials);
|
||||
const auto accountUser = credentials->user();
|
||||
|
|
|
@ -43,6 +43,8 @@ private slots:
|
|||
void slotSocketDestroyed(const QObject * const object);
|
||||
void slotReadyRead();
|
||||
|
||||
void slotAccountStateChanged(const AccountState::State state);
|
||||
|
||||
void parseReceivedLine(const QString &receivedLine);
|
||||
void requestFileProviderDomainInfo() const;
|
||||
void sendAccountDetails() const;
|
||||
|
|
Loading…
Reference in a new issue