mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
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:
parent
d70a388511
commit
744ac540db
2 changed files with 28 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue