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 #include #include -#include -#include #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 diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index 667e4c82b..9a8e81353 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -16,6 +16,7 @@ #include #include +#include #include "cfapiwrapper.h" #include "hydrationjob.h" @@ -308,6 +309,17 @@ void VfsCfApi::requestHydration(const QString &requestId, const QString &path) // of the placeholder with decrypted data if (record._isE2eEncrypted || !record._e2eMangledName.isEmpty()) { qCInfo(lcCfApi) << "Couldn't hydrate, the file is E2EE this is not supported"; + + QMessageBox e2eeFileDownloadRequestWarningMsgBox; + e2eeFileDownloadRequestWarningMsgBox.setText(tr("Download of End-to-End encrypted file failed")); + e2eeFileDownloadRequestWarningMsgBox.setInformativeText(tr("It seems that you are trying to download a virtual file that" + " is End-to-End encrypted. Implicitly downloading such files is not" + " supported at the moment. To workaround this issue, go to the" + " settings and mark the encrypted folder with \"Make always available" + " locally\".")); + e2eeFileDownloadRequestWarningMsgBox.setIcon(QMessageBox::Warning); + e2eeFileDownloadRequestWarningMsgBox.exec(); + emit hydrationRequestFailed(requestId); return; }