From b6ad038a54e392ed6ff088f08620bb4be43ad774 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 24 Nov 2020 10:39:25 +0100 Subject: [PATCH] Add option to disable showing new join and leave events --- imports/NeoChat/Page/SettingsPage.qml | 8 ++++++-- src/messageeventmodel.cpp | 4 ++-- src/neochatconfig.kcfg | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/imports/NeoChat/Page/SettingsPage.qml b/imports/NeoChat/Page/SettingsPage.qml index 333ec7f79..8f46b064d 100644 --- a/imports/NeoChat/Page/SettingsPage.qml +++ b/imports/NeoChat/Page/SettingsPage.qml @@ -17,11 +17,15 @@ Kirigami.ScrollablePage { Kirigami.FormLayout { QQC2.CheckBox { - id: showNotifications - Kirigami.FormData.label: i18n("Show Notifications:") + Kirigami.FormData.label: i18n("Show notifications:") checked: Config.showNotifications onToggled: Config.showNotifications = checked } + QQC2.CheckBox { + Kirigami.FormData.label: i18n("Show leave and join events:") + checked: Config.showLeaveJoinEvent + onToggled: Config.showLeaveJoinEvent = checked + } QQC2.RadioButton { Kirigami.FormData.label: i18n("Rooms and private chats:") text: i18n("Separated") diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index 5f0d720ad..02abb2c71 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include "neochatconfig.h" #include #include @@ -373,7 +373,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const auto *memberEvent = timelineIt->viewAs(); if (memberEvent) { - if ((memberEvent->isJoin() || memberEvent->isLeave()) && !Settings().value("UI/show_joinleave", true).toBool()) + if ((memberEvent->isJoin() || memberEvent->isLeave()) && !NeoChatConfig::self()->showLeaveJoinEvent()) return EventStatus::Hidden; } diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg index 0a8a602c4..6640b6e06 100644 --- a/src/neochatconfig.kcfg +++ b/src/neochatconfig.kcfg @@ -19,6 +19,10 @@ false + + + true +