Status Icons: Let FolderMan only write the folder config files.

Remove the setSyncEnabled() call to individual folders which mistakenly
set the folders to pause. Let the folders keep their pause state on their
own.

If FolderMan is set to be enabled emit a general refresh signal rather
than one for each folder.
This commit is contained in:
Klaas Freitag 2014-08-19 14:03:41 +02:00
parent 01b0ee49de
commit 1245ed6f06
2 changed files with 6 additions and 10 deletions

View file

@ -482,7 +482,7 @@ void Folder::slotTerminateSync()
// Do not display an error message, user knows his own actions. // Do not display an error message, user knows his own actions.
// _errors.append( tr("The CSync thread terminated.") ); // _errors.append( tr("The CSync thread terminated.") );
// _csyncError = true; // _csyncError = true;
setSyncEnabled(false); FolderMan::instance()->slotSetFolderPaused(alias(), true);
setSyncState(SyncResult::SyncAbortRequested); setSyncState(SyncResult::SyncAbortRequested);
return; return;
} }

View file

@ -346,7 +346,7 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
return folder; return folder;
} }
void FolderMan::slotEnableFolder( const QString& alias, bool enable ) void FolderMan::slotSetFolderPaused( const QString& alias, bool paused )
{ {
if( ! _folderMap.contains( alias ) ) { if( ! _folderMap.contains( alias ) ) {
qDebug() << "!! Can not enable alias " << alias << ", can not be found in folderMap."; qDebug() << "!! Can not enable alias " << alias << ", can not be found in folderMap.";
@ -355,7 +355,6 @@ void FolderMan::slotEnableFolder( const QString& alias, bool enable )
Folder *f = _folderMap[alias]; Folder *f = _folderMap[alias];
if( f ) { if( f ) {
f->setSyncEnabled(enable);
slotScheduleSync(alias); slotScheduleSync(alias);
// FIXME: Use MirallConfigFile // FIXME: Use MirallConfigFile
@ -442,7 +441,6 @@ void FolderMan::slotScheduleSync( const QString& alias )
} }
} }
_scheduleQueue.enqueue(alias); _scheduleQueue.enqueue(alias);
} else { } else {
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!"; qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
} }
@ -450,6 +448,8 @@ void FolderMan::slotScheduleSync( const QString& alias )
QTimer::singleShot(500, this, SLOT(slotScheduleFolderSync())); QTimer::singleShot(500, this, SLOT(slotScheduleFolderSync()));
} }
// only enable or disable foldermans will to schedule and do syncs.
// this is not the same as Pause and Resume of folders.
void FolderMan::setSyncEnabled( bool enabled ) void FolderMan::setSyncEnabled( bool enabled )
{ {
if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) { if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) {
@ -457,12 +457,8 @@ void FolderMan::setSyncEnabled( bool enabled )
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync())); QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
} }
_syncEnabled = enabled; _syncEnabled = enabled;
// force a redraw in case the network connect status changed
foreach( Folder *f, _folderMap.values() ) { emit( folderSyncStateChange(QString::null) );
if(f) { // check for f != 0. That can happen, do not remove the check!
f->setSyncEnabled(enabled && !_disabledFolders.contains(f));
}
}
} }
/* /*