Skip to content

Commit

Permalink
Pass entryFlags to clone() when recursing into sub-groups.
Browse files Browse the repository at this point in the history
Based on keepassx/keepassx#178 by Mois Moshev <mois@monomon.me>

Closes keepassxreboot#525
  • Loading branch information
debfx committed Sep 2, 2016
1 parent 595b101 commit 1635a52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ Group* Group::clone(Entry::CloneFlags entryFlags) const
}

Q_FOREACH (Group* groupChild, children()) {
Group* clonedGroupChild = groupChild->clone();
Group* clonedGroupChild = groupChild->clone(entryFlags);
clonedGroupChild->setParent(clonedGroup);
}

Expand Down
5 changes: 5 additions & 0 deletions tests/TestGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,12 @@ void TestGroup::testClone()
QVERIFY(clonedSubGroupEntry->uuid() != subGroupEntry->uuid());
QCOMPARE(clonedSubGroupEntry->title(), QString("SubGroupEntry"));

Group* clonedGroupKeepUuid = originalGroup->clone(Entry::CloneNoFlags);
QCOMPARE(clonedGroupKeepUuid->entries().at(0)->uuid(), originalGroupEntry->uuid());
QCOMPARE(clonedGroupKeepUuid->children().at(0)->entries().at(0)->uuid(), subGroupEntry->uuid());

delete clonedGroup;
delete clonedGroupKeepUuid;
delete db;
}

Expand Down

0 comments on commit 1635a52

Please sign in to comment.