mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
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.
This commit is contained in:
parent
e1fa6f1a0d
commit
b7d7f424c5
3 changed files with 11 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue