Propagate Remote mkdir: save the fileid to the database early

It's important so that if we delete or rename  a diectory that is being
uploaded, this is properly detected
This commit is contained in:
Olivier Goffart 2015-01-22 15:09:45 +01:00
parent 168c89aba7
commit 3c26bfa618
2 changed files with 13 additions and 3 deletions

View file

@ -88,8 +88,7 @@ void PropagateRemoteMkdir::slotMkcolJobFinished()
_job = propfindJob;
return;
}
done(SyncFileItem::Success);
success();
}
void PropagateRemoteMkdir::propfindResult(const QVariantMap &result)
@ -101,7 +100,7 @@ void PropagateRemoteMkdir::propfindResult(const QVariantMap &result)
if (result.contains("id")) {
_item._fileId = result["id"].toByteArray();
}
done(SyncFileItem::Success);
success();
}
void PropagateRemoteMkdir::propfindError()
@ -111,6 +110,16 @@ void PropagateRemoteMkdir::propfindError()
done(SyncFileItem::Success);
}
void PropagateRemoteMkdir::success()
{
// save the file id already so we can detect rename or remove
SyncJournalFileRecord record(_item, _propagator->_localDir + _item.destination());
_propagator->_journal->setFileRecord(record);
done(SyncFileItem::Success);
}
}

View file

@ -31,6 +31,7 @@ private slots:
void slotMkcolJobFinished();
void propfindResult(const QVariantMap &);
void propfindError();
void success();
};
}