1
/* $Id: symbian_ua_guiSettingItemListView.cpp 3550 2011-05-05 05:33:27Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
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.
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.
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
19
// [[[ begin generated region: do not modify [Generated System Includes]
20
#include <aknviewappui.h>
23
#include <akncontext.h>
25
#include <stringloader.h>
28
#include <symbian_ua_gui.rsg>
29
// ]]] end generated region [Generated System Includes]
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]
39
#include "symbian_ua.h"
41
// [[[ begin generated region: do not modify [Generated Constants]
42
// ]]] end generated region [Generated Constants]
45
* First phase of Symbian two-phase construction. Should not contain any
46
* code that could leave.
48
Csymbian_ua_guiSettingItemListView::Csymbian_ua_guiSettingItemListView()
50
// [[[ begin generated region: do not modify [Generated Contents]
51
// ]]] end generated region [Generated Contents]
55
* The view's destructor removes the container from the control
56
* stack and destroys it.
58
Csymbian_ua_guiSettingItemListView::~Csymbian_ua_guiSettingItemListView()
60
// [[[ begin generated region: do not modify [Generated Contents]
61
// ]]] end generated region [Generated Contents]
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
71
Csymbian_ua_guiSettingItemListView* Csymbian_ua_guiSettingItemListView::NewL()
73
Csymbian_ua_guiSettingItemListView* self = Csymbian_ua_guiSettingItemListView::NewLC();
74
CleanupStack::Pop( self );
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
84
Csymbian_ua_guiSettingItemListView* Csymbian_ua_guiSettingItemListView::NewLC()
86
Csymbian_ua_guiSettingItemListView* self = new ( ELeave ) Csymbian_ua_guiSettingItemListView();
87
CleanupStack::PushL( self );
94
* Second-phase constructor for view.
95
* Initialize contents from resource.
97
void Csymbian_ua_guiSettingItemListView::ConstructL()
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]
103
// add your own initialization code here
107
* @return The UID for this view
109
TUid Csymbian_ua_guiSettingItemListView::Id() const
111
return TUid::Uid( ESymbian_ua_guiSettingItemListViewId );
115
* Handle a command for this view (override)
116
* @param aCommand command id to be handled
118
void Csymbian_ua_guiSettingItemListView::HandleCommandL( TInt aCommand )
120
// [[[ begin generated region: do not modify [Generated Code]
121
TBool commandHandled = EFalse;
123
{ // code to dispatch to the AknView's menu and CBA commands is generated here
125
case EAknSoftkeySave:
126
commandHandled = HandleControlPaneRightSoftKeyPressedL( aCommand );
128
case ESymbian_ua_guiSettingItemListViewMenuItem1Command:
129
commandHandled = HandleChangeSelectedSettingItemL( aCommand );
136
if ( !commandHandled )
140
// ]]] end generated region [Generated Code]
145
* Handles user actions during activation of the view,
146
* such as initializing the content.
148
void Csymbian_ua_guiSettingItemListView::DoActivateL(
149
const TVwsViewId& /*aPrevViewId*/,
150
TUid /*aCustomMessageId*/,
151
const TDesC8& /*aCustomMessage*/ )
153
// [[[ begin generated region: do not modify [Generated Contents]
156
CEikButtonGroupContainer* cba = AppUi()->Cba();
159
cba->MakeVisible( EFalse );
162
if ( iSymbian_ua_guiSettingItemList == NULL )
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 );
173
// ]]] end generated region [Generated Contents]
179
void Csymbian_ua_guiSettingItemListView::DoDeactivate()
181
// [[[ begin generated region: do not modify [Generated Contents]
184
CEikButtonGroupContainer* cba = AppUi()->Cba();
187
cba->MakeVisible( ETrue );
191
if ( iSymbian_ua_guiSettingItemList != NULL )
193
AppUi()->RemoveFromStack( iSymbian_ua_guiSettingItemList );
194
delete iSymbian_ua_guiSettingItemList;
195
iSymbian_ua_guiSettingItemList = NULL;
199
// ]]] end generated region [Generated Contents]
203
// [[[ begin generated function: do not modify
204
void Csymbian_ua_guiSettingItemListView::SetupStatusPaneL()
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() )
212
CAknContextPane* context = static_cast< CAknContextPane* > (
213
StatusPane()->ControlL( contextPaneUid ) );
214
context->SetPictureToDefaultL();
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() )
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
232
// ]]] end generated function
234
// [[[ begin generated function: do not modify
235
void Csymbian_ua_guiSettingItemListView::CleanupStatusPane()
238
// ]]] end generated function
241
* Handle status pane size change for this view (override)
243
void Csymbian_ua_guiSettingItemListView::HandleStatusPaneSizeChange()
245
CAknView::HandleStatusPaneSizeChange();
247
// this may fail, but we're not able to propagate exceptions here
249
TRAP( result, SetupStatusPaneL() );
253
* Handle the selected event.
254
* @param aCommand the command id invoked
255
* @return ETrue if the command was handled, EFalse if not
257
TBool Csymbian_ua_guiSettingItemListView::HandleChangeSelectedSettingItemL( TInt aCommand )
259
iSymbian_ua_guiSettingItemList->ChangeSelectedItemL();
264
* Handle the rightSoftKeyPressed event.
265
* @return ETrue if the command was handled, EFalse if not
267
TBool Csymbian_ua_guiSettingItemListView::HandleControlPaneRightSoftKeyPressedL( TInt aCommand )
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));
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);
281
AppUi()->ActivateLocalViewL(TUid::Uid(ESymbian_ua_guiContainerViewId));
286
* Handle the selected event.
287
* @param aCommand the command id invoked
288
* @return ETrue if the command was handled, EFalse if not
290
TBool Csymbian_ua_guiSettingItemListView::HandleCancelMenuItemSelectedL( TInt aCommand )
292
AppUi()->ActivateLocalViewL(TUid::Uid(ESymbian_ua_guiContainerViewId));