Add the chat notification toggle setting logic in generalsettings

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-02-13 13:56:20 +01:00 committed by Matthieu Gallien
parent e7d1f5f092
commit 918d79f5cd
2 changed files with 15 additions and 1 deletions

View file

@ -164,6 +164,10 @@ GeneralSettings::GeneralSettings(QWidget *parent)
this, &GeneralSettings::slotToggleOptionalServerNotifications); this, &GeneralSettings::slotToggleOptionalServerNotifications);
_ui->serverNotificationsCheckBox->setToolTip(tr("Server notifications that require attention.")); _ui->serverNotificationsCheckBox->setToolTip(tr("Server notifications that require attention."));
connect(_ui->chatNotificationsCheckBox, &QAbstractButton::toggled,
this, &GeneralSettings::slotToggleChatNotifications);
_ui->chatNotificationsCheckBox->setToolTip(tr("Show chat notification dialogs."));
connect(_ui->callNotificationsCheckBox, &QAbstractButton::toggled, connect(_ui->callNotificationsCheckBox, &QAbstractButton::toggled,
this, &GeneralSettings::slotToggleCallNotifications); this, &GeneralSettings::slotToggleCallNotifications);
_ui->callNotificationsCheckBox->setToolTip(tr("Show call notification dialogs.")); _ui->callNotificationsCheckBox->setToolTip(tr("Show call notification dialogs."));
@ -271,7 +275,9 @@ void GeneralSettings::loadMiscSettings()
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons()); _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
_ui->serverNotificationsCheckBox->setChecked(cfgFile.optionalServerNotifications()); _ui->serverNotificationsCheckBox->setChecked(cfgFile.optionalServerNotifications());
_ui->callNotificationsCheckBox->setEnabled(_ui->serverNotificationsCheckBox->isEnabled()); _ui->chatNotificationsCheckBox->setEnabled(cfgFile.optionalServerNotifications());
_ui->chatNotificationsCheckBox->setChecked(cfgFile.showChatNotifications());
_ui->callNotificationsCheckBox->setEnabled(cfgFile.optionalServerNotifications());
_ui->callNotificationsCheckBox->setChecked(cfgFile.showCallNotifications()); _ui->callNotificationsCheckBox->setChecked(cfgFile.showCallNotifications());
_ui->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane()); _ui->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane());
_ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter()); _ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
@ -512,9 +518,16 @@ void GeneralSettings::slotToggleOptionalServerNotifications(bool enable)
{ {
ConfigFile cfgFile; ConfigFile cfgFile;
cfgFile.setOptionalServerNotifications(enable); cfgFile.setOptionalServerNotifications(enable);
_ui->chatNotificationsCheckBox->setEnabled(enable);
_ui->callNotificationsCheckBox->setEnabled(enable); _ui->callNotificationsCheckBox->setEnabled(enable);
} }
void GeneralSettings::slotToggleChatNotifications(bool enable)
{
ConfigFile cfgFile;
cfgFile.setShowChatNotifications(enable);
}
void GeneralSettings::slotToggleCallNotifications(bool enable) void GeneralSettings::slotToggleCallNotifications(bool enable)
{ {
ConfigFile cfgFile; ConfigFile cfgFile;

View file

@ -52,6 +52,7 @@ private slots:
void saveMiscSettings(); void saveMiscSettings();
void slotToggleLaunchOnStartup(bool); void slotToggleLaunchOnStartup(bool);
void slotToggleOptionalServerNotifications(bool); void slotToggleOptionalServerNotifications(bool);
void slotToggleChatNotifications(bool);
void slotToggleCallNotifications(bool); void slotToggleCallNotifications(bool);
void slotShowInExplorerNavigationPane(bool); void slotShowInExplorerNavigationPane(bool);
void slotIgnoreFilesEditor(); void slotIgnoreFilesEditor();