From 899d492947c126646561d8505ba8b368e4503b78 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 c2c2cbca03fde..fa485c6f1d859 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -62,6 +62,7 @@ static constexpr char promptDeleteC[] = "promptDeleteAllFiles"; 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"; @@ -193,6 +194,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 9284d4ea25132..9316a63282501 100644 --- a/src/libsync/configfile.h +++ b/src/libsync/configfile.h @@ -156,8 +156,11 @@ class OWNCLOUDSYNC_EXPORT ConfigFile [[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);