~ubuntu-branches/ubuntu/vivid/sflphone/vivid

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiSettingItemListView.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-06-30 11:40:56 UTC
  • mfrom: (4.1.18 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130630114056-0np50jkyqo6vnmii
Tags: 1.2.3-2
* changeset_r92d62cfc54732bbbcfff2b1d36c096b120b981a5.diff 
  - fixes automatic endian detection 
* Update Vcs: fixes vcs-field-not-canonical

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: symbian_ua_guiSettingItemListView.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 <aknviewappui.h>
 
21
#include <eikmenub.h>
 
22
#include <avkon.hrh>
 
23
#include <akncontext.h>
 
24
#include <akntitle.h>
 
25
#include <stringloader.h>
 
26
#include <barsread.h>
 
27
#include <eikbtgpc.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_gui.hrh"
 
33
#include "symbian_ua_guiSettingItemListView.h"
 
34
#include "symbian_ua_guiContainer.hrh"
 
35
#include "symbian_ua_guiSettingItemList.hrh"
 
36
#include "symbian_ua_guiSettingItemList.h"
 
37
// ]]] end generated region [Generated User Includes]
 
38
 
 
39
#include "symbian_ua.h"
 
40
 
 
41
// [[[ begin generated region: do not modify [Generated Constants]
 
42
// ]]] end generated region [Generated Constants]
 
43
 
 
44
/**
 
45
 * First phase of Symbian two-phase construction. Should not contain any
 
46
 * code that could leave.
 
47
 */
 
48
Csymbian_ua_guiSettingItemListView::Csymbian_ua_guiSettingItemListView()
 
49
        {
 
50
        // [[[ begin generated region: do not modify [Generated Contents]
 
51
        // ]]] end generated region [Generated Contents]
 
52
 
 
53
        }
 
54
/**
 
55
 * The view's destructor removes the container from the control
 
56
 * stack and destroys it.
 
57
 */
 
58
Csymbian_ua_guiSettingItemListView::~Csymbian_ua_guiSettingItemListView()
 
59
        {
 
60
        // [[[ begin generated region: do not modify [Generated Contents]
 
61
        // ]]] end generated region [Generated Contents]
 
62
 
 
63
        }
 
64
 
 
65
/**
 
66
 * Symbian two-phase constructor.
 
67
 * This creates an instance then calls the second-phase constructor
 
68
 * without leaving the instance on the cleanup stack.
 
69
 * @return new instance of Csymbian_ua_guiSettingItemListView
 
70
 */
 
71
Csymbian_ua_guiSettingItemListView* Csymbian_ua_guiSettingItemListView::NewL()
 
72
        {
 
73
        Csymbian_ua_guiSettingItemListView* self = Csymbian_ua_guiSettingItemListView::NewLC();
 
74
        CleanupStack::Pop( self );
 
75
        return self;
 
76
        }
 
77
 
 
78
/**
 
79
 * Symbian two-phase constructor.
 
80
 * This creates an instance, pushes it on the cleanup stack,
 
81
 * then calls the second-phase constructor.
 
82
 * @return new instance of Csymbian_ua_guiSettingItemListView
 
83
 */
 
84
Csymbian_ua_guiSettingItemListView* Csymbian_ua_guiSettingItemListView::NewLC()
 
85
        {
 
86
        Csymbian_ua_guiSettingItemListView* self = new ( ELeave ) Csymbian_ua_guiSettingItemListView();
 
87
        CleanupStack::PushL( self );
 
88
        self->ConstructL();
 
89
        return self;
 
90
        }
 
91
 
 
92
 
 
93
/**
 
94
 * Second-phase constructor for view.
 
95
 * Initialize contents from resource.
 
96
 */
 
97
void Csymbian_ua_guiSettingItemListView::ConstructL()
 
98
        {
 
99
        // [[[ begin generated region: do not modify [Generated Code]
 
100
        BaseConstructL( R_SYMBIAN_UA_GUI_SETTING_ITEM_LIST_SYMBIAN_UA_GUI_SETTING_ITEM_LIST_VIEW );
 
101
        // ]]] end generated region [Generated Code]
 
102
 
 
103
        // add your own initialization code here
 
104
        }
 
105
 
 
106
/**
 
107
 * @return The UID for this view
 
108
 */
 
109
TUid Csymbian_ua_guiSettingItemListView::Id() const
 
110
        {
 
111
        return TUid::Uid( ESymbian_ua_guiSettingItemListViewId );
 
112
        }
 
113
 
 
114
/**
 
115
 * Handle a command for this view (override)
 
116
 * @param aCommand command id to be handled
 
117
 */
 
118
void Csymbian_ua_guiSettingItemListView::HandleCommandL( TInt aCommand )
 
119
        {
 
120
        // [[[ begin generated region: do not modify [Generated Code]
 
121
        TBool commandHandled = EFalse;
 
122
        switch ( aCommand )
 
123
                {       // code to dispatch to the AknView's menu and CBA commands is generated here
 
124
 
 
125
                case EAknSoftkeySave:
 
126
                        commandHandled = HandleControlPaneRightSoftKeyPressedL( aCommand );
 
127
                        break;
 
128
                case ESymbian_ua_guiSettingItemListViewMenuItem1Command:
 
129
                        commandHandled = HandleChangeSelectedSettingItemL( aCommand );
 
130
                        break;
 
131
                default:
 
132
                        break;
 
133
                }
 
134
 
 
135
 
 
136
        if ( !commandHandled )
 
137
                {
 
138
 
 
139
                }
 
140
        // ]]] end generated region [Generated Code]
 
141
 
 
142
        }
 
143
 
 
144
/**
 
145
 *      Handles user actions during activation of the view,
 
146
 *      such as initializing the content.
 
147
 */
 
148
void Csymbian_ua_guiSettingItemListView::DoActivateL(
 
149
                const TVwsViewId& /*aPrevViewId*/,
 
150
                TUid /*aCustomMessageId*/,
 
151
                const TDesC8& /*aCustomMessage*/ )
 
152
        {
 
153
        // [[[ begin generated region: do not modify [Generated Contents]
 
154
        SetupStatusPaneL();
 
155
 
 
156
        CEikButtonGroupContainer* cba = AppUi()->Cba();
 
157
        if ( cba != NULL )
 
158
                {
 
159
                cba->MakeVisible( EFalse );
 
160
                }
 
161
 
 
162
        if ( iSymbian_ua_guiSettingItemList == NULL )
 
163
                {
 
164
                iSettings = TSymbian_ua_guiSettingItemListSettings::NewL();
 
165
                iSymbian_ua_guiSettingItemList = new ( ELeave ) CSymbian_ua_guiSettingItemList( *iSettings, this );
 
166
                iSymbian_ua_guiSettingItemList->SetMopParent( this );
 
167
                iSymbian_ua_guiSettingItemList->ConstructFromResourceL( R_SYMBIAN_UA_GUI_SETTING_ITEM_LIST_SYMBIAN_UA_GUI_SETTING_ITEM_LIST );
 
168
                iSymbian_ua_guiSettingItemList->ActivateL();
 
169
                iSymbian_ua_guiSettingItemList->LoadSettingValuesL();
 
170
                iSymbian_ua_guiSettingItemList->LoadSettingsL();
 
171
                AppUi()->AddToStackL( *this, iSymbian_ua_guiSettingItemList );
 
172
                }
 
173
        // ]]] end generated region [Generated Contents]
 
174
 
 
175
        }
 
176
 
 
177
/**
 
178
 */
 
179
void Csymbian_ua_guiSettingItemListView::DoDeactivate()
 
180
        {
 
181
        // [[[ begin generated region: do not modify [Generated Contents]
 
182
        CleanupStatusPane();
 
183
 
 
184
        CEikButtonGroupContainer* cba = AppUi()->Cba();
 
185
        if ( cba != NULL )
 
186
                {
 
187
                cba->MakeVisible( ETrue );
 
188
                cba->DrawDeferred();
 
189
                }
 
190
 
 
191
        if ( iSymbian_ua_guiSettingItemList != NULL )
 
192
                {
 
193
                AppUi()->RemoveFromStack( iSymbian_ua_guiSettingItemList );
 
194
                delete iSymbian_ua_guiSettingItemList;
 
195
                iSymbian_ua_guiSettingItemList = NULL;
 
196
                delete iSettings;
 
197
                iSettings = NULL;
 
198
                }
 
199
        // ]]] end generated region [Generated Contents]
 
200
 
 
201
        }
 
202
 
 
203
// [[[ begin generated function: do not modify
 
204
void Csymbian_ua_guiSettingItemListView::SetupStatusPaneL()
 
205
        {
 
206
        // reset the context pane
 
207
        TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext );
 
208
        CEikStatusPaneBase::TPaneCapabilities subPaneContext =
 
209
                StatusPane()->PaneCapabilities( contextPaneUid );
 
210
        if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() )
 
