From e6f835d138a4a9734209106bdd07f3156393ab90 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 12 Dec 2017 11:26:54 +0100 Subject: [PATCH] [CSE] Unlock the folder after a lock This makes sure the folder will be unlocked for next tests --- src/libsync/propagateupload.cpp | 14 ++++++++++++++ src/libsync/propagateupload.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index f8eab1392..f735e1a6d 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -290,6 +290,20 @@ void PropagateUploadFileCommon::slotFolderLockedSuccessfully(const QByteArray& f void PropagateUploadFileCommon::slotFolderEncriptedMetadataReceived(const QJsonDocument &json, int statusCode) { qDebug() << "Metadata Received" << json.toVariant(); + auto *unlockJob = new UnlockEncryptFolderApiJob(propagator()->account(), _folderId, _folderToken, this); + connect(unlockJob, &UnlockEncryptFolderApiJob::success, this, &PropagateUploadFileCommon::slotUnlockEncryptedFolderSuccess); + connect(unlockJob, &UnlockEncryptFolderApiJob::error, this, &PropagateUploadFileCommon::slotUnlockEncryptedFolderError); + unlockJob->start(); +} + +void PropagateUploadFileCommon::slotUnlockEncryptedFolderSuccess(const QByteArray& fileId) +{ + qDebug() << "Unlock Job worked for folder " << fileId; +} + +void PropagateUploadFileCommon::slotUnlockEncryptedFolderError(const QByteArray& fileId, int httpStatusCode) +{ + qDebug() << "There was an error unlocking " << fileId << httpStatusCode; } void PropagateUploadFileCommon::slotFolderLockedError(const QByteArray& fileId, int httpErrorCode) diff --git a/src/libsync/propagateupload.h b/src/libsync/propagateupload.h index 2dbc14416..e7cb2626d 100644 --- a/src/libsync/propagateupload.h +++ b/src/libsync/propagateupload.h @@ -287,7 +287,8 @@ private slots: void slotFolderLockedError(const QByteArray& fileId, int httpErrorCode); void slotTryLock(const QByteArray& fileId); void slotFolderEncriptedMetadataReceived(const QJsonDocument &json, int statusCode); - + void slotUnlockEncryptedFolderSuccess(const QByteArray& fileId); + void slotUnlockEncryptedFolderError(const QByteArray& fileId, int httpReturnCode); // Private Encryption Stuff private: QElapsedTimer _folderLockFirstTry;