diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mirall/application.cpp | 15 | ||||
-rw-r--r-- | src/mirall/folder.h | 1 | ||||
-rw-r--r-- | src/mirall/folderman.h | 8 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 83b302d43..6bea189ec 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -440,6 +440,7 @@ void Application::slotownCloudWizardDone( int res ) if( res == QDialog::Accepted ) { } + _folderMan->setSyncEnabled( true ); slotStartFolderSetup( res ); } @@ -664,7 +665,7 @@ void Application::slotTrayClicked( QSystemTrayIcon::ActivationReason reason ) void Application::slotAddFolder() { - _folderMan->disableFoldersWithRestore(); + _folderMan->setSyncEnabled(false); // do not start more syncs. Folder::Map folderMap = _folderMan->map(); @@ -704,6 +705,8 @@ void Application::slotAddFolder() goodData = false; } + _folderMan->setSyncEnabled(true); // do not start more syncs. + if( goodData ) { _folderMan->addFolderDefinition( backend, alias, sourceFolder, targetPath, onlyThisLAN ); Folder *f = _folderMan->setupFolderFromConfigFile( alias ); @@ -716,8 +719,10 @@ void Application::slotAddFolder() } else { qDebug() << "* Folder wizard cancelled"; + _folderMan->setSyncEnabled(true); // do not start more syncs. + } - _folderMan->restoreEnabledFolders(); + _folderMan->setSyncEnabled(true); // do not start more syncs. } void Application::slotOpenStatus() @@ -737,6 +742,7 @@ void Application::slotOpenStatus() if( !cfgFile.exists() ) { qDebug() << "No configured folders yet, start the Owncloud integration dialog."; + _folderMan->setSyncEnabled(false); _owncloudSetupWizard->startWizard(true); // with intro } else { qDebug() << "#============# Status dialog starting #=============#"; @@ -859,9 +865,8 @@ void Application::slotEnableFolder(const QString& alias, const bool enable) void Application::slotConfigure() { - _folderMan->disableFoldersWithRestore(); - _owncloudSetupWizard->startWizard(false); - _folderMan->restoreEnabledFolders(); + _folderMan->setSyncEnabled(false); // do not start more syncs. + _owncloudSetupWizard->startWizard(false); } void Application::slotConfigureProxy() diff --git a/src/mirall/folder.h b/src/mirall/folder.h index b9852b960..55e20c313 100644 --- a/src/mirall/folder.h +++ b/src/mirall/folder.h @@ -46,6 +46,7 @@ public: virtual ~Folder(); typedef QHash<QString, Folder*> Map; + typedef QHashIterator<QString, Folder*> MapIterator; /** * alias or nickname diff --git a/src/mirall/folderman.h b/src/mirall/folderman.h index ad8b47699..b91d4db02 100644 --- a/src/mirall/folderman.h +++ b/src/mirall/folderman.h @@ -37,8 +37,6 @@ public: ~FolderMan(); int setupFolders(); - void disableFoldersWithRestore(); - void restoreEnabledFolders(); Mirall::Folder::Map map(); @@ -93,6 +91,10 @@ public slots: void slotSetCustomPollInterval( uint ); + // if enabled is set to false, no new folders will start to sync. + // the current one will finish. + void setSyncEnabled( bool ); + private slots: // slot to add a folder to the syncing queue void slotScheduleSync( const QString & ); @@ -115,12 +117,12 @@ private: FolderWatcher *_configFolderWatcher; Folder::Map _folderMap; - QHash<QString, bool> _folderEnabledMap; QString _folderConfigPath; QSignalMapper *_folderChangeSignalMapper; QString _currentSyncFolder; QStringList _scheduleQueue; uint _customPollInterval; + bool _syncEnabled; }; } |