Fix contact shortcut in searchbar

This commit is contained in:
Julien Wadel 2021-10-06 18:57:51 +02:00
parent b82f6fd13b
commit 8cb167978e
2 changed files with 10 additions and 8 deletions

View file

@ -107,18 +107,20 @@ QVariant SipAddressesModel::data (const QModelIndex &index, int role) const {
// -----------------------------------------------------------------------------
QVariantMap SipAddressesModel::find (const QString &sipAddress) const {
auto it = mPeerAddressToSipAddressEntry.find(sipAddress);
if (it == mPeerAddressToSipAddressEntry.end())
return QVariantMap();
QString cleanedAddress = Utils::cleanSipAddress(sipAddress);
auto it = mPeerAddressToSipAddressEntry.find(cleanedAddress);
if (it == mPeerAddressToSipAddressEntry.end())
return QVariantMap();
return buildVariantMap(*it);
return buildVariantMap(*it);
}
// -----------------------------------------------------------------------------
ContactModel *SipAddressesModel::mapSipAddressToContact (const QString &sipAddress) const {
auto it = mPeerAddressToSipAddressEntry.find(sipAddress);
return it == mPeerAddressToSipAddressEntry.end() ? nullptr : it->contact;
QString cleanedAddress = Utils::cleanSipAddress(sipAddress);
auto it = mPeerAddressToSipAddressEntry.find(cleanedAddress);
return it == mPeerAddressToSipAddressEntry.end() ? nullptr : it->contact;
}
// -----------------------------------------------------------------------------

View file

@ -182,8 +182,8 @@ ApplicationWindow {
})
onEntryClicked: {
if (entry.contact && SettingsModel.contactsEnabled) {
window.setView('ContactEdit', { sipAddress: entry.sipAddress })
if (SettingsModel.contactsEnabled) {
window.setView('ContactEdit', { sipAddress: entry })
} else {
CallsListModel.createChatRoom( "", false, [entry], true )
}