From ec120cd64c47ca9b80d86978b7c90e4c012c7993 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Mon, 18 Feb 2013 18:31:29 +0200 Subject: [PATCH] Make folderman load folders at start and update later. --- src/mirall/application.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 80ebacd51e..574ea6c1b4 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -134,6 +134,7 @@ Application::Application(int &argc, char **argv) : _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); + _folderMan->setSyncEnabled(false); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); @@ -172,6 +173,11 @@ Application::Application(int &argc, char **argv) : setupSystemTray(); setupProxy(); + + int cnt = _folderMan->setupFolders(); + _statusDialog->setFolderList( _folderMan->map() ); + + QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); @@ -358,19 +364,18 @@ void Application::slotAuthCheck( const QString& ,QNetworkReply *reply ) if( ok ) { qDebug() << "######## Credentials are ok!"; - int cnt = _folderMan->setupFolders(); - if( cnt ) { - _tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) ); - _tray->show(); + _folderMan->setSyncEnabled(true); + QMetaObject::invokeMethod(_folderMan, "slotScheduleFolderSync"); - if( _tray ) - _tray->showMessage(tr("%1 Sync Started").arg(_theme->appName()), - tr("Sync started for %1 configured sync folder(s).").arg(cnt)); + _tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) ); + _tray->show(); - _statusDialog->setFolderList( _folderMan->map() ); - computeOverallSyncStatus(); + int cnt = _folderMan->map().size(); + if( _tray ) + _tray->showMessage(tr("%1 Sync Started").arg(_theme->appName()), + tr("Sync started for %1 configured sync folder(s).").arg(cnt)); + computeOverallSyncStatus(); - } _actionAddFolder->setEnabled( true ); _actionOpenStatus->setEnabled( true ); setupContextMenu();