fix empty display name
This commit is contained in:
parent
932b83774c
commit
24f51fbf69
11 changed files with 39 additions and 28 deletions
|
|
@ -66,7 +66,7 @@ CallHistoryCore::CallHistoryCore(const std::shared_ptr<linphone::CallLog> &callL
|
||||||
auto inFriend = Utils::findFriendByAddress(mRemoteAddress);
|
auto inFriend = Utils::findFriendByAddress(mRemoteAddress);
|
||||||
if (inFriend) {
|
if (inFriend) {
|
||||||
auto friendGui = inFriend->getValue().value<FriendGui *>();
|
auto friendGui = inFriend->getValue().value<FriendGui *>();
|
||||||
if (friendGui) mDisplayName = friendGui->getCore()->getDisplayName();
|
if (friendGui) mDisplayName = friendGui->getCore()->getFullName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +89,7 @@ void CallHistoryCore::setSelf(QSharedPointer<CallHistoryCore> me) {
|
||||||
QString displayName;
|
QString displayName;
|
||||||
if (inFriend) {
|
if (inFriend) {
|
||||||
auto friendGui = inFriend->getValue().value<FriendGui *>();
|
auto friendGui = inFriend->getValue().value<FriendGui *>();
|
||||||
if (friendGui) displayName = friendGui->getCore()->getDisplayName();
|
if (friendGui) displayName = friendGui->getCore()->getFullName();
|
||||||
}
|
}
|
||||||
if (!displayName.isEmpty()) {
|
if (!displayName.isEmpty()) {
|
||||||
mCoreModelConnection->invokeToCore([this, displayName]() {
|
mCoreModelConnection->invokeToCore([this, displayName]() {
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,9 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &contact, bool is
|
||||||
mFullName = Utils::coreStringToAppString(vcard->getFullName());
|
mFullName = Utils::coreStringToAppString(vcard->getFullName());
|
||||||
mVCardString = Utils::coreStringToAppString(vcard->asVcard4String());
|
mVCardString = Utils::coreStringToAppString(vcard->asVcard4String());
|
||||||
}
|
}
|
||||||
if (defaultAddress) {
|
if (mFullName.isEmpty()) mFullName = Utils::coreStringToAppString(contact->getName());
|
||||||
if (mGivenName.isEmpty()) mGivenName = Utils::coreStringToAppString(defaultAddress->getUsername());
|
if (mFullName.isEmpty()) mFullName = Utils::coreStringToAppString(contact->getOrganization());
|
||||||
}
|
|
||||||
auto addresses = contact->getAddresses();
|
auto addresses = contact->getAddresses();
|
||||||
for (auto &address : addresses) {
|
for (auto &address : addresses) {
|
||||||
mAddressList.append(
|
mAddressList.append(
|
||||||
|
|
@ -108,8 +108,12 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &contact, bool is
|
||||||
mIsLdap = ToolModel::friendIsInFriendList(ToolModel::getLdapFriendList(), contact);
|
mIsLdap = ToolModel::friendIsInFriendList(ToolModel::getLdapFriendList(), contact);
|
||||||
connect(this, &FriendCore::addressChanged, &FriendCore::allAddressesChanged);
|
connect(this, &FriendCore::addressChanged, &FriendCore::allAddressesChanged);
|
||||||
connect(this, &FriendCore::phoneNumberChanged, &FriendCore::allAddressesChanged);
|
connect(this, &FriendCore::phoneNumberChanged, &FriendCore::allAddressesChanged);
|
||||||
connect(this, &FriendCore::givenNameChanged, &FriendCore::displayNameChanged);
|
auto updateFullName = [this] {
|
||||||
connect(this, &FriendCore::familyNameChanged, &FriendCore::displayNameChanged);
|
auto name = (mGivenName.isEmpty() ? "" : mGivenName) + (mFamilyName.isEmpty() ? "" : mFamilyName);
|
||||||
|
if (!name.isEmpty()) setFullName(name);
|
||||||
|
};
|
||||||
|
connect(this, &FriendCore::givenNameChanged, updateFullName);
|
||||||
|
connect(this, &FriendCore::familyNameChanged, updateFullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendCore::FriendCore(const FriendCore &friendCore) {
|
FriendCore::FriendCore(const FriendCore &friendCore) {
|
||||||
|
|
@ -248,11 +252,18 @@ void FriendCore::reset(const FriendCore &contact) {
|
||||||
setIsSaved(mFriendModel != nullptr);
|
setIsSaved(mFriendModel != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FriendCore::getDisplayName() const {
|
QString FriendCore::getFullName() const {
|
||||||
if (mFullName.isEmpty()) return mGivenName + " " + mFamilyName;
|
if (mFullName.isEmpty()) return mGivenName + " " + mFamilyName;
|
||||||
else return mFullName;
|
else return mFullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FriendCore::setFullName(const QString &name) {
|
||||||
|
if (mFullName != name) {
|
||||||
|
mFullName = name;
|
||||||
|
emit fullNameChanged(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString FriendCore::getGivenName() const {
|
QString FriendCore::getGivenName() const {
|
||||||
return mGivenName;
|
return mGivenName;
|
||||||
}
|
}
|
||||||
|
|
@ -527,9 +538,8 @@ 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(mFullName.isEmpty()
|
auto name = mGivenName + (mFamilyName.isEmpty() || mGivenName.isEmpty() ? "" : " ") + mFamilyName;
|
||||||
? mGivenName + (mFamilyName.isEmpty() || mGivenName.isEmpty() ? "" : " ") + mFamilyName
|
model->setName(name.isEmpty() ? (mFullName.isEmpty() ? mOrganization : mFullName) : name);
|
||||||
: mFullName);
|
|
||||||
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;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class FriendCore : public QObject, public AbstractObject {
|
||||||
Q_PROPERTY(int verifiedDeviceCount MEMBER mVerifiedDeviceCount NOTIFY verifiedDevicesChanged)
|
Q_PROPERTY(int verifiedDeviceCount MEMBER mVerifiedDeviceCount NOTIFY verifiedDevicesChanged)
|
||||||
Q_PROPERTY(QString givenName READ getGivenName WRITE setGivenName NOTIFY givenNameChanged)
|
Q_PROPERTY(QString givenName READ getGivenName WRITE setGivenName NOTIFY givenNameChanged)
|
||||||
Q_PROPERTY(QString familyName READ getFamilyName WRITE setFamilyName NOTIFY familyNameChanged)
|
Q_PROPERTY(QString familyName READ getFamilyName WRITE setFamilyName NOTIFY familyNameChanged)
|
||||||
Q_PROPERTY(QString displayName READ getDisplayName NOTIFY displayNameChanged)
|
Q_PROPERTY(QString fullName READ getFullName NOTIFY fullNameChanged)
|
||||||
Q_PROPERTY(QString organization READ getOrganization WRITE setOrganization NOTIFY organizationChanged)
|
Q_PROPERTY(QString organization READ getOrganization WRITE setOrganization NOTIFY organizationChanged)
|
||||||
Q_PROPERTY(QString job READ getJob WRITE setJob NOTIFY jobChanged)
|
Q_PROPERTY(QString job READ getJob WRITE setJob NOTIFY jobChanged)
|
||||||
Q_PROPERTY(QString defaultAddress READ getDefaultAddress WRITE setDefaultAddress NOTIFY defaultAddressChanged)
|
Q_PROPERTY(QString defaultAddress READ getDefaultAddress WRITE setDefaultAddress NOTIFY defaultAddressChanged)
|
||||||
|
|
@ -81,7 +81,8 @@ public:
|
||||||
void setSelf(SafeSharedPointer<FriendCore> me);
|
void setSelf(SafeSharedPointer<FriendCore> me);
|
||||||
void reset(const FriendCore &contact);
|
void reset(const FriendCore &contact);
|
||||||
|
|
||||||
QString getDisplayName() const;
|
QString getFullName() const;
|
||||||
|
void setFullName(const QString &name);
|
||||||
|
|
||||||
QString getFamilyName() const;
|
QString getFamilyName() const;
|
||||||
void setFamilyName(const QString &name);
|
void setFamilyName(const QString &name);
|
||||||
|
|
@ -154,8 +155,9 @@ protected:
|
||||||
signals:
|
signals:
|
||||||
void contactUpdated();
|
void contactUpdated();
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
void givenNameChanged(const QString &name);
|
void givenNameChanged(QString name);
|
||||||
void familyNameChanged(const QString &name);
|
void familyNameChanged(QString name);
|
||||||
|
void fullNameChanged(QString name);
|
||||||
void starredChanged();
|
void starredChanged();
|
||||||
void phoneNumberChanged();
|
void phoneNumberChanged();
|
||||||
void addressChanged();
|
void addressChanged();
|
||||||
|
|
|
||||||
|
|
@ -215,8 +215,8 @@ bool MagicSearchProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, c
|
||||||
bool rIsStored = r->getIsStored();
|
bool rIsStored = r->getIsStored();
|
||||||
if (lIsStored && !rIsStored) return true;
|
if (lIsStored && !rIsStored) return true;
|
||||||
else if (!lIsStored && rIsStored) return false;
|
else if (!lIsStored && rIsStored) return false;
|
||||||
auto lName = l->getDisplayName().toLower();
|
auto lName = l->getFullName().toLower();
|
||||||
auto rName = r->getDisplayName().toLower();
|
auto rName = r->getFullName().toLower();
|
||||||
return lName < rName;
|
return lName < rName;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ QString ToolModel::getDisplayName(const std::shared_ptr<const linphone::Address>
|
||||||
if (address) {
|
if (address) {
|
||||||
auto linFriend = CoreModel::getInstance()->getCore()->findFriend(address);
|
auto linFriend = CoreModel::getInstance()->getCore()->findFriend(address);
|
||||||
if (linFriend) {
|
if (linFriend) {
|
||||||
if (auto vcard = linFriend->getVcard()) displayName = Utils::coreStringToAppString(vcard->getFullName());
|
|
||||||
if (displayName.isEmpty()) displayName = Utils::coreStringToAppString(linFriend->getName());
|
if (displayName.isEmpty()) displayName = Utils::coreStringToAppString(linFriend->getName());
|
||||||
}
|
}
|
||||||
if (displayName.isEmpty()) {
|
if (displayName.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ ColumnLayout {
|
||||||
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.displayName
|
? contact.core.fullName
|
||||||
: conferenceInfo
|
: conferenceInfo
|
||||||
? conferenceInfo.core.subject
|
? conferenceInfo.core.subject
|
||||||
: computedContactName
|
: computedContactName
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ Loader{
|
||||||
property var displayNameObj: UtilsCpp.getDisplayName(_address)
|
property var displayNameObj: UtilsCpp.getDisplayName(_address)
|
||||||
property string displayNameVal: account && account.core.displayName
|
property string displayNameVal: account && account.core.displayName
|
||||||
? account.core.displayName
|
? account.core.displayName
|
||||||
: contact && contact.core.displayName
|
: contact && contact.core.fullName
|
||||||
? contact.core.displayName
|
? contact.core.fullName
|
||||||
: displayNameObj
|
: displayNameObj
|
||||||
? displayNameObj.value
|
? displayNameObj.value
|
||||||
: ""
|
: ""
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ FocusScope {
|
||||||
property var previousInitial // Use directly previous initial
|
property var previousInitial // Use directly previous initial
|
||||||
property int itemsRightMargin: 39 * DefaultStyle.dp
|
property int itemsRightMargin: 39 * DefaultStyle.dp
|
||||||
|
|
||||||
property var displayName: searchResultItem.core.displayName
|
property var displayName: searchResultItem.core.fullName
|
||||||
property string initial: displayName ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : ''
|
property string initial: displayName ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : ''
|
||||||
|
|
||||||
signal clicked(var mouse)
|
signal clicked(var mouse)
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,11 @@ AbstractMainPage {
|
||||||
if (!contact) return
|
if (!contact) return
|
||||||
var mainWin = UtilsCpp.getMainWindow()
|
var mainWin = UtilsCpp.getMainWindow()
|
||||||
mainWin.showConfirmationLambdaPopup("",
|
mainWin.showConfirmationLambdaPopup("",
|
||||||
qsTr("%1 sera supprimé des contacts. Voulez-vous continuer ?").arg(contact.core.displayName),
|
qsTr("%1 sera supprimé des contacts. Voulez-vous continuer ?").arg(contact.core.fullName),
|
||||||
"",
|
"",
|
||||||
function (confirmed) {
|
function (confirmed) {
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
var name = contact.core.displayName
|
var name = contact.core.fullName
|
||||||
contact.core.remove()
|
contact.core.remove()
|
||||||
UtilsCpp.showInformationPopup(qsTr("Supprimé"), qsTr("%1 a été supprimé").arg(name)) }
|
UtilsCpp.showInformationPopup(qsTr("Supprimé"), qsTr("%1 a été supprimé").arg(name)) }
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +339,7 @@ AbstractMainPage {
|
||||||
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.displayName
|
? contact.core.fullName
|
||||||
: computedContactName
|
: computedContactName
|
||||||
component LabelButton: ColumnLayout {
|
component LabelButton: ColumnLayout {
|
||||||
id: labelButton
|
id: labelButton
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ ApplicationWindow {
|
||||||
if (parentItem == undefined) parentItem = mainWindow.contentItem
|
if (parentItem == undefined) parentItem = mainWindow.contentItem
|
||||||
startCallPopup.parent = parentItem
|
startCallPopup.parent = parentItem
|
||||||
if (contact) {
|
if (contact) {
|
||||||
console.log("START CALL WITH", contact.core.displayName, "addresses count", contact.core.allAddresses.length)
|
console.log("START CALL WITH", contact.core.fullName, "addresses count", contact.core.allAddresses.length)
|
||||||
if (contact.core.allAddresses.length > 1) {
|
if (contact.core.allAddresses.length > 1) {
|
||||||
startCallPopup.contact = contact
|
startCallPopup.contact = contact
|
||||||
startCallPopup.videoEnabled = videoEnabled
|
startCallPopup.videoEnabled = videoEnabled
|
||||||
|
|
@ -171,7 +171,7 @@ ApplicationWindow {
|
||||||
if (parentItem == undefined) parentItem = mainWindow.contentItem
|
if (parentItem == undefined) parentItem = mainWindow.contentItem
|
||||||
startCallPopup.parent = parentItem
|
startCallPopup.parent = parentItem
|
||||||
if (contact) {
|
if (contact) {
|
||||||
console.log("[AbstractWindow] Transfer call to", contact.core.displayName, "addresses count", contact.core.allAddresses.length, call)
|
console.log("[AbstractWindow] Transfer call to", contact.core.fullName, "addresses count", contact.core.allAddresses.length, call)
|
||||||
if (contact.core.allAddresses.length > 1) {
|
if (contact.core.allAddresses.length > 1) {
|
||||||
startCallPopup.contact = contact
|
startCallPopup.contact = contact
|
||||||
startCallPopup.currentCall = call
|
startCallPopup.currentCall = call
|
||||||
|
|
|
||||||
|
|
@ -572,7 +572,7 @@ AbstractWindow {
|
||||||
var callsWin = UtilsCpp.getCallsWindow()
|
var callsWin = UtilsCpp.getCallsWindow()
|
||||||
if (contact) callsWin.showConfirmationLambdaPopup(
|
if (contact) callsWin.showConfirmationLambdaPopup(
|
||||||
qsTr("Confirmer le transfert ?"),
|
qsTr("Confirmer le transfert ?"),
|
||||||
qsTr("Vous allez transférer %1 à %2.").arg(mainWindow.call.core.remoteName).arg(contact.core.displayName),
|
qsTr("Vous allez transférer %1 à %2.").arg(mainWindow.call.core.remoteName).arg(contact.core.fullName),
|
||||||
"",
|
"",
|
||||||
function (confirmed) {
|
function (confirmed) {
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue