Introduce synchronize merge method
* Create history-based merging that keeps older data in history instead of discarding or deleting it * Extract merge logic into the Merger class * Allows special merge behavior * Improve handling of deletion and changes on groups * Enable basic change tracking while merging * Prevent unintended timestamp changes while merging * Handle differences in timestamp precision * Introduce comparison operators to allow for more sophisticated comparisons (ignore special properties, ...) * Introduce Clock class to handle datetime across the app Merge Strategies: * Default (use inherited/fallback method) * Duplicate (duplicate conflicting nodes, apply all deletions) * KeepLocal (use local values, but apply all deletions) * KeepRemote (use remote values, but apply all deletions) * KeepNewer (merge history only) * Synchronize (merge history, newest value stays on top, apply all deletions)
This commit is contained in:
committed by
Jonathan White
parent
b40e5686dc
commit
c1e9f45df9
@@ -37,6 +37,10 @@ struct DeletedObject
|
||||
{
|
||||
QUuid uuid;
|
||||
QDateTime deletionTime;
|
||||
bool operator==(const DeletedObject& other) const
|
||||
{
|
||||
return uuid == other.uuid && deletionTime == other.deletionTime;
|
||||
}
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(DeletedObject, Q_MOVABLE_TYPE);
|
||||
@@ -88,8 +92,12 @@ public:
|
||||
Entry* resolveEntry(const QString& text, EntryReferenceType referenceType);
|
||||
Group* resolveGroup(const QUuid& uuid);
|
||||
QList<DeletedObject> deletedObjects();
|
||||
const QList<DeletedObject>& deletedObjects() const;
|
||||
void addDeletedObject(const DeletedObject& delObj);
|
||||
void addDeletedObject(const QUuid& uuid);
|
||||
bool containsDeletedObject(const QUuid& uuid) const;
|
||||
bool containsDeletedObject(const DeletedObject& uuid) const;
|
||||
void setDeletedObjects(const QList<DeletedObject>& delObjs);
|
||||
|
||||
const QUuid& cipher() const;
|
||||
Database::CompressionAlgorithm compressionAlgo() const;
|
||||
@@ -112,7 +120,7 @@ public:
|
||||
void recycleGroup(Group* group);
|
||||
void emptyRecycleBin();
|
||||
void setEmitModified(bool value);
|
||||
void merge(const Database* other);
|
||||
void markAsModified();
|
||||
QString saveToFile(QString filePath, bool atomic = true, bool backup = false);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user