diff options
author | Felix Weilbach <felix.weilbach@nextcloud.com> | 2021-04-22 15:21:49 +0300 |
---|---|---|
committer | Matthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr> | 2021-05-18 14:50:18 +0300 |
commit | 32b7e6235961f5ba0ac80cfab3b1ef784896a718 (patch) | |
tree | 7b707b28234fb5dda8bf4da9d192b7944db5c2fb /src/gui/accountsettings.cpp | |
parent | 701e106aa382bc65b9ab6963525fb1d4b7e88dcf (diff) |
Warn user if using e2ee and vfs together
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Diffstat (limited to 'src/gui/accountsettings.cpp')
-rw-r--r-- | src/gui/accountsettings.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 5f5ae3e0f..fc8ca8262 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -55,8 +55,6 @@ #include <QVariant> #include <QJsonDocument> #include <QToolTip> -#include <qstringlistmodel.h> -#include <qpropertyanimation.h> #include "account.h" @@ -66,6 +64,8 @@ constexpr auto propertyFolderInfo = "folderInfo"; namespace OCC { +class AccountSettings; + Q_LOGGING_CATEGORY(lcAccountSettings, "nextcloud.gui.account.settings", QtInfoMsg) static const char progressBarStyleC[] = @@ -78,6 +78,24 @@ static const char progressBarStyleC[] = "background-color: %1; width: 1px;" "}"; +bool showEnableE2eeWithVirtualFilesWarningDialog() +{ + QMessageBox e2eeWithVirtualFilesWarningMsgBox; + e2eeWithVirtualFilesWarningMsgBox.setText(AccountSettings::tr("End-to-End Encryption with Virtual Files")); + e2eeWithVirtualFilesWarningMsgBox.setInformativeText(AccountSettings::tr("You seem to have the Virtual Files feature enabled on this folder. At " + " the moment, it is not possible to implicitly download virtual files that are " + "End-to-End encrypted. To get the best experience with Virtual Files and" + " End-to-End Encryption, make sure the encrypted folder is marked with" + " \"Make always available locally\".")); + e2eeWithVirtualFilesWarningMsgBox.setIcon(QMessageBox::Warning); + const auto dontEncryptButton = e2eeWithVirtualFilesWarningMsgBox.button(QMessageBox::StandardButton::Ok); + const auto encryptButton = e2eeWithVirtualFilesWarningMsgBox.button(QMessageBox::StandardButton::Cancel); + dontEncryptButton->setText(AccountSettings::tr("Don't encrypt folder")); + encryptButton->setText(AccountSettings::tr("Encrypt folder")); + + return e2eeWithVirtualFilesWarningMsgBox.clickedButton() != dontEncryptButton; +} + /** * Adjusts the mouse cursor based on the region it is on over the folder tree view. * @@ -315,6 +333,14 @@ void AccountSettings::slotMarkSubfolderEncrypted(FolderStatusModel::SubFolderInf return; } + const auto folder = folderInfo->_folder; + Q_ASSERT(folder); + if (folder->virtualFilesEnabled() + && folder->vfs().mode() == Vfs::WindowsCfApi + && !showEnableE2eeWithVirtualFilesWarningDialog()) { + return; + } + // Folder info have directory paths in Foo/Bar/ convention... Q_ASSERT(!folderInfo->_path.startsWith('/') && folderInfo->_path.endsWith('/')); // But EncryptFolderJob expects directory path Foo/Bar convention |