From 62e468fdbc778be43377fcf8ac88e655b563beb7 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 19 Dec 2022 15:54:55 +0100 Subject: [PATCH 1/2] Ifdef all mentions of navigationpanehelper out of non-Windows builds Signed-off-by: Claudio Cambra --- src/gui/accountsettings.cpp | 6 ++++++ src/gui/accountsetupfromcommandlinejob.cpp | 2 ++ src/gui/folderman.h | 3 +++ src/gui/generalsettings.cpp | 3 +++ src/gui/owncloudsetupwizard.cpp | 6 +++++- 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 65b8b7badc0d4..551d60450575c 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -839,9 +839,11 @@ void AccountSettings::slotFolderWizardAccepted() */ definition.ignoreHiddenFiles = folderMan->ignoreHiddenFiles(); +#ifdef Q_OS_WIN if (folderMan->navigationPaneHelper().showInExplorerNavigationPane()) { definition.navigationPaneClsid = QUuid::createUuid(); } +#endif const auto selectiveSyncBlackList = folderWizard->property("selectiveSyncBlackList").toStringList(); @@ -937,8 +939,10 @@ void AccountSettings::slotEnableVfsCurrentFolder() return; } +#ifdef Q_OS_WIN // we might need to add or remove the panel entry as cfapi brings this feature out of the box FolderMan::instance()->navigationPaneHelper().scheduleUpdateCloudStorageRegistry(); +#endif // It is unsafe to switch on vfs while a sync is running - wait if necessary. const auto connection = std::make_shared(); @@ -1014,8 +1018,10 @@ void AccountSettings::slotDisableVfsCurrentFolder() return; } +#ifdef Q_OS_WIN // we might need to add or remove the panel entry as cfapi brings this feature out of the box FolderMan::instance()->navigationPaneHelper().scheduleUpdateCloudStorageRegistry(); +#endif // It is unsafe to switch off vfs while a sync is running - wait if necessary. const auto connection = std::make_shared(); diff --git a/src/gui/accountsetupfromcommandlinejob.cpp b/src/gui/accountsetupfromcommandlinejob.cpp index eeff0cfb00a31..dd0f4066f2346 100644 --- a/src/gui/accountsetupfromcommandlinejob.cpp +++ b/src/gui/accountsetupfromcommandlinejob.cpp @@ -176,9 +176,11 @@ void AccountSetupFromCommandLineJob::setupLocalSyncFolder(AccountState *accountS definition.ignoreHiddenFiles = folderMan->ignoreHiddenFiles(); definition.alias = folderMan->map().size() > 0 ? QString::number(folderMan->map().size()) : QString::number(0); +#ifdef Q_OS_WIN if (folderMan->navigationPaneHelper().showInExplorerNavigationPane()) { definition.navigationPaneClsid = QUuid::createUuid(); } +#endif folderMan->setSyncEnabled(false); diff --git a/src/gui/folderman.h b/src/gui/folderman.h index 8bb71b7325f91..b76ede8da3f16 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -149,7 +149,10 @@ class FolderMan : public QObject static QString unescapeAlias(const QString &); SocketApi *socketApi(); + +#ifdef Q_OS_WIN NavigationPaneHelper &navigationPaneHelper() { return _navigationPaneHelper; } +#endif /** * Check if @a path is a valid path for a new folder considering the already sync'ed items. diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index bc5c5fbda5c1d..d9d0b5d2c45ee 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -580,8 +580,11 @@ void GeneralSettings::slotShowInExplorerNavigationPane(bool checked) { ConfigFile cfgFile; cfgFile.setShowInExplorerNavigationPane(checked); + +#ifdef Q_OS_WIN // Now update the registry with the change. FolderMan::instance()->navigationPaneHelper().setShowInExplorerNavigationPane(checked); +#endif } void GeneralSettings::slotIgnoreFilesEditor() diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 633d8f6b7252e..50a5fce6cbd74 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -722,8 +722,12 @@ void OwncloudSetupWizard::slotAssistantFinished(int result) folderDefinition.virtualFilesMode = bestAvailableVfsMode(); } #endif - if (folderMan->navigationPaneHelper().showInExplorerNavigationPane()) + +#ifdef Q_OS_WIN + if (folderMan->navigationPaneHelper().showInExplorerNavigationPane()) { folderDefinition.navigationPaneClsid = QUuid::createUuid(); + } +#endif auto f = folderMan->addFolder(account, folderDefinition); if (f) { From b794a3b3d3acd3f6b5d46e720b315ceaeb739bf8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 19 Dec 2022 17:05:13 +0100 Subject: [PATCH 2/2] Only build NavigationPaneHelper on Windows Signed-off-by: Claudio Cambra --- src/gui/CMakeLists.txt | 14 +++++++++----- src/gui/folderman.cpp | 10 ++++++++++ src/gui/folderman.h | 4 ++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 2bfa004dd7fa3..a58117fcfe5b6 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -109,8 +109,6 @@ set(client_SRCS lockwatcher.cpp logbrowser.h logbrowser.cpp - navigationpanehelper.h - navigationpanehelper.cpp networksettings.h networksettings.cpp ocsnavigationappsjob.h @@ -339,13 +337,19 @@ IF( APPLE ) ENDIF() IF( NOT WIN32 AND NOT APPLE ) -set(client_SRCS ${client_SRCS} folderwatcher_linux.cpp) + set(client_SRCS ${client_SRCS} folderwatcher_linux.cpp) ENDIF() IF( WIN32 ) -set(client_SRCS ${client_SRCS} folderwatcher_win.cpp shellextensionsserver.cpp ${CMAKE_SOURCE_DIR}/src/common/shellextensionutils.cpp) + set(client_SRCS + ${client_SRCS} + folderwatcher_win.cpp + navigationpanehelper.h + navigationpanehelper.cpp + shellextensionsserver.cpp + ${CMAKE_SOURCE_DIR}/src/common/shellextensionutils.cpp) ENDIF() IF( APPLE ) -list(APPEND client_SRCS folderwatcher_mac.cpp) + list(APPEND client_SRCS folderwatcher_mac.cpp) ENDIF() set(3rdparty_SRC diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 6be6516e4c49c..892c4fef0f441 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -62,7 +62,9 @@ FolderMan *FolderMan::_instance = nullptr; FolderMan::FolderMan(QObject *parent) : QObject(parent) , _lockWatcher(new LockWatcher) +#ifdef Q_OS_WIN , _navigationPaneHelper(this) +#endif { ASSERT(!_instance); _instance = this; @@ -1257,7 +1259,9 @@ Folder *FolderMan::addFolder(AccountState *accountState, const FolderDefinition emit folderListChanged(_folderMap); } +#ifdef Q_OS_WIN _navigationPaneHelper.scheduleUpdateCloudStorageRegistry(); +#endif return folder; } @@ -1277,10 +1281,12 @@ Folder *FolderMan::addFolderInternal( auto folder = new Folder(folderDefinition, accountState, std::move(vfs), this); +#ifdef Q_OS_WIN if (_navigationPaneHelper.showInExplorerNavigationPane() && folderDefinition.navigationPaneClsid.isNull()) { folder->setNavigationPaneClsid(QUuid::createUuid()); folder->saveToSettings(); } +#endif qCInfo(lcFolderMan) << "Adding folder to Folder Map " << folder << folder->alias(); _folderMap[folder->alias()] = folder; @@ -1414,7 +1420,9 @@ void FolderMan::removeFolder(Folder *folderToRemove) delete folderToRemove; } +#ifdef Q_OS_WIN _navigationPaneHelper.scheduleUpdateCloudStorageRegistry(); +#endif emit folderListChanged(_folderMap); } @@ -1551,7 +1559,9 @@ void FolderMan::slotWipeFolderForAccount(AccountState *accountState) delete f; } +#ifdef Q_OS_WIN _navigationPaneHelper.scheduleUpdateCloudStorageRegistry(); +#endif } emit folderListChanged(_folderMap); diff --git a/src/gui/folderman.h b/src/gui/folderman.h index b76ede8da3f16..9ab08c9ab4bc4 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -23,7 +23,9 @@ #include "folder.h" #include "folderwatcher.h" +#ifdef Q_OS_WIN #include "navigationpanehelper.h" +#endif #include "syncfileitem.h" class TestFolderMan; @@ -403,7 +405,9 @@ private slots: bool _nextSyncShouldStartImmediately = false; QScopedPointer _socketApi; +#ifdef Q_OS_WIN NavigationPaneHelper _navigationPaneHelper; +#endif QPointer _removeE2eeShareJob;