Skip to content

Commit

Permalink
Fix OK statuses not being broadcasted during a sync #3944
Browse files Browse the repository at this point in the history
Since the presence of any path in SyncEngine::_syncedItems
would translate in a SYNC status, platforms that don't refresh
all their status cache after an UPDATE_VIEW message like OS X
or Windows would keep displaying that status even after all
files are successfully synchronized.

- Read SyncFileItem::_status to determine the status to display mid-sync
- Match moved paths also to _renameTarget since this might be the
  path to match
- Make sure that PropagateDirectory jobs also set SyncFileItem::_status
  properly
  • Loading branch information
jturcotte committed Jan 5, 2016
1 parent 60a6b2b commit 6e38095
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,9 @@ void PropagateDirectory::finalize()
}
}
_state = Finished;
_item->_status = _hasError == SyncFileItem::NoStatus ? SyncFileItem::Success : _hasError;
emit itemCompleted(*_item, *this);
emit finished(_hasError == SyncFileItem::NoStatus ? SyncFileItem::Success : _hasError);
emit finished(_item->_status);
}

qint64 PropagateDirectory::committedDiskSpace() const
Expand Down
16 changes: 12 additions & 4 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,12 +1221,20 @@ bool SyncEngine::estimateState(QString fn, csync_ftw_type_e t, SyncFileStatus* s
}

Q_FOREACH(const SyncFileItemPtr &item, _syncedItems) {
//qDebug() << Q_FUNC_INFO << fn << item._file << fn.startsWith(item._file) << item._file.startsWith(fn);
//qDebug() << Q_FUNC_INFO << fn << item->_status << item->_file << fn.startsWith(item->_file) << item->_file.startsWith(fn);

if (item->_file.startsWith(pat) ||
item->_file == fn /* the same directory or file */) {
qDebug() << Q_FUNC_INFO << "Setting" << fn << " to STATUS_EVAL";
s->set(SyncFileStatus::STATUS_EVAL);
item->_file == fn || item->_renameTarget == fn /* the same directory or file */) {
if (item->_status == SyncFileItem::NormalError
|| item->_status == SyncFileItem::FatalError)
s->set(SyncFileStatus::STATUS_ERROR);
else if (item->_status == SyncFileItem::FileIgnored)
s->set(SyncFileStatus::STATUS_IGNORE);
else if (item->_status == SyncFileItem::Success)
s->set(SyncFileStatus::STATUS_SYNC);
else
s->set(SyncFileStatus::STATUS_EVAL);
qDebug() << Q_FUNC_INFO << "Setting" << fn << "to" << s->toSocketAPIString();
return true;
}
}
Expand Down

0 comments on commit 6e38095

Please sign in to comment.