Folders: Signout should not switch folders to paused state. #2112

On signout, syncs that are running in folders are aborted. That used to
also switch the state of these folders to 'paused'. To fix that, aborts
that are caused by user actions no longer change the folder paused
state.

Aborts due to errors should still pause folders! Otherwise we'd try
resyncing them even though there was an error.
This commit is contained in:
Christian Kamm 2014-09-04 10:12:54 +02:00
parent db08d5021e
commit da94533647
6 changed files with 15 additions and 14 deletions

View file

@ -383,7 +383,7 @@ void AccountSettings::slotResetCurrentFolder()
if( ret == QMessageBox::Yes ) {
FolderMan *folderMan = FolderMan::instance();
Folder *f = folderMan->folder(alias);
f->slotTerminateSync();
f->slotTerminateAndPauseSync();
f->wipe();
folderMan->slotScheduleAllFolders();
}
@ -499,7 +499,7 @@ void AccountSettings::slotEnableCurrentFolder()
// message box can return at any time while the thread keeps running,
// so better check again after the user has responded.
if ( f->isBusy() && terminate ) {
f->slotTerminateSync();
f->slotTerminateAndPauseSync();
}
f->setSyncPaused(!currentlyPaused); // toggle the pause setting
folderMan->slotSetFolderPaused( alias, !currentlyPaused );

View file

@ -496,12 +496,16 @@ void Folder::slotTerminateSync()
// Do not display an error message, user knows his own actions.
// _errors.append( tr("The CSync thread terminated.") );
// _csyncError = true;
FolderMan::instance()->slotSetFolderPaused(alias(), true);
setSyncState(SyncResult::SyncAbortRequested);
return;
}
}
void Folder::slotTerminateAndPauseSync()
{
slotTerminateSync();
FolderMan::instance()->slotSetFolderPaused(alias(), true);
}
// This removes the csync File database
// This is needed to provide a clean startup again in case another
// local folder is synced to the same ownCloud.

View file

@ -138,6 +138,7 @@ public slots:
* terminate the current sync run
*/
void slotTerminateSync();
void slotTerminateAndPauseSync();
void slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool*);

View file

@ -226,14 +226,6 @@ bool FolderMan::ensureJournalGone(const QString &localPath)
return true;
}
void FolderMan::terminateCurrentSync()
{
if( !_currentSyncFolder.isEmpty() ) {
qDebug() << "Terminating syncing on folder " << _currentSyncFolder;
terminateSyncProcess( _currentSyncFolder );
}
}
#define SLASH_TAG QLatin1String("__SLASH__")
#define BSLASH_TAG QLatin1String("__BSLASH__")
#define QMARK_TAG QLatin1String("__QMARK__")

View file

@ -107,6 +107,11 @@ public slots:
void slotFolderSyncStarted();
void slotFolderSyncFinished( const SyncResult& );
/**
* Terminates the specified folder sync (or the current one).
*
* It does not switch the folder to paused state.
*/
void terminateSyncProcess( const QString& alias = QString::null );
/* unload and delete on folder object */
@ -134,7 +139,6 @@ private slots:
private:
// finds all folder configuration files
// and create the folders
void terminateCurrentSync();
QString getBackupName( const QString& ) const;
void registerFolderMonitor( Folder *folder );

View file

@ -291,7 +291,7 @@ void SelectiveSyncDialog::accept()
FolderMan *folderMan = FolderMan::instance();
if (_folder->isBusy()) {
_folder->slotTerminateSync();
_folder->slotTerminateAndPauseSync();
}
folderMan->slotScheduleSync(_folder->alias());
}