diff options
author | Christian Kamm <kamm@incasoftware.de> | 2014-11-21 14:58:38 +0300 |
---|---|---|
committer | Christian Kamm <kamm@incasoftware.de> | 2014-12-03 15:46:37 +0300 |
commit | b7d7f424c59ee41fd3bb159c827207d90cecb87a (patch) | |
tree | b673606609d46c30a78a28eb731c67236056451f /src/mirall | |
parent | e1fa6f1a0dcb144e648aa60b60fa4406c27e9cde (diff) |
FolderMan: only touch _currentSyncFolder when done #2407
Also simplity terminateSyncProcess() to always terminate the
*current* sync run. Only one can be running at a time anyway.
Diffstat (limited to 'src/mirall')
-rw-r--r-- | src/mirall/folderman.cpp | 20 | ||||
-rw-r--r-- | src/mirall/folderman.h | 4 | ||||
-rw-r--r-- | src/mirall/owncloudsetupwizard.cpp | 2 |
3 files changed, 11 insertions, 15 deletions
diff --git a/src/mirall/folderman.cpp b/src/mirall/folderman.cpp index 0b955aafb..36a864b37 100644 --- a/src/mirall/folderman.cpp +++ b/src/mirall/folderman.cpp @@ -399,21 +399,17 @@ void FolderMan::slotSetFolderPaused( const QString& alias, bool paused ) } } -// this really terminates, ie. no questions, no prisoners. +// this really terminates the current sync process +// ie. no questions, no prisoners // csync still remains in a stable state, regardless of that. -void FolderMan::terminateSyncProcess( const QString& alias ) +void FolderMan::terminateSyncProcess() { - QString folderAlias = alias; - if( alias.isEmpty() ) { - folderAlias = _currentSyncFolder; - } - if( ! folderAlias.isEmpty() && _folderMap.contains(folderAlias) ) { - Folder *f = _folderMap[folderAlias]; + if( ! _currentSyncFolder.isEmpty() && _folderMap.contains(_currentSyncFolder) ) { + Folder *f = _folderMap[_currentSyncFolder]; if( f ) { + // This will, indirectly and eventually, call slotFolderSyncFinished + // and thereby clear _currentSyncFolder. f->slotTerminateSync(); - if(_currentSyncFolder == folderAlias ) { - _currentSyncFolder.clear(); - } } } } @@ -706,7 +702,7 @@ void FolderMan::slotRemoveFolder( const QString& alias ) if( _currentSyncFolder == alias ) { // terminate if the sync is currently underway. - terminateSyncProcess( alias ); + terminateSyncProcess(); } removeFolder(alias); } diff --git a/src/mirall/folderman.h b/src/mirall/folderman.h index 4dcbfb6b0..442a169b4 100644 --- a/src/mirall/folderman.h +++ b/src/mirall/folderman.h @@ -108,11 +108,11 @@ public slots: void slotFolderSyncFinished( const SyncResult& ); /** - * Terminates the specified folder sync (or the current one). + * Terminates the current folder sync. * * It does not switch the folder to paused state. */ - void terminateSyncProcess( const QString& alias = QString::null ); + void terminateSyncProcess(); /* unload and delete on folder object */ void unloadFolder( const QString& alias ); diff --git a/src/mirall/owncloudsetupwizard.cpp b/src/mirall/owncloudsetupwizard.cpp index 4f2945ada..a29b9bebe 100644 --- a/src/mirall/owncloudsetupwizard.cpp +++ b/src/mirall/owncloudsetupwizard.cpp @@ -413,7 +413,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result ) Folder *f = folderMan->folderForPath(localFolder); if( f ) { folderMan->setSyncEnabled(false); - folderMan->terminateSyncProcess(f->alias()); + f->slotTerminateSync(); f->journalDb()->close(); } |