Skip to content

Commit

Permalink
[Win] Remove legacy setting for sidebar entries
Browse files Browse the repository at this point in the history
We get this for free from the CfApi, and enabling this with winvfs
results in duplicate entries.

Fixes: #10788
  • Loading branch information
erikjv committed Jun 5, 2023
1 parent 0037fcc commit b3fc306
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 305 deletions.
3 changes: 1 addition & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ IF( APPLE )
elseif( WIN32 )
target_sources(owncloudCore PRIVATE
guiutility_win.cpp
folderwatcher_win.cpp
navigationpanehelper.cpp)
folderwatcher_win.cpp)
if(TARGET Qt::WinExtras)
target_link_libraries(owncloudCore PUBLIC Qt::WinExtras)
endif()
Expand Down
10 changes: 0 additions & 10 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,6 @@ 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.
auto connection = std::make_shared<QMetaObject::Connection>();
auto switchVfsOn = [folder, connection, this]() {
Expand Down Expand Up @@ -581,11 +576,6 @@ void AccountSettings::slotDisableVfsCurrentFolder()
if (msgBox->clickedButton() != acceptButton|| !folder)
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.
auto connection = std::make_shared<QMetaObject::Connection>();
auto switchVfsOff = [folder, connection, this]() {
Expand Down
13 changes: 0 additions & 13 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1421,12 +1421,6 @@ void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder)

// Prevent loading of profiles in old clients
settings.setValue(versionC(), maxSettingsVersion());

// Happens only on Windows when the explorer integration is enabled.
if (!folder.navigationPaneClsid.isNull())
settings.setValue(QStringLiteral("navigationPaneClsid"), folder.navigationPaneClsid);
else
settings.remove(QStringLiteral("navigationPaneClsid"));
}

FolderDefinition FolderDefinition::load(QSettings &settings, const QByteArray &id)
Expand All @@ -1437,7 +1431,6 @@ FolderDefinition FolderDefinition::load(QSettings &settings, const QByteArray &i
folder.setTargetPath(settings.value(QStringLiteral("targetPath")).toString());
folder.paused = settings.value(QStringLiteral("paused")).toBool();
folder.ignoreHiddenFiles = settings.value(QStringLiteral("ignoreHiddenFiles"), QVariant(true)).toBool();
folder.navigationPaneClsid = settings.value(QStringLiteral("navigationPaneClsid")).toUuid();
folder._deployed = settings.value(deployedC(), false).toBool();
folder._priority = settings.value(priorityC(), 0).toInt();

Expand Down Expand Up @@ -1519,12 +1512,6 @@ bool Folder::groupInSidebar() const
return false;
}

void Folder::setNavigationPaneClsid(const QUuid &clsid)
{
_definition.navigationPaneClsid = clsid;
saveToSettings();
}

