Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2018-05-18 09:29:40 +0300
committerckamm <mail@ckamm.de>2018-05-23 10:57:00 +0300
commit8f9f2b546277898ea602ae40f639e4b58e413fe5 (patch)
treee2cfa3ebe6f09e39f68104d90ed942c954569b00
parent70b1deb2262e440753b02d56a2390e0a407aba4a (diff)
Rename Placeholders to Virtual Files in code #6531
-rw-r--r--CMakeLists.txt4
-rw-r--r--OWNCLOUD.cmake2
-rw-r--r--cmake/modules/MacOSXBundleInfo.plist.in8
-rw-r--r--cmake/modules/NSIS.template.in8
-rw-r--r--config.h.in4
-rw-r--r--src/csync/csync.h4
-rw-r--r--src/csync/csync_private.h8
-rw-r--r--src/csync/csync_reconcile.cpp36
-rw-r--r--src/csync/csync_update.cpp62
-rw-r--r--src/gui/accountsettings.cpp2
-rw-r--r--src/gui/application.cpp20
-rw-r--r--src/gui/application.h6
-rw-r--r--src/gui/folder.cpp19
-rw-r--r--src/gui/folder.h10
-rw-r--r--src/gui/folderwizard.cpp16
-rw-r--r--src/gui/folderwizard.h4
-rw-r--r--src/gui/owncloud.xml.in4
-rw-r--r--src/gui/owncloudsetupwizard.cpp2
-rw-r--r--src/gui/socketapi.cpp22
-rw-r--r--src/gui/socketapi.h2
-rw-r--r--src/gui/wizard/owncloudadvancedsetuppage.cpp22
-rw-r--r--src/gui/wizard/owncloudadvancedsetuppage.h4
-rw-r--r--src/gui/wizard/owncloudadvancedsetuppage.ui6
-rw-r--r--src/gui/wizard/owncloudwizard.cpp8
-rw-r--r--src/gui/wizard/owncloudwizard.h6
-rw-r--r--src/libsync/owncloudpropagator.cpp4
-rw-r--r--src/libsync/owncloudpropagator.h2
-rw-r--r--src/libsync/propagatedownload.cpp20
-rw-r--r--src/libsync/syncengine.cpp10
-rw-r--r--src/libsync/syncoptions.h6
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/testsyncvirtualfiles.cpp (renamed from test/testsyncplaceholders.cpp)90
32 files changed, 212 insertions, 211 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f43209e1f..a7856a0e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,8 +14,8 @@ else ()
endif()
# Default suffix if the theme doesn't define one
-if(NOT DEFINED APPLICATION_PLACEHOLDER_SUFFIX)
- set(APPLICATION_PLACEHOLDER_SUFFIX "${APPLICATION_SHORTNAME}_placeholder" CACHE STRING "Placeholder suffix (not including the .)")
+if(NOT DEFINED APPLICATION_VIRTUALFILE_SUFFIX)
+ set(APPLICATION_VIRTUALFILE_SUFFIX "${APPLICATION_SHORTNAME}_virtual" CACHE STRING "Virtual file suffix (not including the .)")
endif()
# need this logic to not mess with re/uninstallations via macosx.pkgproj
diff --git a/OWNCLOUD.cmake b/OWNCLOUD.cmake
index f560db47d..8d76fa014 100644
--- a/OWNCLOUD.cmake
+++ b/OWNCLOUD.cmake
@@ -5,7 +5,7 @@ set( APPLICATION_DOMAIN "owncloud.com" )
set( APPLICATION_VENDOR "ownCloud" )
set( APPLICATION_UPDATE_URL "https://updates.owncloud.com/client/" CACHE string "URL for updater" )
set( APPLICATION_ICON_NAME "owncloud" )
-set( APPLICATION_PLACEHOLDER_SUFFIX "owncloud" CACHE STRING "Placeholder suffix (not including the .)")
+set( APPLICATION_VIRTUALFILE_SUFFIX "owncloud" CACHE STRING "Virtual file suffix (not including the .)")
set( LINUX_PACKAGE_SHORTNAME "owncloud" )
diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in
index 3a402f1e8..9eb0f2bc5 100644
--- a/cmake/modules/MacOSXBundleInfo.plist.in
+++ b/cmake/modules/MacOSXBundleInfo.plist.in
@@ -37,11 +37,11 @@
<array>
<dict>
<key>UTTypeIdentifier</key>
- <string>@APPLICATION_REV_DOMAIN@.placeholder</string>
+ <string>@APPLICATION_REV_DOMAIN@.VIRTUALFILE</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
- <string>@APPLICATION_PLACEHOLDER_SUFFIX@</string>
+ <string>@APPLICATION_VIRTUALFILE_SUFFIX@</string>
<key>public.mime-type</key>
<string>application/octet-stream</string>
</dict>
@@ -56,14 +56,14 @@
<array>
<dict>
<key>CFBundleTypeName</key>
- <string>@APPLICATION_EXECUTABLE@ Download Placeholder</string>
+ <string>@APPLICATION_EXECUTABLE@ Download Virtual File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
- <string>@APPLICATION_REV_DOMAIN@.placeholder</string>
+ <string>@APPLICATION_REV_DOMAIN@.VIRTUALFILE</string>
</array>
</dict>
</array>
diff --git a/cmake/modules/NSIS.template.in b/cmake/modules/NSIS.template.in
index 8a2edf965..860910881 100644
--- a/cmake/modules/NSIS.template.in
+++ b/cmake/modules/NSIS.template.in
@@ -7,8 +7,8 @@
!define APPLICATION_CMD_EXECUTABLE "@APPLICATION_EXECUTABLE@cmd.exe"
!define APPLICATION_DOMAIN "@APPLICATION_DOMAIN@"
!define APPLICATION_LICENSE "@APPLICATION_LICENSE@"
-!define APPLICATION_PLACEHOLDER_SUFFIX "@APPLICATION_PLACEHOLDER_SUFFIX@"
-!define APPLICATION_PLACEHOLDER_FILECLASS "@APPLICATION_EXECUTABLE@.@APPLICATION_PLACEHOLDER_SUFFIX@"
+!define APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@"
+!define APPLICATION_VIRTUALFILE_FILECLASS "@APPLICATION_EXECUTABLE@.@APPLICATION_VIRTUALFILE_SUFFIX@"
!define WIN_SETUP_BITMAP_PATH "@WIN_SETUP_BITMAP_PATH@"
!define CRASHREPORTER_EXECUTABLE "@CRASHREPORTER_EXECUTABLE@"
@@ -471,7 +471,7 @@ Section "${APPLICATION_NAME}" SEC_APPLICATION
File "${SOURCE_PATH}/sync-exclude.lst"
;Add file association
- !insertmacro APP_ASSOCIATE "${APPLICATION_PLACEHOLDER_SUFFIX}" "${APPLICATION_PLACEHOLDER_FILECLASS}" "Placeholder for Remote File" "$INSTDIR\${APPLICATION_EXECUTABLE},0" "Download" "$INSTDIR\${APPLICATION_EXECUTABLE} $\"%1$\""
+ !insertmacro APP_ASSOCIATE "${APPLICATION_VIRTUALFILE_SUFFIX}" "${APPLICATION_VIRTUALFILE_FILECLASS}" "Virtual File for Remote File" "$INSTDIR\${APPLICATION_EXECUTABLE},0" "Download" "$INSTDIR\${APPLICATION_EXECUTABLE} $\"%1$\""
SectionEnd
@@ -651,7 +651,7 @@ Section Uninstall
DeleteRegKey HKCR "${APPLICATION_NAME}"
;Remove file association
- !insertmacro APP_UNASSOCIATE "${APPLICATION_PLACEHOLDER_SUFFIX}" "${APPLICATION_PLACEHOLDER_FILECLASS}"
+ !insertmacro APP_UNASSOCIATE "${APPLICATION_VIRTUALFILE_SUFFIX}" "${APPLICATION_VIRTUALFILE_FILECLASS}"
;Shell extension
!ifdef OPTION_SECTION_SC_SHELL_EXT
diff --git a/config.h.in b/config.h.in
index c78d52059..68143d943 100644
--- a/config.h.in
+++ b/config.h.in
@@ -18,8 +18,8 @@
#cmakedefine APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@"
#cmakedefine APPLICATION_UPDATE_URL "@APPLICATION_UPDATE_URL@"
#cmakedefine APPLICATION_ICON_NAME "@APPLICATION_ICON_NAME@"
-#cmakedefine APPLICATION_PLACEHOLDER_SUFFIX "@APPLICATION_PLACEHOLDER_SUFFIX@"
-#define APPLICATION_DOTPLACEHOLDER_SUFFIX "." APPLICATION_PLACEHOLDER_SUFFIX
+#cmakedefine APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@"
+#define APPLICATION_DOTVIRTUALFILE_SUFFIX "." APPLICATION_VIRTUALFILE_SUFFIX
#cmakedefine ZLIB_FOUND @ZLIB_FOUND@
diff --git a/src/csync/csync.h b/src/csync/csync.h
index 5a9f49e3d..c5454149e 100644
--- a/src/csync/csync.h
+++ b/src/csync/csync.h
@@ -138,8 +138,8 @@ enum ItemType {
ItemTypeSoftLink = 1,
ItemTypeDirectory = 2,
ItemTypeSkip = 3,
- ItemTypePlaceholder = 4,
- ItemTypePlaceholderDownload = 5
+ ItemTypeVirtualFile = 4,
+ ItemTypeVirtualFileDownload = 5
};
diff --git a/src/csync/csync_private.h b/src/csync/csync_private.h
index 5426fba1b..93f06f840 100644
--- a/src/csync/csync_private.h
+++ b/src/csync/csync_private.h
@@ -197,14 +197,14 @@ struct OCSYNC_EXPORT csync_s {
bool upload_conflict_files = false;
/**
- * Whether new remote files should start out as placeholders.
+ * Whether new remote files should start out as virtual.
*/
- bool new_files_are_placeholders = false;
+ bool new_files_are_virtual = false;
/**
- * The suffix to use for placeholder files.
+ * The suffix to use for virtual files.
*/
- QByteArray placeholder_suffix;
+ QByteArray virtual_file_suffix;
csync_s(const char *localUri, OCC::SyncJournalDb *statedb);
~csync_s();
diff --git a/src/csync/csync_reconcile.cpp b/src/csync/csync_reconcile.cpp
index cf254ff57..20b57c369 100644
--- a/src/csync/csync_reconcile.cpp
+++ b/src/csync/csync_reconcile.cpp
@@ -122,25 +122,25 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx)
/* If it is ignored, other->instruction will be IGNORE so this one will also be ignored */
}
- // If the user adds a file locally check whether a placeholder for that name exists.
+ // If the user adds a file locally check whether a virtual file for that name exists.
// If so, go to "potential conflict" mode by switching the remote entry to be a
// real file.
if (!other
&& ctx->current == LOCAL_REPLICA
&& cur->instruction == CSYNC_INSTRUCTION_NEW
- && cur->type != ItemTypePlaceholder) {
- // Check if we have a placeholder entry in the remote tree
- auto placeholderPath = cur->path;
- placeholderPath.append(ctx->placeholder_suffix);
- other = other_tree->findFile(placeholderPath);
+ && cur->type != ItemTypeVirtualFile) {
+ // Check if we have a virtual file entry in the remote tree
+ auto virtualFilePath = cur->path;
+ virtualFilePath.append(ctx->virtual_file_suffix);
+ other = other_tree->findFile(virtualFilePath);
if (!other) {
/* Check the renamed path as well. */
- other = other_tree->findFile(csync_rename_adjust_parent_path(ctx, placeholderPath));
+ other = other_tree->findFile(csync_rename_adjust_parent_path(ctx, virtualFilePath));
}
- if (other && other->type == ItemTypePlaceholder) {
- qCInfo(lcReconcile) << "Found placeholder for local" << cur->path << "in remote tree";
+ if (other && other->type == ItemTypeVirtualFile) {
+ qCInfo(lcReconcile) << "Found virtual file for local" << cur->path << "in remote tree";
other->path = cur->path;
- other->type = ItemTypePlaceholderDownload;
+ other->type = ItemTypeVirtualFileDownload;
other->instruction = CSYNC_INSTRUCTION_EVAL;
} else {
other = nullptr;
@@ -166,12 +166,12 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx)
cur->instruction = CSYNC_INSTRUCTION_NEW;
break;
}
- /* If the local placeholder is gone it should be reestablished.
+ /* If the local virtual file is gone, it should be reestablished.
* Unless the base file is seen in the local tree now. */
- if (cur->type == ItemTypePlaceholder
+ if (cur->type == ItemTypeVirtualFile
&& ctx->current == REMOTE_REPLICA
- && cur->path.endsWith(ctx->placeholder_suffix)
- && !other_tree->findFile(cur->path.left(cur->path.size() - ctx->placeholder_suffix.size()))) {
+ && cur->path.endsWith(ctx->virtual_file_suffix)
+ && !other_tree->findFile(cur->path.left(cur->path.size() - ctx->virtual_file_suffix.size()))) {
cur->instruction = CSYNC_INSTRUCTION_NEW;
break;
}
@@ -426,13 +426,13 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx)
cur->instruction = CSYNC_INSTRUCTION_NEW;
break;
case CSYNC_INSTRUCTION_NONE:
- // NONE/NONE on placeholders might become a REMOVE if the base file
+ // NONE/NONE on virtual files might become a REMOVE if the base file
// is found in the local tree.
- if (cur->type == ItemTypePlaceholder
+ if (cur->type == ItemTypeVirtualFile
&& other->instruction == CSYNC_INSTRUCTION_NONE
&& ctx->current == LOCAL_REPLICA
- && cur->path.endsWith(ctx->placeholder_suffix)
- && ctx->local.files.findFile(cur->path.left(cur->path.size() - ctx->placeholder_suffix.size()))) {
+ && cur->path.endsWith(ctx->virtual_file_suffix)
+ && ctx->local.files.findFile(cur->path.left(cur->path.size() - ctx->virtual_file_suffix.size()))) {
cur->instruction = CSYNC_INSTRUCTION_REMOVE;
}
break;
diff --git a/src/csync/csync_update.cpp b/src/csync/csync_update.cpp
index 2f180dda4..c5213d2fa 100644
--- a/src/csync/csync_update.cpp
+++ b/src/csync/csync_update.cpp
@@ -187,17 +187,17 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
return -1;
}
- // The db entry might be for a placeholder, so look for that on the
+ // The db entry might be for a virtual file, so look for that on the
// remote side. If we find one, change the current fs to look like a
- // placeholder too, because that's what one would see if the remote
+ // virtual file too, because that's what one would see if the remote
// db was filled from the database.
if (ctx->current == REMOTE_REPLICA && !base.isValid() && fs->type == ItemTypeFile) {
- auto placeholderPath = fs->path;
- placeholderPath.append(ctx->placeholder_suffix);
- ctx->statedb->getFileRecord(placeholderPath, &base);
- if (base.isValid() && base._type == ItemTypePlaceholder) {
- fs->type = ItemTypePlaceholder;
- fs->path = placeholderPath;
+ auto virtualFilePath = fs->path;
+ virtualFilePath.append(ctx->virtual_file_suffix);
+ ctx->statedb->getFileRecord(virtualFilePath, &base);
+ if (base.isValid() && base._type == ItemTypeVirtualFile) {
+ fs->type = ItemTypeVirtualFile;
+ fs->path = virtualFilePath;
} else {
base = OCC::SyncJournalFileRecord();
}
@@ -220,19 +220,19 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
fs->checksumHeader.constData(), base._checksumHeader.constData(),
base._serverHasIgnoredFiles );
- // If the db suggests a placeholder should be downloaded,
+ // If the db suggests a virtual file should be downloaded,
// treat the file as new on the remote.
- if (ctx->current == REMOTE_REPLICA && base._type == ItemTypePlaceholderDownload) {
+ if (ctx->current == REMOTE_REPLICA && base._type == ItemTypeVirtualFileDownload) {
fs->instruction = CSYNC_INSTRUCTION_NEW;
- fs->type = ItemTypePlaceholderDownload;
+ fs->type = ItemTypeVirtualFileDownload;
goto out;
}
- // If what the db thinks is a placeholder is actually a file/dir,
+ // If what the db thinks is a virtual file is actually a file/dir,
// treat it as new locally.
if (ctx->current == LOCAL_REPLICA
- && (base._type == ItemTypePlaceholder || base._type == ItemTypePlaceholderDownload)
- && fs->type != ItemTypePlaceholder) {
+ && (base._type == ItemTypeVirtualFile || base._type == ItemTypeVirtualFileDownload)
+ && fs->type != ItemTypeVirtualFile) {
fs->instruction = CSYNC_INSTRUCTION_EVAL;
goto out;
}
@@ -240,8 +240,8 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
if (ctx->current == REMOTE_REPLICA && fs->etag != base._etag) {
fs->instruction = CSYNC_INSTRUCTION_EVAL;
- if (fs->type == ItemTypePlaceholder) {
- // If the local thing is a placeholder, we just update the metadata
+ if (fs->type == ItemTypeVirtualFile) {
+ // If the local thing is a virtual file, we just update the metadata
fs->instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
} else if (base._type != fs->type) {
// Preserve the EVAL flag later on if the type has changed.
@@ -365,10 +365,10 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
if (!base.isValid())
return;
- if (base._type == ItemTypePlaceholderDownload) {
- // Remote rename of a placeholder file we have locally scheduled
+ if (base._type == ItemTypeVirtualFileDownload) {
+ // Remote rename of a virtual file we have locally scheduled
// for download. We just consider this NEW but mark it for download.
- fs->type = ItemTypePlaceholderDownload;
+ fs->type = ItemTypeVirtualFileDownload;
done = true;
return;
}
@@ -377,7 +377,7 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
// Since we don't do the same checks again in reconcile, we can't
// just skip the candidate, but have to give up completely.
if (base._type != fs->type
- && base._type != ItemTypePlaceholder) {
+ && base._type != ItemTypeVirtualFile) {
qCWarning(lcUpdate, "file types different, not a rename");
done = true;
return;
@@ -391,10 +391,10 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
// Now we know there is a sane rename candidate.
- // Rename of a placeholder
- if (base._type == ItemTypePlaceholder && fs->type == ItemTypeFile) {
- fs->type = ItemTypePlaceholder;
- fs->path.append(ctx->placeholder_suffix);
+ // Rename of a virtual file
+ if (base._type == ItemTypeVirtualFile && fs->type == ItemTypeFile) {
+ fs->type = ItemTypeVirtualFile;
+ fs->path.append(ctx->virtual_file_suffix);
}
// Record directory renames
@@ -427,12 +427,12 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
}
}
- // Turn new remote files into placeholders if the option is enabled.
- if (ctx->new_files_are_placeholders
+ // Turn new remote files into virtual files if the option is enabled.
+ if (ctx->new_files_are_virtual
&& fs->instruction == CSYNC_INSTRUCTION_NEW
&& fs->type == ItemTypeFile) {
- fs->type = ItemTypePlaceholder;
- fs->path.append(ctx->placeholder_suffix);
+ fs->type = ItemTypeVirtualFile;
+ fs->path.append(ctx->virtual_file_suffix);
}
goto out;
@@ -741,15 +741,15 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
fullpath = QByteArray() % uri % '/' % filename;
}
- // When encountering placeholder files, read the relevant
+ // When encountering virtual files, read the relevant
// entry from the db instead.
if (ctx->current == LOCAL_REPLICA
&& dirent->type == ItemTypeFile
- && filename.endsWith(ctx->placeholder_suffix)) {
+ && filename.endsWith(ctx->virtual_file_suffix)) {
QByteArray db_uri = fullpath.mid(strlen(ctx->local.uri) + 1);
if( ! fill_tree_from_db(ctx, db_uri.constData(), true) ) {
- qCWarning(lcUpdate) << "Placeholder without db entry for" << filename;
+ qCWarning(lcUpdate) << "Virtual file without db entry for" << filename;
QFile::remove(fullpath);
}
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index c4af55c8b..254e825ad 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -378,7 +378,7 @@ void AccountSettings::slotFolderWizardAccepted()
folderWizard->field(QLatin1String("sourceFolder")).toString());
definition.targetPath = FolderDefinition::prepareTargetPath(
folderWizard->property("targetPath").toString());
- definition.usePlaceholders = folderWizard->property("usePlaceholders").toBool();
+ definition.useVirtualFiles = folderWizard->property("useVirtualFiles").toBool();
{
QDir dir(definition.localPath);
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index d9628687e..567dff16b 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -465,9 +465,9 @@ void Application::parseOptions(const QStringList &options)
_debugMode = true;
} else if (option == QLatin1String("--version")) {
_versionOnly = true;
- } else if (option.endsWith(QStringLiteral(APPLICATION_DOTPLACEHOLDER_SUFFIX))) {
- // placeholder file, open it after the Folder were created (if the app is not terminated)
- QTimer::singleShot(0, this, [this, option] { openPlaceholder(option); });
+ } else if (option.endsWith(QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX))) {
+ // virtual file, open it after the Folder were created (if the app is not terminated)
+ QTimer::singleShot(0, this, [this, option] { openVirtualFile(option); });
} else {
showHint("Unrecognized option '" + option.toStdString() + "'");
}
@@ -633,10 +633,10 @@ void Application::showSettingsDialog()
_gui->slotShowSettings();
}
-void Application::openPlaceholder(const QString &filename)
+void Application::openVirtualFile(const QString &filename)
{
- QString placeholderExt = QStringLiteral(APPLICATION_DOTPLACEHOLDER_SUFFIX);
- if (!filename.endsWith(placeholderExt)) {
+ QString virtualFileExt = QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX);
+ if (!filename.endsWith(virtualFileExt)) {
qWarning(lcApplication) << "Can only handle file ending in .owncloud. Unable to open" << filename;
return;
}
@@ -647,8 +647,8 @@ void Application::openPlaceholder(const QString &filename)
// TODO: show a QMessageBox for errors
return;
}
- folder->downloadPlaceholder(relativePath);
- QString normalName = filename.left(filename.size() - placeholderExt.size());
+ folder->downloadVirtualFile(relativePath);
+ QString normalName = filename.left(filename.size() - virtualFileExt.size());
auto con = QSharedPointer<QMetaObject::Connection>::create();
*con = QObject::connect(folder, &Folder::syncFinished, [con, normalName] {
QObject::disconnect(*con);
@@ -664,9 +664,9 @@ bool Application::event(QEvent *event)
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
qCDebug(lcApplication) << "QFileOpenEvent" << openEvent->file();
- // placeholder file, open it after the Folder were created (if the app is not terminated)
+ // virtual file, open it after the Folder were created (if the app is not terminated)
QString fn = openEvent->file();
- QTimer::singleShot(0, this, [this, fn] { openPlaceholder(fn); });
+ QTimer::singleShot(0, this, [this, fn] { openVirtualFile(fn); });
}
#endif
return SharedTools::QtSingleApplication::event(event);
diff --git a/src/gui/application.h b/src/gui/application.h
index 3857cc3e7..a3fa9be79 100644
--- a/src/gui/application.h
+++ b/src/gui/application.h
@@ -73,10 +73,10 @@ public slots:
void slotownCloudWizardDone(int);
void slotCrash();
/**
- * Will download a placeholder file, and open the result.
- * The argument is the filename of the placeholder file (including the extension)
+ * Will download a virtual file, and open the result.
+ * The argument is the filename of the virtual file (including the extension)
*/
- void openPlaceholder(const QString &filename);
+ void openVirtualFile(const QString &filename);
protected:
void parseOptions(const QStringList &);
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 924835e90..0405c785c 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -507,9 +507,9 @@ void Folder::slotWatchedPathChanged(const QString &path)
scheduleThisFolderSoon();
}
-void Folder::downloadPlaceholder(const QString &_relativepath)
+void Folder::downloadVirtualFile(const QString &_relativepath)
{
- qCInfo(lcFolder) << "Download placeholder: " << _relativepath;
+ qCInfo(lcFolder) << "Download virtual file: " << _relativepath;
auto relativepath = _relativepath.toUtf8();
// Set in the database that we should download the file
@@ -517,7 +517,7 @@ void Folder::downloadPlaceholder(const QString &_relativepath)
_journal.getFileRecord(relativepath, &record);
if (!record.isValid())
return;
- record._type = ItemTypePlaceholderDownload;
+ record._type = ItemTypeVirtualFileDownload;
_journal.setFileRecord(record);
// Make sure we go over that file during the discovery
@@ -544,9 +544,10 @@ void Folder::saveToSettings() const
}
}
- if (_definition.usePlaceholders) {
- // If placeholders are enabled, save the folder to a group
+ if (_definition.useVirtualFiles) {
+ // If virtual files are enabled, save the folder to a group
// that will not be read by older (<2.5.0) clients.
+ // The name is from when virtual files were called placeholders.
settingsGroup = QStringLiteral("FoldersWithPlaceholders");
} else if (_saveBackwardsCompatible || oneAccountOnly) {
// The folder is saved to backwards-compatible "Folders"
@@ -710,8 +711,8 @@ void Folder::setSyncOptions()
opt._newBigFolderSizeLimit = newFolderLimit.first ? newFolderLimit.second * 1000LL * 1000LL : -1; // convert from MB to B
opt._confirmExternalStorage = cfgFile.confirmExternalStorage();
opt._moveFilesToTrash = cfgFile.moveToTrash();
- opt._newFilesArePlaceholders = _definition.usePlaceholders;
- opt._placeholderSuffix = QStringLiteral(APPLICATION_DOTPLACEHOLDER_SUFFIX);
+ opt._newFilesAreVirtual = _definition.useVirtualFiles;
+ opt._virtualFileSuffix = QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX);
QByteArray chunkSizeEnv = qgetenv("OWNCLOUD_CHUNK_SIZE");
if (!chunkSizeEnv.isEmpty()) {
@@ -1123,7 +1124,7 @@ void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder)
settings.setValue(QLatin1String("targetPath"), folder.targetPath);
settings.setValue(QLatin1String("paused"), folder.paused);
settings.setValue(QLatin1String("ignoreHiddenFiles"), folder.ignoreHiddenFiles);
- settings.setValue(QLatin1String("usePlaceholders"), folder.usePlaceholders);
+ settings.setValue(QLatin1String("usePlaceholders"), folder.useVirtualFiles);
// Happens only on Windows when the explorer integration is enabled.
if (!folder.navigationPaneClsid.isNull())
@@ -1144,7 +1145,7 @@ bool FolderDefinition::load(QSettings &settings, const QString &alias,
folder->paused = settings.value(QLatin1String("paused")).toBool();
folder->ignoreHiddenFiles = settings.value(QLatin1String("ignoreHiddenFiles"), QVariant(true)).toBool();
folder->navigationPaneClsid = settings.value(QLatin1String("navigationPaneClsid")).toUuid();
- folder->usePlaceholders = settings.value(QLatin1String("usePlaceholders")).toBool();
+ folder->useVirtualFiles = settings.value(QLatin1String("usePlaceholders")).toBool();
settings.endGroup();
// Old settings can contain paths with native separators. In the rest of the
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 22d5690d9..ba3258444 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -66,8 +66,8 @@ public:
bool paused;
/// whether the folder syncs hidden files
bool ignoreHiddenFiles;
- /// New files are downloaded as placeholders
- bool usePlaceholders = false;
+ /// New files are downloaded as virtual files
+ bool useVirtualFiles = false;
/// The CLSID where this folder appears in registry for the Explorer navigation pane entry.
QUuid navigationPaneClsid;
@@ -286,10 +286,10 @@ public slots:
void slotWatchedPathChanged(const QString &path);
/**
- * Mark a placeholder as being ready for download, and start a sync.
- * relativePath is the patch to the placeholder file (includeing the extension)
+ * Mark a virtual file as being ready for download, and start a sync.
+ * relativePath is the patch to the file (including the extension)
*/
- void downloadPlaceholder(const QString &relativepath);
+ void downloadVirtualFile(const QString &relativepath);
private slots:
void slotSyncStarted();
diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp
index 3830a44f7..afda6cace 100644
--- a/src/gui/folderwizard.cpp
+++ b/src/gui/folderwizard.cpp
@@ -484,9 +484,9 @@ FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account)
layout->addWidget(_selectiveSync);
if (ConfigFile().showExperimentalOptions()) {
- _placeholderCheckBox = new QCheckBox(tr("Use virtual files instead of downloading content immediately (experimental)"));
- connect(_placeholderCheckBox, &QCheckBox::clicked, this, &FolderWizardSelectiveSync::placeholderCheckboxClicked);
- layout->addWidget(_placeholderCheckBox);
+ _virtualFilesCheckBox = new QCheckBox(tr("Use virtual files instead of downloading content immediately (experimental)"));
+ connect(_virtualFilesCheckBox, &QCheckBox::clicked, this, &FolderWizardSelectiveSync::virtualFilesCheckboxClicked);
+ layout->addWidget(_virtualFilesCheckBox);
}
}
@@ -515,7 +515,7 @@ void FolderWizardSelectiveSync::initializePage()
bool FolderWizardSelectiveSync::validatePage()
{
wizard()->setProperty("selectiveSyncBlackList", QVariant(_selectiveSync->createBlackList()));
- wizard()->setProperty("usePlaceholders", QVariant(_placeholderCheckBox && _placeholderCheckBox->isChecked()));
+ wizard()->setProperty("useVirtualFiles", QVariant(_virtualFilesCheckBox && _virtualFilesCheckBox->isChecked()));
return true;
}
@@ -529,14 +529,14 @@ void FolderWizardSelectiveSync::cleanupPage()
QWizardPage::cleanupPage();
}
-void FolderWizardSelectiveSync::placeholderCheckboxClicked()
+void FolderWizardSelectiveSync::virtualFilesCheckboxClicked()
{
// The click has already had an effect on the box, so if it's
// checked it was newly activated.
- if (_placeholderCheckBox->isChecked()) {
- OwncloudWizard::askExperimentalPlaceholderFeature([this](bool enable) {
+ if (_virtualFilesCheckBox->isChecked()) {
+ OwncloudWizard::askExperimentalVirtualFilesFeature([this](bool enable) {
if (!enable)
- _placeholderCheckBox->setChecked(false);
+ _virtualFilesCheckBox->setChecked(false);
});
}
}
diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h
index 12a208bbb..ce1fc5293 100644
--- a/src/gui/folderwizard.h
+++ b/src/gui/folderwizard.h
@@ -131,11 +131,11 @@ public:
virtual void cleanupPage() Q_DECL_OVERRIDE;
private slots:
- void placeholderCheckboxClicked();
+ void virtualFilesCheckboxClicked();
private:
SelectiveSyncWidget *_selectiveSync;
- QCheckBox *_placeholderCheckBox = nullptr;
+ QCheckBox *_virtualFilesCheckBox = nullptr;
};
/**
diff --git a/src/gui/owncloud.xml.in b/src/gui/owncloud.xml.in
index 8bc9b48fe..78c8b4b1b 100644
--- a/src/gui/owncloud.xml.in
+++ b/src/gui/owncloud.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-@APPLICATION_EXECUTABLE@">
- <comment>@APPLICATION_NAME@ placeholders</comment>
- <glob pattern="*.@APPLICATION_PLACEHOLDER_SUFFIX@"/>
+ <comment>@APPLICATION_NAME@ virtual files</comment>
+ <glob pattern="*.@APPLICATION_VIRTUALFILE_SUFFIX@"/>
</mime-type>
</mime-info>
diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp
index ba2b3815b..e11baba59 100644
--- a/src/gui/owncloudsetupwizard.cpp
+++ b/src/gui/owncloudsetupwizard.cpp
@@ -613,7 +613,7 @@ void OwncloudSetupWizard::slotAssistantFinished(int result)
folderDefinition.localPath = localFolder;
folderDefinition.targetPath = FolderDefinition::prepareTargetPath(_remoteFolder);
folderDefinition.ignoreHiddenFiles = folderMan->ignoreHiddenFiles();
- folderDefinition.usePlaceholders = _ocWizard->usePlaceholderSync();
+ folderDefinition.useVirtualFiles = _ocWizard->useVirtualFileSync();
if (folderMan->navigationPaneHelper().showInExplorerNavigationPane())
folderDefinition.navigationPaneClsid = QUuid::createUuid();
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index c07829e13..e4ebd4ffc 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -605,18 +605,18 @@ void SocketApi::copyUrlToClipboard(const QString &link)
QApplication::clipboard()->setText(link);
}
-void SocketApi::command_DOWNLOAD_PLACEHOLDER(const QString &filesArg, SocketListener *)
+void SocketApi::command_DOWNLOAD_VIRTUAL_FILE(const QString &filesArg, SocketListener *)
{
QStringList files = filesArg.split(QLatin1Char('\x1e')); // Record Separator
- auto placeholderSuffix = QStringLiteral(APPLICATION_DOTPLACEHOLDER_SUFFIX);
+ auto suffix = QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX);
for (const auto &file : files) {
- if (!file.endsWith(placeholderSuffix))
+ if (!file.endsWith(suffix))
continue;
QString relativePath;
auto folder = FolderMan::instance()->folderForPath(file, &relativePath);
if (folder) {
- folder->downloadPlaceholder(relativePath);
+ folder->downloadVirtualFile(relativePath);
}
}
}
@@ -756,16 +756,16 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
}
}
- // Placeholder download action
+ // Virtual file download action
if (folder) {
- auto placeholderSuffix = QStringLiteral(APPLICATION_DOTPLACEHOLDER_SUFFIX);
- bool hasPlaceholderFile = false;
+ auto virtualFileSuffix = QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX);
+ bool hasVirtualFile = false;
for (const auto &file : files) {
- if (file.endsWith(placeholderSuffix))
- hasPlaceholderFile = true;
+ if (file.endsWith(virtualFileSuffix))
+ hasVirtualFile = true;
}
- if (hasPlaceholderFile)
- listener->sendMessage(QLatin1String("MENU_ITEM:DOWNLOAD_PLACEHOLDER::") + tr("Download file(s)", "", files.size()));
+ if (hasVirtualFile)
+ listener->sendMessage(QLatin1String("MENU_ITEM:DOWNLOAD_VIRTUAL_FILE::") + tr("Download file(s)", "", files.size()));
}
listener->sendMessage(QString("GET_MENU_ITEMS:END"));
diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h
index 9ad1362d4..5666c48b9 100644
--- a/src/gui/socketapi.h
+++ b/src/gui/socketapi.h
@@ -104,7 +104,7 @@ private:
Q_INVOKABLE void command_COPY_PRIVATE_LINK(const QString &localFile, SocketListener *listener);
Q_INVOKABLE void command_EMAIL_PRIVATE_LINK(const QString &localFile, SocketListener *listener);
Q_INVOKABLE void command_OPEN_PRIVATE_LINK(const QString &localFile, SocketListener *listener);
- Q_INVOKABLE void command_DOWNLOAD_PLACEHOLDER(const QString &filesArg, SocketListener *listener);
+ Q_INVOKABLE void command_DOWNLOAD_VIRTUAL_FILE(const QString &filesArg, SocketListener *listener);
// Fetch the private link and call targetFun
void fetchPrivateLinkUrlHelper(const QString &localFile, const std::function<void(const QString &url)> &targetFun);
diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp
index c82ebac07..fe8276024 100644
--- a/src/gui/wizard/owncloudadvancedsetuppage.cpp
+++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp
@@ -60,7 +60,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
connect(_ui.rSyncEverything, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSyncEverythingClicked);
connect(_ui.rSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
- connect(_ui.rPlaceholderSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotPlaceholderSyncClicked);
+ connect(_ui.rVirtualFileSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotVirtualFileSyncClicked);
connect(_ui.bSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
connect(_ui.rManualFolder, &QAbstractButton::clicked, this, [this] { setRadioChecked(_ui.rManualFolder); });
@@ -109,8 +109,8 @@ void OwncloudAdvancedSetupPage::initializePage()
// If the layout were wrapped in a widget, the auto-grouping of the
// radio buttons no longer works and there are surprising margins.
// Just manually hide the button and remove the layout.
- _ui.rPlaceholderSync->hide();
- _ui.wSyncStrategy->layout()->removeItem(_ui.lPlaceholderSync);
+ _ui.rVirtualFileSync->hide();
+ _ui.wSyncStrategy->layout()->removeItem(_ui.lVirtualFileSync);
}
_checking = false;
@@ -233,9 +233,9 @@ QStringList OwncloudAdvancedSetupPage::selectiveSyncBlacklist() const
return _selectiveSyncBlacklist;
}
-bool OwncloudAdvancedSetupPage::usePlaceholderSync() const
+bool OwncloudAdvancedSetupPage::useVirtualFileSync() const
{
- return _ui.rPlaceholderSync->isChecked();
+ return _ui.rVirtualFileSync->isChecked();
}
bool OwncloudAdvancedSetupPage::manualFolderConfig() const
@@ -351,15 +351,15 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
}
}
-void OwncloudAdvancedSetupPage::slotPlaceholderSyncClicked()
+void OwncloudAdvancedSetupPage::slotVirtualFileSyncClicked()
{
- OwncloudWizard::askExperimentalPlaceholderFeature([this](bool enable) {
+ OwncloudWizard::askExperimentalVirtualFilesFeature([this](bool enable) {
if (!enable)
return;
_ui.lSelectiveSyncSizeLabel->setText(QString());
_selectiveSyncBlacklist.clear();
- setRadioChecked(_ui.rPlaceholderSync);
+ setRadioChecked(_ui.rVirtualFileSync);
});
}
@@ -378,15 +378,15 @@ void OwncloudAdvancedSetupPage::slotQuotaRetrieved(const QVariantMap &result)
void OwncloudAdvancedSetupPage::setRadioChecked(QRadioButton *radio)
{
// We don't want clicking the radio buttons to immediately adjust the checked state
- // for selective sync and placeholder sync, so we keep them uncheckable until
+ // for selective sync and virtual file sync, so we keep them uncheckable until
// they should be checked.
radio->setCheckable(true);
radio->setChecked(true);
if (radio != _ui.rSelectiveSync)
_ui.rSelectiveSync->setCheckable(false);
- if (radio != _ui.rPlaceholderSync)
- _ui.rPlaceholderSync->setCheckable(false);
+ if (radio != _ui.rVirtualFileSync)
+ _ui.rVirtualFileSync->setCheckable(false);
}
} // namespace OCC
diff --git a/src/gui/wizard/owncloudadvancedsetuppage.h b/src/gui/wizard/owncloudadvancedsetuppage.h
index c4852ff04..e5f0aea4f 100644
--- a/src/gui/wizard/owncloudadvancedsetuppage.h
+++ b/src/gui/wizard/owncloudadvancedsetuppage.h
@@ -41,7 +41,7 @@ public:
bool validatePage() Q_DECL_OVERRIDE;
QString localFolder() const;
QStringList selectiveSyncBlacklist() const;
- bool usePlaceholderSync() const;
+ bool useVirtualFileSync() const;
bool manualFolderConfig() const;
bool isConfirmBigFolderChecked() const;
void setRemoteFolder(const QString &remoteFolder);
@@ -58,7 +58,7 @@ private slots:
void slotSelectFolder();
void slotSyncEverythingClicked();
void slotSelectiveSyncClicked();
- void slotPlaceholderSyncClicked();
+ void slotVirtualFileSyncClicked();
void slotQuotaRetrieved(const QVariantMap &result);
private:
diff --git a/src/gui/wizard/owncloudadvancedsetuppage.ui b/src/gui/wizard/owncloudadvancedsetuppage.ui
index 508286257..1b9fcaac4 100644
--- a/src/gui/wizard/owncloudadvancedsetuppage.ui
+++ b/src/gui/wizard/owncloudadvancedsetuppage.ui
@@ -417,9 +417,9 @@
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="lPlaceholderSync">
+ <layout class="QHBoxLayout" name="lVirtualFileSync">
<item>
- <widget class="QRadioButton" name="rPlaceholderSync">
+ <widget class="QRadioButton" name="rVirtualFileSync">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
@@ -500,7 +500,7 @@
<tabstop>rSelectiveSync</tabstop>
<tabstop>bSelectiveSync</tabstop>
<tabstop>rManualFolder</tabstop>
- <tabstop>rPlaceholderSync</tabstop>
+ <tabstop>rVirtualFileSync</tabstop>
<tabstop>pbSelectLocalFolder</tabstop>
<tabstop>radioButton</tabstop>
<tabstop>cbSyncFromScratch</tabstop>
diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp
index e86e09c31..0840bdfa1 100644
--- a/src/gui/wizard/owncloudwizard.cpp
+++ b/src/gui/wizard/owncloudwizard.cpp
@@ -113,9 +113,9 @@ QStringList OwncloudWizard::selectiveSyncBlacklist() const
return _advancedSetupPage->selectiveSyncBlacklist();
}
-bool OwncloudWizard::usePlaceholderSync() const
+bool OwncloudWizard::useVirtualFileSync() const
{
- return _advancedSetupPage->usePlaceholderSync();
+ return _advancedSetupPage->useVirtualFileSync();
}
bool OwncloudWizard::manualFolderConfig() const
@@ -254,7 +254,7 @@ AbstractCredentials *OwncloudWizard::getCredentials() const
return 0;
}
-void OwncloudWizard::askExperimentalPlaceholderFeature(const std::function<void(bool enable)> &callback)
+void OwncloudWizard::askExperimentalVirtualFilesFeature(const std::function<void(bool enable)> &callback)
{
auto msgBox = new QMessageBox(
QMessageBox::Warning,
@@ -265,7 +265,7 @@ void OwncloudWizard::askExperimentalPlaceholderFeature(const std::function<void(
"\n\n"
"This is a new, experimental mode. If you decide to use it, please report any "
"issues that come up.")
- .arg(APPLICATION_DOTPLACEHOLDER_SUFFIX));
+ .arg(APPLICATION_DOTVIRTUALFILE_SUFFIX));
msgBox->addButton(tr("Enable experimental mode"), QMessageBox::AcceptRole);
msgBox->addButton(tr("Stay safe"), QMessageBox::RejectRole);
connect(msgBox, &QMessageBox::finished, msgBox, [callback, msgBox](int result) {
diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h
index e8329e876..eff356dda 100644
--- a/src/gui/wizard/owncloudwizard.h
+++ b/src/gui/wizard/owncloudwizard.h
@@ -63,7 +63,7 @@ public:
QString ocUrl() const;
QString localFolder() const;
QStringList selectiveSyncBlacklist() const;
- bool usePlaceholderSync() const;
+ bool useVirtualFileSync() const;
bool manualFolderConfig() const;
bool isConfirmBigFolderChecked() const;
@@ -73,11 +73,11 @@ public:
AbstractCredentials *getCredentials() const;
/**
- * Shows a dialog explaining the placeholder mode and warning about it
+ * Shows a dialog explaining the virtual files mode and warning about it
* being experimental. Calles the callback with true if enabling was
* chosen.
*/
- static void askExperimentalPlaceholderFeature(const std::function<void(bool enable)> &callback);
+ static void askExperimentalVirtualFilesFeature(const std::function<void(bool enable)> &callback);
// FIXME: Can those be local variables?
// Set from the OwncloudSetupPage, later used from OwncloudHttpCredsPage
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index f1c1512d1..cdb2f20d0 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -590,9 +590,9 @@ QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const
return _localDir + tmp_file_name;
}
-QString OwncloudPropagator::addPlaceholderSuffix(const QString &fileName) const
+QString OwncloudPropagator::addVirtualFileSuffix(const QString &fileName) const
{
- return fileName + _syncOptions._placeholderSuffix;
+ return fileName + _syncOptions._virtualFileSuffix;
}
void OwncloudPropagator::scheduleNextJob()
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index b4bc470d2..a8cea56cc 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -451,7 +451,7 @@ public:
bool hasCaseClashAccessibilityProblem(const QString &relfile);
QString getFilePath(const QString &tmp_file_name) const;
- QString addPlaceholderSuffix(const QString &fileName) const;
+ QString addVirtualFileSuffix(const QString &fileName) const;
/** Creates the job for an item.
*/
diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index 83f302b39..5cd2696bc 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -347,10 +347,10 @@ void PropagateDownloadFile::start()
qCDebug(lcPropagateDownload) << _item->_file << propagator()->_activeJobList.count();
_stopwatch.start();
- // For placeholder files just create the file and be done
- if (_item->_type == ItemTypePlaceholder) {
+ // For virtual files just create the file and be done
+ if (_item->_type == ItemTypeVirtualFile) {
auto fn = propagator()->getFilePath(_item->_file);
- qCDebug(lcPropagateDownload) << "creating placeholder file" << fn;
+ qCDebug(lcPropagateDownload) << "creating virtual file" << fn;
QFile file(fn);
file.open(QFile::ReadWrite | QFile::Truncate);
file.write(" ");
@@ -359,14 +359,14 @@ void PropagateDownloadFile::start()
return;
}
- // If we want to download something that used to be a placeholder,
- // wipe the placeholder and proceed with a normal download
- if (_item->_type == ItemTypePlaceholderDownload) {
- auto placeholder = propagator()->addPlaceholderSuffix(_item->_file);
- auto fn = propagator()->getFilePath(placeholder);
- qCDebug(lcPropagateDownload) << "Downloading file that used to be a placeholder" << fn;
+ // If we want to download something that used to be a virtual file,
+ // wipe the virtual file and proceed with a normal download
+ if (_item->_type == ItemTypeVirtualFileDownload) {
+ auto virtualFile = propagator()->addVirtualFileSuffix(_item->_file);
+ auto fn = propagator()->getFilePath(virtualFile);
+ qCDebug(lcPropagateDownload) << "Downloading file that used to be a virtual file" << fn;
QFile::remove(fn);
- propagator()->_journal->deleteFileRecord(placeholder);
+ propagator()->_journal->deleteFileRecord(virtualFile);
_item->_type = ItemTypeFile;
}
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index deb738ddc..e3cb90e66 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -614,7 +614,7 @@ int SyncEngine::treewalkFile(csync_file_stat_t *file, csync_file_stat_t *other,
if (remote) {
QString filePath = _localPath + item->_file;
- if (other && other->type != ItemTypePlaceholder && other->type != ItemTypePlaceholderDownload) {
+ if (other && other->type != ItemTypeVirtualFile && other->type != ItemTypeVirtualFileDownload) {
// Even if the mtime is different on the server, we always want to keep the mtime from
// the file system in the DB, this is to avoid spurious upload on the next sync
item->_modtime = other->modtime;
@@ -851,10 +851,10 @@ void SyncEngine::startSync()
return shouldDiscoverLocally(path);
};
- _csync_ctx->new_files_are_placeholders = _syncOptions._newFilesArePlaceholders;
- _csync_ctx->placeholder_suffix = _syncOptions._placeholderSuffix.toUtf8();
- if (_csync_ctx->new_files_are_placeholders && _csync_ctx->placeholder_suffix.isEmpty()) {
- csyncError(tr("Using virtual files but placeholder suffix is not set"));
+ _csync_ctx->new_files_are_virtual = _syncOptions._newFilesAreVirtual;
+ _csync_ctx->virtual_file_suffix = _syncOptions._virtualFileSuffix.toUtf8();
+ if (_csync_ctx->new_files_are_virtual && _csync_ctx->virtual_file_suffix.isEmpty()) {
+ csyncError(tr("Using virtual files but suffix is not set"));
finalize(false);
return;
}
diff --git a/src/libsync/syncoptions.h b/src/libsync/syncoptions.h
index ea48cd83e..43ef3bf18 100644
--- a/src/libsync/syncoptions.h
+++ b/src/libsync/syncoptions.h
@@ -36,9 +36,9 @@ struct SyncOptions
/** If remotely deleted files are needed to move to trash */
bool _moveFilesToTrash = false;
- /** Create a placeholder for new files instead of downloading */
- bool _newFilesArePlaceholders = false;
- QString _placeholderSuffix = ".owncloud";
+ /** Create a virtual file for new files instead of downloading */
+ bool _newFilesAreVirtual = false;
+ QString _virtualFileSuffix = ".owncloud";
/** The initial un-adjusted chunk size in bytes for chunked uploads, both
* for old and new chunking algorithm, which classifies the item to be chunked
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 65b93762e..0ee8342c9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -42,7 +42,7 @@ owncloud_add_test(ExcludedFiles "")
owncloud_add_test(FileSystem "")
owncloud_add_test(Utility "")
owncloud_add_test(SyncEngine "syncenginetestutils.h")
-owncloud_add_test(SyncPlaceholders "syncenginetestutils.h")
+owncloud_add_test(SyncVirtualFiles "syncenginetestutils.h")
owncloud_add_test(SyncMove "syncenginetestutils.h")
owncloud_add_test(SyncConflict "syncenginetestutils.h")
owncloud_add_test(SyncFileStatusTracker "syncenginetestutils.h")
diff --git a/test/testsyncplaceholders.cpp b/test/testsyncvirtualfiles.cpp
index 454ef45ac..8ec09a6f8 100644
--- a/test/testsyncplaceholders.cpp
+++ b/test/testsyncvirtualfiles.cpp
@@ -34,12 +34,12 @@ SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
return record;
}
-class TestSyncPlaceholders : public QObject
+class TestSyncVirtualFiles : public QObject
{
Q_OBJECT
private slots:
- void testPlaceholderLifecycle_data()
+ void testVirtualFileLifecycle_data()
{
QTest::addColumn<bool>("doLocalDiscovery");
@@ -47,13 +47,13 @@ private slots:
QTest::newRow("skip local discovery") << false;
}
- void testPlaceholderLifecycle()
+ void testVirtualFileLifecycle()
{
QFETCH(bool, doLocalDiscovery);
- FakeFolder fakeFolder{FileInfo()};
+ FakeFolder fakeFolder{ FileInfo() };
SyncOptions syncOptions;
- syncOptions._newFilesArePlaceholders = true;
+ syncOptions._newFilesAreVirtual = true;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
@@ -65,7 +65,7 @@ private slots:
};
cleanup();
- // Create a placeholder for a new remote file
+ // Create a virtual file for a new remote file
fakeFolder.remoteModifier().mkdir("A");
fakeFolder.remoteModifier().insert("A/a1", 64);
QVERIFY(fakeFolder.syncOnce());
@@ -73,7 +73,7 @@ private slots:
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QVERIFY(itemInstruction(completeSpy, "A/a1.owncloud", CSYNC_INSTRUCTION_NEW));
- QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
cleanup();
// Another sync doesn't actually lead to changes
@@ -81,7 +81,7 @@ private slots:
QVERIFY(!fakeFolder.currentLocalState().find("A/a1"));
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
- QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
QVERIFY(completeSpy.isEmpty());
cleanup();
@@ -91,7 +91,7 @@ private slots:
QVERIFY(!fakeFolder.currentLocalState().find("A/a1"));
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
- QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
QVERIFY(completeSpy.isEmpty());
cleanup();
@@ -102,11 +102,11 @@ private slots:
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QVERIFY(itemInstruction(completeSpy, "A/a1.owncloud", CSYNC_INSTRUCTION_UPDATE_METADATA));
- QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._fileSize, 65);
cleanup();
- // If the local placeholder file is removed, it'll just be recreated
+ // If the local virtual file file is removed, it'll just be recreated
if (!doLocalDiscovery)
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, { "A" });
fakeFolder.localModifier().remove("A/a1.owncloud");
@@ -115,7 +115,7 @@ private slots:
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QVERIFY(itemInstruction(completeSpy, "A/a1.owncloud", CSYNC_INSTRUCTION_NEW));
- QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._fileSize, 65);
cleanup();
@@ -129,7 +129,7 @@ private slots:
QVERIFY(!fakeFolder.currentRemoteState().find("A/a1"));
QVERIFY(fakeFolder.currentRemoteState().find("A/a1m"));
QVERIFY(itemInstruction(completeSpy, "A/a1m.owncloud", CSYNC_INSTRUCTION_RENAME));
- QCOMPARE(dbRecord(fakeFolder, "A/a1m.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/a1m.owncloud")._type, ItemTypeVirtualFile);
cleanup();
// Remote remove is propagated
@@ -142,7 +142,7 @@ private slots:
QVERIFY(!dbRecord(fakeFolder, "A/a1m.owncloud").isValid());
cleanup();
- // Edge case: Local placeholder but no db entry for some reason
+ // Edge case: Local virtual file but no db entry for some reason
fakeFolder.remoteModifier().insert("A/a2", 64);
fakeFolder.remoteModifier().insert("A/a3", 64);
QVERIFY(fakeFolder.syncOnce());
@@ -163,11 +163,11 @@ private slots:
cleanup();
}
- void testPlaceholderConflict()
+ void testVirtualFileConflict()
{
FakeFolder fakeFolder{ FileInfo() };
SyncOptions syncOptions;
- syncOptions._newFilesArePlaceholders = true;
+ syncOptions._newFilesAreVirtual = true;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
@@ -177,7 +177,7 @@ private slots:
};
cleanup();
- // Create a placeholder for a new remote file
+ // Create a virtual file for a new remote file
fakeFolder.remoteModifier().mkdir("A");
fakeFolder.remoteModifier().insert("A/a1", 64);
fakeFolder.remoteModifier().insert("A/a2", 64);
@@ -191,8 +191,8 @@ private slots:
QVERIFY(fakeFolder.currentLocalState().find("B/b2.owncloud"));
cleanup();
- // A: the correct file and a conflicting file are added, placeholders stay
- // B: same setup, but the placeholders are deleted by the user
+ // A: the correct file and a conflicting file are added, virtual files stay
+ // B: same setup, but the virtual files are deleted by the user
// C: user adds a *directory* locally
fakeFolder.localModifier().insert("A/a1", 64);
fakeFolder.localModifier().insert("A/a2", 30);
@@ -211,7 +211,7 @@ private slots:
QVERIFY(itemInstruction(completeSpy, "B/b2", CSYNC_INSTRUCTION_CONFLICT));
QVERIFY(itemInstruction(completeSpy, "C/c1", CSYNC_INSTRUCTION_CONFLICT));
- // no placeholder files should remain
+ // no virtual file files should remain
QVERIFY(!fakeFolder.currentLocalState().find("A/a1.owncloud"));
QVERIFY(!fakeFolder.currentLocalState().find("A/a2.owncloud"));
QVERIFY(!fakeFolder.currentLocalState().find("B/b1.owncloud"));
@@ -221,7 +221,7 @@ private slots:
// conflict files should exist
QCOMPARE(fakeFolder.syncJournal().conflictRecordPaths().size(), 3);
- // nothing should have the placeholder tag
+ // nothing should have the virtual file tag
QCOMPARE(dbRecord(fakeFolder, "A/a1")._type, ItemTypeFile);
QCOMPARE(dbRecord(fakeFolder, "A/a2")._type, ItemTypeFile);
QCOMPARE(dbRecord(fakeFolder, "B/b1")._type, ItemTypeFile);
@@ -238,9 +238,9 @@ private slots:
void testWithNormalSync()
{
- FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
+ FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
SyncOptions syncOptions;
- syncOptions._newFilesArePlaceholders = true;
+ syncOptions._newFilesAreVirtual = true;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
@@ -263,22 +263,22 @@ private slots:
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
cleanup();
- // New files on the remote create placeholders
+ // New files on the remote create virtual files
fakeFolder.remoteModifier().insert("A/new");
QVERIFY(fakeFolder.syncOnce());
QVERIFY(!fakeFolder.currentLocalState().find("A/new"));
QVERIFY(fakeFolder.currentLocalState().find("A/new.owncloud"));
QVERIFY(fakeFolder.currentRemoteState().find("A/new"));
QVERIFY(itemInstruction(completeSpy, "A/new.owncloud", CSYNC_INSTRUCTION_NEW));
- QCOMPARE(dbRecord(fakeFolder, "A/new.owncloud")._type, ItemTypePlaceholder);
+ QCOMPARE(dbRecord(fakeFolder, "A/new.owncloud")._type, ItemTypeVirtualFile);
cleanup();
}
- void testPlaceholderDownload()
+ void testVirtualFileDownload()
{
- FakeFolder fakeFolder{FileInfo()};
+ FakeFolder fakeFolder{ FileInfo() };
SyncOptions syncOptions;
- syncOptions._newFilesArePlaceholders = true;
+ syncOptions._newFilesAreVirtual = true;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
@@ -294,11 +294,11 @@ private slots:
journal.getFileRecord(path + ".owncloud", &record);
if (!record.isValid())
return;
- record._type = ItemTypePlaceholderDownload;
+ record._type = ItemTypeVirtualFileDownload;
journal.setFileRecord(record);
};
- // Create a placeholder for remote files
+ // Create a virtual file for remote files
fakeFolder.remoteModifier().mkdir("A");
fakeFolder.remoteModifier().insert("A/a1");
fakeFolder.remoteModifier().insert("A/a2");
@@ -354,33 +354,33 @@ private slots:
QVERIFY(!dbRecord(fakeFolder, "A/a6.owncloud").isValid());
}
- // Check what might happen if an older sync client encounters placeholders
+ // Check what might happen if an older sync client encounters virtual files
void testOldVersion1()
{
FakeFolder fakeFolder{ FileInfo() };
SyncOptions syncOptions;
- syncOptions._newFilesArePlaceholders = true;
+ syncOptions._newFilesAreVirtual = true;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
- // Create a placeholder
+ // Create a virtual file
fakeFolder.remoteModifier().mkdir("A");
fakeFolder.remoteModifier().insert("A/a1");
QVERIFY(fakeFolder.syncOnce());
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
- // Simulate an old client by switching the type of all ItemTypePlaceholder
+ // Simulate an old client by switching the type of all ItemTypeVirtualFile
// entries in the db to an invalid type.
auto &db = fakeFolder.syncJournal();
SyncJournalFileRecord rec;
db.getFileRecord(QByteArray("A/a1.owncloud"), &rec);
QVERIFY(rec.isValid());
- QCOMPARE(rec._type, ItemTypePlaceholder);
+ QCOMPARE(rec._type, ItemTypeVirtualFile);
rec._type = static_cast<ItemType>(-1);
db.setFileRecord(rec);
- // Also switch off new files becoming placeholders
- syncOptions._newFilesArePlaceholders = false;
+ // Also switch off new files becoming virtual files
+ syncOptions._newFilesAreVirtual = false;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
// A sync that doesn't do remote discovery has no effect
@@ -390,7 +390,7 @@ private slots:
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QVERIFY(!fakeFolder.currentRemoteState().find("A/a1.owncloud"));
- // But with a remote discovery the placeholders will be removed and
+ // But with a remote discovery the virtual files will be removed and
// the remote files will be downloaded.
db.forceRemoteDiscoveryNextSync();
QVERIFY(fakeFolder.syncOnce());
@@ -410,22 +410,22 @@ private slots:
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
- // Create the placeholder too
- // In the wild, the new version would create the placeholder and the db entry
+ // Create the virtual file too
+ // In the wild, the new version would create the virtual file and the db entry
// while the old version would download the plain file.
fakeFolder.localModifier().insert("A/a1.owncloud");
auto &db = fakeFolder.syncJournal();
SyncJournalFileRecord rec;
db.getFileRecord(QByteArray("A/a1"), &rec);
- rec._type = ItemTypePlaceholder;
+ rec._type = ItemTypeVirtualFile;
rec._path = "A/a1.owncloud";
db.setFileRecord(rec);
SyncOptions syncOptions;
- syncOptions._newFilesArePlaceholders = true;
+ syncOptions._newFilesAreVirtual = true;
fakeFolder.syncEngine().setSyncOptions(syncOptions);
- // Check that a sync removes the placeholder and its db entry
+ // Check that a sync removes the virtual file and its db entry
QVERIFY(fakeFolder.syncOnce());
QVERIFY(!fakeFolder.currentLocalState().find("A/a1.owncloud"));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
@@ -433,5 +433,5 @@ private slots:
}
};
-QTEST_GUILESS_MAIN(TestSyncPlaceholders)
-#include "testsyncplaceholders.moc"
+QTEST_GUILESS_MAIN(TestSyncVirtualFiles)
+#include "testsyncvirtualfiles.moc"