Commit f909fb1c authored by Alexandre Lision's avatar Alexandre Lision Committed by Guillaume Roguez

hotfix: clear search field after lookup

Clear the search field after processing the URI entered

Change-Id: I0caca540f8f31d47c88011c3f7f0a1dc43b4f278
parent 53302c96
......@@ -301,8 +301,6 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
{
auto cm = PhoneDirectoryModel::instance().getNumber(uri);
auto c = CallModel::instance().dialingCall();
[searchField setStringValue:@""];
RecentModel::instance().peopleProxy()->setFilterWildcard(QString::fromNSString([searchField stringValue]));
c->setPeerContactMethod(cm);
c << Call::Action::ACCEPT;
CallModel::instance().selectCall(c);
......@@ -314,8 +312,6 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
time_t currentTime;
::time(&currentTime);
cm->setLastUsed(currentTime);
[searchField setStringValue:@""];
RecentModel::instance().peopleProxy()->setFilterWildcard(QString::fromNSString([searchField stringValue]));
auto proxyIdx = RecentModel::instance().peopleProxy()->mapToSource(RecentModel::instance().peopleProxy()->index(0, 0));
RecentModel::instance().selectionModel()->setCurrentIndex(proxyIdx, QItemSelectionModel::ClearAndSelect);
}
......@@ -357,6 +353,7 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
const auto* numberEntered = [searchField stringValue];
URI uri = URI(numberEntered.UTF8String);
[self clearSearchField];
if (hasValidRingAccount) {
if (uri.protocolHint() == URI::ProtocolHint::RING) {
......@@ -409,10 +406,8 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
break;
}
}
RecentModel::instance().peopleProxy()->setFilterWildcard(QString::fromNSString([searchField stringValue]));
}
);
});
NameDirectory::instance().lookupName(nullptr, QString(), usernameToLookup);
}
} else if (hasValidSIPAccount) {
......@@ -420,6 +415,7 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
// If it is a RingID and no valid account is available, present error
[self displayErrorModalWithTitle:noValidAccountTitle
WithMessage:noValidAccountMessage];
return;
}
if (shouldCall) {
[self startCallFromURI:uri];
......@@ -432,6 +428,12 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
}
}
- (void) clearSearchField
{
[searchField setStringValue:@""];
RecentModel::instance().peopleProxy()->setFilterWildcard(QString::fromNSString([searchField stringValue]));
}
- (void) addToContact
{
if ([treeController selectedNodes].count == 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment