From 4e8ded737c026c88eee0de41542497cd02a231c0 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 14 Jan 2026 10:02:24 +0100 Subject: [PATCH] Do not add voice recordings to shared medias (try to fix #LINQT-2308) --- .../core/chat/files/ChatMessageFileList.cpp | 2 ++ Linphone/data/languages/de.ts | 26 ++++++++--------- Linphone/data/languages/en.ts | 28 +++++++++---------- Linphone/data/languages/fr.ts | 28 +++++++++---------- .../content/ChatMessageContentModel.cpp | 5 +++- .../view/Control/Display/Chat/FileView.qml | 2 +- .../view/Page/Form/Chat/SelectedChatView.qml | 1 + .../Layout/Chat/MessageSharedFilesInfos.qml | 3 +- 8 files changed, 51 insertions(+), 44 deletions(-) diff --git a/Linphone/core/chat/files/ChatMessageFileList.cpp b/Linphone/core/chat/files/ChatMessageFileList.cpp index ea311c0f..4f7f4da7 100644 --- a/Linphone/core/chat/files/ChatMessageFileList.cpp +++ b/Linphone/core/chat/files/ChatMessageFileList.cpp @@ -77,10 +77,12 @@ void ChatMessageFileList::setSelf(QSharedPointer me) { docs = chatModel->getSharedDocuments(); } for (auto it : medias) { + if (it->isVoiceRecording()) continue; auto model = ChatMessageContentCore::create(it, nullptr); contents->push_back(model); } for (auto it : docs) { + if (it->isVoiceRecording()) continue; auto model = ChatMessageContentCore::create(it, nullptr); contents->push_back(model); } diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 467a7379..719868d0 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -2361,37 +2361,37 @@ Error Fehler - + download_error_object_doesnt_exist - Internal error : message object does not exist anymore ! + Internal error : message object associated to this content does not exist anymore ! Interner Fehler: Nachrichtenobjekt existiert nicht mehr! - + download_file_server_error Error while trying to download content : %1 Fehler beim Versuch, Inhalte herunterzuladen: %1 - + download_file_error_no_safe_file_path Unable to create safe file path for: %1 Speicherpfad konnte nicht erstellen für: %1 - + download_file_error_file_transfer_unavailable This file was already downloaded and is no more on the server. Your peer have to resend it if you want to get it Diese Datei wurde bereits heruntergeladen und ist nicht mehr auf dem Server verfügbar. Ihr Kontakt muss die Datei erneut senden - + download_file_error_null_name Content name is null, can't download it ! Inhaltsname nicht gesetzt, herunterladen fehlgeschlagen! - + download_file_error_unable_to_download Unable to download file of entry %1 Datei des Eintrags %1 konnte nicht heruntergeladen werden @@ -4921,13 +4921,13 @@ Ablauf: %1 MessageSharedFilesInfos - + no_shared_medias No media Keine Medien - + no_shared_documents No document Keine Dokumente @@ -5884,25 +5884,25 @@ Um sie in einem kommerziellen Projekt zu aktivieren, kontaktieren Sie uns bitte. Auf %1 antworten - + shared_medias_title Shared medias Geteilte Medien - + shared_documents_title Shared documents Geteilte Dokumente - + forward_to_title Forward to… Weiterleiten an… - + conversations_title Conversations Chats diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 6a4a9e28..e48292da 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -2319,37 +2319,37 @@ Error ChatMessageContentModel - + download_error_object_doesnt_exist - Internal error : message object does not exist anymore ! - Internal error : message object does not exist anymore ! + Internal error : message object associated to this content does not exist anymore ! + Internal error : message object associated to this content does not exist anymore ! - + download_file_server_error Error while trying to download content : %1 Error while trying to download content : %1 - + download_file_error_no_safe_file_path Unable to create safe file path for: %1 Unable to create safe file path for: %1 - + download_file_error_file_transfer_unavailable This file was already downloaded and is no more on the server. Your peer have to resend it if you want to get it This file was already downloaded and is no more on the server. Your peer have to resend it if you want to get it - + download_file_error_null_name Content name is null, can't download it ! Content name is null, can't download it ! - + download_file_error_unable_to_download Unable to download file of entry %1 Unable to download file of entry %1 @@ -4815,13 +4815,13 @@ Expiration : %1 MessageSharedFilesInfos - + no_shared_medias No media No media - + no_shared_documents No document No document @@ -5761,25 +5761,25 @@ To enable them in a commercial project, please contact us. Reply to %1 - + shared_medias_title Shared medias Shared medias - + shared_documents_title Shared documents Shared documents - + forward_to_title Forward to… Froward to… - + conversations_title Conversations Conversations diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index b3e0ddab..c82c56b0 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -2294,37 +2294,37 @@ Error ChatMessageContentModel - + download_error_object_doesnt_exist - Internal error : message object does not exist anymore ! - Erreur interne : l'objet ChatMessage n'existe plus ! + Internal error : message object associated to this content does not exist anymore ! + Erreur interne : le message associé à ce contenu n'existe plus ! - + download_file_server_error Error while trying to download content : %1 Erreur en tentant de télécharger le contenu : %1 - + download_file_error_no_safe_file_path Unable to create safe file path for: %1 Impossible de créer le chemin : %1 - + download_file_error_file_transfer_unavailable This file was already downloaded and is no more on the server. Your peer have to resend it if you want to get it Le fichier a déjà été téléchargé et n'est plus disponible sur le serveur. Votre correspondant devra vous le renvoyez si vous souhaitez l'obtenir - + download_file_error_null_name Content name is null, can't download it ! Le nom du contenu est nul, impossible de le télécharger ! - + download_file_error_unable_to_download Unable to download file of entry %1 Impossible de télécharger le fichier : %1 @@ -4786,13 +4786,13 @@ Expiration : %1 MessageSharedFilesInfos - + no_shared_medias No media Aucun média - + no_shared_documents No document Aucun document @@ -5732,25 +5732,25 @@ Pour les activer dans un projet commercial, merci de nous contacter.Réponse à %1 - + shared_medias_title Shared medias Médias partagés - + shared_documents_title Shared documents Documents partagés - + forward_to_title Forward to… Transférer à… - + conversations_title Conversations Conversations diff --git a/Linphone/model/chat/message/content/ChatMessageContentModel.cpp b/Linphone/model/chat/message/content/ChatMessageContentModel.cpp index 2345c56f..f2d4d1ac 100644 --- a/Linphone/model/chat/message/content/ChatMessageContentModel.cpp +++ b/Linphone/model/chat/message/content/ChatMessageContentModel.cpp @@ -75,8 +75,11 @@ void ChatMessageContentModel::removeDownloadedFile(QString filePath) { } bool ChatMessageContentModel::downloadFile(const QString &name, QString *error) { + const QString filepath = Utils::getSafeFilePath( + QStringLiteral("%1%2").arg(App::getInstance()->getSettings()->getDownloadFolder()).arg(name), nullptr); + qDebug() << "try to download" << filepath; if (!mChatMessageModel) { - //: Internal error : message object does not exist anymore ! + //: Internal error : message object associated to this content does not exist anymore ! if (error) *error = tr("download_error_object_doesnt_exist"); return false; } diff --git a/Linphone/view/Control/Display/Chat/FileView.qml b/Linphone/view/Control/Display/Chat/FileView.qml index 188d1432..adb93090 100644 --- a/Linphone/view/Control/Display/Chat/FileView.qml +++ b/Linphone/view/Control/Display/Chat/FileView.qml @@ -270,7 +270,7 @@ Item { EffectImage { z: parent.z + 1 anchors.centerIn: parent - imageSource: defaultViewStack.imageSource + imageSource: mainItem.imageSource width: Utils.getSizeWithScreenRatio(22) height: width colorizationColor: DefaultStyle.main2_600 diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index c199e84d..73c14fb2 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -632,6 +632,7 @@ FocusScope { id: sharedFilesComponent MessageSharedFilesInfos { chatGui: mainItem.chat + showAsSquare: contentLoader.panelType === SelectedChatView.PanelType.Medias title: contentLoader.panelType === SelectedChatView.PanelType.Medias //: Shared medias ? qsTr("shared_medias_title") diff --git a/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml b/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml index 73d87220..8d4eee4b 100644 --- a/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml +++ b/Linphone/view/Page/Layout/Chat/MessageSharedFilesInfos.qml @@ -10,6 +10,7 @@ MessageInfosLayout { spacing: Utils.getSizeWithScreenRatio(25) property ChatGui chatGui property int filter + property bool showAsSquare: false tabbar.visible: false content: [ @@ -43,7 +44,7 @@ MessageInfosLayout { } delegate: FileView { contentGui: modelData - showAsSquare: false + showAsSquare: mainItem.showAsSquare width: gridView.cellWidth - Utils.getSizeWithScreenRatio(2) height: gridView.cellHeight - Utils.getSizeWithScreenRatio(2) }