From cb804eb143922d0ac7b7272345b75f125de5ba22 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 4 Jul 2013 13:59:32 +0200 Subject: [PATCH] Document clone() methods. --- src/core/Entry.h | 6 ++++++ src/core/Group.cpp | 3 --- src/core/Group.h | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/Entry.h b/src/core/Entry.h index d4a52933f..4343c1406 100644 --- a/src/core/Entry.h +++ b/src/core/Entry.h @@ -110,6 +110,12 @@ public: void addHistoryItem(Entry* entry); void removeHistoryItems(const QList& historyEntries); void truncateHistory(); + /** + * Creates a duplicate of this entry except that returned entry isn't part + * of any group and all TimeInfo attributes are set to the current time. + * Note that you need to copy the custom icons manually when inserting the + * new entry into another database. + */ Entry* clone() const; void copyDataFrom(const Entry* other); QString resolvePlaceholders(const QString& str) const; diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 1142adf15..4fffe7182 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -466,9 +466,6 @@ QSet Group::customIconsRecursive() const Group* Group::clone() const { - // TODO: what to do about custom icons? - // they won't be available when changing the database later - Group* clonedGroup = new Group(); clonedGroup->setUpdateTimeinfo(false); diff --git a/src/core/Group.h b/src/core/Group.h index b1a51d181..09449620f 100644 --- a/src/core/Group.h +++ b/src/core/Group.h @@ -100,6 +100,13 @@ public: QList entriesRecursive(bool includeHistoryItems = false) const; QList groupsRecursive(bool includeSelf) const; QSet customIconsRecursive() const; + /** + * Creates a duplicate of this group including all child entries and groups. + * The exceptions are that the returned group doesn't have a parent group + * and all TimeInfo attributes are set to the current time. + * Note that you need to copy the custom icons manually when inserting the + * new group into another database. + */ Group* clone() const; void copyDataFrom(const Group* other);