Remove the backup deteciton code which was used for server < 9.1

This commit is contained in:
Olivier Goffart 2018-10-16 16:08:49 +02:00 committed by Kevin Ottens
parent f666511a4b
commit b86e1efc9a
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
4 changed files with 0 additions and 54 deletions

View file

@ -93,8 +93,6 @@ Folder::Folder(const FolderDefinition &definition,
//direct connection so the message box is blocking the sync.
connect(_engine.data(), &SyncEngine::aboutToRemoveAllFiles,
this, &Folder::slotAboutToRemoveAllFiles);
connect(_engine.data(), &SyncEngine::aboutToRestoreBackup,
this, &Folder::slotAboutToRestoreBackup);
connect(_engine.data(), &SyncEngine::transmissionProgress, this, &Folder::slotTransmissionProgress);
connect(_engine.data(), &SyncEngine::itemCompleted,
this, &Folder::slotItemCompleted);
@ -1098,28 +1096,6 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, bool *cancel
}
}
void Folder::slotAboutToRestoreBackup(bool *restore)
{
QString msg =
tr("This sync would reset the files to an earlier time in the sync folder '%1'.\n"
"This might be because a backup was restored on the server.\n"
"Continuing the sync as normal will cause all your files to be overwritten by an older "
"file in an earlier state. "
"Do you want to keep your local most recent files as conflict files?");
QMessageBox msgBox(QMessageBox::Warning, tr("Backup detected"),
msg.arg(shortGuiLocalPath()));
msgBox.setWindowFlags(msgBox.windowFlags() | Qt::WindowStaysOnTopHint);
msgBox.addButton(tr("Normal Synchronisation"), QMessageBox::DestructiveRole);
QPushButton *keepBtn = msgBox.addButton(tr("Keep Local Files as Conflict"), QMessageBox::AcceptRole);
if (msgBox.exec() == -1) {
*restore = true;
return;
}
*restore = msgBox.clickedButton() == keepBtn;
}
void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder)
{
settings.beginGroup(FolderMan::escapeAlias(folder.alias));

View file

@ -261,8 +261,6 @@ public slots:
// connected to the corresponding signals in the SyncEngine
void slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *);
void slotAboutToRestoreBackup(bool *);
/**
* Starts a sync operation

View file

@ -73,8 +73,6 @@ SyncEngine::SyncEngine(AccountPtr account, const QString &localPath,
, _progressInfo(new ProgressInfo)
, _hasNoneFiles(false)
, _hasRemoveFile(false)
, _hasForwardInTimeFiles(false)
, _backInTimeFiles(0)
, _uploadLimit(0)
, _downloadLimit(0)
, _anotherSyncNeeded(NoFollowUpSync)
@ -360,18 +358,6 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
// An upload of an existing file means that the file was left unchanged on the server
// This counts as a NONE for detecting if all the files on the server were changed
_hasNoneFiles = true;
} else if (!item->isDirectory()) {
auto difftime = std::difftime(item->_modtime, item->_previousModtime);
if (difftime < -3600 * 2) {
// We are going back on time
// We only increment if the difference is more than two hours to avoid clock skew
// issues or DST changes. (We simply ignore files that goes in the past less than
// two hours for the backup detection heuristics.)
_backInTimeFiles++;
qCWarning(lcEngine) << item->_file << "has a timestamp earlier than the local file";
} else if (difftime > 0) {
_hasForwardInTimeFiles = true;
}
}
}
@ -414,8 +400,6 @@ void SyncEngine::startSync()
_hasNoneFiles = false;
_hasRemoveFile = false;
_hasForwardInTimeFiles = false;
_backInTimeFiles = 0;
_seenFiles.clear();
_progressInfo->reset();

View file

@ -145,12 +145,6 @@ signals:
* Set *cancel to true in a slot connected from this signal to abort the sync.
*/
void aboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel);
/**
* Emited when the sync engine detects that all the files are changed to dates in the past.
* This usually happen when a backup was restored on the server from an earlier date.
* Set *restore to true in a slot connected from this signal to re-upload all files.
*/
void aboutToRestoreBackup(bool *restore);
// A new folder was discovered and was not synced because of the confirmation feature
void newBigFolder(const QString &folder, bool isExternal);
@ -258,12 +252,6 @@ private:
// true if there is at leasr one file with instruction REMOVE
bool _hasRemoveFile;
// true if there is at least one file from the server that goes forward in time
bool _hasForwardInTimeFiles;
// number of files which goes back in time from the server
int _backInTimeFiles;
// If ignored files should be ignored
bool _ignore_hidden_files = false;