It's always equivalent to _type == SyncFileItem::Directory.
void Folder::slotItemCompleted(const SyncFileItemPtr &item)
{
// add new directories or remove gone away dirs to the watcher
- if (item->_isDirectory && item->_instruction == CSYNC_INSTRUCTION_NEW) {
+ if (item->isDirectory() && item->_instruction == CSYNC_INSTRUCTION_NEW) {
FolderMan::instance()->addMonitorPath(alias(), path() + item->_file);
}
- if (item->_isDirectory && item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
+ if (item->isDirectory() && item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
FolderMan::instance()->removeMonitorPath(alias(), path() + item->_file);
}
PropagateItemJob *newJob = NULL;
if (httpStatusCode == 403 && propagator()->isInSharedDirectory(_item->_file)) {
- if (!_item->_isDirectory) {
+ if (!_item->isDirectory()) {
SyncFileItemPtr downloadItem(new SyncFileItem(*_item));
if (downloadItem->_instruction == CSYNC_INSTRUCTION_NEW
|| downloadItem->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE) {
return new PropagateRemoteDelete(this, item);
case CSYNC_INSTRUCTION_NEW:
case CSYNC_INSTRUCTION_TYPE_CHANGE:
- if (item->_isDirectory) {
+ if (item->isDirectory()) {
if (item->_direction == SyncFileItem::Down) {
auto job = new PropagateLocalMkdir(this, item);
job->setDeleteExistingFile(deleteExisting);
delDirJob->increaseAffectedCount();
}
continue;
- } else if (item->_isDirectory
+ } else if (item->isDirectory()
&& (item->_instruction == CSYNC_INSTRUCTION_NEW
|| item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE)) {
// create a new directory within a deleted directory? That can happen if the directory
directories.pop();
}
- if (item->_isDirectory) {
+ if (item->isDirectory()) {
PropagateDirectory *dir = new PropagateDirectory(this, item);
if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE
/** Return true if the size needs to be taken in account in the total amount of time */
static inline bool isSizeDependent(const SyncFileItem &item)
{
- return !item._isDirectory && (item._instruction == CSYNC_INSTRUCTION_CONFLICT
+ return !item.isDirectory() && (item._instruction == CSYNC_INSTRUCTION_CONFLICT
|| item._instruction == CSYNC_INSTRUCTION_SYNC
|| item._instruction == CSYNC_INSTRUCTION_NEW
|| item._instruction == CSYNC_INSTRUCTION_TYPE_CHANGE);
return;
}
- propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->_isDirectory);
+ propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory());
propagator()->_journal->commit("Remote Remove");
done(SyncFileItem::Success);
}
void start() Q_DECL_OVERRIDE;
void abort() Q_DECL_OVERRIDE;
- bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return !_item->_isDirectory; }
+ bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return !_item->isDirectory(); }
private slots:
void slotDeleteJobFinished();
return;
}
- if (_item->_isDirectory) {
+ if (_item->isDirectory()) {
if (!adjustSelectiveSync(propagator()->_journal, _item->_file, _item->_renameTarget)) {
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
return;
}
void start() Q_DECL_OVERRIDE;
void abort() Q_DECL_OVERRIDE;
- JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->_isDirectory ? WaitForFinished : FullParallelism; }
+ JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->isDirectory() ? WaitForFinished : FullParallelism; }
/**
* Rename the directory in the selective sync list
return;
}
- if (_item->_isDirectory) {
+ if (_item->isDirectory()) {
if (QDir(filename).exists() && !removeRecursively(QString())) {
done(SyncFileItem::NormalError, _error);
return;
}
}
propagator()->reportProgress(*_item, 0);
- propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->_isDirectory);
+ propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory());
propagator()->_journal->commit("Local remove");
done(SyncFileItem::Success);
}
record._checksumHeader = oldRecord._checksumHeader;
}
- if (!_item->_isDirectory) { // Directories are saved at the end
+ if (!_item->isDirectory()) { // Directories are saved at the end
if (!propagator()->_journal->setFileRecord(record)) {
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
return;
{
}
void start() Q_DECL_OVERRIDE;
- JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->_isDirectory ? WaitForFinished : FullParallelism; }
+ JobParallelism parallelism() Q_DECL_OVERRIDE { return _item->isDirectory() ? WaitForFinished : FullParallelism; }
};
}
dir = SyncFileItem::None;
// For directories, metadata-only updates will be done after all their files are propagated.
if (!isDirectory) {
- item->_isDirectory = isDirectory;
emit syncItemDiscovered(*item);
// Update the database now already: New remote fileid or Etag or RemotePerm
}
item->_direction = dir;
- item->_isDirectory = isDirectory;
if (instruction != CSYNC_INSTRUCTION_NONE) {
// check for blacklisting of this item.
// if the item is on blacklist, the instruction was set to ERROR
(*it)->_status = SyncFileItem::FileIgnored;
(*it)->_errorString = tr("Ignored because of the \"choose what to sync\" blacklist");
- if ((*it)->_isDirectory) {
+ if ((*it)->isDirectory()) {
auto it_base = it;
for (SyncFileItemVector::iterator it_next = it + 1; it_next != syncItems.end() && (*it_next)->_file.startsWith(path); ++it_next) {
it = it_next;
if (parent_it == syncItems.end() || (*parent_it)->destination() != parentDir) {
break;
}
- ASSERT((*parent_it)->_isDirectory);
+ ASSERT((*parent_it)->isDirectory());
if ((*parent_it)->_instruction != CSYNC_INSTRUCTION_IGNORE) {
break; // already changed
}
if (perms.isNull()) {
// No permissions set
break;
- } else if ((*it)->_isDirectory && !perms.contains("K")) {
+ } else if ((*it)->isDirectory() && !perms.contains("K")) {
qCWarning(lcEngine) << "checkForPermission: ERROR" << (*it)->_file;
(*it)->_instruction = CSYNC_INSTRUCTION_ERROR;
(*it)->_status = SyncFileItem::NormalError;
(*it)->_errorString = tr("Not allowed because you don't have permission to add parent folder");
}
- } else if (!(*it)->_isDirectory && !perms.contains("C")) {
+ } else if (!(*it)->isDirectory() && !perms.contains("C")) {
qCWarning(lcEngine) << "checkForPermission: ERROR" << (*it)->_file;
(*it)->_instruction = CSYNC_INSTRUCTION_ERROR;
(*it)->_status = SyncFileItem::NormalError;
(*it)->_isRestoration = true;
(*it)->_errorString = tr("Not allowed to remove, restoring");
- if ((*it)->_isDirectory) {
+ if ((*it)->isDirectory()) {
// restore all sub items
for (SyncFileItemVector::iterator it_next = it + 1;
it_next != syncItems.end() && (*it_next)->_file.startsWith(path); ++it_next) {
// not delete permission we fast forward the iterator and leave the
// delete jobs intact. It is not physically tried to remove this files
// underneath, propagator sees that.
- if ((*it)->_isDirectory) {
+ if ((*it)->isDirectory()) {
// put a more descriptive message if a top level share dir really is removed.
if (it == syncItems.begin() || !(path.startsWith((*(it - 1))->_file))) {
(*it)->_errorString = tr("Local files and share folder removed.");
if (isRename || destPerms.isNull()) {
// no need to check for the destination dir permission
destinationOK = true;
- } else if ((*it)->_isDirectory && !destPerms.contains("K")) {
+ } else if ((*it)->isDirectory() && !destPerms.contains("K")) {
destinationOK = false;
- } else if (!(*it)->_isDirectory && !destPerms.contains("C")) {
+ } else if (!(*it)->isDirectory() && !destPerms.contains("C")) {
destinationOK = false;
}
#ifdef OWNCLOUD_RESTORE_RENAME /* We don't like the idea of renaming behind user's back, as the user may be working with the files */
if (!sourceOK && (!destinationOK || isRename)
// (not for directory because that's more complicated with the contents that needs to be adjusted)
- && !(*it)->_isDirectory) {
+ && !(*it)->isDirectory()) {
// Both the source and the destination won't allow move. Move back to the original
std::swap((*it)->_file, (*it)->_renameTarget);
(*it)->_direction = SyncFileItem::Down;
_anotherSyncNeeded = ImmediateFollowUp;
- if ((*it)->_isDirectory) {
+ if ((*it)->isDirectory()) {
for (SyncFileItemVector::iterator it_next = it + 1;
it_next != syncItems.end() && (*it_next)->destination().startsWith(path); ++it_next) {
it = it_next;
SyncFileItem()
: _type(UnknownType)
, _direction(None)
- , _isDirectory(false)
, _serverHasIgnoredFiles(false)
, _hasBlacklistEntry(false)
, _errorMayBeBlacklisted(false)
return _file.isEmpty();
}
+ bool isDirectory() const
+ {
+ return _type == SyncFileItem::Directory;
+ }
+
/**
* True if the item had any kind of error.
*
QString _renameTarget;
Type _type BITFIELD(3);
Direction _direction BITFIELD(3);
- bool _isDirectory BITFIELD(1);
bool _serverHasIgnoredFiles BITFIELD(1);
/// Whether there's an entry in the blacklist table.
_foundFilesNotSynced = true;
}
- if (item->_isDirectory && (item->_instruction == CSYNC_INSTRUCTION_NEW
+ if (item->isDirectory() && (item->_instruction == CSYNC_INSTRUCTION_NEW
|| item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE
|| item->_instruction == CSYNC_INSTRUCTION_REMOVE
|| item->_instruction == CSYNC_INSTRUCTION_RENAME)) {
QSet<QString> seen;
for(const QList<QVariant> &args : completeSpy) {
auto item = args[0].value<SyncFileItemPtr>();
- qDebug() << item->_file << item->_isDirectory << item->_status;
+ qDebug() << item->_file << item->isDirectory() << item->_status;
QVERIFY(!seen.contains(item->_file)); // signal only sent once per item
seen.insert(item->_file);
if (item->_file == "Y/Z/d2") {