fix status dialog status display and overall status display.

This commit is contained in:
Klaas Freitag 2012-04-17 15:02:18 +02:00
parent 61ddff840a
commit 5c07363335
5 changed files with 54 additions and 47 deletions

View file

@ -504,8 +504,8 @@ void Application::slotSyncStateChange( const QString& alias )
// do not promote LocalSyncState to the status dialog.
if( !result.localRunOnly() ) {
_statusDialog->slotUpdateFolderState( _folderMan->folder(alias) );
// computeOverallSyncStatus();
}
computeOverallSyncStatus();
qDebug() << "Sync state changed for folder " << alias << ": " << result.localRunOnly();
}
@ -519,9 +519,12 @@ void Application::computeOverallSyncStatus()
Folder::Map map = _folderMan->map();
foreach ( Folder *syncedFolder, map ) {
QString folderMessage;
QString folderMessage = _overallStatusStrings[syncedFolder];
SyncResult folderResult = syncedFolder->syncResult();
SyncResult::Status syncStatus = folderResult.status();
if( ! folderResult.localRunOnly() ) { // skip local runs, use the last message.
if ( syncStatus == SyncResult::Success ) {
folderMessage = tr( "Folder %1: Ok." ).arg( syncedFolder->alias() );
} else if ( syncStatus == SyncResult::Error ) {
@ -544,15 +547,19 @@ void Application::computeOverallSyncStatus()
}
folderMessage = tr( "Folder %1: undefined state" ).arg( syncedFolder->alias() );
}
if ( !trayMessage.isEmpty() ) {
trayMessage += "\n";
}
trayMessage += folderMessage;
_overallStatusStrings[syncedFolder] = folderMessage;
}
// create the tray blob message
QStringList allStatusStrings = _overallStatusStrings.values();
trayMessage = allStatusStrings.join("\n");
#if 0
if( _statusDialog->isVisible() ) {
_statusDialog->slotUpdateFolderState( syncedFolder );
}
}
#endif
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), 22 );

View file

@ -105,6 +105,7 @@ private:
QSplashScreen *_splash;
ownCloudInfo *_ocInfo;
UpdateDetector *_updateDetector;
QMap<Folder*, QString> _overallStatusStrings;
};
} // namespace Mirall

View file

@ -237,7 +237,7 @@ void Folder::slotSyncFinished(const SyncResult &result)
_watcher->setEventsEnabled(true);
#endif
qDebug() << "OOOOOOOOOOOOOOOOO sync result: " << int(result.status()) << " local: " << result.localRunOnly();
qDebug() << "OO folder slotSyncFinished: result: " << int(result.status()) << " local: " << result.localRunOnly();
emit syncStateChange();
// reenable the poll timer if folder is sync enabled

View file

@ -215,7 +215,6 @@ void ownCloudFolder::slotCSyncFinished()
_syncResult.setErrorStrings( _errors );
qDebug() << " * owncloud csync thread finished with error";
} else {
qDebug() << " * owncloud csync thread finished successfully " << _localCheckOnly;
_syncResult.setStatus(SyncResult::Success);
}

View file

@ -290,7 +290,7 @@ void StatusDialog::slotUpdateFolderState( Folder *folder )
if( item ) {
folderToModelItem( item, folder );
} else {
qDebug() << " OO Error: did not find model item for folder " << folder->alias();
// the dialog is not visible.
}
}