fix display name in call notification and call history

This commit is contained in:
Gaelle Braud 2025-02-12 14:37:40 +01:00
parent 2494600efe
commit b4307dd464
8 changed files with 17 additions and 19 deletions

View file

@ -52,7 +52,7 @@ AccountCore::AccountCore(const std::shared_ptr<linphone::Account> &account) : QO
mUnreadNotifications = account->getMissedCallsCount(); mUnreadNotifications = account->getMissedCallsCount();
mDisplayName = Utils::coreStringToAppString(identityAddress->getDisplayName()); mDisplayName = Utils::coreStringToAppString(identityAddress->getDisplayName());
if (mDisplayName.isEmpty()) { if (mDisplayName.isEmpty()) {
mDisplayName = ToolModel::getDisplayName(mIdentityAddress); mDisplayName = ToolModel::getDisplayName(identityAddress);
identityAddress->setDisplayName(Utils::appStringToCoreString(mDisplayName)); identityAddress->setDisplayName(Utils::appStringToCoreString(mDisplayName));
params->setIdentityAddress(identityAddress); params->setIdentityAddress(identityAddress);
account->setParams(params); account->setParams(params);

View file

@ -48,7 +48,6 @@ CallHistoryCore::CallHistoryCore(const std::shared_ptr<linphone::CallLog> &callL
auto addr = callLog->getRemoteAddress()->clone(); auto addr = callLog->getRemoteAddress()->clone();
addr->clean(); addr->clean();
// mRemoteAddress->clean();
mStatus = LinphoneEnums::fromLinphone(callLog->getStatus()); mStatus = LinphoneEnums::fromLinphone(callLog->getStatus());
mDate = QDateTime::fromMSecsSinceEpoch(callLog->getStartDate() * 1000); mDate = QDateTime::fromMSecsSinceEpoch(callLog->getStartDate() * 1000);
mIsOutgoing = callLog->getDir() == linphone::Call::Dir::Outgoing; mIsOutgoing = callLog->getDir() == linphone::Call::Dir::Outgoing;
@ -66,7 +65,9 @@ CallHistoryCore::CallHistoryCore(const std::shared_ptr<linphone::CallLog> &callL
if (linphoneFriend) { if (linphoneFriend) {
mFriendModel = Utils::makeQObject_ptr<FriendModel>(linphoneFriend); mFriendModel = Utils::makeQObject_ptr<FriendModel>(linphoneFriend);
mDisplayName = mFriendModel->getFullName(); mDisplayName = mFriendModel->getFullName();
} else mDisplayName = ToolModel::getDisplayName(Utils::coreStringToAppString(addr->asStringUriOnly())); } else {
mDisplayName = ToolModel::getDisplayName(addr);
}
} }
} }
@ -165,7 +166,7 @@ void CallHistoryCore::onRemoved(const std::shared_ptr<linphone::Friend> &updated
if (isThisFriend) { if (isThisFriend) {
mFriendModel = nullptr; mFriendModel = nullptr;
mFriendModelConnection = nullptr; mFriendModelConnection = nullptr;
mDisplayName = ToolModel::getDisplayName(mRemoteAddress); mDisplayName = ToolModel::getDisplayName(fAddress);
emit displayNameChanged(); emit displayNameChanged();
emit friendUpdated(); emit friendUpdated();
} }

View file

@ -125,7 +125,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
if (linphoneFriend) if (linphoneFriend)
mRemoteName = Utils::coreStringToAppString( mRemoteName = Utils::coreStringToAppString(
linphoneFriend->getVcard() ? linphoneFriend->getVcard()->getFullName() : linphoneFriend->getName()); linphoneFriend->getVcard() ? linphoneFriend->getVcard()->getFullName() : linphoneFriend->getName());
if (mRemoteName.isEmpty()) mRemoteName = ToolModel::getDisplayName(mRemoteAddress); if (mRemoteName.isEmpty()) mRemoteName = ToolModel::getDisplayName(remoteAddress);
mShouldFindRemoteFriend = !linphoneFriend; mShouldFindRemoteFriend = !linphoneFriend;
if (mShouldFindRemoteFriend) { if (mShouldFindRemoteFriend) {
mShouldFindRemoteFriend = CoreModel::getInstance()->getCore()->getRemoteContactDirectories().size() > 0; mShouldFindRemoteFriend = CoreModel::getInstance()->getCore()->getRemoteContactDirectories().size() > 0;

View file

@ -51,7 +51,7 @@ ParticipantDeviceCore::ParticipantDeviceCore(const std::shared_ptr<linphone::Par
// Use the participant name instead // Use the participant name instead
mDisplayName = Utils::coreStringToAppString(device->getParticipant()->getAddress()->getDisplayName()); mDisplayName = Utils::coreStringToAppString(device->getParticipant()->getAddress()->getDisplayName());
if (mDisplayName.isEmpty()) { if (mDisplayName.isEmpty()) {
mDisplayName = ToolModel::getDisplayName(mAddress); mDisplayName = ToolModel::getDisplayName(deviceAddress);
} }
mIsMuted = device->getIsMuted(); mIsMuted = device->getIsMuted();
mIsSpeaking = device->getIsSpeaking(); mIsSpeaking = device->getIsSpeaking();

View file

@ -106,7 +106,7 @@ QString ConferenceInfoModel::getOrganizerName() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto organizer = mConferenceInfo->getOrganizer(); auto organizer = mConferenceInfo->getOrganizer();
auto name = Utils::coreStringToAppString(organizer->getDisplayName()); auto name = Utils::coreStringToAppString(organizer->getDisplayName());
if (name.isEmpty()) name = ToolModel::getDisplayName(Utils::coreStringToAppString(organizer->asStringUriOnly())); if (name.isEmpty()) name = ToolModel::getDisplayName(organizer);
return name; return name;
} }

View file

@ -11,16 +11,18 @@ ColumnLayout {
id: mainItem id: mainItem
spacing: 30 * DefaultStyle.dp spacing: 30 * DefaultStyle.dp
property var callHistoryGui
property FriendGui contact property FriendGui contact
property ConferenceInfoGui conferenceInfo property var conferenceInfo: callHistoryGui?.core.conferenceInfo
property bool isConference: conferenceInfo != undefined && conferenceInfo != null property bool isConference: conferenceInfo != undefined && conferenceInfo != null
property string contactAddress: specificAddress != "" ? specificAddress : contact && contact.core.defaultAddress || "" property string contactAddress: specificAddress != "" ? specificAddress : contact && contact.core.defaultAddress || ""
property var computedContactNameObj: UtilsCpp.getDisplayName(contactAddress) property var computedContactNameObj: UtilsCpp.getDisplayName(contactAddress)
property string computedContactName: computedContactNameObj ? computedContactNameObj.value: "" property string computedContactName: computedContactNameObj ? computedContactNameObj.value: ""
property string contactName: contact property string contactName: contact
? contact.core.fullName ? contact.core.fullName
: conferenceInfo : callHistoryGui
? conferenceInfo.core.subject ? callHistoryGui.core.displayName
: computedContactName : computedContactName
// Set this property to get the security informations // Set this property to get the security informations
@ -72,9 +74,7 @@ ColumnLayout {
height: 100 * DefaultStyle.dp height: 100 * DefaultStyle.dp
contact: mainItem.contact || null contact: mainItem.contact || null
isConference: !!mainItem.conferenceInfo isConference: !!mainItem.conferenceInfo
_address: mainItem.conferenceInfo displayNameVal: mainItem.contactName
? mainItem.conferenceInfo.core.subject
: mainItem.contactAddress || mainItem.contactName
secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified
} }
Item { Item {

View file

@ -115,9 +115,7 @@ ListView {
id: historyAvatar id: historyAvatar
property var contactObj: UtilsCpp.findFriendByAddress(modelData.core.remoteAddress) property var contactObj: UtilsCpp.findFriendByAddress(modelData.core.remoteAddress)
contact: contactObj?.value || null contact: contactObj?.value || null
_address: modelData.core.conferenceInfo displayNameVal: modelData.core.displayName
? modelData.core.conferenceInfo.core.subject
: modelData.core.remoteAddress
secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified
width: 45 * DefaultStyle.dp width: 45 * DefaultStyle.dp
height: 45 * DefaultStyle.dp height: 45 * DefaultStyle.dp

View file

@ -444,7 +444,6 @@ AbstractMainPage {
Component { Component {
id: contactDetailComp id: contactDetailComp
FocusScope{ FocusScope{
objectName: "contactDetailComp"
width: parent?.width width: parent?.width
height: parent?.height height: parent?.height
CallHistoryLayout { CallHistoryLayout {
@ -453,12 +452,12 @@ AbstractMainPage {
anchors.topMargin: 45 * DefaultStyle.dp anchors.topMargin: 45 * DefaultStyle.dp
anchors.bottomMargin: 45 * DefaultStyle.dp anchors.bottomMargin: 45 * DefaultStyle.dp
visible: mainItem.selectedRowHistoryGui != undefined visible: mainItem.selectedRowHistoryGui != undefined
callHistoryGui: selectedRowHistoryGui
property var contactObj: UtilsCpp.findFriendByAddress(specificAddress) property var contactObj: UtilsCpp.findFriendByAddress(specificAddress)
contact: contactObj && contactObj.value || null contact: contactObj && contactObj.value || null
conferenceInfo: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.conferenceInfo || null specificAddress: callHistoryGui && callHistoryGui.core.remoteAddress || ""
specificAddress: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress || ""
buttonContent: PopupButton { buttonContent: PopupButton {
id: detailOptions id: detailOptions