fixed overall sync state calculation for tray .

This commit is contained in:
Klaas Freitag 2012-07-18 17:28:30 +02:00
parent 11b4b36c3f
commit 3244a922e3

View file

@ -658,7 +658,7 @@ void Application::computeOverallSyncStatus()
{ {
// display the info of the least successful sync (eg. not just display the result of the latest sync // display the info of the least successful sync (eg. not just display the result of the latest sync
SyncResult overallResult = SyncResult::Success; SyncResult overallResult(SyncResult::Undefined );
QString trayMessage; QString trayMessage;
Folder::Map map = _folderMan->map(); Folder::Map map = _folderMan->map();
@ -679,25 +679,29 @@ void Application::computeOverallSyncStatus()
break; break;
case SyncResult::NotYetStarted: case SyncResult::NotYetStarted:
folderMessage = tr( "Waits to start syncing." ); folderMessage = tr( "Waits to start syncing." );
overallResult.setStatus( SyncResult::NotYetStarted );
break; break;
case SyncResult::SyncRunning: case SyncResult::SyncRunning:
folderMessage = tr( "Sync is running." ); folderMessage = tr( "Sync is running." );
overallResult.setStatus( SyncResult::SyncRunning );
break; break;
case SyncResult::Success: case SyncResult::Success:
folderMessage = tr( "Last Sync was successful." ); folderMessage = tr( "Last Sync was successful." );
overallResult.setStatus( SyncResult::Success );
break; break;
case SyncResult::Error: case SyncResult::Error:
overallResult = SyncResult::Error; overallResult.setStatus( SyncResult::Error );
folderMessage = tr( "Syncing Error." ); folderMessage = tr( "Syncing Error." );
break; break;
case SyncResult::SetupError: case SyncResult::SetupError:
if ( overallResult.status() != SyncResult::Error ) { if ( overallResult.status() != SyncResult::Error ) {
overallResult = SyncResult::SetupError; overallResult.setStatus( SyncResult::SetupError );
} }
folderMessage = tr( "Setup Error." ); folderMessage = tr( "Setup Error." );
break; break;
default: default:
folderMessage = tr( "Undefined Error State." ); folderMessage = tr( "Undefined Error State." );
overallResult.setStatus( SyncResult::Error );
} }
} else { } else {
// sync is disabled. // sync is disabled.
@ -709,22 +713,19 @@ void Application::computeOverallSyncStatus()
} }
} }
// create the tray blob message // create the tray blob message, check if we have an defined state
QStringList allStatusStrings = _overallStatusStrings.values(); if( overallResult.status() != SyncResult::Undefined ) {
if( ! allStatusStrings.isEmpty() ) QStringList allStatusStrings = _overallStatusStrings.values();
trayMessage = allStatusStrings.join("\n"); if( ! allStatusStrings.isEmpty() )
else trayMessage = allStatusStrings.join("\n");
trayMessage = tr("No sync folders configured."); else
trayMessage = tr("No sync folders configured.");
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), 48 ); QIcon statusIcon = _theme->syncStateIcon( overallResult.status()); // size 48 before
if( overallResult.status() == SyncResult::Success ) { _tray->setIcon( statusIcon );
// Rather display the mirall icon instead of the ok icon. _tray->setToolTip(trayMessage);
statusIcon = _theme->applicationIcon();
} }
_tray->setIcon( statusIcon );
_tray->setToolTip(trayMessage);
} }
void Application::showHelp() void Application::showHelp()