Skip to content

Commit

Permalink
Add setting for showing chat notifications to configfile
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Feb 13, 2023
1 parent 8e07e04 commit 899d492
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 899d492

Please sign in to comment.