From a7f626e321fab53d339439d3bcbd865da1fdec6a Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 29 Dec 2016 16:21:30 +0100 Subject: [PATCH] fix(src/components/sip-addresses/SipAddressesModel): ignore aborted calls --- .../components/sip-addresses/SipAddressesModel.cpp | 4 ++++ .../smart-search-bar/SmartSearchBarModel.cpp | 12 ++++++------ tests/src/components/timeline/TimelineModel.cpp | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/src/components/sip-addresses/SipAddressesModel.cpp b/tests/src/components/sip-addresses/SipAddressesModel.cpp index 883657110..4df2f5959 100644 --- a/tests/src/components/sip-addresses/SipAddressesModel.cpp +++ b/tests/src/components/sip-addresses/SipAddressesModel.cpp @@ -191,6 +191,10 @@ void SipAddressesModel::fetchSipAddresses () { if (address_done.contains(sip_address)) continue; // Already used. + + if (call_log->getStatus() == linphone::CallStatusAborted) + continue; // Ignore aborted calls. + address_done << sip_address; QVariantMap map; diff --git a/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp b/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp index c1b1792a9..365ecffac 100644 --- a/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp +++ b/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp @@ -35,18 +35,18 @@ void SmartSearchBarModel::setFilter (const QString &pattern) { // ----------------------------------------------------------------------------- bool SmartSearchBarModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const { - const QModelIndex &index = sourceModel()->index(source_row, 0, source_parent); - const QVariantMap &map = index.data().toMap(); + const QModelIndex index = sourceModel()->index(source_row, 0, source_parent); + const QVariantMap map = index.data().toMap(); return computeStringWeight(map["sipAddress"].toString()) > 0; } bool SmartSearchBarModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { - const QVariantMap &map_a = sourceModel()->data(left).toMap(); - const QVariantMap &map_b = sourceModel()->data(right).toMap(); + const QVariantMap map_a = sourceModel()->data(left).toMap(); + const QVariantMap map_b = sourceModel()->data(right).toMap(); - const QString &sip_address_a = map_a["sipAddress"].toString(); - const QString &sip_address_b = map_b["sipAddress"].toString(); + const QString sip_address_a = map_a["sipAddress"].toString(); + const QString sip_address_b = map_b["sipAddress"].toString(); int weight_a = computeStringWeight(sip_address_a); int weight_b = computeStringWeight(sip_address_b); diff --git a/tests/src/components/timeline/TimelineModel.cpp b/tests/src/components/timeline/TimelineModel.cpp index 4d9d5d01e..08592e5f6 100644 --- a/tests/src/components/timeline/TimelineModel.cpp +++ b/tests/src/components/timeline/TimelineModel.cpp @@ -18,15 +18,15 @@ QHash TimelineModel::roleNames () const { // ----------------------------------------------------------------------------- bool TimelineModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const { - const QModelIndex &index = sourceModel()->index(source_row, 0, source_parent); - const QVariantMap &map = index.data().toMap(); + const QModelIndex index = sourceModel()->index(source_row, 0, source_parent); + const QVariantMap map = index.data().toMap(); return map.contains("timestamp"); } bool TimelineModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { - const QVariantMap &sip_address_a = sourceModel()->data(left).toMap(); - const QVariantMap &sip_address_b = sourceModel()->data(right).toMap(); + const QVariantMap sip_address_a = sourceModel()->data(left).toMap(); + const QVariantMap sip_address_b = sourceModel()->data(right).toMap(); return sip_address_a["timestamp"] > sip_address_b["timestamp"]; }