diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg
index 87b5a29b7..09efb4049 100644
--- a/src/neochatconfig.kcfg
+++ b/src/neochatconfig.kcfg
@@ -25,10 +25,6 @@
0.3
-
-
- true
-
false
diff --git a/src/notificationsmanager.cpp b/src/notificationsmanager.cpp
index 8ed08486c..f2b0f03eb 100644
--- a/src/notificationsmanager.cpp
+++ b/src/notificationsmanager.cpp
@@ -55,10 +55,6 @@ void NotificationsManager::postNotification(NeoChatRoom *room,
const QString &replyEventId,
bool canReply)
{
- if (!NeoChatConfig::self()->showNotifications()) {
- return;
- }
-
QPixmap img;
img.convertFromImage(icon);
KNotification *notification = new KNotification("message");
@@ -103,9 +99,6 @@ void NotificationsManager::postNotification(NeoChatRoom *room,
void NotificationsManager::postInviteNotification(NeoChatRoom *room, const QString &title, const QString &sender, const QImage &icon)
{
- if (!NeoChatConfig::self()->showNotifications()) {
- return;
- }
QPixmap img;
img.convertFromImage(icon);
KNotification *notification = new KNotification("invite");
@@ -284,7 +277,9 @@ void NotificationsManager::updateNotificationRules(const QString &type)
if (overrideRule["rule_id"] == ".m.rule.master") {
bool ruleEnabled = overrideRule["enabled"].toBool();
m_globalNotificationsEnabled = !ruleEnabled;
- NeoChatConfig::self()->setShowNotifications(m_globalNotificationsEnabled);
+ if (!m_globalNotificationsSet) {
+ m_globalNotificationsSet = true;
+ }
Q_EMIT globalNotificationsEnabledChanged(m_globalNotificationsEnabled);
}
diff --git a/src/notificationsmanager.h b/src/notificationsmanager.h
index d80b43112..0be9acb3b 100644
--- a/src/notificationsmanager.h
+++ b/src/notificationsmanager.h
@@ -33,6 +33,7 @@ class NotificationsManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool globalNotificationsEnabled MEMBER m_globalNotificationsEnabled WRITE setGlobalNotificationsEnabled NOTIFY globalNotificationsEnabledChanged)
+ Q_PROPERTY(bool globalNotificationsSet MEMBER m_globalNotificationsSet NOTIFY globalNotificationsSetChanged)
Q_PROPERTY(PushNotificationAction::Action oneToOneNotificationAction MEMBER m_oneToOneNotificationAction WRITE setOneToOneNotificationAction NOTIFY
oneToOneNotificationActionChanged)
Q_PROPERTY(PushNotificationAction::Action encryptedOneToOneNotificationAction MEMBER m_encryptedOneToOneNotificationAction WRITE
@@ -73,7 +74,8 @@ private:
QMultiMap m_notifications;
QHash> m_invitations;
- bool m_globalNotificationsEnabled;
+ bool m_globalNotificationsEnabled = false;
+ bool m_globalNotificationsSet = false;
PushNotificationAction::Action m_oneToOneNotificationAction = PushNotificationAction::Unknown;
PushNotificationAction::Action m_encryptedOneToOneNotificationAction = PushNotificationAction::Unknown;
PushNotificationAction::Action m_groupChatNotificationAction = PushNotificationAction::Unknown;
@@ -107,6 +109,7 @@ private Q_SLOTS:
Q_SIGNALS:
void globalNotificationsEnabledChanged(bool newState);
+ void globalNotificationsSetChanged(bool newState);
void oneToOneNotificationActionChanged(PushNotificationAction::Action action);
void encryptedOneToOneNotificationActionChanged(PushNotificationAction::Action action);
void groupChatNotificationActionChanged(PushNotificationAction::Action action);
diff --git a/src/qml/Settings/GlobalNotificationsPage.qml b/src/qml/Settings/GlobalNotificationsPage.qml
index ab6bdc3fe..0cb040840 100644
--- a/src/qml/Settings/GlobalNotificationsPage.qml
+++ b/src/qml/Settings/GlobalNotificationsPage.qml
@@ -19,14 +19,12 @@ Kirigami.ScrollablePage {
MobileForm.FormCard {
Layout.fillWidth: true
-
contentItem: MobileForm.FormCheckDelegate {
text: i18n("Enable notifications for this account")
- checked: Config.showNotifications
- enabled: !Config.isShowNotificationsImmutable && Controller.activeConnection
+ description: i18n("Whether push notifications are generated by your Matrix server")
+ checked: NotificationsManager.globalNotificationsEnabled
+ enabled: NotificationsManager.globalNotificationsSet
onToggled: {
- Config.showNotifications = checked
- Config.save()
NotificationsManager.globalNotificationsEnabled = checked
}
}