diff --git a/CMakeLists.txt b/CMakeLists.txt index 02dd65cf9..a55d10af4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ endif () #------------------------------------------------------------------------------ # Prepare gobal CMAKE configuration specific to the current project - +set(CMAKE_POSITION_INDEPENDENT_CODE ON)#Needed for Qt if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/OUTPUT" CACHE PATH "Default linphone-app installation prefix" FORCE) set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE) diff --git a/Linphone/core/friend/FriendCore.cpp b/Linphone/core/friend/FriendCore.cpp index 44fd39bb9..a6d9a4e89 100644 --- a/Linphone/core/friend/FriendCore.cpp +++ b/Linphone/core/friend/FriendCore.cpp @@ -69,9 +69,10 @@ FriendCore::FriendCore(const std::shared_ptr &contact, bool is // lDebug() << mDefaultAddress << " / " << mDefaultFullAddress; auto phoneNumbers = contact->getPhoneNumbersWithLabel(); for (auto &phoneNumber : phoneNumbers) { + auto label = Utils::coreStringToAppString(phoneNumber->getLabel()); + if (label.isEmpty()) label = _phoneLabel; mPhoneNumberList.append( - Utils::createFriendAddressVariant(Utils::coreStringToAppString(phoneNumber->getLabel()), - Utils::coreStringToAppString(phoneNumber->getPhoneNumber()))); + Utils::createFriendAddressVariant(label, Utils::coreStringToAppString(phoneNumber->getPhoneNumber()))); } auto devices = contact->getDevices(); @@ -429,8 +430,19 @@ void FriendCore::resetAddresses(QList newList) { emit addressChanged(); } +// Display all sip addresses and remove phone numbers duplicates (priority on sip) QList FriendCore::getAllAddresses() const { - return mAddressList + mPhoneNumberList; + QList addresses; + auto addressIt = mAddressList.begin(); + auto phoneNumbers = mPhoneNumberList; + while (addressIt != mAddressList.end()) { + auto username = Utils::getUsername(addressIt->toMap()["address"].toString()); + std::remove_if(phoneNumbers.begin(), phoneNumbers.end(), + [username](const QVariant &data) { return data.toMap()["address"].toString() == username; }); + ++addressIt; + } + addresses << phoneNumbers; + return addresses; } QList FriendCore::getDevices() const { diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index 2323a7607..1d7618e81 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -1412,6 +1412,10 @@ QString Utils::getFileChecksum(const QString &filePath) { return QString(); } +QList Utils::append(const QList a, const QList b) { + return a + b; +} + // Codecs download QList> Utils::getDownloadableVideoPayloadTypes() { diff --git a/Linphone/tool/Utils.hpp b/Linphone/tool/Utils.hpp index df4cd7fea..afd7dd5c7 100644 --- a/Linphone/tool/Utils.hpp +++ b/Linphone/tool/Utils.hpp @@ -135,6 +135,7 @@ public: Q_INVOKABLE bool isInteger(const QString &text); Q_INVOKABLE QString boldTextPart(const QString &text, const QString ®ex); Q_INVOKABLE static QString getFileChecksum(const QString &filePath); + Q_INVOKABLE QList append(const QList a, const QList b); static QString getApplicationProduct(); static QString getOsProduct(); diff --git a/Linphone/view/Page/Main/Contact/ContactPage.qml b/Linphone/view/Page/Main/Contact/ContactPage.qml index 05b426810..c219d55ee 100644 --- a/Linphone/view/Page/Main/Contact/ContactPage.qml +++ b/Linphone/view/Page/Main/Contact/ContactPage.qml @@ -441,7 +441,7 @@ AbstractMainPage { clip: true spacing: 9 * DefaultStyle.dp model: VariantList { - model: mainItem.selectedContact ? mainItem.selectedContact.core.allAddresses : [] + model: (mainItem.selectedContact ? UtilsCpp.append(mainItem.selectedContact.core.addresses, mainItem.selectedContact.core.phoneNumbers): []) } delegate: Item { property var listViewModelData: modelData diff --git a/Linphone/view/Page/Window/AbstractWindow.qml b/Linphone/view/Page/Window/AbstractWindow.qml index 3bc6cfd77..f9ebef099 100644 --- a/Linphone/view/Page/Window/AbstractWindow.qml +++ b/Linphone/view/Page/Window/AbstractWindow.qml @@ -74,7 +74,7 @@ ApplicationWindow { spacing: 5 * DefaultStyle.dp width: startCallPopup.width Text { - text: qsTr("Quelle addresse souhaitez-vous appeler ?") + text: qsTr("Quelle adresse souhaitez-vous appeler ?") wrapMode: Text.Wrap Layout.fillWidth: true font {