Rename _dir to _direction

(to avoid confusion with directory)
This commit is contained in:
Olivier Goffart 2014-03-20 14:56:31 +01:00
parent a1ab9c84c7
commit c5f8a2555d
5 changed files with 16 additions and 16 deletions

View file

@ -323,7 +323,7 @@ void Folder::bubbleUpSyncResult()
FolderMan::instance()->removeMonitorPath( alias(), path()+item._file );
}
if (item._dir == SyncFileItem::Down) {
if (item._direction == SyncFileItem::Down) {
switch (item._instruction) {
case CSYNC_INSTRUCTION_NEW:
newItems++;
@ -354,7 +354,7 @@ void Folder::bubbleUpSyncResult()
// nothing.
break;
}
} else if( item._dir == SyncFileItem::None ) { // ignored files counting.
} else if( item._direction == SyncFileItem::None ) { // ignored files counting.
if( item._instruction == CSYNC_INSTRUCTION_IGNORE ) {
ignoredItems++;
}

View file

@ -91,14 +91,14 @@ bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QStr
// the file was removed or renamed, just recover the old one
downloadItem._instruction = CSYNC_INSTRUCTION_SYNC;
}
downloadItem._dir = SyncFileItem::Down;
downloadItem._direction = SyncFileItem::Down;
newJob = new PropagateDownloadFileLegacy(_propagator, downloadItem);
} else {
// Directories are harder to recover.
// But just re-create the directory, next sync will be able to recover the files
SyncFileItem mkdirItem(_item);
mkdirItem._instruction = CSYNC_INSTRUCTION_SYNC;
mkdirItem._dir = SyncFileItem::Down;
mkdirItem._direction = SyncFileItem::Down;
newJob = new PropagateLocalMkdir(_propagator, mkdirItem);
// Also remove the inodes and fileid from the db so no further renames are tried for
// this item.
@ -134,11 +134,11 @@ void PropagateItemJob::slotRestoreJobCompleted(const SyncFileItem& item )
PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
switch(item._instruction) {
case CSYNC_INSTRUCTION_REMOVE:
if (item._dir == SyncFileItem::Down) return new PropagateLocalRemove(this, item);
if (item._direction == SyncFileItem::Down) return new PropagateLocalRemove(this, item);
else return new PropagateRemoteRemove(this, item);
case CSYNC_INSTRUCTION_NEW:
if (item._isDirectory) {
if (item._dir == SyncFileItem::Down) return new PropagateLocalMkdir(this, item);
if (item._direction == SyncFileItem::Down) return new PropagateLocalMkdir(this, item);
else return new PropagateRemoteMkdir(this, item);
} //fall trough
case CSYNC_INSTRUCTION_SYNC:
@ -148,20 +148,20 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
return 0;
}
if (useLegacyJobs()) {
if (item._dir != SyncFileItem::Up) {
if (item._direction != SyncFileItem::Up) {
return new PropagateDownloadFileLegacy(this, item);
} else {
return new PropagateUploadFileLegacy(this, item);
}
} else {
if (item._dir != SyncFileItem::Up) {
if (item._direction != SyncFileItem::Up) {
return new PropagateDownloadFileQNAM(this, item);
} else {
return new PropagateUploadFileQNAM(this, item);
}
}
case CSYNC_INSTRUCTION_RENAME:
if (item._dir == SyncFileItem::Up) {
if (item._direction == SyncFileItem::Up) {
return new PropagateRemoteRename(this, item);
} else {
return new PropagateLocalRename(this, item);

View file

@ -28,7 +28,7 @@ QString Progress::asResultString( const SyncFileItem& item)
case CSYNC_INSTRUCTION_CONFLICT:
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_NEW:
if (item._dir != SyncFileItem::Up)
if (item._direction != SyncFileItem::Up)
return QCoreApplication::translate( "progress", "Downloaded");
else
return QCoreApplication::translate( "progress", "Uploaded");
@ -48,7 +48,7 @@ QString Progress::asActionString( const SyncFileItem &item )
case CSYNC_INSTRUCTION_CONFLICT:
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_NEW:
if (item._dir != SyncFileItem::Up)
if (item._direction != SyncFileItem::Up)
return QCoreApplication::translate( "progress", "downloading");
else
return QCoreApplication::translate( "progress", "uploading");

View file

@ -212,7 +212,7 @@ bool SyncEngine::checkBlacklisting( SyncFileItem *item )
// has changed, it is tried again
// note that if the retryCount is -1 we never try again.
if( entry._retryCount == 0 ) {
if( item->_dir == SyncFileItem::Up ) { // check the modtime
if( item->_direction == SyncFileItem::Up ) { // check the modtime
if(item->_modtime == 0 || entry._lastTryModtime == 0) {
re = false;
} else {
@ -262,7 +262,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
item._file = QString::fromUtf8( file->path );
item._originalFile = item._file;
item._instruction = file->instruction;
item._dir = SyncFileItem::None;
item._direction = SyncFileItem::None;
item._fileId = QString::fromUtf8(file->file_id);
// record the seen files to be able to clean the journal later
@ -350,7 +350,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
break;
}
item._dir = dir;
item._direction = dir;
// check for blacklisting of this item.
// if the item is on blacklist, the instruction was set to IGNORE
checkBlacklisting( &item );
@ -530,7 +530,7 @@ void SyncEngine::slotUpdateFinished(int updateResult)
if (!_hasFiles && !_syncedItems.isEmpty()) {
qDebug() << Q_FUNC_INFO << "All the files are going to be removed, asking the user";
bool cancel = false;
emit aboutToRemoveAllFiles(_syncedItems.first()._dir, &cancel);
emit aboutToRemoveAllFiles(_syncedItems.first()._direction, &cancel);
if (cancel) {
qDebug() << Q_FUNC_INFO << "Abort sync";
return;

View file

@ -73,7 +73,7 @@ public:
QString _file;
QString _renameTarget;
Type _type;
Direction _dir;
Direction _direction;
bool _isDirectory;
// Variables used by the propagator