SocketAPI: Code simplifications as asked for in the review.

This commit is contained in:
Klaas Freitag 2016-04-21 14:54:13 +02:00
parent 361ebf5464
commit 7acdf50a2c
2 changed files with 2 additions and 12 deletions

View file

@ -293,16 +293,8 @@ void SocketApi::command_RETRIEVE_FILE_STATUS(const QString& argument, QIODevice*
const QString file = QDir::cleanPath(argument).mid(syncFolder->cleanPath().length()+1);
// future: Send more specific states for paused, disconnected etc.
if( syncFolder->syncPaused() ){
if( syncFolder->syncPaused() || !syncFolder->accountState()->isConnected() ) {
statusString = nopString;
} else if( !syncFolder->accountState()->isConnected() ) {
if( file.isEmpty() || file == QLatin1String("/") ) {
// only the root folder
statusString = nopString;
} else {
// all other files and dirs in unconnected sync
statusString = nopString;
}
} else {
SyncFileStatus fileStatus = syncFolder->syncEngine().syncFileStatusTracker().fileStatus(file);

View file

@ -102,13 +102,11 @@ SyncFileStatus SyncFileStatusTracker::rootStatus()
status = SyncFileStatus::StatusSync;
} else {
// sync is not running. Check dirty list and _syncProblems
int errs = 0, warns = 0;
int errs = 0;
for (auto it = _syncProblems.begin(); it != _syncProblems.end(); ++it) {
if( it->second == SyncFileStatus::StatusError ) {
errs ++;
break; // stop if an error found at all.
} if( it->second == SyncFileStatus::StatusWarning ) {
warns ++;
}
}
if( errs ) {