From: Kevin Ottens Date: Tue, 30 Jun 2020 16:18:06 +0000 (+0200) Subject: Reduce interaction with e2ee folders when in the wizard X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~125^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=542d303313201f14fba570afd61102b6f26f71c2;p=nextcloud-desktop.git Reduce interaction with e2ee folders when in the wizard During the wizard we currently don't have much information about the encrypted folders. In particular we can only display their mangled names which is far from ideal for the user to make an informed choice. That's why in the wizard we now forbid creation of subfolders in e2ee folders and we also don't display subfolders of e2ee folders. Signed-off-by: Kevin Ottens --- diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 6e1ca4790..ee315d82e 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -319,6 +319,13 @@ void FolderWizardRemotePath::slotUpdateDirectories(const QStringList &list) Utility::sortFilenames(sortedList); foreach (QString path, sortedList) { path.remove(webdavFolder); + + // Don't allow to select subfolders of encrypted subfolders + if (_account->capabilities().clientSideEncryptionAvailable() && + _account->e2e()->isAnyParentFolderEncrypted(path)) { + continue; + } + QStringList paths = path.split('/'); if (paths.last().isEmpty()) paths.removeLast(); @@ -344,6 +351,12 @@ void FolderWizardRemotePath::slotCurrentItemChanged(QTreeWidgetItem *item) { if (item) { QString dir = item->data(0, Qt::UserRole).toString(); + + // We don't want to allow creating subfolders in encrypted folders outside of the sync logic + const auto encrypted = _account->capabilities().clientSideEncryptionAvailable() && + _account->e2e()->isFolderEncrypted(dir + '/'); + _ui.addFolderButton->setEnabled(!encrypted); + if (!dir.startsWith(QLatin1Char('/'))) { dir.prepend(QLatin1Char('/')); } diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index b30258317..42e69799b 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -248,6 +248,13 @@ void SelectiveSyncWidget::slotUpdateDirectories(QStringList list) foreach (QString path, list) { auto size = job ? job->_folderInfos[path].size : 0; path.remove(pathToRemove); + + // Don't allow to select subfolders of encrypted subfolders + if (_account->capabilities().clientSideEncryptionAvailable() && + _account->e2e()->isAnyParentFolderEncrypted(_rootName + '/' + path)) { + continue; + } + QStringList paths = path.split('/'); if (paths.last().isEmpty()) paths.removeLast();