Support for fullName Vcard entry (ldap search context)

This commit is contained in:
Christophe Deschamps 2024-09-26 14:06:46 +02:00
parent 7b19b79156
commit b4a86b1d01
2 changed files with 8 additions and 3 deletions

View file

@ -67,6 +67,7 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &contact) : QObje
mJob = Utils::coreStringToAppString(vcard->getJobTitle()); mJob = Utils::coreStringToAppString(vcard->getJobTitle());
mGivenName = Utils::coreStringToAppString(vcard->getGivenName()); mGivenName = Utils::coreStringToAppString(vcard->getGivenName());
mFamilyName = Utils::coreStringToAppString(vcard->getFamilyName()); mFamilyName = Utils::coreStringToAppString(vcard->getFamilyName());
mFullName = Utils::coreStringToAppString(vcard->getFullName());
mVCardString = Utils::coreStringToAppString(vcard->asVcard4String()); mVCardString = Utils::coreStringToAppString(vcard->asVcard4String());
} }
auto addresses = contact->getAddresses(); auto addresses = contact->getAddresses();
@ -110,6 +111,7 @@ FriendCore::FriendCore(const FriendCore &friendCore) {
mDefaultAddress = friendCore.mDefaultAddress; mDefaultAddress = friendCore.mDefaultAddress;
mGivenName = friendCore.mGivenName; mGivenName = friendCore.mGivenName;
mFamilyName = friendCore.mFamilyName; mFamilyName = friendCore.mFamilyName;
mFullName = friendCore.mFullName;
mOrganization = friendCore.mOrganization; mOrganization = friendCore.mOrganization;
mJob = friendCore.mJob; mJob = friendCore.mJob;
mPictureUri = friendCore.mPictureUri; mPictureUri = friendCore.mPictureUri;
@ -238,7 +240,7 @@ void FriendCore::reset(const FriendCore &contact) {
} }
QString FriendCore::getDisplayName() const { QString FriendCore::getDisplayName() const {
return mGivenName + " " + mFamilyName; return !mFullName.isEmpty() ? mFullName : mGivenName + " " + mFamilyName;
} }
QString FriendCore::getGivenName() const { QString FriendCore::getGivenName() const {
@ -491,7 +493,9 @@ void FriendCore::writeIntoModel(std::shared_ptr<FriendModel> model) const {
mustBeInLinphoneThread(QString("[") + gClassName + "] " + Q_FUNC_INFO); mustBeInLinphoneThread(QString("[") + gClassName + "] " + Q_FUNC_INFO);
model->getFriend()->edit(); model->getFriend()->edit();
// needed to create the vcard if not created yet // needed to create the vcard if not created yet
model->setName(mGivenName + (mFamilyName.isEmpty() || mGivenName.isEmpty() ? "" : " ") + mFamilyName); model->setName(!mFullName.isEmpty()
? mFullName
: mGivenName + (mFamilyName.isEmpty() || mGivenName.isEmpty() ? "" : " ") + mFamilyName);
auto core = CoreModel::getInstance()->getCore(); auto core = CoreModel::getInstance()->getCore();
std::list<std::shared_ptr<linphone::Address>> addresses; std::list<std::shared_ptr<linphone::Address>> addresses;
@ -618,7 +622,7 @@ void FriendCore::save() { // Save Values to model
(core->getDefaultFriendList()->addFriend(contact) == linphone::FriendList::Status::OK); (core->getDefaultFriendList()->addFriend(contact) == linphone::FriendList::Status::OK);
if (created) { if (created) {
core->getDefaultFriendList()->updateSubscriptions(); core->getDefaultFriendList()->updateSubscriptions();
emit CoreModel::getInstance()->friendCreated(contact); emit CoreModel::getInstance() -> friendCreated(contact);
} }
mCoreModelConnection->invokeToCore([this, created]() { mCoreModelConnection->invokeToCore([this, created]() {
if (created) setSelf(mCoreModelConnection->mCore); if (created) setSelf(mCoreModelConnection->mCore);

View file

@ -172,6 +172,7 @@ protected:
QDateTime mPresenceTimestamp; QDateTime mPresenceTimestamp;
QString mGivenName; QString mGivenName;
QString mFamilyName; QString mFamilyName;
QString mFullName;
QString mOrganization; QString mOrganization;
QString mJob; QString mJob;
bool mStarred; bool mStarred;