~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/shared/qbs/examples/cocoa-touch-application/CocoaTouchApplication/DetailViewController.m

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2013 Petroules Corporation.
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of the Qt Build Suite.
 
7
**
 
8
** Commercial License Usage
 
9
** Licensees holding valid commercial Qt licenses may use this file in
 
10
** accordance with the commercial license agreement provided with the
 
11
** Software or, alternatively, in accordance with the terms contained in
 
12
** a written agreement between you and Digia.  For licensing terms and
 
13
** conditions see http://qt.digia.com/licensing.  For further information
 
14
** use the contact form at http://qt.digia.com/contact-us.
 
15
**
 
16
** GNU Lesser General Public License Usage
 
17
** Alternatively, this file may be used under the terms of the GNU Lesser
 
18
** General Public License version 2.1 as published by the Free Software
 
19
** Foundation and appearing in the file LICENSE.LGPL included in the
 
20
** packaging of this file.  Please review the following information to
 
21
** ensure the GNU Lesser General Public License version 2.1 requirements
 
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
23
**
 
24
** In addition, as a special exception, Digia gives you certain additional
 
25
** rights.  These rights are described in the Digia Qt LGPL Exception
 
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
27
**
 
28
****************************************************************************/
 
29
 
 
30
#import "DetailViewController.h"
 
31
 
 
32
@interface DetailViewController ()
 
33
@property (nonatomic, retain) UIPopoverController *masterPopoverController;
 
34
- (void)configureView;
 
35
@end
 
36
 
 
37
@implementation DetailViewController
 
38
 
 
39
@synthesize detailItem = _detailItem;
 
40
@synthesize detailDescriptionLabel = _detailDescriptionLabel;
 
41
@synthesize masterPopoverController = _masterPopoverController;
 
42
 
 
43
- (void)dealloc
 
44
{
 
45
    [_detailItem release];
 
46
    [_detailDescriptionLabel release];
 
47
    [_masterPopoverController release];
 
48
    [super dealloc];
 
49
}
 
50
 
 
51
#pragma mark - Managing the detail item
 
52
 
 
53
- (void)setDetailItem:(id)newDetailItem
 
54
{
 
55
    if (_detailItem != newDetailItem) {
 
56
        [_detailItem release];
 
57
        _detailItem = [newDetailItem retain];
 
58
 
 
59
        // Update the view.
 
60
        [self configureView];
 
61
    }
 
62
 
 
63
    if (self.masterPopoverController != nil) {
 
64
        [self.masterPopoverController dismissPopoverAnimated:YES];
 
65
    }
 
66
}
 
67
 
 
68
- (void)configureView
 
69
{
 
70
    // Update the user interface for the detail item.
 
71
 
 
72
    if (self.detailItem) {
 
73
        self.detailDescriptionLabel.text = [self.detailItem description];
 
74
    }
 
75
}
 
76
 
 
77
- (void)viewDidLoad
 
78
{
 
79
    [super viewDidLoad];
 
80
    // Do any additional setup after loading the view, typically from a nib.
 
81
    [self configureView];
 
82
}
 
83
 
 
84
- (void)didReceiveMemoryWarning
 
85
{
 
86
    [super didReceiveMemoryWarning];
 
87
    // Dispose of any resources that can be recreated.
 
88
}
 
89
 
 
90
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
 
91
{
 
92
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
 
93
    if (self) {
 
94
        self.title = NSLocalizedString(@"Detail", @"Detail");
 
95
    }
 
96
    return self;
 
97
}
 
98
 
 
99
#pragma mark - Split view
 
100
 
 
101
- (void)splitViewController:(UISplitViewController *) __unused splitController willHideViewController:(UIViewController *) __unused viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
 
102
{
 
103
    barButtonItem.title = NSLocalizedString(@"Master", @"Master");
 
104
    [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
 
105
    self.masterPopoverController = popoverController;
 
106
}
 
107
 
 
108
- (void)splitViewController:(UISplitViewController *) __unused splitController willShowViewController:(UIViewController *) __unused viewController invalidatingBarButtonItem:(UIBarButtonItem *) __unused barButtonItem
 
109
{
 
110
    // Called when the view is shown again in the split view, invalidating the button and popover controller.
 
111
    [self.navigationItem setLeftBarButtonItem:nil animated:YES];
 
112
    self.masterPopoverController = nil;
 
113
}
 
114
 
 
115
@end