From c0e0bc1e48abf5314f7713ea25112a29a0ca5d63 Mon Sep 17 00:00:00 2001 From: Ben Kluwe Date: Thu, 11 Apr 2024 08:37:48 +0200 Subject: [PATCH] ui: added checkbox and associated logic for recursing into groups --- src/keeshare/KeeShareSettings.h | 1 + src/keeshare/ShareExport.cpp | 4 +++- src/keeshare/group/EditGroupWidgetKeeShare.cpp | 12 ++++++++++++ src/keeshare/group/EditGroupWidgetKeeShare.h | 1 + src/keeshare/group/EditGroupWidgetKeeShare.ui | 11 +++++++++-- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/keeshare/KeeShareSettings.h b/src/keeshare/KeeShareSettings.h index b81dc15af..c8ee73d67 100644 --- a/src/keeshare/KeeShareSettings.h +++ b/src/keeshare/KeeShareSettings.h @@ -126,6 +126,7 @@ namespace KeeShareSettings QUuid uuid; QString path; QString password; + bool recurse; Reference(); bool isNull() const; diff --git a/src/keeshare/ShareExport.cpp b/src/keeshare/ShareExport.cpp index d9615f443..98c5ddf59 100644 --- a/src/keeshare/ShareExport.cpp +++ b/src/keeshare/ShareExport.cpp @@ -110,7 +110,9 @@ namespace targetRoot->setUpdateTimeinfo(updateTimeinfo); cloneIcon(targetMetadata, sourceRoot->database(), targetRoot->iconUuid()); cloneEntries(targetMetadata, sourceRoot, targetRoot); - cloneChildren(targetMetadata, sourceRoot, targetRoot); + if(reference.recurse) { + cloneChildren(targetMetadata, sourceRoot, targetRoot); + } auto key = QSharedPointer::create(); key->addKey(QSharedPointer::create(reference.password)); diff --git a/src/keeshare/group/EditGroupWidgetKeeShare.cpp b/src/keeshare/group/EditGroupWidgetKeeShare.cpp index 82f8dd1c0..39da44e1f 100644 --- a/src/keeshare/group/EditGroupWidgetKeeShare.cpp +++ b/src/keeshare/group/EditGroupWidgetKeeShare.cpp @@ -43,6 +43,7 @@ EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent) connect(m_ui->pathEdit, SIGNAL(editingFinished()), SLOT(selectPath())); connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog())); connect(m_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(selectType())); + connect(m_ui->recurseIntoGroupsCheckbox, SIGNAL(toggled(bool)), SLOT(recurseIntoGroupsToggled(bool))); connect(m_ui->clearButton, SIGNAL(clicked(bool)), SLOT(clearInputs())); connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(updateSharingState())); @@ -97,6 +98,7 @@ void EditGroupWidgetKeeShare::updateSharingState() m_ui->pathEdit->setEnabled(isEnabled); m_ui->pathSelectionButton->setEnabled(isEnabled); m_ui->passwordEdit->setEnabled(isEnabled); + m_ui->recurseIntoGroupsCheckbox->setEnabled(isEnabled); if (!m_temporaryGroup || !isEnabled) { m_ui->messageWidget->hideMessage(); @@ -291,3 +293,13 @@ void EditGroupWidgetKeeShare::selectType() updateSharingState(); } + +void EditGroupWidgetKeeShare::recurseIntoGroupsToggled(bool toggled) +{ + if (!m_temporaryGroup) { + return; + } + auto reference = KeeShare::referenceOf(m_temporaryGroup); + reference.recurse = toggled; + KeeShare::setReferenceTo(m_temporaryGroup, reference); +} diff --git a/src/keeshare/group/EditGroupWidgetKeeShare.h b/src/keeshare/group/EditGroupWidgetKeeShare.h index aaa3ebbd3..3e403b1e3 100644 --- a/src/keeshare/group/EditGroupWidgetKeeShare.h +++ b/src/keeshare/group/EditGroupWidgetKeeShare.h @@ -48,6 +48,7 @@ private slots: void selectPassword(); void launchPathSelectionDialog(); void selectPath(); + void recurseIntoGroupsToggled(bool); private: QScopedPointer m_ui; diff --git a/src/keeshare/group/EditGroupWidgetKeeShare.ui b/src/keeshare/group/EditGroupWidgetKeeShare.ui index 857ba61c8..921b1f002 100644 --- a/src/keeshare/group/EditGroupWidgetKeeShare.ui +++ b/src/keeshare/group/EditGroupWidgetKeeShare.ui @@ -138,7 +138,7 @@ - + @@ -171,7 +171,7 @@ - + Qt::Vertical @@ -184,6 +184,13 @@ + + + + Share recursively + + +