|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Freestyle Email implementation file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 #include "emailtrace.h" |
|
21 #include <aknViewAppUi.h> |
|
22 #include <eikmenub.h> |
|
23 #include <avkon.hrh> |
|
24 #include <akncontext.h> |
|
25 #include <akntitle.h> |
|
26 #include <StringLoader.h> |
|
27 #include <barsread.h> |
|
28 #include <FreestyleEmailUi.rsg> |
|
29 // <cmail> |
|
30 #include <csxhelp/cmail.hlp.hrh> |
|
31 // </cmail> |
|
32 #include <featmgr.h> |
|
33 //</cmail> |
|
34 |
|
35 // LOCAL INCLUDES |
|
36 #include "FreestyleEmailUiUtilities.h" |
|
37 #include "FreestyleEmailUiGlobalSettings.hrh" |
|
38 #include "FreestyleEmailUiGlobalSettingsListView.h" |
|
39 #include "FreestyleEmailUiGlobalSettingsList.h" |
|
40 #include "FreestyleEmailUiGlobalSettingsData.h" |
|
41 #include "FreestyleEmailUiAppui.h" |
|
42 #include "FreestyleEmailUiConstants.h" |
|
43 #include "FreestyleEmailUiShortcutBinding.h" |
|
44 #include "FSEmail.pan" |
|
45 |
|
46 /** |
|
47 * First phase of Symbian two-phase construction. Should not contain any |
|
48 * code that could leave. |
|
49 */ |
|
50 CFsEmailUiGlobalSettingsListView::CFsEmailUiGlobalSettingsListView( CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aControlGroup ) |
|
51 : CFsEmailUiViewBase( aControlGroup, *aAppUi ) |
|
52 { |
|
53 FUNC_LOG; |
|
54 } |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 CFsEmailUiGlobalSettingsListView::~CFsEmailUiGlobalSettingsListView() |
|
60 { |
|
61 FUNC_LOG; |
|
62 } |
|
63 |
|
64 /** |
|
65 * Symbian two-phase constructor. |
|
66 * This creates an instance then calls the second-phase constructor |
|
67 * without leaving the instance on the cleanup stack. |
|
68 * @return new instance of CFsEmailUiGlobalSettingsListView |
|
69 */ |
|
70 CFsEmailUiGlobalSettingsListView* CFsEmailUiGlobalSettingsListView::NewL( |
|
71 CFreestyleEmailUiAppUi* aAppUi, |
|
72 CAlfControlGroup& aControlGroup ) |
|
73 { |
|
74 FUNC_LOG; |
|
75 |
|
76 CFsEmailUiGlobalSettingsListView* self = CFsEmailUiGlobalSettingsListView::NewLC( aAppUi, aControlGroup ); |
|
77 CleanupStack::Pop( self ); |
|
78 |
|
79 return self; |
|
80 } |
|
81 |
|
82 /** |
|
83 * Symbian two-phase constructor. |
|
84 * This creates an instance, pushes it on the cleanup stack, |
|
85 * then calls the second-phase constructor. |
|
86 * @return new instance of CFsEmailUiGlobalSettingsListView |
|
87 */ |
|
88 CFsEmailUiGlobalSettingsListView* CFsEmailUiGlobalSettingsListView::NewLC( |
|
89 CFreestyleEmailUiAppUi* aAppUi, |
|
90 CAlfControlGroup& aControlGroup ) |
|
91 { |
|
92 FUNC_LOG; |
|
93 |
|
94 CFsEmailUiGlobalSettingsListView* self = new ( ELeave ) CFsEmailUiGlobalSettingsListView( aAppUi, aControlGroup ); |
|
95 CleanupStack::PushL( self ); |
|
96 self->ConstructL(); |
|
97 |
|
98 return self; |
|
99 } |
|
100 |
|
101 |
|
102 /** |
|
103 * Second-phase constructor for view. |
|
104 * Initialize contents from resource. |
|
105 */ |
|
106 void CFsEmailUiGlobalSettingsListView::ConstructL() |
|
107 { |
|
108 FUNC_LOG; |
|
109 |
|
110 BaseConstructL( R_GLOBAL_SETTINGS_LIST_VIEW ); |
|
111 |
|
112 } |
|
113 |
|
114 /** |
|
115 * @return The UID for this view |
|
116 */ |
|
117 TUid CFsEmailUiGlobalSettingsListView::Id() const |
|
118 { |
|
119 FUNC_LOG; |
|
120 return GlobalSettingsViewId; |
|
121 } |
|
122 |
|
123 void CFsEmailUiGlobalSettingsListView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
124 { |
|
125 FUNC_LOG; |
|
126 if ( aResourceId == R_GLOBAL_SETTINGS_MENU_PANE ) |
|
127 { |
|
128 |
|
129 if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
|
130 { |
|
131 // remove help support in pf5250 |
|
132 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
133 } |
|
134 |
|
135 // Dim "Open" or "Change" depending on the focused item |
|
136 TInt focusedId = iGlobalSettingsSettingItemList->FocusedItemId(); |
|
137 if ( focusedId == EGlobalSettingsActiveIdle ) |
|
138 { |
|
139 aMenuPane->SetItemDimmed( EFsEmailUiCmdChange, ETrue ); |
|
140 } |
|
141 else |
|
142 { |
|
143 aMenuPane->SetItemDimmed( EFsEmailUiCmdOpen, ETrue ); |
|
144 } |
|
145 |
|
146 // Add shortcut hints |
|
147 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
|
148 CFSEmailUiShortcutBinding::EContextSettings ); |
|
149 } |
|
150 } |
|
151 |
|
152 /** |
|
153 * Handle a command for this view (override) |
|
154 * @param aCommand command id to be handled |
|
155 */ |
|
156 void CFsEmailUiGlobalSettingsListView::HandleCommandL( TInt aCommand ) |
|
157 { |
|
158 FUNC_LOG; |
|
159 |
|
160 switch ( aCommand ) |
|
161 { |
|
162 case EAknSoftkeyBack: |
|
163 iAppUi.ReturnToPreviousViewL(); |
|
164 break; |
|
165 case EFsEmailUiCmdChange: |
|
166 case EAknSoftkeyChange: |
|
167 case EFsEmailUiCmdOpen: |
|
168 case EAknSoftkeyOpen: |
|
169 HandleChangeSelectedSettingItemL( aCommand ); |
|
170 break; |
|
171 case EFsEmailUiCmdHelp: |
|
172 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
173 break; |
|
174 case EFsEmailUiCmdExit: |
|
175 case EEikCmdExit: |
|
176 case EAknCmdExit: |
|
177 AppUi()->HandleCommandL( EEikCmdExit ); |
|
178 break; |
|
179 case EFsEmailUiCmdGoToTop: |
|
180 iGlobalSettingsSettingItemList->GoToTop(); |
|
181 break; |
|
182 case EFsEmailUiCmdGoToBottom: |
|
183 iGlobalSettingsSettingItemList->GoToBottom(); |
|
184 break; |
|
185 case EFsEmailUiCmdPageUp: |
|
186 iGlobalSettingsSettingItemList->PageUp(); |
|
187 break; |
|
188 case EFsEmailUiCmdPageDown: |
|
189 iGlobalSettingsSettingItemList->PageDown(); |
|
190 break; |
|
191 default: |
|
192 __ASSERT_DEBUG( EFalse, Panic(EFSEmailUiUnexpectedValue) ); |
|
193 break; |
|
194 } |
|
195 } |
|
196 |
|
197 /** |
|
198 * Set MSK label depending on the currently focused item |
|
199 */ |
|
200 void CFsEmailUiGlobalSettingsListView::SetMskL() |
|
201 { |
|
202 FUNC_LOG; |
|
203 if ( iGlobalSettingsSettingItemList ) |
|
204 { |
|
205 TInt focusedId = iGlobalSettingsSettingItemList->FocusedItemId(); |
|
206 if ( focusedId == EGlobalSettingsActiveIdle ) |
|
207 { |
|
208 ChangeMskCommandL( R_FSE_QTN_MSK_OPEN ); |
|
209 } |
|
210 else |
|
211 { |
|
212 ChangeMskCommandL( R_FSE_QTN_MSK_CHANGE ); |
|
213 } |
|
214 } |
|
215 } |
|
216 |
|
217 /** |
|
218 * Handles actions during activation of the view, |
|
219 * such as initializing the content. |
|
220 */ |
|
221 // <cmail> Toolbar |
|
222 /*void CFsEmailUiGlobalSettingsListView::DoActivateL( |
|
223 const TVwsViewId& aPrevViewId, |
|
224 TUid aCustomMessageId, |
|
225 const TDesC8& aCustomMessage )*/ |
|
226 void CFsEmailUiGlobalSettingsListView::ChildDoActivateL( |
|
227 const TVwsViewId& /*aPrevViewId*/, |
|
228 TUid /*aCustomMessageId*/, |
|
229 const TDesC8& /*aCustomMessage*/ ) |
|
230 // </cmail> Toolbar |
|
231 { |
|
232 FUNC_LOG; |
|
233 |
|
234 SetupStatusPaneL(); |
|
235 |
|
236 if ( !iGlobalSettingsSettingItemList ) |
|
237 { |
|
238 iSettings = CFsEmailUiGlobalSettingsData::NewL(); |
|
239 iGlobalSettingsSettingItemList = new ( ELeave ) CFsEmailUiGlobalSettingsList( *iSettings, this ); |
|
240 iGlobalSettingsSettingItemList->SetMopParent( this ); |
|
241 iGlobalSettingsSettingItemList->ConstructFromResourceL( R_GLOBAL_SETTINGS_ITEM_LIST ); |
|
242 iGlobalSettingsSettingItemList->ActivateL(); |
|
243 iGlobalSettingsSettingItemList->LoadSettingValuesL(); |
|
244 iGlobalSettingsSettingItemList->LoadSettingsL(); |
|
245 AppUi()->AddToStackL( *this, iGlobalSettingsSettingItemList ); |
|
246 } |
|
247 iAppUi.HideTitlePaneConnectionStatus(); |
|
248 |
|
249 } |
|
250 |
|
251 /** |
|
252 * ChildDoDeactivate |
|
253 * From CFsEmailUiViewBase (override) |
|
254 */ |
|
255 void CFsEmailUiGlobalSettingsListView::ChildDoDeactivate() |
|
256 { |
|
257 FUNC_LOG; |
|
258 |
|
259 if ( iGlobalSettingsSettingItemList ) |
|
260 { |
|
261 AppUi()->RemoveFromStack( iGlobalSettingsSettingItemList ); |
|
262 delete iGlobalSettingsSettingItemList; |
|
263 iGlobalSettingsSettingItemList = NULL; |
|
264 delete iSettings; |
|
265 iSettings = NULL; |
|
266 } |
|
267 |
|
268 } |
|
269 |
|
270 /** |
|
271 * SetupStatusPaneL |
|
272 * From CAknView |
|
273 */ |
|
274 void CFsEmailUiGlobalSettingsListView::SetupStatusPaneL() |
|
275 { |
|
276 FUNC_LOG; |
|
277 |
|
278 // reset the context pane |
|
279 TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext ); |
|
280 CEikStatusPaneBase::TPaneCapabilities subPaneContext = |
|
281 StatusPane()->PaneCapabilities( contextPaneUid ); |
|
282 if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() ) |
|
283 { |
|
284 CAknContextPane* context = static_cast< CAknContextPane* > ( |
|
285 StatusPane()->ControlL( contextPaneUid ) ); |
|
286 context->SetPictureToDefaultL(); |
|
287 } |
|
288 |
|
289 // setup the title pane |
|
290 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
291 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
292 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
293 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
294 { |
|
295 CAknTitlePane* title = static_cast< CAknTitlePane* >( |
|
296 StatusPane()->ControlL( titlePaneUid ) ); |
|
297 TResourceReader reader; |
|
298 iEikonEnv->CreateResourceReaderLC( reader, R_GLOBAL_SETTINGS_TITLE_RESOURCE ); |
|
299 title->SetFromResourceL( reader ); |
|
300 CleanupStack::PopAndDestroy(); // reader internal state |
|
301 } |
|
302 |
|
303 } |
|
304 |
|
305 /** |
|
306 * CleanupStatusPaneL |
|
307 * Change status pane title back to default |
|
308 */ |
|
309 void CFsEmailUiGlobalSettingsListView::CleanupStatusPaneL() |
|
310 { |
|
311 FUNC_LOG; |
|
312 iAppUi.ResetTitlePaneTextL(); |
|
313 } |
|
314 |
|
315 |
|
316 /** |
|
317 * Handle status pane size change for this view (override) |
|
318 * |
|
319 */ |
|
320 void CFsEmailUiGlobalSettingsListView::HandleStatusPaneSizeChange() |
|
321 { |
|
322 FUNC_LOG; |
|
323 if ( IsForeground() ) |
|
324 { |
|
325 CAknView::HandleStatusPaneSizeChange(); |
|
326 |
|
327 // this may fail, but we're not able to propagate exceptions here |
|
328 TRAPD( err, SetupStatusPaneL() ); |
|
329 if (err) |
|
330 { |
|
331 } |
|
332 } |
|
333 } |
|
334 |
|
335 |
|
336 /** |
|
337 * Handle the selected event. |
|
338 * @param aCommand the command id invoked |
|
339 * @return ETrue if the command was handled, EFalse if not |
|
340 */ |
|
341 TBool CFsEmailUiGlobalSettingsListView::HandleChangeSelectedSettingItemL( TInt aCommand ) |
|
342 { |
|
343 FUNC_LOG; |
|
344 |
|
345 TBool calledFromMenu = |
|
346 ( aCommand != EAknSoftkeyChange && aCommand != EAknSoftkeyOpen ); |
|
347 iGlobalSettingsSettingItemList->ChangeSelectedItemL( calledFromMenu ); |
|
348 |
|
349 return ETrue; |
|
350 } |
|
351 |