зеркало из https://github.com/nextcloud/desktop.git
Add support for FILE_PROVIDER_DOMAIN_SYNC_STATE_CHANGE socket messages in client file provider socket controller
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Родитель
d70a388511
Коммит
744ac540db
|
@ -89,6 +89,9 @@ void FileProviderSocketController::parseReceivedLine(const QString &receivedLine
|
|||
_accountState = FileProviderDomainManager::accountStateFromFileProviderDomainIdentifier(argument);
|
||||
sendAccountDetails();
|
||||
return;
|
||||
} else if (command == "FILE_PROVIDER_DOMAIN_SYNC_STATE_CHANGE") {
|
||||
reportSyncState(argument);
|
||||
return;
|
||||
}
|
||||
|
||||
qCWarning(lcFileProviderSocketController) << "Unknown command or reply:" << receivedLine;
|
||||
|
@ -216,6 +219,24 @@ void FileProviderSocketController::sendAccountDetails() const
|
|||
sendMessage(message);
|
||||
}
|
||||
|
||||
void FileProviderSocketController::reportSyncState(const QString &receivedState) const
|
||||
{
|
||||
auto syncState = SyncResult::Status::Undefined;
|
||||
if (receivedState == QStringLiteral("SYNC_STARTED")) {
|
||||
syncState = SyncResult::Status::SyncRunning;
|
||||
} else if (receivedState == QStringLiteral("SYNC_FINISHED")) {
|
||||
syncState = SyncResult::Status::Success;
|
||||
} else if (receivedState == QStringLiteral("SYNC_FAILED")) {
|
||||
syncState = SyncResult::Status::Problem;
|
||||
} else if (receivedState == QStringLiteral("SYNC_PAUSED")) {
|
||||
syncState = SyncResult::Status::Paused;
|
||||
} else {
|
||||
qCWarning(lcFileProviderSocketController) << "Unknown sync state received:" << receivedState;
|
||||
}
|
||||
|
||||
emit syncStateChanged(_accountState->account(), syncState);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Mac
|
||||
|
||||
} // namespace OCC
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
#include <QPointer>
|
||||
|
||||
#include "accountstate.h"
|
||||
#include "gui/accountstate.h"
|
||||
#include "libsync/syncresult.h"
|
||||
|
||||
class QLocalSocket;
|
||||
|
||||
|
@ -32,7 +33,8 @@ public:
|
|||
explicit FileProviderSocketController(QLocalSocket * const socket, QObject * const parent = nullptr);
|
||||
|
||||
signals:
|
||||
void socketDestroyed(const QLocalSocket * const socket);
|
||||
void socketDestroyed(const QLocalSocket * const socket);signals:
|
||||
void syncStateChanged(const AccountPtr &account, SyncResult::Status state) const;
|
||||
|
||||
public slots:
|
||||
void sendMessage(const QString &message) const;
|
||||
|
@ -50,6 +52,8 @@ private slots:
|
|||
void sendAccountDetails() const;
|
||||
void sendNotAuthenticated() const;
|
||||
|
||||
void reportSyncState(const QString &receivedState) const;
|
||||
|
||||
private:
|
||||
QPointer<QLocalSocket> _socket;
|
||||
AccountStatePtr _accountState;
|
||||
|
|
Загрузка…
Ссылка в новой задаче