28 #include <AknIconArray.h> |
27 #include <AknIconArray.h> |
29 #include <eikclbd.h> |
28 #include <eikclbd.h> |
30 #include <akncontext.h> |
29 #include <akncontext.h> |
31 #include <akntitle.h> |
30 #include <akntitle.h> |
32 #include <FreestyleEmailUi.rsg> |
31 #include <FreestyleEmailUi.rsg> |
33 //<cmail> |
|
34 #include <featmgr.h> |
32 #include <featmgr.h> |
35 //</cmail> |
33 #include <aknstyluspopupmenu.h> |
36 |
34 |
37 #include "CFSMailCommon.h" |
35 #include "CFSMailCommon.h" |
38 #include "CFSMailBox.h" |
36 #include "CFSMailBox.h" |
39 #include "ESMailSettingsPlugin.h" |
37 #include "ESMailSettingsPlugin.h" |
40 #include "ESMailSettingsPluginUids.hrh" |
38 #include "ESMailSettingsPluginUids.hrh" |
41 //</cmail> |
|
42 #include <gsfwviewuids.h> // Uids for general settings activation |
39 #include <gsfwviewuids.h> // Uids for general settings activation |
43 // <cmail> |
|
44 #include <csxhelp/cmail.hlp.hrh> |
40 #include <csxhelp/cmail.hlp.hrh> |
45 // </cmail> |
|
46 |
41 |
47 // LOCAL INCLUDES |
42 // LOCAL INCLUDES |
48 #include "FreestyleEmailUiUtilities.h" |
43 #include "FreestyleEmailUiUtilities.h" |
49 #include "FreestyleEmailUiSettingsListView.h" |
44 #include "FreestyleEmailUiSettingsListView.h" |
50 #include "FreestyleEmailUiSettingsList.h" |
45 #include "FreestyleEmailUiSettingsList.h" |
59 // --------------------------------------------------------------------------- |
54 // --------------------------------------------------------------------------- |
60 // First phase of Symbian two-phase construction. Should not contain any |
55 // First phase of Symbian two-phase construction. Should not contain any |
61 // code that could leave. |
56 // code that could leave. |
62 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
63 // |
58 // |
64 CFsEmailSettingsListView::CFsEmailSettingsListView( CAlfControlGroup& aControlGroup, |
59 CFsEmailSettingsListView::CFsEmailSettingsListView( |
65 CFreestyleEmailUiAppUi& aAppUi, CFSMailClient& aMailClient ) |
60 CAlfControlGroup& aControlGroup, |
66 : CFsEmailUiViewBase( aControlGroup, aAppUi ), iMailClient( aMailClient ) |
61 CFreestyleEmailUiAppUi& aAppUi, |
67 { |
62 CFSMailClient& aMailClient ) |
68 FUNC_LOG; |
63 : CFsEmailUiViewBase( aControlGroup, aAppUi ), |
69 |
64 iMailClient( aMailClient ), |
|
65 iMailboxSettings( EFalse ) |
|
66 { |
|
67 FUNC_LOG; |
70 iFsEmailSettingsList = NULL; |
68 iFsEmailSettingsList = NULL; |
71 iMailboxSettings = EFalse; |
|
72 |
|
73 } |
69 } |
74 |
70 |
75 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
76 // ~CFsEmailSettingsListView |
72 // ~CFsEmailSettingsListView |
77 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
78 // |
74 // |
79 CFsEmailSettingsListView::~CFsEmailSettingsListView() |
75 CFsEmailSettingsListView::~CFsEmailSettingsListView() |
80 { |
76 { |
81 FUNC_LOG; |
77 FUNC_LOG; |
|
78 |
82 if ( iAsyncCallback ) |
79 if ( iAsyncCallback ) |
83 { |
80 { |
84 iAsyncCallback->Cancel(); |
81 iAsyncCallback->Cancel(); |
85 delete iAsyncCallback; |
82 delete iAsyncCallback; |
86 } |
83 } |
|
84 |
|
85 if ( iStylusPopUpMenu ) |
|
86 { |
|
87 delete iStylusPopUpMenu; |
|
88 iStylusPopUpMenu = NULL; |
|
89 } |
87 } |
90 } |
88 |
91 |
89 |
92 |
90 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
91 // Symbian two-phase constructor. |
94 // Symbian two-phase constructor. |
120 CAlfControlGroup& aControlGroup ) |
124 CAlfControlGroup& aControlGroup ) |
121 { |
125 { |
122 FUNC_LOG; |
126 FUNC_LOG; |
123 |
127 |
124 CFsEmailSettingsListView* self = |
128 CFsEmailSettingsListView* self = |
125 new ( ELeave ) CFsEmailSettingsListView( aControlGroup, *aAppUi, aMailClient ); |
129 new ( ELeave ) CFsEmailSettingsListView( |
|
130 aControlGroup, *aAppUi, aMailClient ); |
126 CleanupStack::PushL( self ); |
131 CleanupStack::PushL( self ); |
127 self->ConstructL(); |
132 self->ConstructL(); |
128 |
133 |
129 return self; |
134 return self; |
130 } |
135 } |
131 |
136 |
132 |
137 |
133 /** |
138 // --------------------------------------------------------------------------- |
134 * Second-phase constructor for view. |
139 // Second-phase constructor for view. |
135 * Initialize contents from resource. |
140 // Initialize contents from resource. |
136 */ |
141 // --------------------------------------------------------------------------- |
|
142 // |
137 void CFsEmailSettingsListView::ConstructL() |
143 void CFsEmailSettingsListView::ConstructL() |
138 { |
144 { |
139 FUNC_LOG; |
145 FUNC_LOG; |
140 |
146 |
141 BaseConstructL( R_FS_EMAIL_SETTINGS_LIST_VIEW ); |
147 BaseConstructL( R_FS_EMAIL_SETTINGS_LIST_VIEW ); |
142 |
148 |
143 iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard ); |
149 iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard ); |
144 iAsyncCallback->Set( TCallBack( DisplayCreateQuery, this ) ); |
150 iAsyncCallback->Set( TCallBack( DisplayCreateQuery, this ) ); |
145 |
|
146 } |
151 } |
147 |
152 |
148 // ----------------------------------------------------------------------------- |
153 // ----------------------------------------------------------------------------- |
149 // CFsEmailSettingsListView::DisplayCreateQuery |
154 // CFsEmailSettingsListView::DisplayCreateQuery |
150 // ----------------------------------------------------------------------------- |
155 // ----------------------------------------------------------------------------- |
|
156 // |
151 void CFsEmailSettingsListView::StartMailboxAsyncQueryL() |
157 void CFsEmailSettingsListView::StartMailboxAsyncQueryL() |
152 { |
158 { |
153 FUNC_LOG; |
159 FUNC_LOG; |
|
160 |
154 if ( iAsyncCallback ) |
161 if ( iAsyncCallback ) |
155 { |
162 { |
156 iAsyncCallback->CallBack(); |
163 iAsyncCallback->CallBack(); |
157 } |
164 } |
158 } |
165 } |
159 |
166 |
160 |
167 |
161 // ----------------------------------------------------------------------------- |
168 // ----------------------------------------------------------------------------- |
|
169 // CFsEmailSettingsListView::DisplayStylusPopUpMenu() |
|
170 // Displays the pop-up menu. |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 void CFsEmailSettingsListView::DisplayStylusPopUpMenu( const TPoint& aPosition ) |
|
174 { |
|
175 if ( iStylusPopUpMenu ) |
|
176 { |
|
177 iStylusPopUpMenu->SetPosition( aPosition ); |
|
178 iStylusPopUpMenu->ShowMenu(); |
|
179 } |
|
180 } |
|
181 |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
162 // CFsEmailSettingsListView::DisplayCreateQuery |
184 // CFsEmailSettingsListView::DisplayCreateQuery |
163 // ----------------------------------------------------------------------------- |
185 // ----------------------------------------------------------------------------- |
|
186 // |
164 TInt CFsEmailSettingsListView::DisplayCreateQuery( TAny* aViewPtr ) |
187 TInt CFsEmailSettingsListView::DisplayCreateQuery( TAny* aViewPtr ) |
165 { |
188 { |
166 FUNC_LOG; |
189 FUNC_LOG; |
167 CFsEmailSettingsListView* self = static_cast<CFsEmailSettingsListView*>( aViewPtr ); |
190 CFsEmailSettingsListView* self = |
|
191 static_cast<CFsEmailSettingsListView*>( aViewPtr ); |
168 TRAPD( err, self->DisplayCreateMailboxNoteIfNeededL() ); |
192 TRAPD( err, self->DisplayCreateMailboxNoteIfNeededL() ); |
169 return err; |
193 return err; |
170 } |
194 } |
171 |
195 |
172 // ----------------------------------------------------------------------------- |
196 // ----------------------------------------------------------------------------- |
173 // CFsEmailSettingsListView::DisplayCreateQueryL |
197 // CFsEmailSettingsListView::DisplayCreateQueryL |
174 // ----------------------------------------------------------------------------- |
198 // ----------------------------------------------------------------------------- |
|
199 // |
175 void CFsEmailSettingsListView::DisplayCreateMailboxNoteIfNeededL() |
200 void CFsEmailSettingsListView::DisplayCreateMailboxNoteIfNeededL() |
176 { |
201 { |
177 FUNC_LOG; |
202 FUNC_LOG; |
178 User::LeaveIfNull( iFsEmailSettingsList ); |
203 User::LeaveIfNull( iFsEmailSettingsList ); |
179 iFsEmailSettingsList->DisplayCreateMailboxNoteIfNeededL(); |
204 iFsEmailSettingsList->DisplayCreateMailboxNoteIfNeededL(); |
180 } |
205 } |
181 |
206 |
182 /** |
207 // ----------------------------------------------------------------------------- |
183 * @return The UID for this view |
208 // CFsEmailSettingsListView::Id() |
184 */ |
209 // From CAknView. |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
185 TUid CFsEmailSettingsListView::Id() const |
212 TUid CFsEmailSettingsListView::Id() const |
186 { |
213 { |
187 FUNC_LOG; |
214 FUNC_LOG; |
188 return SettingsViewId; |
215 return SettingsViewId; |
189 } |
216 } |
190 |
217 |
191 /** |
218 // ----------------------------------------------------------------------------- |
192 * Handle a command for this view (override) |
219 // CFsEmailSettingsListView::HandleCommandL() |
193 * @param aCommand command id to be handled |
220 // From CAknView. |
194 */ |
221 // ----------------------------------------------------------------------------- |
|
222 // |
195 void CFsEmailSettingsListView::HandleCommandL( TInt aCommand ) |
223 void CFsEmailSettingsListView::HandleCommandL( TInt aCommand ) |
196 { |
224 { |
197 FUNC_LOG; |
225 FUNC_LOG; |
198 |
226 |
199 switch ( aCommand ) |
227 switch ( aCommand ) |
213 else |
241 else |
214 { |
242 { |
215 // navigate away from settings |
243 // navigate away from settings |
216 NavigateBackL(); |
244 NavigateBackL(); |
217 } |
245 } |
|
246 |
218 break; |
247 break; |
219 } |
248 } |
220 case EAknSoftkeyOpen: |
249 case EAknSoftkeyOpen: |
221 case EFsEmailUiCmdOpen: |
250 case EFsEmailUiCmdOpen: |
222 { |
251 { |
223 iFsEmailSettingsList->HandleUserSelectionsL(); |
252 iFsEmailSettingsList->HandleUserSelectionsL(); |
224 SetupStatusPaneL(); |
253 SetupStatusPaneL(); |
225 break; |
254 break; |
226 } |
255 } |
227 case EFsEmailUiCmdSettingsAddAccount: |
256 case EFsEmailUiCmdSettingsAddAccount: |
|
257 { |
228 iFsEmailSettingsList->AddAccountL(); |
258 iFsEmailSettingsList->AddAccountL(); |
229 break; |
259 break; |
|
260 } |
230 case EFsEmailUiCmdSettingsRemoveAccount: |
261 case EFsEmailUiCmdSettingsRemoveAccount: |
|
262 case EFsEmailUiCmdDeleteSelectedMailbox: // From the pop-up menu. |
|
263 { |
231 iFsEmailSettingsList->RemoveAccountL(); |
264 iFsEmailSettingsList->RemoveAccountL(); |
232 break; |
265 iFsEmailSettingsList->ClearFocus(); |
|
266 break; |
|
267 } |
233 case EFsEmailUiCmdHelp: |
268 case EFsEmailUiCmdHelp: |
|
269 { |
234 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
270 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
235 break; |
271 break; |
|
272 } |
236 case EFsEmailUiCmdExit: |
273 case EFsEmailUiCmdExit: |
|
274 { |
237 AppUi()->HandleCommandL( EEikCmdExit ); |
275 AppUi()->HandleCommandL( EEikCmdExit ); |
238 break; |
276 break; |
|
277 } |
239 case EFsEmailUiCmdGoToTop: |
278 case EFsEmailUiCmdGoToTop: |
|
279 { |
240 iFsEmailSettingsList->GoToTop(); |
280 iFsEmailSettingsList->GoToTop(); |
241 break; |
281 break; |
|
282 } |
242 case EFsEmailUiCmdGoToBottom: |
283 case EFsEmailUiCmdGoToBottom: |
|
284 { |
243 iFsEmailSettingsList->GoToBottom(); |
285 iFsEmailSettingsList->GoToBottom(); |
244 break; |
286 break; |
|
287 } |
245 case EFsEmailUiCmdPageUp: |
288 case EFsEmailUiCmdPageUp: |
|
289 { |
246 iFsEmailSettingsList->PageUp(); |
290 iFsEmailSettingsList->PageUp(); |
247 break; |
291 break; |
|
292 } |
248 case EFsEmailUiCmdPageDown: |
293 case EFsEmailUiCmdPageDown: |
|
294 { |
249 iFsEmailSettingsList->PageDown(); |
295 iFsEmailSettingsList->PageDown(); |
250 break; |
296 break; |
|
297 } |
|
298 case KErrCancel: |
|
299 { |
|
300 // The pop-up menu was cancelled. |
|
301 iFsEmailSettingsList->ClearFocus(); |
|
302 break; |
|
303 } |
251 default: |
304 default: |
|
305 { |
252 break; |
306 break; |
253 } |
307 } |
254 } |
308 } // switch ( aCommand ) |
255 |
309 } |
256 /** |
310 |
257 * Handles user actions during activation of the view, |
311 |
258 * such as initializing the content. |
312 // ----------------------------------------------------------------------------- |
259 */ |
313 // CFsEmailSettingsListView::ChildDoActivateL() |
260 // <cmail> Toolbar |
314 // From CFsEmailUiViewBase. |
261 /*void CFsEmailSettingsListView::DoActivateL( |
315 // ----------------------------------------------------------------------------- |
262 const TVwsViewId& aPrevViewId, |
316 // |
263 TUid aCustomMessageId, |
|
264 const TDesC8& aCustomMessage )*/ |
|
265 void CFsEmailSettingsListView::ChildDoActivateL( |
317 void CFsEmailSettingsListView::ChildDoActivateL( |
266 const TVwsViewId& aPrevViewId, |
318 const TVwsViewId& aPrevViewId, |
267 TUid aCustomMessageId, |
319 TUid aCustomMessageId, |
268 const TDesC8& aCustomMessage ) |
320 const TDesC8& aCustomMessage ) |
269 // </cmail> Toolbar |
|
270 { |
321 { |
271 FUNC_LOG; |
322 FUNC_LOG; |
272 |
323 |
273 if ( aCustomMessageId.iUid != KMailSettingsReturnToPrevious && |
324 if ( aCustomMessageId.iUid != KMailSettingsReturnToPrevious && |
274 aCustomMessageId.iUid != KMailSettingsReturnFromPluginSettings ) |
325 aCustomMessageId.iUid != KMailSettingsReturnFromPluginSettings ) |
411 iFsEmailSettingsList->CreateAccountListL(); |
462 iFsEmailSettingsList->CreateAccountListL(); |
412 } |
463 } |
413 } |
464 } |
414 // setup status pane title |
465 // setup status pane title |
415 SetupStatusPaneL(); |
466 SetupStatusPaneL(); |
416 |
467 |
|
468 if( !iStylusPopUpMenu ) |
|
469 { |
|
470 // Construct the long tap pop-up menu. |
|
471 TPoint point( 0, 0 ); |
|
472 iStylusPopUpMenu = CAknStylusPopUpMenu::NewL( this , point ); |
|
473 TResourceReader reader; |
|
474 iCoeEnv->CreateResourceReaderLC( reader, |
|
475 R_STYLUS_POPUP_MENU_LAUNCHER_GRID_VIEW ); |
|
476 iStylusPopUpMenu->ConstructFromResourceL( reader ); |
|
477 CleanupStack::PopAndDestroy(); // reader |
|
478 } |
|
479 |
417 // Make a deferred call to show the "create mailbox" query if we opened the main settings list |
480 // Make a deferred call to show the "create mailbox" query if we opened the main settings list |
418 if ( aCustomMessageId.iUid == KMailSettingsOpenMainList || |
481 if ( aCustomMessageId.iUid == KMailSettingsOpenMainList || |
419 aCustomMessageId.iUid == KOpenMailSettingsFromGS ) |
482 aCustomMessageId.iUid == KOpenMailSettingsFromGS ) |
420 { |
483 { |
421 StartMailboxAsyncQueryL(); |
484 StartMailboxAsyncQueryL(); |
422 } |
485 } |
|
486 |
423 iAppUi.HideTitlePaneConnectionStatus(); |
487 iAppUi.HideTitlePaneConnectionStatus(); |
424 } |
488 } |
425 |
489 |
426 // --------------------------------------------------------------------------- |
490 // --------------------------------------------------------------------------- |
427 // ChildDoDeactivate |
491 // ChildDoDeactivate |
527 iAppUi.SetTitlePaneTextL( *text ); |
591 iAppUi.SetTitlePaneTextL( *text ); |
528 CleanupStack::PopAndDestroy( text ); |
592 CleanupStack::PopAndDestroy( text ); |
529 |
593 |
530 } |
594 } |
531 |
595 |
532 /** |
596 // --------------------------------------------------------------------------- |
533 * Sets application default title when leaving this view |
597 // CleanupStatusPaneL() |
534 */ |
598 // Sets application default title when leaving this view |
|
599 // --------------------------------------------------------------------------- |
|
600 // |
535 void CFsEmailSettingsListView::CleanupStatusPaneL() |
601 void CFsEmailSettingsListView::CleanupStatusPaneL() |
536 { |
602 { |
537 FUNC_LOG; |
603 FUNC_LOG; |
538 iAppUi.ResetTitlePaneTextL(); |
604 iAppUi.ResetTitlePaneTextL(); |
539 } |
605 } |
540 |
606 |
541 |
607 |
542 /** |
608 // --------------------------------------------------------------------------- |
543 * Handle status pane size change for this view (override) |
609 // HandleStatusPaneSizeChange() |
544 */ |
610 // From CAknView. |
|
611 // Handle status pane size change for this view (override). |
|
612 // --------------------------------------------------------------------------- |
|
613 // |
545 void CFsEmailSettingsListView::HandleStatusPaneSizeChange() |
614 void CFsEmailSettingsListView::HandleStatusPaneSizeChange() |
546 { |
615 { |
547 FUNC_LOG; |
616 FUNC_LOG; |
548 if ( IsForeground() ) |
617 if ( IsForeground() ) |
549 { |
618 { |