LINQT-1531: Fix call history display names.
This commit is contained in:
parent
fb29ddb4c4
commit
cfe3c49a68
3 changed files with 36 additions and 18 deletions
|
|
@ -99,25 +99,35 @@ void CallHistoryCore::setSelf(QSharedPointer<CallHistoryCore> me) {
|
|||
[this, remoteAddress = mRemoteAddress](const std::shared_ptr<linphone::Friend> &f) {
|
||||
auto friendModel = Utils::makeQObject_ptr<FriendModel>(f);
|
||||
auto displayName = friendModel->getFullName();
|
||||
mCoreModelConnection->invokeToCore([this, friendModel, displayName]() {
|
||||
mFriendModel = friendModel;
|
||||
auto me = mCoreModelConnection->mCore.mQData; // Locked from previous call.
|
||||
mFriendModelConnection = QSharedPointer<SafeConnection<CallHistoryCore, FriendModel>>(
|
||||
new SafeConnection<CallHistoryCore, FriendModel>(me, mFriendModel), &QObject::deleteLater);
|
||||
mFriendModelConnection->makeConnectToModel(&FriendModel::fullNameChanged, [this]() {
|
||||
auto fullName = mFriendModel->getFullName();
|
||||
mCoreModelConnection->invokeToCore([this, fullName]() {
|
||||
if (fullName != mDisplayName) {
|
||||
mDisplayName = fullName;
|
||||
emit displayNameChanged();
|
||||
}
|
||||
});
|
||||
});
|
||||
if (displayName != mDisplayName) {
|
||||
mDisplayName = displayName;
|
||||
emit displayNameChanged();
|
||||
auto fAddress = ToolModel::interpretUrl(remoteAddress);
|
||||
bool isThisFriend = false;
|
||||
for (auto f : friendModel->getAddresses()) {
|
||||
if (f->weakEqual(fAddress)) {
|
||||
isThisFriend = true;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isThisFriend)
|
||||
mCoreModelConnection->invokeToCore([this, friendModel, displayName]() {
|
||||
mFriendModel = friendModel;
|
||||
auto me = mCoreModelConnection->mCore.mQData; // Locked from previous call.
|
||||
mFriendModelConnection = QSharedPointer<SafeConnection<CallHistoryCore, FriendModel>>(
|
||||
new SafeConnection<CallHistoryCore, FriendModel>(me, mFriendModel), &QObject::deleteLater);
|
||||
mFriendModelConnection->makeConnectToModel(&FriendModel::fullNameChanged, [this]() {
|
||||
auto fullName = mFriendModel->getFullName();
|
||||
mCoreModelConnection->invokeToCore([this, fullName]() {
|
||||
if (fullName != mDisplayName) {
|
||||
mDisplayName = fullName;
|
||||
emit displayNameChanged();
|
||||
}
|
||||
});
|
||||
});
|
||||
if (displayName != mDisplayName) {
|
||||
mDisplayName = displayName;
|
||||
emit displayNameChanged();
|
||||
}
|
||||
emit friendAdded();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public:
|
|||
signals:
|
||||
void durationChanged(QString duration);
|
||||
void displayNameChanged();
|
||||
void friendAdded(); // When a friend is created, this log is linked to it.
|
||||
void removed();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -310,6 +310,13 @@ AbstractMainPage {
|
|||
anchors.topMargin: 5 * DefaultStyle.dp
|
||||
anchors.bottomMargin: 5 * DefaultStyle.dp
|
||||
visible: !!modelData
|
||||
Connections{
|
||||
target: modelData?.core
|
||||
// Update contact with the new friend.
|
||||
function onFriendAdded(){
|
||||
historyAvatar.contactObj = UtilsCpp.findFriendByAddress(modelData.core.remoteAddress)
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
z: 1
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
Loading…
Reference in a new issue