Fix missing phone labels.

Fix transferring menu with same items (same address and phone number).
Fix build compilation.
Add a QList operator for QML.
Fix typo.
This commit is contained in:
Julien Wadel 2025-02-05 15:02:39 +01:00
parent 1be5ae2bad
commit 2494600efe
6 changed files with 23 additions and 6 deletions

View file

@ -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)

View file

@ -69,9 +69,10 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &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<QVariant> newList) {
emit addressChanged();
}
// Display all sip addresses and remove phone numbers duplicates (priority on sip)
QList<QVariant> FriendCore::getAllAddresses() const {
return mAddressList + mPhoneNumberList;
QList<QVariant> 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<QVariant> FriendCore::getDevices() const {

View file

@ -1412,6 +1412,10 @@ QString Utils::getFileChecksum(const QString &filePath) {
return QString();
}
QList<QVariant> Utils::append(const QList<QVariant> a, const QList<QVariant> b) {
return a + b;
}
// Codecs download
QList<QSharedPointer<DownloadablePayloadTypeCore>> Utils::getDownloadableVideoPayloadTypes() {

View file

@ -135,6 +135,7 @@ public:
Q_INVOKABLE bool isInteger(const QString &text);
Q_INVOKABLE QString boldTextPart(const QString &text, const QString &regex);
Q_INVOKABLE static QString getFileChecksum(const QString &filePath);
Q_INVOKABLE QList<QVariant> append(const QList<QVariant> a, const QList<QVariant> b);
static QString getApplicationProduct();
static QString getOsProduct();

View file

@ -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

View file

@ -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 {