Extracting default clone flags.

This commit is contained in:
Louis-Bertrand Varin 2017-11-21 14:02:21 -05:00
parent 2ff56fe86c
commit 94ea323836
2 changed files with 11 additions and 6 deletions

View File

@ -26,6 +26,11 @@
const int Group::DefaultIconNumber = 48; const int Group::DefaultIconNumber = 48;
const int Group::RecycleBinIconNumber = 43; const int Group::RecycleBinIconNumber = 43;
Group::CloneFlags Group::DefaultCloneFlags = static_cast<Group::CloneFlags>(
Group::CloneNewUuid | Group::CloneResetTimeInfo | Group::CloneIncludeEntries);
Entry::CloneFlags Group::DefaultEntryCloneFlags = static_cast<Entry::CloneFlags>(
Entry::CloneNewUuid | Entry::CloneResetTimeInfo);
Group::Group() Group::Group()
: m_updateTimeinfo(true) : m_updateTimeinfo(true)
{ {

View File

@ -86,6 +86,8 @@ public:
static const int DefaultIconNumber; static const int DefaultIconNumber;
static const int RecycleBinIconNumber; static const int RecycleBinIconNumber;
static CloneFlags DefaultCloneFlags;
static Entry::CloneFlags DefaultEntryCloneFlags;
Group* findChildByName(const QString& name); Group* findChildByName(const QString& name);
Group* findChildByUuid(const Uuid& uuid); Group* findChildByUuid(const Uuid& uuid);
@ -128,15 +130,13 @@ public:
QList<Group*> groupsRecursive(bool includeSelf); QList<Group*> groupsRecursive(bool includeSelf);
QSet<Uuid> customIconsRecursive() const; QSet<Uuid> customIconsRecursive() const;
/** /**
* Creates a duplicate of this group including all child entries and groups (if not shallow). * Creates a duplicate of this group.
* 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 * Note that you need to copy the custom icons manually when inserting the
* new group into another database. * new group into another database.
*/ */
Group* clone(Entry::CloneFlags entryFlags = Entry::CloneNewUuid | Entry::CloneResetTimeInfo, Group* clone(
CloneFlags groupFlags = static_cast<CloneFlags>(Group::CloneNewUuid | Group::CloneResetTimeInfo | Entry::CloneFlags entryFlags = DefaultEntryCloneFlags, CloneFlags groupFlags = DefaultCloneFlags) const;
Group::CloneIncludeEntries)) const;
void copyDataFrom(const Group* other); void copyDataFrom(const Group* other);
void merge(const Group* other); void merge(const Group* other);
QString print(bool recursive = false, int depth = 0); QString print(bool recursive = false, int depth = 0);