From fd7a5e65f1865bc29dccafb28c6d91b27a868c36 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Mon, 2 Feb 2026 13:27:51 +0100 Subject: [PATCH] hide notification content setting --- Linphone/core/notifier/Notifier.cpp | 6 ++- Linphone/core/setting/SettingsCore.cpp | 23 +++++++++- Linphone/core/setting/SettingsCore.hpp | 28 +++++++---- Linphone/data/languages/de.ts | 32 +++++++++++-- Linphone/data/languages/en.ts | 46 ++++++++++++++----- Linphone/data/languages/fr.ts | 32 +++++++++++-- Linphone/model/setting/SettingsModel.cpp | 13 +++++- Linphone/model/setting/SettingsModel.hpp | 4 ++ .../Layout/Settings/ChatSettingsLayout.qml | 25 ++++++++++ 9 files changed, 175 insertions(+), 34 deletions(-) diff --git a/Linphone/core/notifier/Notifier.cpp b/Linphone/core/notifier/Notifier.cpp index c38663038..58c3289f1 100644 --- a/Linphone/core/notifier/Notifier.cpp +++ b/Linphone/core/notifier/Notifier.cpp @@ -366,7 +366,8 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr txt = tr("new_conference_invitation"); }; - if (messages.size() == 1) { // Display only sender on mono message. + if (messages.size() == 1 && + SettingsModel::getInstance()->getDisplayNotificationContent()) { // Display only sender on mono message. if (message->isRead()) return; getMessage(message); if (txt.isEmpty()) { // Do not notify message without content @@ -382,6 +383,9 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr } } if (unreadCount == 0) return; + else if (unreadCount == 1) + //: 'New message received!' Notification that warn the user of a new message. + txt = tr("new_chat_room_message"); if (unreadCount > 1) //: 'New messages received!' Notification that warn the user of new messages. txt = tr("new_chat_room_messages"); diff --git a/Linphone/core/setting/SettingsCore.cpp b/Linphone/core/setting/SettingsCore.cpp index a4f59b9c2..f94e49489 100644 --- a/Linphone/core/setting/SettingsCore.cpp +++ b/Linphone/core/setting/SettingsCore.cpp @@ -50,17 +50,16 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) { mVideoEnabled = settingsModel->getVideoEnabled(); mEchoCancellationEnabled = settingsModel->getEchoCancellationEnabled(); mAutoDownloadReceivedFiles = settingsModel->getAutoDownloadReceivedFiles(); + mDisplayNotificationContent = settingsModel->getDisplayNotificationContent(); mAutomaticallyRecordCallsEnabled = settingsModel->getAutomaticallyRecordCallsEnabled(); mRingtonePath = settingsModel->getRingtone(); QFileInfo ringtone(mRingtonePath); if (ringtone.exists()) { mRingtoneFileName = ringtone.fileName(); mRingtoneFolder = ringtone.absolutePath(); - CoreModel::getInstance()->getCore()->enableNativeRinging(false); } else { mRingtoneFileName = mRingtonePath.right(mRingtonePath.lastIndexOf(QDir::separator())); mRingtoneFolder = mRingtonePath.left(mRingtonePath.lastIndexOf(QDir::separator())); - CoreModel::getInstance()->getCore()->enableNativeRinging(true); } // Network @@ -166,6 +165,7 @@ SettingsCore::SettingsCore(const SettingsCore &settingsCore) { mVideoEnabled = settingsCore.mVideoEnabled; mEchoCancellationEnabled = settingsCore.mEchoCancellationEnabled; mAutoDownloadReceivedFiles = settingsCore.mAutoDownloadReceivedFiles; + mDisplayNotificationContent = settingsCore.mDisplayNotificationContent; mAutomaticallyRecordCallsEnabled = settingsCore.mAutomaticallyRecordCallsEnabled; // Audio @@ -252,6 +252,7 @@ void SettingsCore::reloadSettings() { setVideoEnabled(settingsModel->getVideoEnabled()); setEchoCancellationEnabled(settingsModel->getEchoCancellationEnabled()); setAutoDownloadReceivedFiles(settingsModel->getAutoDownloadReceivedFiles()); + setDisplayNotificationContent(settingsModel->getDisplayNotificationContent()); setAutomaticallyRecordCallsEnabled(settingsModel->getAutomaticallyRecordCallsEnabled()); setRingtone(settingsModel->getRingtone()); @@ -402,6 +403,12 @@ void SettingsCore::setSelf(QSharedPointer me) { mSettingsModelConnection->invokeToCore([this, enabled]() { setAutoDownloadReceivedFiles(enabled); }); }); + // Auto download incoming files + mSettingsModelConnection->makeConnectToModel( + &SettingsModel::displayNotificationContentChanged, [this](const bool enabled) { + mSettingsModelConnection->invokeToCore([this, enabled]() { setDisplayNotificationContent(enabled); }); + }); + // Auto recording mSettingsModelConnection->makeConnectToModel( &SettingsModel::automaticallyRecordCallsEnabledChanged, [this](const bool enabled) { @@ -642,6 +649,7 @@ void SettingsCore::reset(const SettingsCore &settingsCore) { setAutomaticallyRecordCallsEnabled(settingsCore.mAutomaticallyRecordCallsEnabled); setAutoDownloadReceivedFiles(settingsCore.mAutoDownloadReceivedFiles); + setDisplayNotificationContent(settingsCore.mDisplayNotificationContent); // Audio setCaptureDevices(settingsCore.mCaptureDevices); setPlaybackDevices(settingsCore.mPlaybackDevices); @@ -797,6 +805,14 @@ void SettingsCore::setAutoDownloadReceivedFiles(bool enabled) { } } +void SettingsCore::setDisplayNotificationContent(bool enabled) { + if (mDisplayNotificationContent != enabled) { + mDisplayNotificationContent = enabled; + emit displayNotificationContentChanged(); + setIsSaved(false); + } +} + void SettingsCore::setAutomaticallyRecordCallsEnabled(bool enabled) { if (mAutomaticallyRecordCallsEnabled != enabled) { mAutomaticallyRecordCallsEnabled = enabled; @@ -1243,6 +1259,8 @@ void SettingsCore::writeIntoModel(std::shared_ptr model) const { // Chat model->setAutoDownloadReceivedFiles(mAutoDownloadReceivedFiles); + model->setDisplayNotificationContent(mDisplayNotificationContent); + // Audio model->setRingerDevice(mRingerDevice); model->setCaptureDevice(mCaptureDevice); @@ -1318,6 +1336,7 @@ void SettingsCore::writeFromModel(const std::shared_ptr &model) { // Chat mAutoDownloadReceivedFiles = model->getAutoDownloadReceivedFiles(); + mDisplayNotificationContent = model->getDisplayNotificationContent(); // Audio mCaptureDevices = model->getCaptureDevices(); diff --git a/Linphone/core/setting/SettingsCore.hpp b/Linphone/core/setting/SettingsCore.hpp index 25cde25cd..85f159908 100644 --- a/Linphone/core/setting/SettingsCore.hpp +++ b/Linphone/core/setting/SettingsCore.hpp @@ -42,6 +42,8 @@ public: echoCancellationEnabledChanged) Q_PROPERTY(bool autoDownloadReceivedFiles READ getAutoDownloadReceivedFiles WRITE setAutoDownloadReceivedFiles NOTIFY autoDownloadReceivedFilesChanged) + Q_PROPERTY(bool displayNotificationContent READ getDisplayNotificationContent WRITE setDisplayNotificationContent + NOTIFY displayNotificationContentChanged) Q_PROPERTY( int echoCancellationCalibration READ getEchoCancellationCalibration NOTIFY echoCancellationCalibrationChanged) Q_PROPERTY(bool automaticallyRecordCallsEnabled READ getAutomaticallyRecordCallsEnabled WRITE @@ -93,18 +95,17 @@ public: Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged) Q_PROPERTY(bool crashReporterEnabled READ getCrashReporterEnabled WRITE setCrashReporterEnabled NOTIFY crashReporterEnabledChanged) - Q_PROPERTY(QString logsEmail READ getLogsEmail) - Q_PROPERTY(QString logsFolder READ getLogsFolder) - Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged) - Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged) - Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged) - Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged) - Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged) + Q_PROPERTY(QString logsEmail READ getLogsEmail) Q_PROPERTY(QString logsFolder READ getLogsFolder) + Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged) + Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged) + Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged) + Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged) + Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged) - Q_PROPERTY( - bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices NOTIFY showAccountDevicesChanged) + Q_PROPERTY(bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices + NOTIFY showAccountDevicesChanged) - static QSharedPointer create(); + static QSharedPointer create(); SettingsCore(QObject *parent = Q_NULLPTR); SettingsCore(const SettingsCore &settingsCore); virtual ~SettingsCore(); @@ -152,6 +153,11 @@ public: } void setAutoDownloadReceivedFiles(bool enabled); + bool getDisplayNotificationContent() { + return mDisplayNotificationContent; + } + void setDisplayNotificationContent(bool enabled); + bool getAutomaticallyRecordCallsEnabled() { return mAutomaticallyRecordCallsEnabled; } @@ -309,6 +315,7 @@ signals: void echoCancellationEnabledChanged(); void autoDownloadReceivedFilesChanged(); + void displayNotificationContentChanged(); void automaticallyRecordCallsEnabledChanged(); @@ -406,6 +413,7 @@ private: bool mVideoEnabled; bool mEchoCancellationEnabled; bool mAutoDownloadReceivedFiles; + bool mDisplayNotificationContent; bool mAutomaticallyRecordCallsEnabled; // Audio diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 8d3a2c0c5..161570d27 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -2674,17 +2674,35 @@ Stellen Sie sicher, dass Sie keine sensiblen Informationen teilen! Angefügte Dateien - + + settings_chat_notifications_title + Notifications + + + + settings_chat_attached_files_auto_download_title "Automatic download" Automatischer Download - + settings_chat_attached_files_auto_download_subtitle "Automatically download transferred or received files in conversations" Übertragene oder empfangene Dateien in Unterhaltungen automatisch herunterladen + + + settings_chat_display_notification_content_title + "Display notification content" + + + + + settings_chat_display_notification_content_subtitle + "Display the content of the received message" + + CliModel @@ -5113,13 +5131,19 @@ Ablauf: %1 Konferenzeinladung erhalten! - + + new_chat_room_message + 'New message received!' Notification that warn the user of a new message. + + + + new_chat_room_messages 'New messages received!' Notification that warn the user of new messages. Neue Nachrichten erhalten! - + new_message_alert_accessible_name New message on chatroom %1 Neue Nachricht im Chat %1 diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index f89595b8b..89bebd226 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -2627,17 +2627,35 @@ Only your correspondent can decrypt them. Attached files - + + settings_chat_notifications_title + Notifications + Notifications + + + settings_chat_attached_files_auto_download_title "Automatic download" Automatic download - + settings_chat_attached_files_auto_download_subtitle "Automatically download transferred or received files in conversations" Automatically download transferred or received files in conversations + + + settings_chat_display_notification_content_title + "Display notification content" + Display content + + + + settings_chat_display_notification_content_subtitle + "Display the content of the received message" + Display the content of the received message + CliModel @@ -4458,13 +4476,13 @@ Expiration : %1 oidc_connection_waiting_message "Trying to connect to single sign on on web page ..." - + Trying to connect to single sign on on web page ... cancel Cancel - Cancel + Cancel @@ -4506,24 +4524,24 @@ Expiration : %1 info_popup_error_title - Error + Error info_popup_manage_participant_error_message Error while setting participants ! - + Error while setting participants ! info_popup_success_title - + Success info_popup_manage_participant_updated_message Participants updated - + Participants updated @@ -4534,7 +4552,7 @@ Expiration : %1 apply_button_text Apply - + Apply @@ -5002,13 +5020,19 @@ Expiration : %1 Conference invitation received ! - + + new_chat_room_message + 'New message received!' Notification that warn the user of a new message. + New message received! + + + new_chat_room_messages 'New messages received!' Notification that warn the user of new messages. New messages received ! - + new_message_alert_accessible_name New message on chatroom %1 New message on chatroom %1 diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index 5050aa80d..2f9d9f9cd 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -2602,17 +2602,35 @@ en bout. Seul votre correspondant peut les déchiffrer. Fichiers joints - + + settings_chat_notifications_title + Notifications + Notifications + + + settings_chat_attached_files_auto_download_title "Automatic download" Téléchargement automatique - + settings_chat_attached_files_auto_download_subtitle "Automatically download transferred or received files in conversations" Télécharger automatiquement les fichiers échangés dans les conversations + + + settings_chat_display_notification_content_title + "Display notification content" + Afficher le contenu + + + + settings_chat_display_notification_content_subtitle + "Display the content of the received message" + Afficher le contenu du message reçu + CliModel @@ -4973,13 +4991,19 @@ Expiration : %1 Nouvelle invitation à une conférence ! - + + new_chat_room_message + 'New message received!' Notification that warn the user of a new message. + Nouveau message reçu + + + new_chat_room_messages 'New messages received!' Notification that warn the user of new messages. Nouveaux messages reçus ! - + new_message_alert_accessible_name New message on chatroom %1 Nouveau message sur la conversation %1 diff --git a/Linphone/model/setting/SettingsModel.cpp b/Linphone/model/setting/SettingsModel.cpp index 2bc817970..6f87a0eee 100644 --- a/Linphone/model/setting/SettingsModel.cpp +++ b/Linphone/model/setting/SettingsModel.cpp @@ -466,9 +466,7 @@ void SettingsModel::setRingtone(QString ringtonePath) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); QFileInfo ringtone(ringtonePath); if (ringtonePath.isEmpty() || !ringtone.exists()) { - CoreModel::getInstance()->getCore()->enableNativeRinging(true); } else { - CoreModel::getInstance()->getCore()->enableNativeRinging(false); CoreModel::getInstance()->getCore()->setRing(Utils::appStringToCoreString(ringtonePath)); emit ringtoneChanged(ringtonePath); } @@ -517,6 +515,17 @@ void SettingsModel::setAutoDownloadReceivedFiles(bool status) { emit autoDownloadReceivedFilesChanged(status); } +bool SettingsModel::getDisplayNotificationContent() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + return !!mConfig->getInt(UiSection, "display_notification_content", 1); +} + +void SettingsModel::setDisplayNotificationContent(bool display) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + mConfig->setInt(UiSection, "display_notification_content", display); + emit displayNotificationContentChanged(display); +} + bool SettingsModel::getEchoCancellationEnabled() const { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); return CoreModel::getInstance()->getCore()->echoCancellationEnabled(); diff --git a/Linphone/model/setting/SettingsModel.hpp b/Linphone/model/setting/SettingsModel.hpp index 3329a70b5..9b5adb6fa 100644 --- a/Linphone/model/setting/SettingsModel.hpp +++ b/Linphone/model/setting/SettingsModel.hpp @@ -66,6 +66,9 @@ public: void setAutoDownloadReceivedFiles(bool enabled); bool getAutoDownloadReceivedFiles() const; + void setDisplayNotificationContent(bool display); + bool getDisplayNotificationContent() const; + // Audio. -------------------------------------------------------------------- bool getIsInCall() const; @@ -287,6 +290,7 @@ signals: // Messages. -------------------------------------------------------------------- void autoDownloadReceivedFilesChanged(bool enabled); + void displayNotificationContentChanged(bool display); private: void notifyConfigReady(); diff --git a/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml index f1b8142cd..7c841f31f 100644 --- a/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/ChatSettingsLayout.qml @@ -15,6 +15,13 @@ AbstractSettingsLayout { subTitle: "", contentComponent: attachedFilesParamComp, // hideTopMargin: true + }, + { + //: Notifications + title: qsTr("settings_chat_notifications_title"), + subTitle: "", + contentComponent: displayNotifParamComp, + // hideTopMargin: true } ] @@ -28,6 +35,24 @@ AbstractSettingsLayout { propertyName: "autoDownloadReceivedFiles" propertyOwner: SettingsCpp + Connections { + target: mainItem + function onSave() { + SettingsCpp.save() + } + } + } + } + Component { + id: displayNotifParamComp + SwitchSetting { + //: "Display notification content" + titleText: qsTr("settings_chat_display_notification_content_title") + //: "Display the content of the received message" + subTitleText: qsTr("settings_chat_display_notification_content_subtitle") + propertyName: "displayNotificationContent" + propertyOwner: SettingsCpp + Connections { target: mainItem function onSave() {