From 0225b8fa5087fcd80304024dcc8cfb48136faee3 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 14 Jun 2022 15:51:22 +0200 Subject: [PATCH] Change priority on display name display based on caller address (instead of call logs) --- CHANGELOG.md | 10 ++++++++ .../src/components/call/CallModel.cpp | 2 +- linphone-app/src/utils/Utils.cpp | 25 +++++++++++-------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4180f994..60f8efd74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Video conference. +- Log viewer. +- Option to set the display name in "using an account" tab of assistant. +- Long pressed buttons. +- Phone dialpad on main window. ### Fixed - Crash on exit. - Memory stability. +## 4.4.6 - 2022-06-14 + +###Fixed +- Crash when using no account. +- Show display name of the caller if it exists instead of call logs. + ## 4.4.5 - 2022-06-06 ### Fixed diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index a76121298..0aba6e5c5 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -718,7 +718,7 @@ void CallModel::searchReceived(std::list }else{ if((*it)->getAddress()->weakEqual(mRemoteAddress)){ std::string newDisplayName = (*it)->getAddress()->getDisplayName(); - if(!newDisplayName.empty())// Override only if there is one + if( ((*it)->getSourceFlags() & (int) linphone::MagicSearchSource::CallLogs) == 0 || newDisplayName.empty()) setRemoteDisplayName(newDisplayName); found = true; } diff --git a/linphone-app/src/utils/Utils.cpp b/linphone-app/src/utils/Utils.cpp index da7a38d3a..1b20af7c4 100644 --- a/linphone-app/src/utils/Utils.cpp +++ b/linphone-app/src/utils/Utils.cpp @@ -495,16 +495,21 @@ QString Utils::getDisplayName(const std::shared_ptr& ad if(model && model->getVcardModel()) displayName = model->getVcardModel()->getUsername(); else{ - auto callHistory = CoreManager::getInstance()->getCore()->getCallLogs(); - auto callLog = std::find_if(callHistory.begin(), callHistory.end(), [address](std::shared_ptr& cl){ - return cl->getRemoteAddress()->weakEqual(address); - }); - if(callLog != callHistory.end()) - displayName = QString::fromStdString((*callLog)->getRemoteAddress()->getDisplayName()); - if(displayName == "") - displayName = QString::fromStdString(address->getDisplayName()); - if(displayName == "") - displayName = Utils::coreStringToAppString(address->getUsername()); + // Try to get display from full address + displayName = QString::fromStdString(address->getDisplayName()); + if( displayName == ""){ + // Try to get display name from logs + auto callHistory = CoreManager::getInstance()->getCore()->getCallLogs(); + auto callLog = std::find_if(callHistory.begin(), callHistory.end(), [address](std::shared_ptr& cl){ + return cl->getRemoteAddress()->weakEqual(address); + }); + if(callLog != callHistory.end()) + displayName = QString::fromStdString((*callLog)->getRemoteAddress()->getDisplayName()); + if(displayName == "") + displayName = QString::fromStdString(address->getDisplayName()); + if(displayName == "") + displayName = Utils::coreStringToAppString(address->getUsername()); + } } } return displayName;