mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
fix magic search : call address found from research if friend with more than one address
This commit is contained in:
parent
ea1dd96006
commit
8463c3e5f9
4 changed files with 18 additions and 10 deletions
|
|
@ -406,6 +406,7 @@ void FriendCore::removeAddress(int index) {
|
|||
if (index < 0 && index >= mAddressList.size()) return;
|
||||
auto map = mAddressList[index].toMap();
|
||||
if (map["address"].toString() == mDefaultFullAddress) mDefaultFullAddress.clear();
|
||||
if (map["address"].toString() == mDefaultAddress) mDefaultAddress.clear();
|
||||
mAddressList.remove(index);
|
||||
emit addressChanged();
|
||||
setIsSaved(false);
|
||||
|
|
|
|||
|
|
@ -1438,6 +1438,15 @@ QList<QVariant> Utils::append(const QList<QVariant> a, const QList<QVariant> b)
|
|||
return a + b;
|
||||
}
|
||||
|
||||
QString Utils::getAddressToDisplay(QVariantList addressList, QString filter, QString defaultAddress) {
|
||||
if (filter.isEmpty()) return defaultAddress;
|
||||
for (auto& item: addressList) {
|
||||
QString address = item.toMap()["address"].toString();
|
||||
if (address.contains(filter)) return address;
|
||||
}
|
||||
return defaultAddress;
|
||||
}
|
||||
|
||||
// Codecs download
|
||||
|
||||
QList<QSharedPointer<DownloadablePayloadTypeCore>> Utils::getDownloadableVideoPayloadTypes() {
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ public:
|
|||
Q_INVOKABLE QString boldTextPart(const QString &text, const QString ®ex);
|
||||
Q_INVOKABLE static QString getFileChecksum(const QString &filePath);
|
||||
Q_INVOKABLE QList<QVariant> append(const QList<QVariant> a, const QList<QVariant> b);
|
||||
Q_INVOKABLE QString getAddressToDisplay(QVariantList addressList, QString filter, QString defaultAddress);
|
||||
|
||||
// QDir findDirectoryByName(QString startPath, QString name);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ FocusScope {
|
|||
property bool showActions: false // Display actions layout (call buttons)
|
||||
property bool showContactMenu: true // Display the dot menu for contacts.
|
||||
property string highlightText
|
||||
property string addressFromFilter: UtilsCpp.getAddressToDisplay(searchResultItem.core.addresses, highlightText, searchResultItem.core.defaultAddress)
|
||||
|
||||
// Bold characters in Display name.
|
||||
property bool displayNameCapitalization: true // Capitalize display name.
|
||||
|
|
@ -90,7 +91,9 @@ FocusScope {
|
|||
Layout.topMargin: Math.round(2 * DefaultStyle.dp)
|
||||
Layout.fillWidth: true
|
||||
visible: mainItem.showDefaultAddress
|
||||
property string address: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(searchResultItem.core.defaultAddress) : searchResultItem.core.defaultAddress
|
||||
property string address: SettingsCpp.onlyDisplaySipUriUsername
|
||||
? UtilsCpp.getUsername(mainItem.addressFromFilter)
|
||||
: mainItem.addressFromFilter
|
||||
text: UtilsCpp.boldTextPart(address, mainItem.highlightText)
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
|
|
@ -113,8 +116,7 @@ FocusScope {
|
|||
EffectImage {
|
||||
id: isSelectedCheck
|
||||
visible: mainItem.multiSelectionEnabled
|
||||
&& (mainItem.selectedContacts.indexOf(
|
||||
searchResultItem.core.defaultAddress) != -1)
|
||||
&& (mainItem.selectedContacts.indexOf(mainItem.addressFromFilter) != -1)
|
||||
Layout.preferredWidth: Math.round(24 * DefaultStyle.dp)
|
||||
Layout.preferredHeight: Math.round(24 * DefaultStyle.dp)
|
||||
imageSource: AppIcons.check
|
||||
|
|
@ -134,8 +136,7 @@ FocusScope {
|
|||
focus: visible
|
||||
radius: Math.round(40 * DefaultStyle.dp)
|
||||
style: ButtonStyle.grey
|
||||
onClicked: UtilsCpp.createCall(
|
||||
searchResultItem.core.defaultFullAddress)
|
||||
onClicked: UtilsCpp.createCall(mainItem.addressFromFilter)
|
||||
KeyNavigation.left: chatButton
|
||||
KeyNavigation.right: videoCallButton
|
||||
}
|
||||
|
|
@ -150,11 +151,7 @@ FocusScope {
|
|||
focus: visible && !callButton.visible
|
||||
radius: Math.round(40 * DefaultStyle.dp)
|
||||
style: ButtonStyle.grey
|
||||
onClicked: UtilsCpp.createCall(
|
||||
searchResultItem.core.defaultFullAddress,
|
||||
{
|
||||
"localVideoEnabled": true
|
||||
})
|
||||
onClicked: UtilsCpp.createCall(mainItem.addressFromFilter, {"localVideoEnabled": true})
|
||||
KeyNavigation.left: callButton
|
||||
KeyNavigation.right: chatButton
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue