mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-18 03:41:50 +03:00
Fix a few FIXME
This commit is contained in:
parent
7cd12e7dc5
commit
2193da0ab5
2 changed files with 14 additions and 27 deletions
|
@ -232,9 +232,7 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||||
}
|
}
|
||||||
|
|
||||||
item._dir = dir;
|
item._dir = dir;
|
||||||
_mutex.lock();
|
|
||||||
_syncedItems.append(item);
|
_syncedItems.append(item);
|
||||||
_mutex.unlock();
|
|
||||||
|
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
@ -261,19 +259,6 @@ int CSyncThread::treewalkFinalize(TREE_WALK_FILE* file)
|
||||||
file->md5 = action->etag.constData();
|
file->md5 = action->etag.constData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put the error in _syncedItems so the UI can display them
|
|
||||||
// (FIXME, this should not be done here but in the propagate step instead)
|
|
||||||
|
|
||||||
if( file->instruction == CSYNC_INSTRUCTION_STAT_ERROR ||
|
|
||||||
file->instruction == CSYNC_INSTRUCTION_ERROR ) {
|
|
||||||
QMutexLocker locker(&_mutex);
|
|
||||||
SyncFileItemVector::iterator it = qBinaryFind(_syncedItems.begin(), _syncedItems.end(), item);
|
|
||||||
if ( it == _syncedItems.end())
|
|
||||||
return 0;
|
|
||||||
it->_instruction = file->instruction;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,9 +312,9 @@ void CSyncThread::startSync()
|
||||||
qDebug() << Q_FUNC_INFO << "Sync started";
|
qDebug() << Q_FUNC_INFO << "Sync started";
|
||||||
|
|
||||||
qDebug() << "starting to sync " << qApp->thread() << QThread::currentThread();
|
qDebug() << "starting to sync " << qApp->thread() << QThread::currentThread();
|
||||||
|
_syncedItems.clear();
|
||||||
|
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
_syncedItems.clear();
|
|
||||||
_needsUpdate = false;
|
_needsUpdate = false;
|
||||||
_mutex.unlock();
|
_mutex.unlock();
|
||||||
|
|
||||||
|
@ -377,7 +362,9 @@ void CSyncThread::startSync()
|
||||||
|
|
||||||
QString lastDeleted;
|
QString lastDeleted;
|
||||||
OwncloudPropagator propagator(session, _localPath, _remotePath, &db);
|
OwncloudPropagator propagator(session, _localPath, _remotePath, &db);
|
||||||
foreach (const SyncFileItem &item , _syncedItems) {
|
|
||||||
|
for (SyncFileItemVector::iterator it = _syncedItems.begin(); it != _syncedItems.end(); ++it) {
|
||||||
|
const SyncFileItem &item = *it;
|
||||||
Action a;
|
Action a;
|
||||||
if (!lastDeleted.isEmpty() && item._file.startsWith(lastDeleted)
|
if (!lastDeleted.isEmpty() && item._file.startsWith(lastDeleted)
|
||||||
&& item._instruction == CSYNC_INSTRUCTION_REMOVE) {
|
&& item._instruction == CSYNC_INSTRUCTION_REMOVE) {
|
||||||
|
@ -391,17 +378,14 @@ void CSyncThread::startSync()
|
||||||
a.instruction = propagator.propagate(item);
|
a.instruction = propagator.propagate(item);
|
||||||
|
|
||||||
// if the propagator had an error for a file, put the error string into the synced item
|
// if the propagator had an error for a file, put the error string into the synced item
|
||||||
if( propagator._errorCode != CSYNC_ERR_NONE ) {
|
if( propagator._errorCode != CSYNC_ERR_NONE
|
||||||
// find the real object to add the err message. The loop only handles const refs.
|
|| a.instruction == CSYNC_INSTRUCTION_ERROR) {
|
||||||
SyncFileItemVector::iterator it = qBinaryFind(_syncedItems.begin(), _syncedItems.end(), item);
|
it->_instruction = CSYNC_INSTRUCTION_ERROR;
|
||||||
if ( it != _syncedItems.end()) {
|
|
||||||
QMutexLocker locker(&_mutex);
|
|
||||||
it->_errorString = csyncErrorToString( propagator._errorCode );
|
it->_errorString = csyncErrorToString( propagator._errorCode );
|
||||||
it->_errorDetail = propagator._errorString;
|
it->_errorDetail = propagator._errorString;
|
||||||
it->_httpCode = propagator._httpStatusCode;
|
it->_httpCode = propagator._httpStatusCode;
|
||||||
qDebug() << "File " << item._file << " propagator error " << item._errorString;
|
qDebug() << "File " << item._file << " propagator error " << item._errorString;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (item._isDirectory && item._instruction == CSYNC_INSTRUCTION_REMOVE
|
if (item._isDirectory && item._instruction == CSYNC_INSTRUCTION_REMOVE
|
||||||
&& a.instruction == CSYNC_INSTRUCTION_DELETED) {
|
&& a.instruction == CSYNC_INSTRUCTION_DELETED) {
|
||||||
|
|
|
@ -49,6 +49,9 @@ struct ScopedPointerHelpers {
|
||||||
|
|
||||||
csync_instructions_e OwncloudPropagator::propagate(const SyncFileItem &item)
|
csync_instructions_e OwncloudPropagator::propagate(const SyncFileItem &item)
|
||||||
{
|
{
|
||||||
|
_errorCode = CSYNC_ERR_NONE;
|
||||||
|
_errorString.clear();
|
||||||
|
_httpStatusCode = 0;
|
||||||
switch(item._instruction) {
|
switch(item._instruction) {
|
||||||
case CSYNC_INSTRUCTION_REMOVE:
|
case CSYNC_INSTRUCTION_REMOVE:
|
||||||
return item._dir == SyncFileItem::Down ? localRemove(item) : remoteRemove(item);
|
return item._dir == SyncFileItem::Down ? localRemove(item) : remoteRemove(item);
|
||||||
|
|
Loading…
Reference in a new issue