mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
Really unload folders before reconfiguring.
This commit is contained in:
parent
7c1f91abdd
commit
49b4c341ae
3 changed files with 22 additions and 11 deletions
|
@ -79,20 +79,28 @@ void FolderMan::slotReparseConfiguration()
|
||||||
setupKnownFolders();
|
setupKnownFolders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FolderMan::unloadAllFolders()
|
||||||
|
{
|
||||||
|
// first terminate sync jobs.
|
||||||
|
terminateCurrentSync();
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
// clear the list of existing folders.
|
||||||
|
Folder::MapIterator i(_folderMap);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
delete _folderMap.take( i.key() );
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
int FolderMan::setupKnownFolders()
|
int FolderMan::setupKnownFolders()
|
||||||
{
|
{
|
||||||
qDebug() << "* Setup folders from " << _folderConfigPath;
|
qDebug() << "* Setup folders from " << _folderConfigPath;
|
||||||
|
|
||||||
// first terminate sync jobs.
|
unloadAllFolders();
|
||||||
terminateCurrentSync();
|
|
||||||
|
|
||||||
// clear the list of existing folders.
|
|
||||||
Folder::MapIterator i(_folderMap);
|
|
||||||
while (i.hasNext()) {
|
|
||||||
i.next();
|
|
||||||
delete _folderMap.take( i.key() );
|
|
||||||
}
|
|
||||||
|
|
||||||
QDir dir( _folderConfigPath );
|
QDir dir( _folderConfigPath );
|
||||||
dir.setFilter(QDir::Files);
|
dir.setFilter(QDir::Files);
|
||||||
|
|
|
@ -104,6 +104,9 @@ public slots:
|
||||||
|
|
||||||
void terminateSyncProcess( const QString& alias = QString::null );
|
void terminateSyncProcess( const QString& alias = QString::null );
|
||||||
|
|
||||||
|
/* delete all folder objects */
|
||||||
|
int unloadAllFolders();
|
||||||
|
|
||||||
// if enabled is set to false, no new folders will start to sync.
|
// if enabled is set to false, no new folders will start to sync.
|
||||||
// the current one will finish.
|
// the current one will finish.
|
||||||
void setSyncEnabled( bool );
|
void setSyncEnabled( bool );
|
||||||
|
|
|
@ -128,9 +128,9 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
|
||||||
bool acceptCfg = true;
|
bool acceptCfg = true;
|
||||||
|
|
||||||
if( urlHasChanged ) {
|
if( urlHasChanged ) {
|
||||||
_folderMan->terminateSyncProcess( QString::null ); // terminate the current sync.
|
_folderMan->unloadAllFolders();
|
||||||
|
|
||||||
bool startFromScratch = _ocWizard->field( "OCSyncFromScratch" ).toBool();
|
bool startFromScratch = _ocWizard->field( "OCSyncFromScratch" ).toBool();
|
||||||
if( startFromScratch ) {
|
if( startFromScratch ) {
|
||||||
// first try to rename (backup) the current local dir.
|
// first try to rename (backup) the current local dir.
|
||||||
bool renameOk = false;
|
bool renameOk = false;
|
||||||
|
|
Loading…
Reference in a new issue