Add entry clone functionality.

This commit is contained in:
Florian Geyer
2012-05-15 21:10:39 +02:00
parent 7ebee78c75
commit eb82df5994
8 changed files with 50 additions and 1 deletions

View File

@@ -413,6 +413,19 @@ void Entry::truncateHistory() {
}
}
Entry* Entry::clone() const
{
Entry* entry = new Entry();
entry->setUpdateTimeinfo(false);
entry->m_uuid = m_uuid;
entry->m_data = m_data;
*entry->m_attributes = *m_attributes;
*entry->m_attachments = *m_attachments;
entry->setUpdateTimeinfo(true);
return entry;
}
void Entry::beginUpdate()
{
Q_ASSERT(!m_tmpHistoryItem);

View File

@@ -117,6 +117,7 @@ public:
const QList<Entry*>& historyItems() const;
void addHistoryItem(Entry* entry);
void truncateHistory();
Entry* clone() const;
/**
* Call before and after set*() methods to create a history item