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:
Jonathan White 2018-09-30 08:45:06 -04:00 committed by Jonathan White
parent b40e5686dc
commit c1e9f45df9
43 changed files with 2777 additions and 585 deletions

View file

@ -19,6 +19,7 @@
#include "TotpDialog.h"
#include "ui_TotpDialog.h"
#include "core/Clock.h"
#include "core/Config.h"
#include "gui/Clipboard.h"
@ -77,7 +78,7 @@ void TotpDialog::updateProgressBar()
void TotpDialog::updateSeconds()
{
uint epoch = QDateTime::currentDateTime().toTime_t() - 1;
uint epoch = Clock::currentSecondsSinceEpoch() - 1;
m_ui->timerLabel->setText(tr("Expires in <b>%n</b> second(s)", "", m_step - (epoch % m_step)));
}
@ -91,6 +92,6 @@ void TotpDialog::updateTotp()
void TotpDialog::resetCounter()
{
uint epoch = QDateTime::currentDateTime().toTime_t();
uint epoch = Clock::currentSecondsSinceEpoch();
m_counter = static_cast<int>(static_cast<double>(epoch % m_step) / m_step * 100);
}