mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
SocketAPI: Code simplifications as asked for in the review.
This commit is contained in:
parent
361ebf5464
commit
7acdf50a2c
2 changed files with 2 additions and 12 deletions
|
@ -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);
|
const QString file = QDir::cleanPath(argument).mid(syncFolder->cleanPath().length()+1);
|
||||||
|
|
||||||
// future: Send more specific states for paused, disconnected etc.
|
// future: Send more specific states for paused, disconnected etc.
|
||||||
if( syncFolder->syncPaused() ){
|
if( syncFolder->syncPaused() || !syncFolder->accountState()->isConnected() ) {
|
||||||
statusString = nopString;
|
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 {
|
} else {
|
||||||
SyncFileStatus fileStatus = syncFolder->syncEngine().syncFileStatusTracker().fileStatus(file);
|
SyncFileStatus fileStatus = syncFolder->syncEngine().syncFileStatusTracker().fileStatus(file);
|
||||||
|
|
||||||
|
|
|
@ -102,13 +102,11 @@ SyncFileStatus SyncFileStatusTracker::rootStatus()
|
||||||
status = SyncFileStatus::StatusSync;
|
status = SyncFileStatus::StatusSync;
|
||||||
} else {
|
} else {
|
||||||
// sync is not running. Check dirty list and _syncProblems
|
// 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) {
|
for (auto it = _syncProblems.begin(); it != _syncProblems.end(); ++it) {
|
||||||
if( it->second == SyncFileStatus::StatusError ) {
|
if( it->second == SyncFileStatus::StatusError ) {
|
||||||
errs ++;
|
errs ++;
|
||||||
break; // stop if an error found at all.
|
break; // stop if an error found at all.
|
||||||
} if( it->second == SyncFileStatus::StatusWarning ) {
|
|
||||||
warns ++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( errs ) {
|
if( errs ) {
|
||||||
|
|
Loading…
Reference in a new issue