]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Add warning prior to folder encryption to prevent unknowing users from creating unrec...
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 11 Aug 2023 07:05:42 +0000 (15:05 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 23 Aug 2023 00:46:23 +0000 (08:46 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/accountsettings.cpp

index 7613595cd55df84f70e70a07d6284fd130c618ce..994fbe3c327ed49da30fc402be75af8f39192ec2 100644 (file)
@@ -109,6 +109,27 @@ void showEnableE2eeWithVirtualFilesWarningDialog(std::function<void(void)> onAcc
     messageBox->open();
 }
 
+void showEnableE2eeWarningDialog(std::function<void(void)> onAccept)
+{
+    const auto messageBox = new QMessageBox;
+    messageBox->setAttribute(Qt::WA_DeleteOnClose);
+    messageBox->setText(AccountSettings::tr("End-to-end Encryption"));
+    messageBox->setInformativeText(
+        AccountSettings::tr("This will encrypt your folder and all files within it. "
+                            "These files will no longer be accessible without your encryption mnemonic key. "
+                            "\n<b>This process is not reversible. Are you sure you want to proceed?</b>"));
+    messageBox->setIcon(QMessageBox::Warning);
+    const auto dontEncryptButton = messageBox->addButton(QMessageBox::StandardButton::Cancel);
+    Q_ASSERT(dontEncryptButton);
+    dontEncryptButton->setText(AccountSettings::tr("Do not encrypt folder"));
+    const auto encryptButton = messageBox->addButton(QMessageBox::StandardButton::Ok);
+    Q_ASSERT(encryptButton);
+    encryptButton->setText(AccountSettings::tr("Encrypt folder"));
+    QObject::connect(messageBox, &QMessageBox::accepted, onAccept);
+
+    messageBox->open();
+}
+
 /**
  * Adjusts the mouse cursor based on the region it is on over the folder tree view.
  *
@@ -415,7 +436,8 @@ void AccountSettings::slotMarkSubfolderEncrypted(FolderStatusModel::SubFolderInf
         showEnableE2eeWithVirtualFilesWarningDialog(encryptFolder);
         return;
     }
-    encryptFolder();
+
+    showEnableE2eeWarningDialog(encryptFolder);
 }
 
 void AccountSettings::slotEditCurrentIgnoredFiles()