mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
SyncEngine: Don't whipe the white list if the sync was aborted
Issue #4018
This commit is contained in:
parent
38a8e5ee03
commit
c3cf6aef7d
5 changed files with 17 additions and 17 deletions
|
@ -447,7 +447,7 @@ restart_sync:
|
|||
}
|
||||
|
||||
SyncEngine engine(account, _csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
|
||||
QObject::connect(&engine, SIGNAL(finished()), &app, SLOT(quit()));
|
||||
QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit()));
|
||||
QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot()));
|
||||
|
||||
// Have to be done async, else, an error before exec() does not terminate the event loop.
|
||||
|
|
|
@ -887,7 +887,7 @@ void Folder::startSync(const QStringList &pathList)
|
|||
this, SLOT(slotAboutToPropagate(SyncFileItemVector&)));
|
||||
|
||||
connect(_engine.data(), SIGNAL(started()), SLOT(slotSyncStarted()), Qt::QueuedConnection);
|
||||
connect(_engine.data(), SIGNAL(finished()), SLOT(slotSyncFinished()), Qt::QueuedConnection);
|
||||
connect(_engine.data(), SIGNAL(finished(bool)), SLOT(slotSyncFinished(bool)), Qt::QueuedConnection);
|
||||
connect(_engine.data(), SIGNAL(csyncError(QString)), SLOT(slotSyncError(QString)), Qt::QueuedConnection);
|
||||
connect(_engine.data(), SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection);
|
||||
|
||||
|
@ -959,7 +959,7 @@ void Folder::slotCsyncUnavailable()
|
|||
_csyncUnavail = true;
|
||||
}
|
||||
|
||||
void Folder::slotSyncFinished()
|
||||
void Folder::slotSyncFinished(bool success)
|
||||
{
|
||||
qDebug() << " - client version" << qPrintable(Theme::instance()->version())
|
||||
<< " Qt" << qVersion()
|
||||
|
@ -1017,7 +1017,7 @@ void Folder::slotSyncFinished()
|
|||
qDebug() << "the last" << _consecutiveFailingSyncs << "syncs failed";
|
||||
}
|
||||
|
||||
if (_syncResult.status() == SyncResult::Success) {
|
||||
if (_syncResult.status() == SyncResult::Success && success) {
|
||||
// Clear the white list as all the folders that should be on that list are sync-ed
|
||||
journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, QStringList());
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ private slots:
|
|||
void slotSyncStarted();
|
||||
void slotSyncError(const QString& );
|
||||
void slotCsyncUnavailable();
|
||||
void slotSyncFinished();
|
||||
void slotSyncFinished(bool);
|
||||
|
||||
void slotFolderDiscovered(bool local, QString folderName);
|
||||
void slotTransmissionProgress(const ProgressInfo& pi);
|
||||
|
|
|
@ -572,7 +572,7 @@ void SyncEngine::handleSyncError(CSYNC *ctx, const char *state) {
|
|||
} else {
|
||||
emit csyncError(errStr);
|
||||
}
|
||||
finalize();
|
||||
finalize(false);
|
||||
}
|
||||
|
||||
void SyncEngine::startSync()
|
||||
|
@ -598,7 +598,7 @@ void SyncEngine::startSync()
|
|||
if (!QDir(_localPath).exists()) {
|
||||
// No _tr, it should only occur in non-mirall
|
||||
emit csyncError("Unable to find local sync folder.");
|
||||
finalize();
|
||||
finalize(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ void SyncEngine::startSync()
|
|||
emit csyncError(tr("Only %1 are available, need at least %2 to start").arg(
|
||||
Utility::octetsToString(freeBytes),
|
||||
Utility::octetsToString(minFree)));
|
||||
finalize();
|
||||
finalize(false);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -643,7 +643,7 @@ void SyncEngine::startSync()
|
|||
if( fileRecordCount == -1 ) {
|
||||
qDebug() << "No way to create a sync journal!";
|
||||
emit csyncError(tr("Unable to initialize a sync journal."));
|
||||
finalize();
|
||||
finalize(false);
|
||||
return;
|
||||
// database creation error!
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
|
|||
if (!_journal->isConnected()) {
|
||||
qDebug() << "Bailing out, DB failure";
|
||||
emit csyncError(tr("Cannot open the sync journal"));
|
||||
finalize();
|
||||
finalize(false);
|
||||
return;
|
||||
} else {
|
||||
// Commits a possibly existing (should not though) transaction and starts a new one for the propagate phase
|
||||
|
@ -785,7 +785,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
|
|||
emit aboutToRemoveAllFiles(_syncedItems.first()->_direction, &cancel);
|
||||
if (cancel) {
|
||||
qDebug() << Q_FUNC_INFO << "Abort sync";
|
||||
finalize();
|
||||
finalize(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -833,7 +833,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
|
|||
void SyncEngine::slotCleanPollsJobAborted(const QString &error)
|
||||
{
|
||||
csyncError(error);
|
||||
finalize();
|
||||
finalize(false);
|
||||
}
|
||||
|
||||
void SyncEngine::setNetworkLimits(int upload, int download)
|
||||
|
@ -888,10 +888,10 @@ void SyncEngine::slotFinished()
|
|||
|
||||
_journal->commit("All Finished.", false);
|
||||
emit treeWalkResult(_syncedItems);
|
||||
finalize();
|
||||
finalize(true); // FIXME: should it be true if there was errors?
|
||||
}
|
||||
|
||||
void SyncEngine::finalize()
|
||||
void SyncEngine::finalize(bool success)
|
||||
{
|
||||
_thread.quit();
|
||||
_thread.wait();
|
||||
|
@ -902,7 +902,7 @@ void SyncEngine::finalize()
|
|||
_stopWatch.stop();
|
||||
|
||||
_syncRunning = false;
|
||||
emit finished();
|
||||
emit finished(success);
|
||||
|
||||
// Delete the propagator only after emitting the signal.
|
||||
_propagator.clear();
|
||||
|
|
|
@ -109,7 +109,7 @@ signals:
|
|||
|
||||
void transmissionProgress( const ProgressInfo& progress );
|
||||
|
||||
void finished();
|
||||
void finished(bool success);
|
||||
void started();
|
||||
|
||||
void aboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel);
|
||||
|
@ -144,7 +144,7 @@ private:
|
|||
void deleteStaleErrorBlacklistEntries();
|
||||
|
||||
// cleanup and emit the finished signal
|
||||
void finalize();
|
||||
void finalize(bool success);
|
||||
|
||||
static bool _syncRunning; //true when one sync is running somewhere (for debugging)
|
||||
|
||||
|
|
Loading…
Reference in a new issue