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();
mDisplayName = Utils::coreStringToAppString(identityAddress->getDisplayName());
if (mDisplayName.isEmpty()) {
mDisplayName = ToolModel::getDisplayName(mIdentityAddress);
mDisplayName = ToolModel::getDisplayName(identityAddress);
identityAddress->setDisplayName(Utils::appStringToCoreString(mDisplayName));
params->setIdentityAddress(identityAddress);
account->setParams(params);

View file

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

View file

@ -125,7 +125,7 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
if (linphoneFriend)
mRemoteName = Utils::coreStringToAppString(
linphoneFriend->getVcard() ? linphoneFriend->getVcard()->getFullName() : linphoneFriend->getName());
if (mRemoteName.isEmpty()) mRemoteName = ToolModel::getDisplayName(mRemoteAddress);
if (mRemoteName.isEmpty()) mRemoteName = ToolModel::getDisplayName(remoteAddress);
mShouldFindRemoteFriend = !linphoneFriend;
if (mShouldFindRemoteFriend) {
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
mDisplayName = Utils::coreStringToAppString(device->getParticipant()->getAddress()->getDisplayName());
if (mDisplayName.isEmpty()) {
mDisplayName = ToolModel::getDisplayName(mAddress);
mDisplayName = ToolModel::getDisplayName(deviceAddress);
}
mIsMuted = device->getIsMuted();
mIsSpeaking = device->getIsSpeaking();

View file

@ -106,7 +106,7 @@ QString ConferenceInfoModel::getOrganizerName() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto organizer = mConferenceInfo->getOrganizer();
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;
}

View file

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

View file

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

View file

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