smartlist: allow filtering

peopleProxy is a QSortProxyFilter we can use to filter our smartlist
based on user input from the searchbar

Issue: #81111
Change-Id: I0dab38670e4f5f64d924effc81405d663d90dfeb
diff --git a/src/SmartViewVC.h b/src/SmartViewVC.h
index 1ef6594..8e2d988 100644
--- a/src/SmartViewVC.h
+++ b/src/SmartViewVC.h
@@ -19,6 +19,6 @@
 
 #import <Cocoa/Cocoa.h>
 
-@interface SmartViewVC : NSViewController
+@interface SmartViewVC : NSViewController <NSTextFieldDelegate>
 
 @end
diff --git a/src/SmartViewVC.mm b/src/SmartViewVC.mm
index f885a0c..3bea943 100644
--- a/src/SmartViewVC.mm
+++ b/src/SmartViewVC.mm
@@ -291,10 +291,13 @@
     }
 
     c << Call::Action::ACCEPT;
+
+    [searchField setStringValue:@""];
+    RecentModel::instance()->peopleProxy()->
+    setFilterRegExp(QRegExp(QString::fromNSString([searchField stringValue]), Qt::CaseInsensitive, QRegExp::FixedString));
 }
 
-
-#pragma NSTextField Delegate
+#pragma NSTextFieldDelegate
 
 - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
 {
@@ -308,4 +311,10 @@
     return NO;
 }
 
+- (void)controlTextDidChange:(NSNotification *) notification
+{
+    RecentModel::instance()->peopleProxy()->
+    setFilterRegExp(QRegExp(QString::fromNSString([searchField stringValue]), Qt::CaseInsensitive, QRegExp::FixedString));
+}
+
 @end