Pass entryFlags to clone() when recursing into sub-groups.

Based on https://github.com/keepassx/keepassx/pull/178 by Mois Moshev <mois@monomon.me>

Closes #525
This commit is contained in:
Felix Geyer 2016-09-02 11:47:22 +02:00
parent 595b1011dd
commit 1635a5211f
2 changed files with 6 additions and 1 deletions

View File

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

View File

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