mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
General Settings: Make sure to reload the settings when an account is added
The Size limit, or confirmation checkboxes might have changed. We need to guard against saving if the control changes while we are loading Issue: https://github.com/owncloud/client/pull/5340#issuecomment-274878023
This commit is contained in:
parent
38cf459b3e
commit
b76a9654cc
2 changed files with 10 additions and 1 deletions
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QScopedValueRollback>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
|
||||||
connect(_ui->crashreporterCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
connect(_ui->crashreporterCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
||||||
connect(_ui->newFolderLimitCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
connect(_ui->newFolderLimitCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
||||||
connect(_ui->newFolderLimitSpinBox, SIGNAL(valueChanged(int)), SLOT(saveMiscSettings()));
|
connect(_ui->newFolderLimitSpinBox, SIGNAL(valueChanged(int)), SLOT(saveMiscSettings()));
|
||||||
|
connect(_ui->newExternalStorage, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
||||||
|
|
||||||
#ifndef WITH_CRASHREPORTER
|
#ifndef WITH_CRASHREPORTER
|
||||||
_ui->crashreporterCheckBox->setVisible(false);
|
_ui->crashreporterCheckBox->setVisible(false);
|
||||||
|
@ -85,6 +87,9 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
|
||||||
_ui->monoIconsCheckBox->setVisible(QDir(themeDir).exists());
|
_ui->monoIconsCheckBox->setVisible(QDir(themeDir).exists());
|
||||||
|
|
||||||
connect(_ui->ignoredFilesButton, SIGNAL(clicked()), SLOT(slotIgnoreFilesEditor()));
|
connect(_ui->ignoredFilesButton, SIGNAL(clicked()), SLOT(slotIgnoreFilesEditor()));
|
||||||
|
|
||||||
|
// accountAdded means the wizard was finished and the wizard might change some options.
|
||||||
|
connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)), this, SLOT(loadMiscSettings()));
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralSettings::~GeneralSettings()
|
GeneralSettings::~GeneralSettings()
|
||||||
|
@ -99,6 +104,7 @@ QSize GeneralSettings::sizeHint() const {
|
||||||
|
|
||||||
void GeneralSettings::loadMiscSettings()
|
void GeneralSettings::loadMiscSettings()
|
||||||
{
|
{
|
||||||
|
QScopedValueRollback<bool> scope(_currentlyLoading, true);
|
||||||
ConfigFile cfgFile;
|
ConfigFile cfgFile;
|
||||||
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
||||||
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
|
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
|
||||||
|
@ -132,6 +138,8 @@ void GeneralSettings::slotUpdateInfo()
|
||||||
|
|
||||||
void GeneralSettings::saveMiscSettings()
|
void GeneralSettings::saveMiscSettings()
|
||||||
{
|
{
|
||||||
|
if (_currentlyLoading)
|
||||||
|
return;
|
||||||
ConfigFile cfgFile;
|
ConfigFile cfgFile;
|
||||||
bool isChecked = _ui->monoIconsCheckBox->isChecked();
|
bool isChecked = _ui->monoIconsCheckBox->isChecked();
|
||||||
cfgFile.setMonoIcons(isChecked);
|
cfgFile.setMonoIcons(isChecked);
|
||||||
|
|
|
@ -45,13 +45,14 @@ private slots:
|
||||||
void slotToggleOptionalDesktopNotifications(bool);
|
void slotToggleOptionalDesktopNotifications(bool);
|
||||||
void slotUpdateInfo();
|
void slotUpdateInfo();
|
||||||
void slotIgnoreFilesEditor();
|
void slotIgnoreFilesEditor();
|
||||||
|
void loadMiscSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadMiscSettings();
|
|
||||||
|
|
||||||
Ui::GeneralSettings *_ui;
|
Ui::GeneralSettings *_ui;
|
||||||
QPointer<IgnoreListEditor> _ignoreEditor;
|
QPointer<IgnoreListEditor> _ignoreEditor;
|
||||||
QPointer<SyncLogDialog> _syncLogDialog;
|
QPointer<SyncLogDialog> _syncLogDialog;
|
||||||
|
bool _currentlyLoading = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue