Skip to content
Snippets Groups Projects
Commit 25bcd48e authored by Alexandre Lision's avatar Alexandre Lision
Browse files

call: fix callbar

- press enter to start call

Refs #67611

Change-Id: I721a6cdc93ec152958caa6234c738b285820e3c8
parent 11af2176
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@
#import "HistoryViewController.h"
#import "PreferencesViewController.h"
@interface RingWindowController : NSWindowController <NSToolbarDelegate>{
@interface RingWindowController : NSWindowController <NSToolbarDelegate, NSTextFieldDelegate>{
IBOutlet NSView *currentView;
}
@property (nonatomic, assign) NSViewController *myCurrentViewController;
......
......@@ -168,8 +168,8 @@ static NSString* const kCallButtonIdentifer = @"CallButtonIdentifier";
callField = [[NSSearchField alloc] initWithFrame:NSMakeRect(0,0,400,21)];
[[callField cell] setSearchButtonCell:nil];
[callField setToolTip:@"Call"];
//[callField setAlignment:NSCenterTextAlignment];
[callField setAlignment:NSCenterTextAlignment];
[callField setDelegate:self];
[item setView:callField];
}
......@@ -194,7 +194,13 @@ static NSString* const kCallButtonIdentifer = @"CallButtonIdentifier";
}
return item;
}
- (IBAction)placeCall:(id)sender
{
Call* c = CallModel::instance()->dialingCall();
c->setDialNumber(QString::fromNSString([callField stringValue]));
c << Call::Action::ACCEPT;
}
-(NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
......@@ -225,6 +231,20 @@ static NSString* const kCallButtonIdentifer = @"CallButtonIdentifier";
return nil;
}
#pragma NSTextField Delegate
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
{
NSLog(@"Selector method is (%@)", NSStringFromSelector( commandSelector ) );
if (commandSelector == @selector(insertNewline:)) {
if([[callField stringValue] isNotEqualTo:@""]) {
[self placeCall:nil];
return YES;
}
}
return NO;
}
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment