case CSYNC_INSTRUCTION_NEW:
case CSYNC_INSTRUCTION_TYPE_CHANGE:
if (item._direction != SyncFileItem::Up) {
- return QCoreApplication::translate("progress", "Downloaded");
+ if (item._type == ItemTypeVirtualFile) {
+ return QCoreApplication::translate("progress", "Virtual file created");
+ } else if (item._type == ItemTypeVirtualFileDehydration) {
+ return QCoreApplication::translate("progress", "Replaced by virtual file");
+ } else {
+ return QCoreApplication::translate("progress", "Downloaded");
+ }
} else {
return QCoreApplication::translate("progress", "Uploaded");
}
}
qCDebug(lcPropagateDownload) << "dehydrating file" << _item->_file;
- _item->_type = ItemTypeVirtualFile; // Needed?
vfs->dehydratePlaceholder(*_item);
propagator()->_journal->deleteFileRecord(_item->_originalFile);
- if (!_item->_renameTarget.isEmpty())
- _item->_file = _item->_renameTarget;
+ // NOTE: This is only done because other rename-like ops also adjust _file, even though
+ // updateMetadata() will store at destination() anyway. Doing this may not be necessary
+ // but maybe it has an effect on reporting (destination() and moves aren't handled
+ // consistently everywhere)
+ _item->_file = _item->destination();
updateMetadata(false);
return;
}
SyncJournalFileRecord rec;
rec._path = destination().toUtf8();
rec._modtime = _modtime;
+
+ // Some types should never be written to the database when propagation completes
rec._type = _type;
+ if (rec._type == ItemTypeVirtualFileDownload)
+ rec._type = ItemTypeFile;
+ if (rec._type == ItemTypeVirtualFileDehydration)
+ rec._type = ItemTypeVirtualFile;
+
rec._etag = _etag;
rec._fileId = _fileId;
rec._fileSize = _size;
}
// Variables useful for everybody
+
+ /** The syncfolder-relative filesystem path that the operation is about
+ *
+ * For rename operation this is the rename source and the target is in _renameTarget.
+ */
QString _file;
- // for renames: the name _file should be renamed to
- // for dehydrations: the name _file should become after dehydration (like adding a suffix)
+
+ /** for renames: the name _file should be renamed to
+ * for dehydrations: the name _file should become after dehydration (like adding a suffix)
+ * otherwise empty. Use destination() to find the sync target.
+ */
QString _renameTarget;
+ /** The db-path of this item.
+ *
+ * This can easily differ from _file and _renameTarget if parts of the path were renamed.
+ */
+ QString _originalFile;
+
/// Whether there's end to end encryption on this file.
/// If the file is encrypted, the _encryptedFilename is
/// the encrypted name on the server.
QString _encryptedFileName;
+
ItemType _type BITFIELD(3);
Direction _direction BITFIELD(3);
bool _serverHasIgnoredFiles BITFIELD(1);
// Variables used by the propagator
csync_instructions_e _instruction = CSYNC_INSTRUCTION_NONE;
- QString _originalFile; // as it is in the csync tree
time_t _modtime = 0;
QByteArray _etag;
quint64 _size = 0;
QVERIFY(isDehydrated("A/a1"));
QVERIFY(hasDehydratedDbEntries("A/a1"));
QVERIFY(itemInstruction(completeSpy, "A/a1.nextcloud", CSYNC_INSTRUCTION_SYNC));
+ QCOMPARE(findItem(completeSpy, "A/a1.nextcloud")->_type, ItemTypeVirtualFileDehydration);
QVERIFY(isDehydrated("A/a2"));
QVERIFY(hasDehydratedDbEntries("A/a2"));
QVERIFY(itemInstruction(completeSpy, "A/a2.nextcloud", CSYNC_INSTRUCTION_SYNC));
+ QCOMPARE(findItem(completeSpy, "A/a2.nextcloud")->_type, ItemTypeVirtualFileDehydration);
QVERIFY(!fakeFolder.currentLocalState().find("B/b1"));
QVERIFY(!fakeFolder.currentRemoteState().find("B/b1"));