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
parent 3224460c6d
commit c0e0bc1e48
5 changed files with 26 additions and 3 deletions

View File

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

View File

@ -110,7 +110,9 @@ namespace
targetRoot->setUpdateTimeinfo(updateTimeinfo); targetRoot->setUpdateTimeinfo(updateTimeinfo);
cloneIcon(targetMetadata, sourceRoot->database(), targetRoot->iconUuid()); cloneIcon(targetMetadata, sourceRoot->database(), targetRoot->iconUuid());
cloneEntries(targetMetadata, sourceRoot, targetRoot); cloneEntries(targetMetadata, sourceRoot, targetRoot);
if(reference.recurse) {
cloneChildren(targetMetadata, sourceRoot, targetRoot); cloneChildren(targetMetadata, sourceRoot, targetRoot);
}
auto key = QSharedPointer<CompositeKey>::create(); auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create(reference.password)); 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->pathEdit, SIGNAL(editingFinished()), SLOT(selectPath()));
connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog())); connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog()));
connect(m_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(selectType())); 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(m_ui->clearButton, SIGNAL(clicked(bool)), SLOT(clearInputs()));
connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(updateSharingState())); connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(updateSharingState()));
@ -97,6 +98,7 @@ void EditGroupWidgetKeeShare::updateSharingState()
m_ui->pathEdit->setEnabled(isEnabled); m_ui->pathEdit->setEnabled(isEnabled);
m_ui->pathSelectionButton->setEnabled(isEnabled); m_ui->pathSelectionButton->setEnabled(isEnabled);
m_ui->passwordEdit->setEnabled(isEnabled); m_ui->passwordEdit->setEnabled(isEnabled);
m_ui->recurseIntoGroupsCheckbox->setEnabled(isEnabled);
if (!m_temporaryGroup || !isEnabled) { if (!m_temporaryGroup || !isEnabled) {
m_ui->messageWidget->hideMessage(); m_ui->messageWidget->hideMessage();
@ -291,3 +293,13 @@ void EditGroupWidgetKeeShare::selectType()
updateSharingState(); 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 selectPassword();
void launchPathSelectionDialog(); void launchPathSelectionDialog();
void selectPath(); void selectPath();
void recurseIntoGroupsToggled(bool);
private: private:
QScopedPointer<Ui::EditGroupWidgetKeeShare> m_ui; QScopedPointer<Ui::EditGroupWidgetKeeShare> m_ui;

View File

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