mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
Merge pull request #3183 from nextcloud/bugfix/warn-if-e2ee-with-vfs
Warn user if using e2ee and vfs together
This commit is contained in:
commit
79e6459bd1
2 changed files with 40 additions and 2 deletions
|
@ -55,8 +55,6 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <qstringlistmodel.h>
|
|
||||||
#include <qpropertyanimation.h>
|
|
||||||
|
|
||||||
#include "account.h"
|
#include "account.h"
|
||||||
|
|
||||||
|
@ -66,6 +64,8 @@ constexpr auto propertyFolderInfo = "folderInfo";
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
|
class AccountSettings;
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcAccountSettings, "nextcloud.gui.account.settings", QtInfoMsg)
|
Q_LOGGING_CATEGORY(lcAccountSettings, "nextcloud.gui.account.settings", QtInfoMsg)
|
||||||
|
|
||||||
static const char progressBarStyleC[] =
|
static const char progressBarStyleC[] =
|
||||||
|
@ -78,6 +78,24 @@ static const char progressBarStyleC[] =
|
||||||
"background-color: %1; width: 1px;"
|
"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.
|
* 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;
|
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...
|
// Folder info have directory paths in Foo/Bar/ convention...
|
||||||
Q_ASSERT(!folderInfo->_path.startsWith('/') && folderInfo->_path.endsWith('/'));
|
Q_ASSERT(!folderInfo->_path.startsWith('/') && folderInfo->_path.endsWith('/'));
|
||||||
// But EncryptFolderJob expects directory path Foo/Bar convention
|
// But EncryptFolderJob expects directory path Foo/Bar convention
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "cfapiwrapper.h"
|
#include "cfapiwrapper.h"
|
||||||
#include "hydrationjob.h"
|
#include "hydrationjob.h"
|
||||||
|
@ -308,6 +309,17 @@ void VfsCfApi::requestHydration(const QString &requestId, const QString &path)
|
||||||
// of the placeholder with decrypted data
|
// of the placeholder with decrypted data
|
||||||
if (record._isE2eEncrypted || !record._e2eMangledName.isEmpty()) {
|
if (record._isE2eEncrypted || !record._e2eMangledName.isEmpty()) {
|
||||||
qCInfo(lcCfApi) << "Couldn't hydrate, the file is E2EE this is not supported";
|
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);
|
emit hydrationRequestFailed(requestId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue