mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 22:46:04 +03:00
Fix the root item sync status #4682
Make sure that we push the new status when the status of the SyncEngine changed. SyncEngine::started comes a bit late, only when the propagation starts, although it's better in this case since child folders will only switch to Sync in aboutToPropagate. Also fix an issue with SyncEngine::findSyncItem when using an empty fileName; this would match and return the wrong item, even though not currently happening with the code since fileStatus won't call it with an empty fileName anymore.
This commit is contained in:
parent
a5df44c757
commit
32b3023a8e
3 changed files with 12 additions and 5 deletions
|
@ -1342,7 +1342,7 @@ SyncFileItem* SyncEngine::findSyncItem(const QString &fileName) const
|
|||
{
|
||||
Q_FOREACH(const SyncFileItemPtr &item, _syncedItems) {
|
||||
// Directories will appear in this list as well, and will get their status set once all children have been propagated
|
||||
if ((item->_file == fileName || item->_renameTarget == fileName))
|
||||
if ((item->_file == fileName || (!item->_renameTarget.isEmpty() && item->_renameTarget == fileName)))
|
||||
return item.data();
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -72,11 +72,12 @@ SyncFileStatusTracker::SyncFileStatusTracker(SyncEngine *syncEngine)
|
|||
: _syncEngine(syncEngine)
|
||||
{
|
||||
connect(syncEngine, SIGNAL(aboutToPropagate(SyncFileItemVector&)),
|
||||
this, SLOT(slotAboutToPropagate(SyncFileItemVector&)));
|
||||
SLOT(slotAboutToPropagate(SyncFileItemVector&)));
|
||||
connect(syncEngine, SIGNAL(itemCompleted(const SyncFileItem&, const PropagatorJob&)),
|
||||
this, SLOT(slotItemCompleted(const SyncFileItem&)));
|
||||
connect(syncEngine, SIGNAL(started()),
|
||||
SLOT(slotClearDirtyPaths()));
|
||||
SLOT(slotItemCompleted(const SyncFileItem&)));
|
||||
connect(syncEngine, SIGNAL(started()), SLOT(slotClearDirtyPaths()));
|
||||
connect(syncEngine, SIGNAL(started()), SLOT(slotSyncEngineRunningChanged()));
|
||||
connect(syncEngine, SIGNAL(finished(bool)), SLOT(slotSyncEngineRunningChanged()));
|
||||
}
|
||||
|
||||
SyncFileStatus SyncFileStatusTracker::rootStatus()
|
||||
|
@ -213,6 +214,11 @@ void SyncFileStatusTracker::slotItemCompleted(const SyncFileItem &item)
|
|||
emit fileStatusChanged(getSystemDestination(item), fileStatus(item));
|
||||
}
|
||||
|
||||
void SyncFileStatusTracker::slotSyncEngineRunningChanged()
|
||||
{
|
||||
emit fileStatusChanged(_syncEngine->localPath(), rootStatus());
|
||||
}
|
||||
|
||||
void SyncFileStatusTracker::slotClearDirtyPaths()
|
||||
{
|
||||
// We just assume that during a sync all dirty statuses will be resolved
|
||||
|
|
|
@ -46,6 +46,7 @@ signals:
|
|||
private slots:
|
||||
void slotAboutToPropagate(SyncFileItemVector& items);
|
||||
void slotItemCompleted(const SyncFileItem& item);
|
||||
void slotSyncEngineRunningChanged();
|
||||
void slotClearDirtyPaths();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue