Commit 0febcfa9 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

fix: search field

This patch fixes visual bug caused by search pressing enter.
Now it opens conversation view for searching result.

Change-Id: I561abb8fcdf3b27725d517ea992004e32cac720b
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent e3f3f374
......@@ -493,13 +493,30 @@ NSInteger const REQUEST_SEG = 1;
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
{
if (commandSelector == @selector(insertNewline:)) {
if([[searchField stringValue] isNotEqualTo:@""]) {
[self processSearchFieldInput];
if (commandSelector != @selector(insertNewline:) || [[searchField stringValue] isEqual:@""]) {
return NO;
}
if (model_->allFilteredConversations().size() <= 0) {
return YES;
}
auto model = model_->filteredConversation(0);
auto uid = model.uid;
if (selectedUid_ == uid) {
return YES;
}
@try {
auto contact = model_->owner.contactModel->getContact(model.participants[0]);
if ((contact.profileInfo.uri.empty() && contact.profileInfo.type != lrc::api::profile::Type::SIP) || contact.profileInfo.type == lrc::api::profile::Type::INVALID) {
return YES;
}
selectedUid_ = uid;
model_->selectConversation(uid);
[self.view.window makeFirstResponder: smartView];
searchField.stringValue = @"";
return YES;
} @catch (NSException *exception) {
return YES;
}
return NO;
}
- (void)controlTextDidChange:(NSNotification *) notification
......
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