211
                {
 
212
                CAknContextPane* context = static_cast< CAknContextPane* > (
 
213
                        StatusPane()->ControlL( contextPaneUid ) );
 
214
                context->SetPictureToDefaultL();
 
215
                }
 
216
 
 
217
        // setup the title pane
 
218
        TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle );
 
219
        CEikStatusPaneBase::TPaneCapabilities subPaneTitle =
 
220
                StatusPane()->PaneCapabilities( titlePaneUid );
 
221
        if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() )
 
222
                {
 
223
                CAknTitlePane* title = static_cast< CAknTitlePane* >(
 
224
                        StatusPane()->ControlL( titlePaneUid ) );
 
225
                TResourceReader reader;
 
226
                iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_SETTING_ITEM_LIST_TITLE_RESOURCE );
 
227
                title->SetFromResourceL( reader );
 
228
                CleanupStack::PopAndDestroy(); // reader internal state
 
229
                }
 
230
 
 
231
        }
 
232
// ]]] end generated function
 
233
 
 
234
// [[[ begin generated function: do not modify
 
235
void Csymbian_ua_guiSettingItemListView::CleanupStatusPane()
 
236
        {
 
237
        }
 
238
// ]]] end generated function
 
239
 
 
240
/**
 
241
 * Handle status pane size change for this view (override)
 
242
 */
 
243
void Csymbian_ua_guiSettingItemListView::HandleStatusPaneSizeChange()
 
244
        {
 
245
        CAknView::HandleStatusPaneSizeChange();
 
246
 
 
247
        // this may fail, but we're not able to propagate exceptions here
 
248
        TInt result;
 
249
        TRAP( result, SetupStatusPaneL() );
 
250
        }
 
251
 
 
252
/**
 
253
 * Handle the selected event.
 
254
 * @param aCommand the command id invoked
 
255
 * @return ETrue if the command was handled, EFalse if not
 
256
 */
 
257
TBool Csymbian_ua_guiSettingItemListView::HandleChangeSelectedSettingItemL( TInt aCommand )
 
258
        {
 
259
        iSymbian_ua_guiSettingItemList->ChangeSelectedItemL();
 
260
        return ETrue;
 
261
        }
 
262
 
 
263
/**
 
264
 * Handle the rightSoftKeyPressed event.
 
265
 * @return ETrue if the command was handled, EFalse if not
 
266
 */
 
267
TBool Csymbian_ua_guiSettingItemListView::HandleControlPaneRightSoftKeyPressedL( TInt aCommand )
 
268
        {
 
269
        TUint8 domain[256] = {0};
 
270
        TPtr8 cDomain(domain, sizeof(domain));
 
271
        TUint8 user[64] = {0};
 
272
        TPtr8 cUser(user, sizeof(user));
 
273
        TUint8 pass[64] = {0};
 
274
        TPtr8 cPass(pass, sizeof(pass));
 
275
 
 
276
        cDomain.Copy(iSettings->Ed_registrar());
 
277
        cUser.Copy(iSettings->Ed_user());
 
278
        cPass.Copy(iSettings->Ed_password());
 
279
        symbian_ua_set_account((char*)domain, (char*)user, (char*)pass, false, false);
 
280
 
 
281
        AppUi()->ActivateLocalViewL(TUid::Uid(ESymbian_ua_guiContainerViewId));
 
282
        return ETrue;
 
283
        }
 
284
 
 
285
/**
 
286
 * Handle the selected event.
 
287
 * @param aCommand the command id invoked
 
288
 * @return ETrue if the command was handled, EFalse if not
 
289
 */
 
290
TBool Csymbian_ua_guiSettingItemListView::HandleCancelMenuItemSelectedL( TInt aCommand )
 
291
        {
 
292
        AppUi()->ActivateLocalViewL(TUid::Uid(ESymbian_ua_guiContainerViewId));
 
293
        return ETrue;
 
294
        }