From 1635a5211f1636f68bb5819d3e6507cf111b2968 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Fri, 2 Sep 2016 11:47:22 +0200 Subject: [PATCH] Pass entryFlags to clone() when recursing into sub-groups. Based on https://github.com/keepassx/keepassx/pull/178 by Mois Moshev Closes #525 --- src/core/Group.cpp | 2 +- tests/TestGroup.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 371f3e4d..cae53dbc 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -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); } diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp index 507cf155..514ef6dd 100644 --- a/tests/TestGroup.cpp +++ b/tests/TestGroup.cpp @@ -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; }