bool FolderDefinition::isDeployed() const
{
return _deployed;
Expand Down
5 changes: 0 additions & 5 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ class FolderDefinition
bool ignoreHiddenFiles = true;
/// Which virtual files setting the folder uses
Vfs::Mode virtualFilesMode = Vfs::Off;
/// The CLSID where this folder appears in registry for the Explorer navigation pane entry.
QUuid navigationPaneClsid;

/// Whether the vfs mode shall silently be updated if possible
bool upgradeVfsMode = false;
Expand Down Expand Up @@ -213,9 +211,6 @@ class Folder : public QObject
*/
QString remotePathTrailingSlash() const;

void setNavigationPaneClsid(const QUuid &clsid);
QUuid navigationPaneClsid() const { return _definition.navigationPaneClsid; }

/**
* remote folder path with server url
*/
Expand Down
13 changes: 0 additions & 13 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ FolderMan::FolderMan(QObject *parent)
, _currentSyncFolder(nullptr)
, _syncEnabled(true)
, _lockWatcher(new LockWatcher)
#ifdef Q_OS_WIN
, _navigationPaneHelper(this)
#endif
, _appRestartRequired(false)
{
OC_ASSERT(!_instance);
Expand Down Expand Up @@ -965,9 +962,6 @@ void FolderMan::removeFolder(Folder *f)
unloadFolder(f);
f->deleteLater();

#ifdef Q_OS_WIN
_navigationPaneHelper.scheduleUpdateCloudStorageRegistry();
#endif
Q_EMIT folderRemoved(f);
emit folderListChanged();
QTimer::singleShot(0, this, &FolderMan::startScheduledSyncSoon);
Expand Down Expand Up @@ -1346,13 +1340,6 @@ Folder *FolderMan::addFolderFromWizard(const AccountStatePtr &accountStatePtr, c
// With spaces we only handle the main folder
if (!newFolder->groupInSidebar()) {
Utility::setupFavLink(localFolder);
#ifdef Q_OS_WIN
if (_navigationPaneHelper.showInExplorerNavigationPane()) {
newFolder->setNavigationPaneClsid(QUuid::createUuid());
// we might need to add or remove the panel entry as cfapi brings this feature out of the box
FolderMan::instance()->navigationPaneHelper().scheduleUpdateCloudStorageRegistry();
}
#endif
}
if (!ConfigFile().newBigFolderSizeLimit().first) {
// The user already accepted the selective sync dialog. everything is in the white list
Expand Down
8 changes: 0 additions & 8 deletions src/gui/folderman.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include <QList>

#include "folder.h"
#include "navigationpanehelper.h"

#include "folderwizard/folderwizard.h"

class TestFolderMigration;
Expand Down Expand Up @@ -174,9 +172,6 @@ class FolderMan : public QObject
static TrayOverallStatusResult trayOverallStatus(const QVector<Folder *> &folders);

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.
Expand Down Expand Up @@ -376,9 +371,6 @@ private slots:
QTimer _startScheduledSyncTimer;

QScopedPointer<SocketApi> _socketApi;
#ifdef Q_OS_WIN
NavigationPaneHelper _navigationPaneHelper;
#endif

bool _appRestartRequired;

Expand Down
18 changes: 0 additions & 18 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ GeneralSettings::GeneralSettings(QWidget *parent)
_ui->setupUi(this);

connect(_ui->desktopNotificationsCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleOptionalDesktopNotifications);
#ifdef Q_OS_WIN
connect(_ui->showInExplorerNavigationPaneCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotShowInExplorerNavigationPane);
#endif

reloadConfig();
loadMiscSettings();
Expand Down Expand Up @@ -85,10 +82,6 @@ GeneralSettings::GeneralSettings(QWidget *parent)
_ui->crashreporterCheckBox->setVisible(false);
#endif

// Hide on non-Windows, or WindowsVersion < 10.
// The condition should match the default value of ConfigFile::showInExplorerNavigationPane.
_ui->showInExplorerNavigationPaneCheckBox->setVisible(QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10);

/* Set the left contents margin of the layout to zero to make the checkboxes
* align properly vertically , fixes bug #3758
*/
Expand Down Expand Up @@ -177,7 +170,6 @@ void GeneralSettings::loadMiscSettings()
ConfigFile cfgFile;
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
_ui->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane());
_ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
_ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
Expand Down Expand Up @@ -285,16 +277,6 @@ void GeneralSettings::slotToggleOptionalDesktopNotifications(bool enable)
cfgFile.setOptionalDesktopNotifications(enable);
}

#ifdef Q_OS_WIN
void GeneralSettings::slotShowInExplorerNavigationPane(bool checked)
{
ConfigFile cfgFile;
cfgFile.setShowInExplorerNavigationPane(checked);
// Now update the registry with the change.
FolderMan::instance()->navigationPaneHelper().setShowInExplorerNavigationPane(checked);
}
#endif

void GeneralSettings::slotIgnoreFilesEditor()
{
if (_ignoreEditor.isNull()) {
Expand Down
3 changes: 0 additions & 3 deletions src/gui/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ private slots:
void saveMiscSettings();
void slotToggleLaunchOnStartup(bool);
void slotToggleOptionalDesktopNotifications(bool);
#ifdef Q_OS_WIN
void slotShowInExplorerNavigationPane(bool);
#endif
void slotUpdateChannelChanged(int index);
void slotIgnoreFilesEditor();
void loadMiscSettings();
Expand Down
12 changes: 2 additions & 10 deletions src/gui/generalsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>771</width>
<height>637</height>
<width>765</width>
<height>618</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
Expand Down Expand Up @@ -100,13 +100,6 @@
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="showInExplorerNavigationPaneCheckBox">
<property name="text">
<string>Show sync folders in &amp;Explorer's Navigation Pane</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="syncHiddenFilesCheckBox">
<property name="text">
Expand Down Expand Up @@ -378,7 +371,6 @@
<tabstop>autostartCheckBox</tabstop>
<tabstop>desktopNotificationsCheckBox</tabstop>
<tabstop>monoIconsCheckBox</tabstop>
<tabstop>showInExplorerNavigationPaneCheckBox</tabstop>
<tabstop>syncHiddenFilesCheckBox</tabstop>
<tabstop>crashreporterCheckBox</tabstop>
<tabstop>ignoredFilesButton</tabstop>
Expand Down
160 changes: 0 additions & 160 deletions src/gui/navigationpanehelper.cpp

This file was deleted.

Loading

0 comments on commit b3fc306

Please sign in to comment.