Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows cfapi backend for vfs #2778

Merged
merged 9 commits into from
Dec 30, 2020
5 changes: 4 additions & 1 deletion src/gui/socketapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,11 @@ DirectEditor* SocketApi::getDirectEditorForLocalFile(const QString &localFile)
auto capabilities = fileData.folder->accountState()->account()->capabilities();

if (fileData.folder && fileData.folder->accountState()->isConnected()) {
const auto record = fileData.journalRecord();
const auto mimeMatchMode = record.isVirtualFile() ? QMimeDatabase::MatchExtension : QMimeDatabase::MatchDefault;

QMimeDatabase db;
QMimeType type = db.mimeTypeForFile(localFile);
QMimeType type = db.mimeTypeForFile(localFile, mimeMatchMode);

DirectEditor* editor = capabilities.getDirectEditorForMimetype(type);
if (!editor) {
Expand Down
10 changes: 10 additions & 0 deletions src/libsync/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ set(libsync_SRCS
vfs/suffix/vfs_suffix.cpp
)

if (WIN32)
set(libsync_SRCS ${libsync_SRCS}
vfs/cfapi/cfapiwrapper.cpp
vfs/cfapi/hydrationjob.cpp
vfs/cfapi/vfs_cfapi.cpp
)
add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN10)
list(APPEND OS_SPECIFIC_LINK_LIBRARIES cldapi)
endif()

if(TOKEN_AUTH_ONLY)
set (libsync_SRCS ${libsync_SRCS} creds/tokencredentials.cpp)
else()
Expand Down
4 changes: 2 additions & 2 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,8 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
auto postProcessLocalNew = [item, localEntry, this]() {
if (localEntry.isVirtualFile) {
// Remove the spurious file if it looks like a placeholder file
// (we know placeholder files contain " ")
if (localEntry.size <= 1) {
// (we know placeholder files contain " ", but only in the suffix case)
if (localEntry.size <= 1 || !isVfsWithSuffix()) {
qCWarning(lcDisco) << "Wiping virtual file without db entry for" << _currentFolder._local + "/" + localEntry.name;
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
Expand Down
3 changes: 2 additions & 1 deletion src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ QPixmap Theme::createColorAwarePixmap(const QString &name)

bool Theme::showVirtualFilesOption() const
{
return ConfigFile().showExperimentalOptions();
const auto vfsMode = bestAvailableVfsMode();
return ConfigFile().showExperimentalOptions() || vfsMode == Vfs::WindowsCfApi;
}

} // end namespace client
Loading