From e7d1f5f0921d8a2d5e8da5a9f876c6ea50a0c415 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Feb 2023 13:47:52 +0100 Subject: [PATCH] Add setting for showing chat notifications to configfile Signed-off-by: Claudio Cambra --- src/libsync/configfile.cpp | 14 ++++++++++++++ src/libsync/configfile.h | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 1f571de3c..2b1cda432 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -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); diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h index ff289b1fe..212d6e6fe 100644 --- a/src/libsync/configfile.h +++ b/src/libsync/configfile.h @@ -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); -- 2.30.2