Commit ac4f5b6d authored by Alexandre Lision's avatar Alexandre Lision

ui: remove contact and history button

- add a menu entry to toggle between contacts/history/recent
- display conversation screen when hitting 'enter' on search field
- add call button right from searchfield

Tuleap: #400
Change-Id: I2fd9667c8cdf90b97018d97f5828eba2bd9b53e1
parent 0c56cb69
......@@ -50,8 +50,6 @@
//UI elements
__unsafe_unretained IBOutlet RingOutlineView* smartView;
__unsafe_unretained IBOutlet NSSearchField* searchField;
__unsafe_unretained IBOutlet NSButton* showContactsButton;
__unsafe_unretained IBOutlet NSButton* showHistoryButton;
__unsafe_unretained IBOutlet NSTabView* tabbar;
}
......@@ -106,9 +104,6 @@ NSInteger const TXT_BUTTON_TAG = 500;
auto proxyIdx = RecentModel::instance().peopleProxy()->mapFromSource(current);
if (proxyIdx.isValid()) {
[treeController setSelectionQModelIndex:proxyIdx];
[showContactsButton setHighlighted:NO];
[showHistoryButton setHighlighted:NO];
[tabbar selectTabViewItemAtIndex:0];
[smartView scrollRowToVisible:proxyIdx.row()];
}
......@@ -171,26 +166,17 @@ NSInteger const TXT_BUTTON_TAG = 500;
- (IBAction)showHistory:(NSButton*)sender
{
[showContactsButton setHighlighted:NO];
[showHistoryButton setHighlighted:![sender isHighlighted]];
if (![sender isHighlighted]) {
[tabbar selectTabViewItemAtIndex:0];
} else {
[tabbar selectTabViewItemAtIndex:1];
}
[tabbar selectTabViewItemAtIndex:1];
}
- (IBAction)showContacts:(NSButton*)sender
{
[showContactsButton setHighlighted:![sender isHighlighted]];
[showHistoryButton setHighlighted:NO];
[tabbar selectTabViewItemAtIndex:2];
}
if (![sender isHighlighted]) {
[tabbar selectTabViewItemAtIndex:0];
} else {
[tabbar selectTabViewItemAtIndex:2];
}
- (IBAction)showSmartlist:(NSButton*)sender
{
[tabbar selectTabViewItemAtIndex:0];
}
#pragma mark - NSOutlineViewDelegate methods
......@@ -282,12 +268,30 @@ NSInteger const TXT_BUTTON_TAG = 500;
return (((NSTreeNode*)item).indexPath.length == 1) ? 60.0 : 45.0;
}
- (IBAction)placeCallFromSearchField:(id)sender
{
if ([searchField stringValue].length == 0) {
return;
}
auto cm = PhoneDirectoryModel::instance().getNumber(QString::fromNSString([searchField stringValue]));
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);
}
- (void) startConversationFromSearchField
{
auto cm = PhoneDirectoryModel::instance().getNumber(QString::fromNSString([searchField stringValue]));
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);
}
- (void) addToContact
......@@ -344,10 +348,15 @@ NSInteger const TXT_BUTTON_TAG = 500;
return YES;
}
}
return NO;
}
- (void)controlTextDidChange:(NSNotification *) notification
{
BOOL empty = [[searchField stringValue] isEqualTo:@""];
RecentModel::instance().peopleProxy()->setFilterWildcard(QString::fromNSString([searchField stringValue]));
}
#pragma mark - NSPopOverDelegate
- (void)popoverDidClose:(NSNotification *)notification
......@@ -358,10 +367,6 @@ NSInteger const TXT_BUTTON_TAG = 500;
}
}
- (void)controlTextDidChange:(NSNotification *) notification
{
RecentModel::instance().peopleProxy()->setFilterWildcard(QString::fromNSString([searchField stringValue]));
}
#pragma mark - ContactLinkedDelegate
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
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