Skip to content

Commit cc8a441

Browse files
committed
feat: Add option to disable CloudProviders sidebar integration
Adds a new setting in General preferences to control whether synchronized folders appear in the file manager sidebar via CloudProviders on Linux. Changes: - Add 'showCloudProvidersInFileManager' config setting (defaults to true) - Add checkbox in General Settings UI (Linux only) - Check setting during CloudProviderManager initialization - Skip DBus registration when disabled The setting requires application restart to take effect. Signed-off-by: eriolloan <[email protected]>
1 parent 5124562 commit cc8a441

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

src/gui/cloudproviders/cloudprovidermanager.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
#include "cloudprovidermanager.h"
1212
#include "account.h"
1313
#include "cloudproviderconfig.h"
14+
#include "configfile.h"
15+
16+
#include <QLoggingCategory>
17+
18+
Q_DECLARE_LOGGING_CATEGORY(lcNextcloudCloudProviderIntegration)
1419

1520
CloudProvidersProviderExporter *_providerExporter;
1621

@@ -42,6 +47,12 @@ void CloudProviderManager::registerSignals()
4247

4348
CloudProviderManager::CloudProviderManager(QObject *parent) : QObject(parent)
4449
{
50+
OCC::ConfigFile cfg;
51+
if (!cfg.showCloudProvidersInFileManager()) {
52+
qCInfo(lcNextcloudCloudProviderIntegration) << "CloudProviders disabled by user setting";
53+
return;
54+
}
55+
4556
_folder_index = 0;
4657
g_bus_own_name (G_BUS_TYPE_SESSION, LIBCLOUDPROVIDERS_DBUS_BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, nullptr, on_name_acquired, nullptr, this, nullptr);
4758
}

src/gui/generalsettings.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ GeneralSettings::GeneralSettings(QWidget *parent)
231231

232232
connect(_ui->showInExplorerNavigationPaneCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotShowInExplorerNavigationPane);
233233

234+
connect(_ui->showCloudProvidersCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleCloudProviders);
235+
234236
// Rename 'Explorer' appropriately on non-Windows
235237
#ifdef Q_OS_MACOS
236238
QString txt = _ui->showInExplorerNavigationPaneCheckBox->text();
@@ -281,6 +283,11 @@ GeneralSettings::GeneralSettings(QWidget *parent)
281283
_ui->showInExplorerNavigationPaneCheckBox->setVisible(false);
282284
#endif
283285

286+
// Hide CloudProviders checkbox on non-Linux platforms
287+
#ifndef Q_OS_LINUX
288+
_ui->showCloudProvidersCheckBox->setVisible(false);
289+
#endif
290+
284291
/* Set the left contents margin of the layout to zero to make the checkboxes
285292
* align properly vertically , fixes bug #3758
286293
*/
@@ -335,6 +342,7 @@ void GeneralSettings::loadMiscSettings()
335342
_ui->quotaWarningNotificationsCheckBox->setEnabled(cfgFile.optionalServerNotifications());
336343
_ui->quotaWarningNotificationsCheckBox->setChecked(cfgFile.showQuotaWarningNotifications());
337344
_ui->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane());
345+
_ui->showCloudProvidersCheckBox->setChecked(cfgFile.showCloudProvidersInFileManager());
338346
_ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
339347
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
340348
_ui->moveFilesToTrashCheckBox->setChecked(cfgFile.moveToTrash());
@@ -648,6 +656,12 @@ void GeneralSettings::slotShowInExplorerNavigationPane(bool checked)
648656
#endif
649657
}
650658

659+
void GeneralSettings::slotToggleCloudProviders(bool checked)
660+
{
661+
ConfigFile cfgFile;
662+
cfgFile.setShowCloudProvidersInFileManager(checked);
663+
}
664+
651665
void GeneralSettings::slotIgnoreFilesEditor()
652666
{
653667
if (_ignoreEditor.isNull()) {

src/gui/generalsettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ private slots:
5151
void slotToggleCallNotifications(bool);
5252
void slotToggleQuotaWarningNotifications(bool);
5353
void slotShowInExplorerNavigationPane(bool);
54+
void slotToggleCloudProviders(bool);
5455
void slotIgnoreFilesEditor();
5556
void slotCreateDebugArchive();
5657
void loadMiscSettings();

src/gui/generalsettings.ui

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@
6565
</property>
6666
</widget>
6767
</item>
68+
<item row="2" column="0">
69+
<widget class="QCheckBox" name="showCloudProvidersCheckBox">
70+
<property name="text">
71+
<string>Show synchronized folders in file manager sidebar</string>
72+
</property>
73+
<property name="toolTip">
74+
<string>When enabled, synchronized folders will appear in the file manager's sidebar via CloudProviders (Linux only). Requires application restart.</string>
75+
</property>
76+
</widget>
77+
</item>
6878
</layout>
6979
</widget>
7080
</item>

src/libsync/configfile.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,19 @@ void ConfigFile::setShowInExplorerNavigationPane(bool show)
231231
settings.sync();
232232
}
233233

234+
bool ConfigFile::showCloudProvidersInFileManager() const
235+
{
236+
QSettings settings(configFile(), QSettings::IniFormat);
237+
return settings.value(showCloudProvidersInFileManagerC, true).toBool();
238+
}
239+
240+
void ConfigFile::setShowCloudProvidersInFileManager(bool show)
241+
{
242+
QSettings settings(configFile(), QSettings::IniFormat);
243+
settings.setValue(showCloudProvidersInFileManagerC, show);
244+
settings.sync();
245+
}
246+
234247
int ConfigFile::timeout() const
235248
{
236249
QSettings settings(configFile(), QSettings::IniFormat);

src/libsync/configfile.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
172172
[[nodiscard]] bool showInExplorerNavigationPane() const;
173173
void setShowInExplorerNavigationPane(bool show);
174174

175+
[[nodiscard]] bool showCloudProvidersInFileManager() const;
176+
void setShowCloudProvidersInFileManager(bool show);
177+
175178
[[nodiscard]] int timeout() const;
176179
[[nodiscard]] qint64 chunkSize() const;
177180
[[nodiscard]] qint64 maxChunkSize() const;
@@ -296,6 +299,7 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
296299
static constexpr char showQuotaWarningNotificationsC[] = "showQuotaWarningNotifications";
297300
static constexpr char showChatNotificationsC[] = "showChatNotifications";
298301
static constexpr char showInExplorerNavigationPaneC[] = "showInExplorerNavigationPane";
302+
static constexpr char showCloudProvidersInFileManagerC[] = "showCloudProvidersInFileManager";
299303
static constexpr char confirmExternalStorageC[] = "confirmExternalStorage";
300304
static constexpr char useNewBigFolderSizeLimitC[] = "useNewBigFolderSizeLimit";
301305
static constexpr char newBigFolderSizeLimitC[] = "newBigFolderSizeLimit";

0 commit comments

Comments
 (0)