Add the chat notification toggle setting logic in generalsettings
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 13 Feb 2023 12:56:20 +0000 (13:56 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 21 Nov 2024 11:31:23 +0000 (12:31 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/generalsettings.cpp
src/gui/generalsettings.h

index d9fcbefe284cd77f8b3e71b8d2a8aec21aa563d1..8653f433f6c6fabe2cdc7dcac2f6edc161f55a3f 100644 (file)
@@ -164,6 +164,10 @@ GeneralSettings::GeneralSettings(QWidget *parent)
         this, &GeneralSettings::slotToggleOptionalServerNotifications);
     _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,
         this, &GeneralSettings::slotToggleCallNotifications);
     _ui->callNotificationsCheckBox->setToolTip(tr("Show call notification dialogs."));
@@ -271,7 +275,9 @@ void GeneralSettings::loadMiscSettings()
 
     _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
     _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->showInExplorerNavigationPaneCheckBox->setChecked(cfgFile.showInExplorerNavigationPane());
     _ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
@@ -512,9 +518,16 @@ void GeneralSettings::slotToggleOptionalServerNotifications(bool enable)
 {
     ConfigFile cfgFile;
     cfgFile.setOptionalServerNotifications(enable);
+    _ui->chatNotificationsCheckBox->setEnabled(enable);
     _ui->callNotificationsCheckBox->setEnabled(enable);
 }
 
+void GeneralSettings::slotToggleChatNotifications(bool enable)
+{
+    ConfigFile cfgFile;
+    cfgFile.setShowChatNotifications(enable);
+}
+
 void GeneralSettings::slotToggleCallNotifications(bool enable)
 {
     ConfigFile cfgFile;
index 02a8cef3dedf28dfa19a39f70d414dc76e3b876d..83067799a9753cb5567eb7a143268b2c52fba2c5 100644 (file)
@@ -52,6 +52,7 @@ private slots:
     void saveMiscSettings();
     void slotToggleLaunchOnStartup(bool);
     void slotToggleOptionalServerNotifications(bool);
+    void slotToggleChatNotifications(bool);
     void slotToggleCallNotifications(bool);
     void slotShowInExplorerNavigationPane(bool);
     void slotIgnoreFilesEditor();