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;
|
if (index < 0 && index >= mAddressList.size()) return;
|
||||||
auto map = mAddressList[index].toMap();
|
auto map = mAddressList[index].toMap();
|
||||||
if (map["address"].toString() == mDefaultFullAddress) mDefaultFullAddress.clear();
|
if (map["address"].toString() == mDefaultFullAddress) mDefaultFullAddress.clear();
|
||||||
|
if (map["address"].toString() == mDefaultAddress) mDefaultAddress.clear();
|
||||||
mAddressList.remove(index);
|
mAddressList.remove(index);
|
||||||
emit addressChanged();
|
emit addressChanged();
|
||||||
setIsSaved(false);
|
setIsSaved(false);
|
||||||
|
|
|
||||||
|
|
@ -1438,6 +1438,15 @@ QList<QVariant> Utils::append(const QList<QVariant> a, const QList<QVariant> b)
|
||||||
return a + 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
|
// Codecs download
|
||||||
|
|
||||||
QList<QSharedPointer<DownloadablePayloadTypeCore>> Utils::getDownloadableVideoPayloadTypes() {
|
QList<QSharedPointer<DownloadablePayloadTypeCore>> Utils::getDownloadableVideoPayloadTypes() {
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@ public:
|
||||||
Q_INVOKABLE QString boldTextPart(const QString &text, const QString ®ex);
|
Q_INVOKABLE QString boldTextPart(const QString &text, const QString ®ex);
|
||||||
Q_INVOKABLE static QString getFileChecksum(const QString &filePath);
|
Q_INVOKABLE static QString getFileChecksum(const QString &filePath);
|
||||||
Q_INVOKABLE QList<QVariant> append(const QList<QVariant> a, const QList<QVariant> b);
|
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);
|
// QDir findDirectoryByName(QString startPath, QString name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ FocusScope {
|
||||||
property bool showActions: false // Display actions layout (call buttons)
|
property bool showActions: false // Display actions layout (call buttons)
|
||||||
property bool showContactMenu: true // Display the dot menu for contacts.
|
property bool showContactMenu: true // Display the dot menu for contacts.
|
||||||
property string highlightText
|
property string highlightText
|
||||||
|
property string addressFromFilter: UtilsCpp.getAddressToDisplay(searchResultItem.core.addresses, highlightText, searchResultItem.core.defaultAddress)
|
||||||
|
|
||||||
// Bold characters in Display name.
|
// Bold characters in Display name.
|
||||||
property bool displayNameCapitalization: true // Capitalize display name.
|
property bool displayNameCapitalization: true // Capitalize display name.
|
||||||
|
|
@ -90,7 +91,9 @@ FocusScope {
|
||||||
Layout.topMargin: Math.round(2 * DefaultStyle.dp)
|
Layout.topMargin: Math.round(2 * DefaultStyle.dp)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: mainItem.showDefaultAddress
|
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)
|
text: UtilsCpp.boldTextPart(address, mainItem.highlightText)
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
@ -113,8 +116,7 @@ FocusScope {
|
||||||
EffectImage {
|
EffectImage {
|
||||||
id: isSelectedCheck
|
id: isSelectedCheck
|
||||||
visible: mainItem.multiSelectionEnabled
|
visible: mainItem.multiSelectionEnabled
|
||||||
&& (mainItem.selectedContacts.indexOf(
|
&& (mainItem.selectedContacts.indexOf(mainItem.addressFromFilter) != -1)
|
||||||
searchResultItem.core.defaultAddress) != -1)
|
|
||||||
Layout.preferredWidth: Math.round(24 * DefaultStyle.dp)
|
Layout.preferredWidth: Math.round(24 * DefaultStyle.dp)
|
||||||
Layout.preferredHeight: Math.round(24 * DefaultStyle.dp)
|
Layout.preferredHeight: Math.round(24 * DefaultStyle.dp)
|
||||||
imageSource: AppIcons.check
|
imageSource: AppIcons.check
|
||||||
|
|
@ -134,8 +136,7 @@ FocusScope {
|
||||||
focus: visible
|
focus: visible
|
||||||
radius: Math.round(40 * DefaultStyle.dp)
|
radius: Math.round(40 * DefaultStyle.dp)
|
||||||
style: ButtonStyle.grey
|
style: ButtonStyle.grey
|
||||||
onClicked: UtilsCpp.createCall(
|
onClicked: UtilsCpp.createCall(mainItem.addressFromFilter)
|
||||||
searchResultItem.core.defaultFullAddress)
|
|
||||||
KeyNavigation.left: chatButton
|
KeyNavigation.left: chatButton
|
||||||
KeyNavigation.right: videoCallButton
|
KeyNavigation.right: videoCallButton
|
||||||
}
|
}
|
||||||
|
|
@ -150,11 +151,7 @@ FocusScope {
|
||||||
focus: visible && !callButton.visible
|
focus: visible && !callButton.visible
|
||||||
radius: Math.round(40 * DefaultStyle.dp)
|
radius: Math.round(40 * DefaultStyle.dp)
|
||||||
style: ButtonStyle.grey
|
style: ButtonStyle.grey
|
||||||
onClicked: UtilsCpp.createCall(
|
onClicked: UtilsCpp.createCall(mainItem.addressFromFilter, {"localVideoEnabled": true})
|
||||||
searchResultItem.core.defaultFullAddress,
|
|
||||||
{
|
|
||||||
"localVideoEnabled": true
|
|
||||||
})
|
|
||||||
KeyNavigation.left: callButton
|
KeyNavigation.left: callButton
|
||||||
KeyNavigation.right: chatButton
|
KeyNavigation.right: chatButton
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue