~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: symbian_ua_guiContainer.cpp 3550 2011-05-05 05:33:27Z nanang $ */
 
2
/* 
 
3
 * Copyright (C) 2008-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
// [[[ begin generated region: do not modify [Generated System Includes]
 
20
#include <barsread.h>
 
21
#include <stringloader.h>
 
22
#include <eiklabel.h>
 
23
#include <eikenv.h>
 
24
#include <gdi.h>
 
25
#include <eikedwin.h>
 
26
#include <aknviewappui.h>
 
27
#include <eikappui.h>
 
28
#include <symbian_ua_gui.rsg>
 
29
// ]]] end generated region [Generated System Includes]
 
30
 
 
31
// [[[ begin generated region: do not modify [Generated User Includes]
 
32
#include "symbian_ua_guiContainer.h"
 
33
#include "symbian_ua_guiContainerView.h"
 
34
#include "symbian_ua_gui.hrh"
 
35
#include "symbian_ua_guiContainer.hrh"
 
36
#include "symbian_ua_guiSettingItemList.hrh"
 
37
// ]]] end generated region [Generated User Includes]
 
38
 
 
39
// [[[ begin generated region: do not modify [Generated Constants]
 
40
// ]]] end generated region [Generated Constants]
 
41
 
 
42
/**
 
43
 * First phase of Symbian two-phase construction. Should not 
 
44
 * contain any code that could leave.
 
45
 */
 
46
CSymbian_ua_guiContainer::CSymbian_ua_guiContainer()
 
47
        {
 
48
        // [[[ begin generated region: do not modify [Generated Contents]
 
49
        iLabel1 = NULL;
 
50
        iEd_url = NULL;
 
51
        iEd_info = NULL;
 
52
        // ]]] end generated region [Generated Contents]
 
53
        
 
54
        }
 
55
/** 
 
56
 * Destroy child controls.
 
57
 */
 
58
CSymbian_ua_guiContainer::~CSymbian_ua_guiContainer()
 
59
        {
 
60
        // [[[ begin generated region: do not modify [Generated Contents]
 
61
        delete iLabel1;
 
62
        iLabel1 = NULL;
 
63
        delete iEd_url;
 
64
        iEd_url = NULL;
 
65
        delete iEd_info;
 
66
        iEd_info = NULL;
 
67
        // ]]] end generated region [Generated Contents]
 
68
        
 
69
        }
 
70
                                
 
71
/**
 
72
 * Construct the control (first phase).
 
73
 *  Creates an instance and initializes it.
 
74
 *  Instance is not left on cleanup stack.
 
75
 * @param aRect bounding rectangle
 
76
 * @param aParent owning parent, or NULL
 
77
 * @param aCommandObserver command observer
 
78
 * @return initialized instance of CSymbian_ua_guiContainer
 
79
 */
 
80
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL( 
 
81
                const TRect& aRect, 
 
82
                const CCoeControl* aParent, 
 
83
                MEikCommandObserver* aCommandObserver )
 
84
        {
 
85
        CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC( 
 
86
                        aRect, 
 
87
                        aParent, 
 
88
                        aCommandObserver );
 
89
        CleanupStack::Pop( self );
 
90
        return self;
 
91
        }
 
92
 
 
93
/**
 
94
 * Construct the control (first phase).
 
95
 *  Creates an instance and initializes it.
 
96
 *  Instance is left on cleanup stack.
 
97
 * @param aRect The rectangle for this window
 
98
 * @param aParent owning parent, or NULL
 
99
 * @param aCommandObserver command observer
 
100
 * @return new instance of CSymbian_ua_guiContainer
 
101
 */
 
102
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC( 
 
103
                const TRect& aRect, 
 
104
                const CCoeControl* aParent, 
 
105
                MEikCommandObserver* aCommandObserver )
 
106
        {
 
107
        CSymbian_ua_guiContainer* self = new ( ELeave ) CSymbian_ua_guiContainer();
 
108
        CleanupStack::PushL( self );
 
109
        self->ConstructL( aRect, aParent, aCommandObserver );
 
110
        return self;
 
111
        }
 
112
                        
 
113
/**
 
114
 * Construct the control (second phase).
 
115
 *  Creates a window to contain the controls and activates it.
 
116
 * @param aRect bounding rectangle
 
117
 * @param aCommandObserver command observer
 
118
 * @param aParent owning parent, or NULL
 
119
 */ 
 
120
void CSymbian_ua_guiContainer::ConstructL( 
 
121
                const TRect& aRect, 
 
122
                const CCoeControl* aParent, 
 
123
                MEikCommandObserver* aCommandObserver )
 
124
        {
 
125
        if ( aParent == NULL )
 
126
            {
 
127
                CreateWindowL();
 
128
            }
 
129
        else
 
130
            {
 
131
            SetContainerWindowL( *aParent );
 
132
            }
 
133
        iFocusControl = NULL;
 
134
        iCommandObserver = aCommandObserver;
 
135
        InitializeControlsL();
 
136
        SetRect( aRect );
 
137
        ActivateL();
 
138
        // [[[ begin generated region: do not modify [Post-ActivateL initializations]
 
139
        // ]]] end generated region [Post-ActivateL initializations]
 
140
        
 
141
        }
 
142
                        
 
143
/**
 
144
* Return the number of controls in the container (override)
 
145
* @return count
 
146
*/
 
147
TInt CSymbian_ua_guiContainer::CountComponentControls() const
 
148
        {
 
149
        return ( int ) ELastControl;
 
150
        }
 
151
                                
 
152
/**
 
153
* Get the control with the given index (override)
 
154
* @param aIndex Control index [0...n) (limited by #CountComponentControls)
 
155
* @return Pointer to control
 
156
*/
 
157
CCoeControl* CSymbian_ua_guiContainer::ComponentControl( TInt aIndex ) const
 
158
        {
 
159
        // [[[ begin generated region: do not modify [Generated Contents]
 
160
        switch ( aIndex )
 
161
                {
 
162
                case ELabel1:
 
163
                        return iLabel1;
 
164
                case EEd_url:
 
165
                        return iEd_url;
 
166
                case EEd_info:
 
167
                        return iEd_info;
 
168
                }
 
169
        // ]]] end generated region [Generated Contents]
 
170
        
 
171
        // handle any user controls here...
 
172
        
 
173
        return NULL;
 
174
        }
 
175
                                
 
176
/**
 
177
 *      Handle resizing of the container. This implementation will lay out
 
178
 *  full-sized controls like list boxes for any screen size, and will layout
 
179
 *  labels, editors, etc. to the size they were given in the UI designer.
 
180
 *  This code will need to be modified to adjust arbitrary controls to
 
181
 *  any screen size.
 
182
 */                             
 
183
void CSymbian_ua_guiContainer::SizeChanged()
 
184
        {
 
185
        CCoeControl::SizeChanged();
 
186
        LayoutControls();
 
187
        // [[[ begin generated region: do not modify [Generated Contents]
 
188
                        
 
189
        // ]]] end generated region [Generated Contents]
 
190
        
 
191
        }
 
192
                                
 
193
// [[[ begin generated function: do not modify
 
194
/**
 
195
 * Layout components as specified in the UI Designer
 
196
 */
 
197
void CSymbian_ua_guiContainer::LayoutControls()
 
198
        {
 
199
        iLabel1->SetExtent( TPoint( 2, 23 ), TSize( 32, 28 ) );
 
200
        iEd_url->SetExtent( TPoint( 49, 25 ), TSize( 197, 28 ) );
 
201
        iEd_info->SetExtent( TPoint( 3, 78 ), TSize( 235, 143 ) );
 
202
        }
 
203
// ]]] end generated function
 
204
 
 
205
/**
 
206
 *      Handle key events.
 
207
 */                             
 
208
TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL( 
 
209
                const TKeyEvent& aKeyEvent, 
 
210
                TEventCode aType )
 
211
        {
 
212
        // [[[ begin generated region: do not modify [Generated Contents]
 
213
        
 
214
        // ]]] end generated region [Generated Contents]
 
215
        
 
216
        if ( iFocusControl != NULL
 
217
                && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
 
218
                {
 
219
                return EKeyWasConsumed;
 
220
                }
 
221
        return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
 
222
        }
 
223
                                
 
224
// [[[ begin generated function: do not modify
 
225
/**
 
226
 *      Initialize each control upon creation.
 
227
 */                             
 
228
void CSymbian_ua_guiContainer::InitializeControlsL()
 
229
        {
 
230
        iLabel1 = new ( ELeave ) CEikLabel;
 
231
        iLabel1->SetContainerWindowL( *this );
 
232
                {
 
233
                TResourceReader reader;
 
234
                iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1 );
 
235
                iLabel1->ConstructFromResourceL( reader );
 
236
                CleanupStack::PopAndDestroy(); // reader internal state
 
237
                }
 
238
        iEd_url = new ( ELeave ) CEikEdwin;
 
239
        iEd_url->SetContainerWindowL( *this );
 
240
                {
 
241
                TResourceReader reader;
 
242
                iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_URL );
 
243
                iEd_url->ConstructFromResourceL( reader );
 
244
                CleanupStack::PopAndDestroy(); // reader internal state
 
245
                }
 
246
                {
 
247
                HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2 );
 
248
                iEd_url->SetTextL( text );
 
249
                CleanupStack::PopAndDestroy( text );
 
250
                }
 
251
        iEd_info = new ( ELeave ) CEikEdwin;
 
252
        iEd_info->SetContainerWindowL( *this );
 
253
                {
 
254
                TResourceReader reader;
 
255
                iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO );
 
256
                iEd_info->ConstructFromResourceL( reader );
 
257
                CleanupStack::PopAndDestroy(); // reader internal state
 
258
                }
 
259
                {
 
260
                HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2 );
 
261
                iEd_info->SetTextL( text );
 
262
                CleanupStack::PopAndDestroy( text );
 
263
                }
 
264
        
 
265
        iEd_url->SetFocus( ETrue );
 
266
        iFocusControl = iEd_url;
 
267
        
 
268
        }
 
269
// ]]] end generated function
 
270
 
 
271
/** 
 
272
 * Handle global resource changes, such as scalable UI or skin events (override)
 
273
 */
 
274
void CSymbian_ua_guiContainer::HandleResourceChange( TInt aType )
 
275
        {
 
276
        CCoeControl::HandleResourceChange( aType );
 
277
        SetRect( iAvkonViewAppUi->View( TUid::Uid( ESymbian_ua_guiContainerViewId ) )->ClientRect() );
 
278
        // [[[ begin generated region: do not modify [Generated Contents]
 
279
        // ]]] end generated region [Generated Contents]
 
280
        
 
281
        }
 
282
                                
 
283
/**
 
284
 *      Draw container contents.
 
285
 */                             
 
286
void CSymbian_ua_guiContainer::Draw( const TRect& aRect ) const
 
287
        {
 
288
        // [[[ begin generated region: do not modify [Generated Contents]
 
289
        CWindowGc& gc = SystemGc();
 
290
        gc.Clear( aRect );
 
291
        
 
292
        // ]]] end generated region [Generated Contents]
 
293
        
 
294
        }
 
295