mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-13 07:34:52 +03:00
[CSE] Pass the folder to the GetEncryptionStatus
Sometimes we are only interested in folders.
This commit is contained in:
parent
66aecb9626
commit
863e86138f
3 changed files with 13 additions and 6 deletions
|
@ -984,7 +984,7 @@ void ClientSideEncryption::getPublicKeyFromServer()
|
||||||
|
|
||||||
void ClientSideEncryption::fetchFolderEncryptedStatus() {
|
void ClientSideEncryption::fetchFolderEncryptedStatus() {
|
||||||
_refreshingEncryptionStatus = true;
|
_refreshingEncryptionStatus = true;
|
||||||
auto getEncryptedStatus = new GetFolderEncryptStatus(_account);
|
auto getEncryptedStatus = new GetFolderEncryptStatus(_account, QString());
|
||||||
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusReceived,
|
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusReceived,
|
||||||
this, &ClientSideEncryption::folderEncryptedStatusFetched);
|
this, &ClientSideEncryption::folderEncryptedStatusFetched);
|
||||||
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusError,
|
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusError,
|
||||||
|
@ -1483,8 +1483,8 @@ bool GetMetadataApiJob::finished()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetFolderEncryptStatus::GetFolderEncryptStatus(const AccountPtr& account, QObject *parent)
|
GetFolderEncryptStatus::GetFolderEncryptStatus(const AccountPtr& account, const QString& folder, QObject *parent)
|
||||||
: OCC::AbstractNetworkJob(account, QStringLiteral("remote.php/webdav"), parent)
|
: OCC::AbstractNetworkJob(account, QStringLiteral("remote.php/webdav"), parent), _folder(folder)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,7 +1499,8 @@ void GetFolderEncryptStatus::start()
|
||||||
QBuffer *buf = new QBuffer(this);
|
QBuffer *buf = new QBuffer(this);
|
||||||
buf->setData(xml);
|
buf->setData(xml);
|
||||||
buf->open(QIODevice::ReadOnly);
|
buf->open(QIODevice::ReadOnly);
|
||||||
sendRequest("PROPFIND", Utility::concatUrlPath(account()->url(), path()), req, buf);
|
QString tmpPath = path() + (!_folder.isEmpty() ? "/" + _folder : QString());
|
||||||
|
sendRequest("PROPFIND", Utility::concatUrlPath(account()->url(), tmpPath), req, buf);
|
||||||
|
|
||||||
AbstractNetworkJob::start();
|
AbstractNetworkJob::start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,7 @@ class OWNCLOUDSYNC_EXPORT GetFolderEncryptStatus : public AbstractNetworkJob
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit GetFolderEncryptStatus (const AccountPtr &account, QObject *parent = 0);
|
explicit GetFolderEncryptStatus (const AccountPtr &account, const QString& folder, QObject *parent = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void start() override;
|
void start() override;
|
||||||
|
@ -352,6 +352,8 @@ protected:
|
||||||
signals:
|
signals:
|
||||||
void encryptStatusReceived(const QMap<QString, bool> folderMetadata2EncryptionStatus);
|
void encryptStatusReceived(const QMap<QString, bool> folderMetadata2EncryptionStatus);
|
||||||
void encryptStatusError(int statusCode);
|
void encryptStatusError(int statusCode);
|
||||||
|
private:
|
||||||
|
QString _folder;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OCC
|
} // namespace OCC
|
||||||
|
|
|
@ -192,7 +192,11 @@ void PropagateUploadFileCommon::start()
|
||||||
*
|
*
|
||||||
* If the folder is unencrypted we just follow the old way.
|
* If the folder is unencrypted we just follow the old way.
|
||||||
*/
|
*/
|
||||||
auto getEncryptedStatus = new GetFolderEncryptStatus(propagator()->account());
|
QFileInfo info(_item->_file);
|
||||||
|
|
||||||
|
auto getEncryptedStatus = new GetFolderEncryptStatus(propagator()->account(),
|
||||||
|
info.path());
|
||||||
|
|
||||||
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusReceived,
|
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusReceived,
|
||||||
this, &PropagateUploadFileCommon::slotFolderEncryptedStatusFetched);
|
this, &PropagateUploadFileCommon::slotFolderEncryptedStatusFetched);
|
||||||
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusError,
|
connect(getEncryptedStatus, &GetFolderEncryptStatus::encryptStatusError,
|
||||||
|
|
Loading…
Reference in a new issue