only add Encrypt context menu entry for top folder in settings dialog
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 2 Sep 2024 14:18:44 +0000 (16:18 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 3 Sep 2024 07:25:50 +0000 (07:25 +0000)
will omit Encrypt menu item for child fodlers as displayed in selective
sync folders tree in settings dialog

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/accountsettings.cpp

index 15498d5629f5bfe49f68b58beb68be78215be361..6446876cd0f194461c1ffc6d7c21eb8cffe8de9b 100644 (file)
@@ -584,8 +584,9 @@ void AccountSettings::slotSubfolderContextMenuRequested(const QModelIndex& index
 
         const auto isEncrypted = info->isEncrypted();
         const auto isParentEncrypted = _model->isAnyAncestorEncrypted(index);
+        const auto isTopFolder = index.parent().isValid() && !index.parent().parent().isValid();
 
-        if (!isEncrypted && !isParentEncrypted) {
+        if (!isEncrypted && !isParentEncrypted && isTopFolder) {
             ac = menu.addAction(tr("Encrypt"));
             connect(ac, &QAction::triggered, [this, info] { slotMarkSubfolderEncrypted(info); });
         } else {