static void addErroredSyncItemPathsToList(const SyncFileItemVector& items, QSet<QString>* set) { foreach (const SyncFileItemPtr &item, items) { if (showErrorInSocketApi(*item)) { set->insert(item->_file); } } }
SyncFileStatus SyncFileStatusTracker::syncFileItemStatus(const SyncFileItem& item) { // Hack to know if the item was taken from the sync engine (Sync), or from the database (UpToDate) // Mark any directory in the SyncEngine's items as syncing, this is currently how we mark parent directories // of currently syncing items since the PropagateDirectory job will mark the directorie's SyncFileItem::_status as Success // once all child jobs have been completed. bool waitingForPropagation = (item._isDirectory || item._direction != SyncFileItem::None) && item._status == SyncFileItem::NoStatus; SyncFileStatus status(SyncFileStatus::StatusUpToDate); if (waitingForPropagation) { status.set(SyncFileStatus::StatusSync); } else if (showErrorInSocketApi(item)) { status.set(SyncFileStatus::StatusError); } else if (showWarningInSocketApi(item)) { status.set(SyncFileStatus::StatusWarning); } else { // After a sync finished, we need to show the users issues from that last sync like the activity list does. // Also used for parent directories showing a warning for an error child. SyncFileStatus::SyncFileStatusTag problemStatus = lookupProblem(item.destination(), _syncProblems); if (problemStatus != SyncFileStatus::StatusNone) status.set(problemStatus); } if (item._remotePerm.contains("S")) status.setSharedWithMe(true); return status; }
void SyncFileStatusTracker::slotAboutToPropagate(SyncFileItemVector& items) { std::map<QString, SyncFileStatus::SyncFileStatusTag> oldProblems; std::swap(_syncProblems, oldProblems); foreach (const SyncFileItemPtr &item, items) { // qDebug() << Q_FUNC_INFO << "Investigating" << item->destination() << item->_status; if (showErrorInSocketApi(*item)) { _syncProblems[item->_file] = SyncFileStatus::StatusError; } else if (showWarningInSocketApi(*item)) { _syncProblems[item->_file] = SyncFileStatus::StatusWarning; } emit fileStatusChanged(getSystemDestination(item->destination()), syncFileItemStatus(*item)); } // Make sure to push any status that might have been resolved indirectly since the last sync // (like an error file being deleted from disk) for (auto it = _syncProblems.begin(); it != _syncProblems.end(); ++it) oldProblems.erase(it->first); for (auto it = oldProblems.begin(); it != oldProblems.end(); ++it) { const QString &path = it->first; SyncFileStatus::SyncFileStatusTag severity = it->second; if (severity == SyncFileStatus::StatusError) invalidateParentPaths(path); emit fileStatusChanged(getSystemDestination(path), fileStatus(path)); } }
// a item is completed: count the errors and forward to the ProgressDispatcher void Folder::slotItemCompleted(const SyncFileItem &item, const PropagatorJob& job) { if (showErrorInSocketApi(item)) { _stateLastSyncItemsWithErrorNew.insert(item._file); } if (Progress::isWarningKind(item._status)) { // Count all error conditions. _syncResult.setWarnCount(_syncResult.warnCount()+1); } emit ProgressDispatcher::instance()->itemCompleted(alias(), item, job); }
void SyncFileStatusTracker::slotItemCompleted(const SyncFileItem &item) { // qDebug() << Q_FUNC_INFO << item.destination() << item._status; if (showErrorInSocketApi(item)) { _syncProblems[item._file] = SyncFileStatus::StatusError; invalidateParentPaths(item.destination()); } else if (showWarningInSocketApi(item)) { _syncProblems[item._file] = SyncFileStatus::StatusWarning; } else { _syncProblems.erase(item._file); } emit fileStatusChanged(getSystemDestination(item.destination()), syncFileItemStatus(item)); }