From d2d2df4c751ffec9f1ec26fbe144692f870b41d1 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 27 Nov 2017 21:06:38 +0100 Subject: [PATCH] [CSE] Try to find the webdav url of a folder. --- src/gui/accountsettings.cpp | 24 ++++++++++++++++++------ src/libsync/clientsideencryption.cpp | 7 +++++++ src/libsync/clientsideencryption.h | 3 ++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index bb0837f24b..6eb234393b 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -347,17 +347,29 @@ void AccountSettings::slotSubfolderContextMenuRequested(const QModelIndex& index if (!QFile::exists(fileName)) { ac->setEnabled(false); } - auto fileId = _model->data(index, FolderStatusModel::FileIdRole).toByteArray(); + auto info = _model->infoForIndex(index); + // jesus, nothing here returns me the webdav url + qDebug() << "path" << info->_folder->path(); + qDebug() << "remote" << info->_folder->remotePath(); + qDebug() << "clean" << info->_folder->cleanPath(); + qDebug() << "url" << info->_folder->remoteUrl(); + qDebug() << "info path" << info->_path; + qDebug() << "name" << info->_name; + qDebug() << _model->data(index, OCC::FolderStatusDelegate::FolderPathRole).toString(); + qDebug() << _model->data(index, OCC::FolderStatusDelegate::FolderSecondPathRole).toString(); + + auto acc = _accountState->account(); + acc->e2e()->printWebdavFolders(); + if (acc->capabilities().clientSideEncryptionAvaliable()) { - if (accountsState()->account()->capabilities().clientSideEncryptionAvaliable()) { ac = menu.addAction(tr("Encrypt")); - connect(ac, &QAction::triggered, [this, &fileId] { - slotMarkSubfolderEncrpted(fileId); + connect(ac, &QAction::triggered, [this, &info] { + slotMarkSubfolderEncrpted(info->_fileId); }); ac = menu.addAction(tr("Decrypt")); - connect(ac, &QAction::triggered, [this, &fileId] { - slotMarkSubfolderDecrypted(fileId); + connect(ac, &QAction::triggered, [this, &info] { + slotMarkSubfolderDecrypted(info->_fileId); }); } menu.exec(QCursor::pos()); diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 8939e0985b..fedf2eb46f 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -653,6 +653,7 @@ void ClientSideEncryption::fetchFolderEncryptedStatus() { void ClientSideEncryption::folderEncryptedStatusFetched(const QMap& result) { _refreshingEncryptionStatus = false; + _folder2encryptedStatus = result; qDebug() << "Retrieved correctly the encrypted status of the folders." << result; } @@ -1220,4 +1221,10 @@ bool GetFolderEncryptStatus::finished() return true; } +void ClientSideEncryption::printWebdavFolders() +{ + for(const auto folder : _folder2encryptedStatus.keys()) { + qDebug() << folder << _folder2encryptedStatus[folder]; + } +} } diff --git a/src/libsync/clientsideencryption.h b/src/libsync/clientsideencryption.h index 3a648cce75..34b139d933 100644 --- a/src/libsync/clientsideencryption.h +++ b/src/libsync/clientsideencryption.h @@ -49,6 +49,7 @@ public: // (as it makes sense, but it increase the chance // of conflicts). void fetchFolderEncryptedStatus(); + void printWebdavFolders(); private slots: void folderEncryptedStatusFetched(const QMap &values); @@ -71,7 +72,7 @@ private: bool _refreshingEncryptionStatus = false; //TODO: Save this on disk. QMap _folder2token; - QMap _folder2encryptedStatus; + QMap _folder2encryptedStatus; QSslKey _privateKey; QSslCertificate _certificate;