Add setting for showing chat notifications to configfile
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 13 Feb 2023 12:47:52 +0000 (13:47 +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/libsync/configfile.cpp
src/libsync/configfile.h

index 1f571de3c42cf420108f8ae16e68f8d3a8b138ea..2b1cda432e597094ff865ce9e6b71bff398aa468 100644 (file)
@@ -58,6 +58,7 @@ static constexpr char deleteFilesThresholdC[] = "deleteFilesThreshold";
 static constexpr char crashReporterC[] = "crashReporter";
 static constexpr char optionalServerNotificationsC[] = "optionalServerNotifications";
 static constexpr char showCallNotificationsC[] = "showCallNotifications";
+static constexpr char showChatNotificationsC[] = "showChatNotifications";
 static constexpr char showInExplorerNavigationPaneC[] = "showInExplorerNavigationPane";
 static constexpr char skipUpdateCheckC[] = "skipUpdateCheck";
 static constexpr char autoUpdateCheckC[] = "autoUpdateCheck";
@@ -205,6 +206,19 @@ bool ConfigFile::optionalServerNotifications() const
     return settings.value(QLatin1String(optionalServerNotificationsC), true).toBool();
 }
 
+bool ConfigFile::showChatNotifications() const
+{
+    const QSettings settings(configFile(), QSettings::IniFormat);
+    return settings.value(QLatin1String(showChatNotificationsC), true).toBool() && optionalServerNotifications();
+}
+
+void ConfigFile::setShowChatNotifications(const bool show)
+{
+    QSettings settings(configFile(), QSettings::IniFormat);
+    settings.setValue(QLatin1String(showChatNotificationsC), show);
+    settings.sync();
+}
+
 bool ConfigFile::showCallNotifications() const
 {
     const QSettings settings(configFile(), QSettings::IniFormat);
index ff289b1fe06054a536dc452eac0cfffb6a2de1b1..212d6e6fe0d7dcd67151154cd82ec4d08c743050 100644 (file)
@@ -167,8 +167,11 @@ public:
     [[nodiscard]] bool optionalServerNotifications() const;
     void setOptionalServerNotifications(bool show);
 
+    [[nodiscard]] bool showChatNotifications() const;
+    void setShowChatNotifications(bool show);
+
     [[nodiscard]] bool showCallNotifications() const;
-    void setShowCallNotifications(bool show);
+    void setShowCallNotifications(const bool show);
 
     [[nodiscard]] bool showInExplorerNavigationPane() const;
     void setShowInExplorerNavigationPane(bool show);