~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip-apps/src/ipjsua/Classes/FirstViewController.m

  • Committer: Jackson Doak
  • Date: 2013-07-10 21:04:46 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: noskcaj@ubuntu.com-20130710210446-y8f587vza807icr9
Properly merged from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: FirstViewController.m 3550 2011-05-05 05:33:27Z nanang $ */
 
2
/*
 
3
 * Copyright (C) 2010-2011 Teluu Inc. (http://www.teluu.com)
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
#import "FirstViewController.h"
 
20
#import "ipjsuaAppDelegate.h"
 
21
 
 
22
 
 
23
@implementation FirstViewController
 
24
@synthesize textField;
 
25
@synthesize textView;
 
26
@synthesize button1;
 
27
@synthesize text;
 
28
@synthesize hasInput;
 
29
 
 
30
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
 
31
    // When the user presses return, take focus away from the text field so that the keyboard is dismissed.
 
32
    if (theTextField == textField) {
 
33
        [self.textField resignFirstResponder];
 
34
        self.hasInput = true;
 
35
        self.text = [textField.text stringByAppendingString:@"\n"];
 
36
        textField.text = @"";
 
37
    }
 
38
    return YES;
 
39
}
 
40
 
 
41
 
 
42
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
 
43
{
 
44
    // Dismiss the keyboard when the view outside the text field is touched.
 
45
    [textField resignFirstResponder];
 
46
    [super touchesBegan:touches withEvent:event];
 
47
}
 
48
 
 
49
/*
 
50
// The designated initializer. Override to perform setup that is required before the view is loaded.
 
51
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
 
52
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
 
53
        // Custom initialization
 
54
    }
 
55
    return self;
 
56
}
 
57
*/
 
58
 
 
59
/*
 
60
// Implement loadView to create a view hierarchy programmatically, without using a nib.
 
61
- (void)loadView {
 
62
}
 
63
*/
 
64
 
 
65
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
 
66
- (void)viewDidLoad {
 
67
    [super viewDidLoad];
 
68
 
 
69
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
 
70
 
 
71
    ipjsuaAppDelegate *appd = (ipjsuaAppDelegate *)[[UIApplication sharedApplication] delegate];
 
72
    appd.mainView = self;
 
73
    textField.delegate = self;
 
74
    [self.textView setFont:[UIFont fontWithName:@"Courier New" size:8.9]];
 
75
    [self.textField setEnabled: false];
 
76
    [button1 addTarget:self action:@selector(button1Pressed:) forControlEvents:(UIControlEvents)UIControlEventTouchDown];
 
77
}
 
78
 
 
79
- (void)button1Pressed:(id)sender {
 
80
    /* Clear the text view */
 
81
    self.textView.text = @"";
 
82
}
 
83
 
 
84
// Override to allow orientations other than the default portrait orientation.
 
85
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 
86
    // Return YES for supported orientations
 
87
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
 
88
}
 
89
 
 
90
- (void)didReceiveMemoryWarning {
 
91
    // Releases the view if it doesn't have a superview.
 
92
    [super didReceiveMemoryWarning];
 
93
 
 
94
    // Release any cached data, images, etc that aren't in use.
 
95
}
 
96
 
 
97
- (void)viewDidUnload {
 
98
    // Release any retained subviews of the main view.
 
99
    // e.g. self.myOutlet = nil;
 
100
}
 
101
 
 
102
 
 
103
- (void)dealloc {
 
104
    [super dealloc];
 
105
}
 
106
 
 
107
@end