Skip to content

Commit acb2f69

Browse files
BenKluwedroidmonkey
authored andcommitted
ui: added checkbox and associated logic for recursing into groups
1 parent e3d989d commit acb2f69

5 files changed

+26
-3
lines changed

src/keeshare/KeeShareSettings.h

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ namespace KeeShareSettings
126126
QUuid uuid;
127127
QString path;
128128
QString password;
129+
bool recurse;
129130

130131
Reference();
131132
bool isNull() const;

src/keeshare/ShareExport.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ namespace
110110
targetRoot->setUpdateTimeinfo(updateTimeinfo);
111111
cloneIcon(targetMetadata, sourceRoot->database(), targetRoot->iconUuid());
112112
cloneEntries(targetMetadata, sourceRoot, targetRoot);
113-
cloneChildren(targetMetadata, sourceRoot, targetRoot);
113+
if(reference.recurse) {
114+
cloneChildren(targetMetadata, sourceRoot, targetRoot);
115+
}
114116

115117
auto key = QSharedPointer<CompositeKey>::create();
116118
key->addKey(QSharedPointer<PasswordKey>::create(reference.password));

src/keeshare/group/EditGroupWidgetKeeShare.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent)
4343
connect(m_ui->pathEdit, SIGNAL(editingFinished()), SLOT(selectPath()));
4444
connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog()));
4545
connect(m_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(selectType()));
46+
connect(m_ui->recurseIntoGroupsCheckbox, SIGNAL(toggled(bool)), SLOT(recurseIntoGroupsToggled(bool)));
4647
connect(m_ui->clearButton, SIGNAL(clicked(bool)), SLOT(clearInputs()));
4748

4849
connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(updateSharingState()));
@@ -97,6 +98,7 @@ void EditGroupWidgetKeeShare::updateSharingState()
9798
m_ui->pathEdit->setEnabled(isEnabled);
9899
m_ui->pathSelectionButton->setEnabled(isEnabled);
99100
m_ui->passwordEdit->setEnabled(isEnabled);
101+
m_ui->recurseIntoGroupsCheckbox->setEnabled(isEnabled);
100102

101103
if (!m_temporaryGroup || !isEnabled) {
102104
m_ui->messageWidget->hideMessage();
@@ -291,3 +293,13 @@ void EditGroupWidgetKeeShare::selectType()
291293

292294
updateSharingState();
293295
}
296+
297+
void EditGroupWidgetKeeShare::recurseIntoGroupsToggled(bool toggled)
298+
{
299+
if (!m_temporaryGroup) {
300+
return;
301+
}
302+
auto reference = KeeShare::referenceOf(m_temporaryGroup);
303+
reference.recurse = toggled;
304+
KeeShare::setReferenceTo(m_temporaryGroup, reference);
305+
}

src/keeshare/group/EditGroupWidgetKeeShare.h

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ private slots:
4848
void selectPassword();
4949
void launchPathSelectionDialog();
5050
void selectPath();
51+
void recurseIntoGroupsToggled(bool);
5152

5253
private:
5354
QScopedPointer<Ui::EditGroupWidgetKeeShare> m_ui;

src/keeshare/group/EditGroupWidgetKeeShare.ui

+9-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
</item>
139139
</layout>
140140
</item>
141-
<item row="3" column="1">
141+
<item row="4" column="1">
142142
<layout class="QHBoxLayout" name="horizontalLayout">
143143
<item>
144144
<spacer name="horizontalSpacer">
@@ -171,7 +171,7 @@
171171
</item>
172172
</layout>
173173
</item>
174-
<item row="4" column="0">
174+
<item row="5" column="0">
175175
<spacer name="verticalSpacer_2">
176176
<property name="orientation">
177177
<enum>Qt::Vertical</enum>
@@ -184,6 +184,13 @@
184184
</property>
185185
</spacer>
186186
</item>
187+
<item row="3" column="1">
188+
<widget class="QCheckBox" name="recurseIntoGroupsCheckbox">
189+
<property name="text">
190+
<string>Share recursively</string>
191+
</property>
192+
</widget>
193+
</item>
187194
</layout>
188195
</item>
189196
</layout>

0 commit comments

Comments
 (0)