mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge pull request #5433 from nextcloud/feature/disable-talk-notifications
Feature/disable talk chat notifications
This commit is contained in:
commit
52f066d20d
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -7,13 +7,221 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>667</width>
|
||||
<height>663</height>
|
||||
<height>796</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="aboutGroupBox">
|
||||
<property name="title">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="aboutLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="legalNoticeButton">
|
||||
<property name="text">
|
||||
<string>Legal notice</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="generalGroupBox">
|
||||
<property name="title">
|
||||
<string>General Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="autostartCheckBox">
|
||||
<property name="text">
|
||||
<string>&Launch on System Startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="callNotificationsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show Call Notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="monoIconsCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>For System Tray</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &Monochrome Icons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="chatNotificationsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show Chat Notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="serverNotificationsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show Server &Notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="updatesGroupBox">
|
||||
<property name="title">
|
||||
<string>Updates</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoCheckForUpdatesCheckBox">
|
||||
<property name="text">
|
||||
<string>&Automatically check for Updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="updateChannelLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Channel</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>updateChannel</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="updateChannel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>stable</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>beta</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="updateStateLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restartButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Restart && Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="updateButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Check for Update now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
@ -383,52 +591,11 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="generalGroupBox">
|
||||
<property name="title">
|
||||
<string>General Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="monoIconsCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>For System Tray</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &monochrome icons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="autostartCheckBox">
|
||||
<property name="text">
|
||||
<string>&Launch on system startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="serverNotificationsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show server &notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="callNotificationsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show call notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>autostartCheckBox</tabstop>
|
||||
<tabstop>serverNotificationsCheckBox</tabstop>
|
||||
<tabstop>monoIconsCheckBox</tabstop>
|
||||
<tabstop>ignoredFilesButton</tabstop>
|
||||
<tabstop>newFolderLimitCheckBox</tabstop>
|
||||
<tabstop>newFolderLimitSpinBox</tabstop>
|
||||
|
||||
@ -184,7 +184,7 @@ void User::showDesktopTalkNotification(const Activity &activity)
|
||||
{
|
||||
const auto notificationId = activity._id;
|
||||
|
||||
if (!canShowNotification(notificationId)) {
|
||||
if (!canShowNotification(notificationId) || !ConfigFile().showChatNotifications()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -167,6 +167,9 @@ 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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user