mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
fix status dialog status display and overall status display.
This commit is contained in:
parent
61ddff840a
commit
5c07363335
5 changed files with 54 additions and 47 deletions
|
@ -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();
|
||||
}
|
||||
|
@ -513,56 +513,63 @@ void Application::slotSyncStateChange( const QString& alias )
|
|||
void Application::computeOverallSyncStatus()
|
||||
{
|
||||
|
||||
// display the info of the least succesful sync (eg. not just display the result of the latest sync
|
||||
SyncResult overallResult = SyncResult::Success;
|
||||
QString trayMessage;
|
||||
Folder::Map map = _folderMan->map();
|
||||
// display the info of the least succesful sync (eg. not just display the result of the latest sync
|
||||
SyncResult overallResult = SyncResult::Success;
|
||||
QString trayMessage;
|
||||
Folder::Map map = _folderMan->map();
|
||||
|
||||
foreach ( Folder *syncedFolder, map ) {
|
||||
QString folderMessage;
|
||||
SyncResult folderResult = syncedFolder->syncResult();
|
||||
SyncResult::Status syncStatus = folderResult.status();
|
||||
if ( syncStatus == SyncResult::Success ) {
|
||||
folderMessage = tr( "Folder %1: Ok." ).arg( syncedFolder->alias() );
|
||||
} else if ( syncStatus == SyncResult::Error ) {
|
||||
overallResult = SyncResult::Error;
|
||||
folderMessage = tr( "Folder %1: %2" ).arg( syncedFolder->alias(), folderResult.errorString() );
|
||||
} else if ( syncStatus == SyncResult::SetupError ) {
|
||||
if ( overallResult.status() != SyncResult::Error ) {
|
||||
overallResult = SyncResult::SetupError;
|
||||
}
|
||||
folderMessage = tr( "Folder %1: setup error" ).arg( syncedFolder->alias() );
|
||||
} else if ( syncStatus == SyncResult::Disabled ) {
|
||||
if ( overallResult.status() != SyncResult::SetupError
|
||||
&& overallResult.status() != SyncResult::Error ) {
|
||||
overallResult = SyncResult::Disabled;
|
||||
}
|
||||
folderMessage = tr( "Folder %1: %2" ).arg( syncedFolder->alias(), folderResult.errorString() );
|
||||
} else if ( syncStatus == SyncResult::Undefined ) {
|
||||
if ( overallResult.status() == SyncResult::Success ) {
|
||||
overallResult = SyncResult::Undefined;
|
||||
}
|
||||
folderMessage = tr( "Folder %1: undefined state" ).arg( syncedFolder->alias() );
|
||||
}
|
||||
if ( !trayMessage.isEmpty() ) {
|
||||
trayMessage += "\n";
|
||||
}
|
||||
trayMessage += folderMessage;
|
||||
foreach ( Folder *syncedFolder, map ) {
|
||||
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 ) {
|
||||
overallResult = SyncResult::Error;
|
||||
folderMessage = tr( "Folder %1: %2" ).arg( syncedFolder->alias(), folderResult.errorString() );
|
||||
} else if ( syncStatus == SyncResult::SetupError ) {
|
||||
if ( overallResult.status() != SyncResult::Error ) {
|
||||
overallResult = SyncResult::SetupError;
|
||||
}
|
||||
folderMessage = tr( "Folder %1: setup error" ).arg( syncedFolder->alias() );
|
||||
} else if ( syncStatus == SyncResult::Disabled ) {
|
||||
if ( overallResult.status() != SyncResult::SetupError
|
||||
&& overallResult.status() != SyncResult::Error ) {
|
||||
overallResult = SyncResult::Disabled;
|
||||
}
|
||||
folderMessage = tr( "Folder %1: %2" ).arg( syncedFolder->alias(), folderResult.errorString() );
|
||||
} else if ( syncStatus == SyncResult::Undefined ) {
|
||||
if ( overallResult.status() == SyncResult::Success ) {
|
||||
overallResult = SyncResult::Undefined;
|
||||
}
|
||||
folderMessage = tr( "Folder %1: undefined state" ).arg( syncedFolder->alias() );
|
||||
}
|
||||
}
|
||||
_overallStatusStrings[syncedFolder] = folderMessage;
|
||||
}
|
||||
|
||||
// create the tray blob message
|
||||
QStringList allStatusStrings = _overallStatusStrings.values();
|
||||
trayMessage = allStatusStrings.join("\n");
|
||||
|
||||
#if 0
|
||||
if( _statusDialog->isVisible() ) {
|
||||
_statusDialog->slotUpdateFolderState( syncedFolder );
|
||||
_statusDialog->slotUpdateFolderState( syncedFolder );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), 22 );
|
||||
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), 22 );
|
||||
|
||||
if( overallResult.status() == SyncResult::Success ) {
|
||||
// Rather display the mirall icon instead of the ok icon.
|
||||
statusIcon = _theme->applicationIcon();
|
||||
}
|
||||
if( overallResult.status() == SyncResult::Success ) {
|
||||
// Rather display the mirall icon instead of the ok icon.
|
||||
statusIcon = _theme->applicationIcon();
|
||||
}
|
||||
|
||||
_tray->setIcon( statusIcon );
|
||||
_tray->setToolTip(trayMessage);
|
||||
_tray->setIcon( statusIcon );
|
||||
_tray->setToolTip(trayMessage);
|
||||
}
|
||||
|
||||
} // namespace Mirall
|
||||
|
|
|
@ -105,6 +105,7 @@ private:
|
|||
QSplashScreen *_splash;
|
||||
ownCloudInfo *_ocInfo;
|
||||
UpdateDetector *_updateDetector;
|
||||
QMap<Folder*, QString> _overallStatusStrings;
|
||||
};
|
||||
|
||||
} // namespace Mirall
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue