|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <aknviewappui.h> |
|
19 #include <eikmenub.h> |
|
20 #include <avkon.hrh> |
|
21 #include <akncontext.h> |
|
22 #include <akntitle.h> |
|
23 #include <stringloader.h> |
|
24 #include <barsread.h> |
|
25 #include <eikbtgpc.h> |
|
26 #include <atconfigurationappgui.rsg> |
|
27 |
|
28 #include "atconfigurationappgui.hrh" |
|
29 #include "atconfigurationappguisettingitemlistview.h" |
|
30 #include "atconfigurationappguisettingitemlist.hrh" |
|
31 #include "atconfigurationappguisettingitemlist.h" |
|
32 #include "atlog.h" |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CATConfigurationAppGuiSettingItemListView::CATConfigurationAppGuiSettingItemListView() |
|
36 // First phase of Symbian two-phase construction. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CATConfigurationAppGuiSettingItemListView::CATConfigurationAppGuiSettingItemListView() : |
|
40 iLastViewId( TUid::Uid( EATConfigurationAppGuiListBoxViewId ) ) |
|
41 { |
|
42 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::CATConfigurationAppGuiSettingItemListView()" ); |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CATConfigurationAppGuiSettingItemListView::~CATConfigurationAppGuiSettingItemListView() |
|
47 // Destructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CATConfigurationAppGuiSettingItemListView::~CATConfigurationAppGuiSettingItemListView() |
|
51 { |
|
52 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::~CATConfigurationAppGuiSettingItemListView()" ); |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CATConfigurationAppGuiSettingItemListView::NewL() |
|
57 // Symbian two-phase constructor. |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CATConfigurationAppGuiSettingItemListView* CATConfigurationAppGuiSettingItemListView::NewL() |
|
61 { |
|
62 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::NewL()" ); |
|
63 |
|
64 CATConfigurationAppGuiSettingItemListView* self = CATConfigurationAppGuiSettingItemListView::NewLC(); |
|
65 CleanupStack::Pop( self ); |
|
66 return self; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CATConfigurationAppGuiSettingItemListView::NewLC() |
|
71 // Symbian two-phase constructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CATConfigurationAppGuiSettingItemListView* CATConfigurationAppGuiSettingItemListView::NewLC() |
|
75 { |
|
76 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::NewLC()" ); |
|
77 |
|
78 CATConfigurationAppGuiSettingItemListView* self = new ( ELeave ) CATConfigurationAppGuiSettingItemListView(); |
|
79 CleanupStack::PushL( self ); |
|
80 self->ConstructL(); |
|
81 return self; |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CATConfigurationAppGuiSettingItemListView::ConstructL() |
|
86 // Second-phase constructor for view. |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CATConfigurationAppGuiSettingItemListView::ConstructL() |
|
90 { |
|
91 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::ConstructL()" ); |
|
92 |
|
93 BaseConstructL( R_ATCONFIGURATION_APP_GUI_SETTING_ITEM_LIST_VIEW ); |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CATConfigurationAppGuiSettingItemListView::Id() |
|
98 // Returns the UID for this view. |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 TUid CATConfigurationAppGuiSettingItemListView::Id() const |
|
102 { |
|
103 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::Id()" ); |
|
104 |
|
105 return TUid::Uid( EATConfigurationAppGuiSettingItemListViewId ); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CATConfigurationAppGuiSettingItemListView::HandleCommandL() |
|
110 // Handle a command for this view. |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void CATConfigurationAppGuiSettingItemListView::HandleCommandL( TInt aCommand ) |
|
114 { |
|
115 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::HandleCommandL()" ); |
|
116 |
|
117 TBool commandHandled = EFalse; |
|
118 switch ( aCommand ) |
|
119 { // Code to dispatch to the AknView's menu and CBA commands is generated here |
|
120 case EATConfigurationAppGuiSettingItemListViewMenuItem1Command: |
|
121 commandHandled = HandleChangeSelectedSettingItemL( aCommand ); |
|
122 break; |
|
123 case EAknSoftkeyBack: |
|
124 { |
|
125 AppUi()->ActivateLocalViewL( iLastViewId ); |
|
126 commandHandled = ETrue; |
|
127 break; |
|
128 } |
|
129 default: |
|
130 break; |
|
131 } |
|
132 |
|
133 |
|
134 if ( !commandHandled ) |
|
135 { |
|
136 |
|
137 if ( aCommand == EAknSoftkeyBack ) |
|
138 { |
|
139 AppUi()->HandleCommandL( EEikCmdExit ); |
|
140 } |
|
141 |
|
142 } |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CATConfigurationAppGuiSettingItemListView::DoActivateL() |
|
147 // Handles user actions during activation of the view. |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void CATConfigurationAppGuiSettingItemListView::DoActivateL( |
|
151 const TVwsViewId& /*aPrevViewId*/, |
|
152 TUid aCustomMessageId, |
|
153 const TDesC8& /*aCustomMessage*/ ) |
|
154 { |
|
155 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::DoActivateL()" ); |
|
156 |
|
157 SetupStatusPaneL(); |
|
158 iLastViewId = aCustomMessageId; |
|
159 |
|
160 if ( iATConfigUISettingItemList == NULL ) |
|
161 { |
|
162 iSettings = CATConfigurationAppGuiSettingItemListSettings::NewL(); |
|
163 iATConfigUISettingItemList = new ( ELeave ) CATConfigurationAppGuiSettingItemList( *iSettings, this ); |
|
164 iATConfigUISettingItemList->SetMopParent( this ); |
|
165 iATConfigUISettingItemList->ConstructFromResourceL( R_ATCONFIGURATION_APP_GUI_SETTING_ITEM_LIST ); |
|
166 iATConfigUISettingItemList->ActivateL(); |
|
167 iATConfigUISettingItemList->LoadSettingValuesL(); |
|
168 iATConfigUISettingItemList->LoadSettingsL(); |
|
169 AppUi()->AddToStackL( *this, iATConfigUISettingItemList ); |
|
170 } |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CATConfigurationAppGuiSettingItemListView::DoDeactivate() |
|
175 // Handles user actions during deactivation of the view. |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void CATConfigurationAppGuiSettingItemListView::DoDeactivate() |
|
179 { |
|
180 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::DoDeactivate()" ); |
|
181 |
|
182 CleanupStatusPane(); |
|
183 |
|
184 if ( iATConfigUISettingItemList != NULL ) |
|
185 { |
|
186 AppUi()->RemoveFromStack( iATConfigUISettingItemList ); |
|
187 delete iATConfigUISettingItemList; |
|
188 iATConfigUISettingItemList = NULL; |
|
189 delete iSettings; |
|
190 iSettings = NULL; |
|
191 } |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CATConfigurationAppGuiSettingItemListView::HandleStatusPaneSizeChange() |
|
196 // Handle status pane size change for this view. |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CATConfigurationAppGuiSettingItemListView::HandleStatusPaneSizeChange() |
|
200 { |
|
201 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::HandleStatusPaneSizeChange()" ); |
|
202 |
|
203 CAknView::HandleStatusPaneSizeChange(); |
|
204 |
|
205 // This may fail, but we're not able to propagate exceptions here |
|
206 TInt result; |
|
207 TRAP( result, SetupStatusPaneL() ); |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CATConfigurationAppGuiSettingItemListView::SetupStatusPaneL() |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CATConfigurationAppGuiSettingItemListView::SetupStatusPaneL() |
|
215 { |
|
216 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::SetupStatusPaneL()" ); |
|
217 |
|
218 // Reset the context pane |
|
219 TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext ); |
|
220 CEikStatusPaneBase::TPaneCapabilities subPaneContext = |
|
221 StatusPane()->PaneCapabilities( contextPaneUid ); |
|
222 if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() ) |
|
223 { |
|
224 CAknContextPane* context = static_cast< CAknContextPane* > ( |
|
225 StatusPane()->ControlL( contextPaneUid ) ); |
|
226 context->SetPictureToDefaultL(); |
|
227 } |
|
228 |
|
229 // Setup the title pane |
|
230 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
231 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
232 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
233 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
234 { |
|
235 CAknTitlePane* title = static_cast< CAknTitlePane* >( |
|
236 StatusPane()->ControlL( titlePaneUid ) ); |
|
237 TResourceReader reader; |
|
238 iEikonEnv->CreateResourceReaderLC( reader, R_ATCONFIGURATION_APP_GUI_SETTINGS_TITLE_RESOURCE ); |
|
239 title->SetFromResourceL( reader ); |
|
240 CleanupStack::PopAndDestroy(); // Reader internal state |
|
241 } |
|
242 |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CATConfigurationAppGuiSettingItemListView::CleanupStatusPane() |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 void CATConfigurationAppGuiSettingItemListView::CleanupStatusPane() |
|
250 { |
|
251 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::CleanupStatusPane()" ); |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CATConfigurationAppGuiSettingItemListView::HandleChangeSelectedSettingItemL() |
|
256 // Handle the selected event. |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 TBool CATConfigurationAppGuiSettingItemListView::HandleChangeSelectedSettingItemL( |
|
260 TInt /*aCommand*/ ) |
|
261 { |
|
262 LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemListView::HandleChangeSelectedSettingItemL()" ); |
|
263 |
|
264 iATConfigUISettingItemList->ChangeSelectedItemL(); |
|
265 return ETrue; |
|
266 } |
|
267 |
|
268 // End of File |