[CSE] Try to find the webdav url of a folder.

This commit is contained in:
Tomaz Canabrava 2017-11-27 21:06:38 +01:00
parent ffb9f69cf6
commit d2d2df4c75
3 changed files with 27 additions and 7 deletions

View File

@ -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());

View File

@ -653,6 +653,7 @@ void ClientSideEncryption::fetchFolderEncryptedStatus() {
void ClientSideEncryption::folderEncryptedStatusFetched(const QMap<QString, bool>& 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];
}
}
}

View File

@ -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<QString, bool> &values);
@ -71,7 +72,7 @@ private:
bool _refreshingEncryptionStatus = false;
//TODO: Save this on disk.
QMap<QByteArray, QByteArray> _folder2token;
QMap<QByteArray, bool> _folder2encryptedStatus;
QMap<QString, bool> _folder2encryptedStatus;
QSslKey _privateKey;
QSslCertificate _certificate;