ui: added checkbox and associated logic for recursing into groups

This commit is contained in:
Ben Kluwe 2024-04-11 08:37:48 +02:00 committed by Jonathan White
parent e3d989db5f
commit acb2f6900d
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
5 changed files with 26 additions and 3 deletions

View File

@ -126,6 +126,7 @@ namespace KeeShareSettings
QUuid uuid;
QString path;
QString password;
bool recurse;
Reference();
bool isNull() const;

View File

@ -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<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create(reference.password));

View File

@ -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);
}

View File

@ -48,6 +48,7 @@ private slots:
void selectPassword();
void launchPathSelectionDialog();
void selectPath();
void recurseIntoGroupsToggled(bool);
private:
QScopedPointer<Ui::EditGroupWidgetKeeShare> m_ui;

View File

@ -138,7 +138,7 @@
</item>
</layout>
</item>
<item row="3" column="1">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
@ -171,7 +171,7 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="5" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -184,6 +184,13 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="recurseIntoGroupsCheckbox">
<property name="text">
<string>Share recursively</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>