|
1 /* |
|
2 * Copyright (c) 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: This file implements classes CPIMSettingItemListDlg, CFsEmailSettingsList. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 #include "emailtrace.h" |
|
21 #include <barsread.h> |
|
22 #include <StringLoader.h> |
|
23 #include <aknlists.h> |
|
24 #include <eikenv.h> |
|
25 #include <AknIconArray.h> |
|
26 #include <eikclbd.h> |
|
27 #include <aknViewAppUi.h> |
|
28 #include <eikappui.h> |
|
29 #include <aknlistquerydialog.h> |
|
30 #include <e32cmn.h> |
|
31 #include <FreestyleEmailUi.rsg> |
|
32 //<cmail> |
|
33 #include "CFSMailClient.h" |
|
34 #include "CFSMailBox.h" |
|
35 #include <AknGlobalConfirmationQuery.h> // confirmation |
|
36 #include <freestyleemailui.mbg> // icons |
|
37 #include "ESMailSettingsPluginUids.hrh" |
|
38 #include "ESMailSettingsPlugin.h" |
|
39 //</cmail> |
|
40 #include <aknnotewrappers.h> // for note |
|
41 #include <AknDialog.h> // for settings dialog |
|
42 #include <aknsettingitemlist.h> // for settings dialog |
|
43 |
|
44 // 9.11.2009: Temporary flagging SYMBIAN_ENABLE_SPLIT_HEADERS |
|
45 // Can be removed when header structure change is complete |
|
46 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
47 #include <eikctrlstatus.h> // EEikControlHasEars |
|
48 #else |
|
49 #include <uikon/eikctrlstatus.h> // EEikControlHasEars |
|
50 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS |
|
51 |
|
52 // LOCAL INCLUDES |
|
53 #include "FreestyleEmailUiConstants.h" |
|
54 #include "FreestyleEmailUiSettingsListView.h" |
|
55 #include "FreestyleEmailUiSettingsList.h" |
|
56 #include "FreestyleEmailUiSettings.hrh" |
|
57 #include "FreestyleEmailUiConstants.h" |
|
58 #include "FreestyleEmailUiAppui.h" |
|
59 #include "FreestyleEmailUiLauncherGridVisualiser.h" |
|
60 #include "FreestyleEmailUiShortcutBinding.h" |
|
61 #include "FreestyleEmailUiUtilities.h" |
|
62 #include "FSEmail.pan" |
|
63 |
|
64 // CONSTANTS |
|
65 |
|
66 |
|
67 //** PIM selection dialog ** |
|
68 |
|
69 //---------------------------------------------------------------------------- |
|
70 // CPIMSettingsItem extends |
|
71 //---------------------------------------------------------------------------- |
|
72 class CPIMSettingsItem : public CAknEnumeratedTextPopupSettingItem |
|
73 { |
|
74 public: |
|
75 void SetDefaultPIM( TInt aNewValue ); |
|
76 }; |
|
77 |
|
78 void CPIMSettingsItem::SetDefaultPIM( TInt aNewValue ) |
|
79 { |
|
80 FUNC_LOG; |
|
81 SetInternalValue( aNewValue ); |
|
82 SetSelectedIndex( aNewValue ); |
|
83 } |
|
84 |
|
85 //---------------------------------------------------------------------------- |
|
86 // CSettingItemList class declaration |
|
87 //---------------------------------------------------------------------------- |
|
88 class CSettingItemList : public CAknSettingItemList |
|
89 { |
|
90 public: |
|
91 CSettingItemList(); |
|
92 |
|
93 virtual CAknSettingItem* CreateSettingItemL(TInt aIdentifier); |
|
94 |
|
95 TInt iItemId; |
|
96 CSettingItemList* iSettingsList; |
|
97 }; |
|
98 |
|
99 //---------------------------------------------------------------------------- |
|
100 // constructor CSettingItemList |
|
101 //---------------------------------------------------------------------------- |
|
102 CSettingItemList::CSettingItemList() |
|
103 { |
|
104 FUNC_LOG; |
|
105 } |
|
106 //---------------------------------------------------------------------------- |
|
107 // CreateSettingItemL |
|
108 //---------------------------------------------------------------------------- |
|
109 CAknSettingItem* CSettingItemList::CreateSettingItemL( TInt aIdentifier ) |
|
110 { |
|
111 FUNC_LOG; |
|
112 CAknSettingItem* settingitem = NULL; |
|
113 |
|
114 switch (aIdentifier) |
|
115 { |
|
116 case 0: |
|
117 { |
|
118 settingitem = new (ELeave) CAknEnumeratedTextPopupSettingItem( aIdentifier, iItemId ); |
|
119 } |
|
120 break; |
|
121 } |
|
122 |
|
123 return settingitem; |
|
124 } |
|
125 |
|
126 //---------------------------------------------------------------------------- |
|
127 // CPIMSettingItemListDlg Class declaration |
|
128 //---------------------------------------------------------------------------- |
|
129 class CPIMSettingItemListDlg : public CAknDialog |
|
130 { |
|
131 public: |
|
132 CPIMSettingItemListDlg( CFSMailClient& aMailClient ); |
|
133 ~CPIMSettingItemListDlg(); |
|
134 virtual SEikControlInfo CreateCustomControlL(TInt aControlType); |
|
135 virtual CPIMSettingItemListDlg::TFormControlTypes ConvertCustomControlTypeToBaseControlType(TInt aControlType) const; |
|
136 |
|
137 virtual void PostLayoutDynInitL(); |
|
138 void AddPIMSettingItemsL( TInt aIndex ); |
|
139 |
|
140 virtual TBool OkToExitL( TInt aButtonId ); |
|
141 |
|
142 protected: |
|
143 CSettingItemList* iSettingsList; |
|
144 CFSMailClient& iMailClient; |
|
145 RArray<TUid> iPluginUids; |
|
146 }; |
|
147 |
|
148 //---------------------------------------------------------------------------- |
|
149 // CPIMSettingItemListDlg |
|
150 //---------------------------------------------------------------------------- |
|
151 CPIMSettingItemListDlg::CPIMSettingItemListDlg( CFSMailClient& aMailClient) |
|
152 : iMailClient(aMailClient) |
|
153 { |
|
154 FUNC_LOG; |
|
155 } |
|
156 |
|
157 //---------------------------------------------------------------------------- |
|
158 // CPIMSettingItemListDlg::~CPIMSettingItemListDlg |
|
159 //---------------------------------------------------------------------------- |
|
160 CPIMSettingItemListDlg::~CPIMSettingItemListDlg( ) |
|
161 { |
|
162 FUNC_LOG; |
|
163 iPluginUids.Close(); |
|
164 } |
|
165 |
|
166 //---------------------------------------------------------------------------- |
|
167 // CreateCustomControlL |
|
168 //---------------------------------------------------------------------------- |
|
169 SEikControlInfo CPIMSettingItemListDlg::CreateCustomControlL(TInt /*aControlType*/) |
|
170 { |
|
171 FUNC_LOG; |
|
172 iSettingsList = new (ELeave) CSettingItemList; |
|
173 |
|
174 SEikControlInfo controlInfo; |
|
175 controlInfo.iFlags = EEikControlHasEars; |
|
176 controlInfo.iTrailerTextId = 0; |
|
177 controlInfo.iControl = iSettingsList; |
|
178 STATIC_CAST(CSettingItemList*, controlInfo.iControl)->SetContainerWindowL(*this); |
|
179 |
|
180 return controlInfo; |
|
181 } |
|
182 |
|
183 //---------------------------------------------------------------------------- |
|
184 // ConvertCustomControlTypeToBaseControlType |
|
185 //---------------------------------------------------------------------------- |
|
186 CPIMSettingItemListDlg::TFormControlTypes CPIMSettingItemListDlg::ConvertCustomControlTypeToBaseControlType(TInt /*aControlType*/) const |
|
187 { |
|
188 FUNC_LOG; |
|
189 return EPopfieldDerived; |
|
190 } |
|
191 |
|
192 //---------------------------------------------------------------------------- |
|
193 // PostLayoutDynInitL |
|
194 // This safely loads the dialog with the data |
|
195 //---------------------------------------------------------------------------- |
|
196 void CPIMSettingItemListDlg::PostLayoutDynInitL() |
|
197 { |
|
198 FUNC_LOG; |
|
199 // there are only one item in list |
|
200 AddPIMSettingItemsL( 0 ); |
|
201 } |
|
202 |
|
203 //---------------------------------------------------------------------------- |
|
204 // AddPIMSettingItemsL |
|
205 // |
|
206 //---------------------------------------------------------------------------- |
|
207 void CPIMSettingItemListDlg::AddPIMSettingItemsL( TInt aIndex ) |
|
208 { |
|
209 FUNC_LOG; |
|
210 CPIMSettingsItem* item = static_cast<CPIMSettingsItem*>( |
|
211 (*iSettingsList->SettingItemArray())[aIndex] ); |
|
212 CArrayPtr<CAknEnumeratedText>* texts = item->EnumeratedTextArray(); |
|
213 texts->ResetAndDestroy(); |
|
214 |
|
215 // Read mailboxes **************************** |
|
216 RPointerArray<CFSMailBox> mailBoxes; |
|
217 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
218 TFSMailMsgId plugin; |
|
219 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
220 |
|
221 TUid PIMpluginId; |
|
222 TInt mailBoxesCount = mailBoxes.Count(); |
|
223 for ( TInt i = 0; i < mailBoxesCount; ++i ) |
|
224 { |
|
225 // get mailbox name and insert it to listBox |
|
226 CFSMailBox* mailBox = mailBoxes[i]; |
|
227 |
|
228 // Insert mailbox to dialog list if can handle PIM sync |
|
229 if ( mailBox->GetSettingsUid() != TUid::Null() ) |
|
230 { |
|
231 TUid pluginUid = mailBox->GetSettingsUid(); |
|
232 CESMailSettingsPlugin* settingsPlugin = |
|
233 CESMailSettingsPlugin::NewL( pluginUid ); |
|
234 CleanupStack::PushL(settingsPlugin); |
|
235 HBufC* itemTxt = |
|
236 settingsPlugin->LocalizedProtocolName().AllocLC(); |
|
237 TBool canHandlePIMSync = settingsPlugin->CanHandlePIMSync(); |
|
238 |
|
239 if ( canHandlePIMSync && PIMpluginId != pluginUid ) |
|
240 { |
|
241 PIMpluginId = pluginUid; |
|
242 iPluginUids.Append( pluginUid ); |
|
243 // takes ownership of itemTxt |
|
244 texts->AppendL( |
|
245 new ( ELeave ) CAknEnumeratedText( i, itemTxt ) ); |
|
246 // set as default item if selected for PIM sync |
|
247 if ( settingsPlugin->IsSelectedForPIMSync() ) |
|
248 { |
|
249 item->SetDefaultPIM( i ); |
|
250 } |
|
251 CleanupStack::Pop( itemTxt ); |
|
252 } |
|
253 else |
|
254 { |
|
255 CleanupStack::PopAndDestroy( itemTxt ); |
|
256 } |
|
257 CleanupStack::PopAndDestroy();//settingsPlugin |
|
258 } |
|
259 } |
|
260 item->UpdateListBoxTextL(); |
|
261 |
|
262 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
263 } |
|
264 |
|
265 //---------------------------------------------------------------------------- |
|
266 // OkToExitL |
|
267 // |
|
268 //---------------------------------------------------------------------------- |
|
269 TBool CPIMSettingItemListDlg::OkToExitL( TInt aButtonId ) |
|
270 { |
|
271 FUNC_LOG; |
|
272 if ( aButtonId == EFSEmailUiPIMDialogBack ) |
|
273 return ETrue; |
|
274 |
|
275 if ( aButtonId == EFSEmailUiPIMDialogChange ) |
|
276 { |
|
277 const TInt current = iSettingsList->ListBox()->CurrentItemIndex(); |
|
278 iSettingsList->EditItemL( current, ETrue ); |
|
279 iSettingsList->StoreSettingsL(); |
|
280 |
|
281 for ( TInt i=0; i < iPluginUids.Count(); ++i ) |
|
282 { |
|
283 CESMailSettingsPlugin* settingsPlugin = CESMailSettingsPlugin::NewL( iPluginUids[i] ); |
|
284 if ( iSettingsList->iItemId == i ) |
|
285 { |
|
286 settingsPlugin->SelectForPIMSync( ETrue ); |
|
287 } |
|
288 else |
|
289 { |
|
290 settingsPlugin->SelectForPIMSync( EFalse ); |
|
291 } |
|
292 delete settingsPlugin; |
|
293 settingsPlugin = NULL; |
|
294 } |
|
295 iPluginUids.Close(); |
|
296 } |
|
297 |
|
298 return EFalse; |
|
299 } |
|
300 |
|
301 |
|
302 //**** CFsEmailSettingsList **** |
|
303 |
|
304 // --------------------------------------------------------------------------- |
|
305 // c++ Constructor |
|
306 // |
|
307 // First phase of Symbian two-phase construction. Should not |
|
308 // contain any code that could leave. |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 CFsEmailSettingsList::CFsEmailSettingsList(CFreestyleEmailUiAppUi& aAppUi, CFSMailClient& aMailClient, CFsEmailSettingsListView& aView ) |
|
312 :iAppUi(aAppUi), iMailClient(aMailClient), iView( aView ) |
|
313 { |
|
314 FUNC_LOG; |
|
315 |
|
316 iListBox = NULL; |
|
317 iCurrentSubView = EFsEmailSettingsMainListView; |
|
318 iPIMListActivation = EFalse; |
|
319 iPIMServiceSettingsSelection = EFalse; |
|
320 iPIMSyncMailboxIndex = -1; |
|
321 iPIMSyncCount = 0; |
|
322 iSelectedSubListIndex = 0; |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // c++ destructor |
|
327 // |
|
328 // Destroy child controls |
|
329 // --------------------------------------------------------------------------- |
|
330 // |
|
331 CFsEmailSettingsList::~CFsEmailSettingsList() |
|
332 { |
|
333 FUNC_LOG; |
|
334 |
|
335 if ( iListBox ) |
|
336 { |
|
337 delete iListBox; |
|
338 iListBox = NULL; |
|
339 } |
|
340 |
|
341 } |
|
342 |
|
343 // --------------------------------------------------------------------------- |
|
344 // Construct the control (first phase). |
|
345 // |
|
346 // @param aRect bounding rectangle |
|
347 // @param aParent owning parent, or NULL |
|
348 // @param aAppUi pointer to AppUi |
|
349 // @param aMailClient reference to freestyle mail client |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 CFsEmailSettingsList* CFsEmailSettingsList::NewL( |
|
353 const TRect& aRect, |
|
354 const CCoeControl* aParent, |
|
355 CFreestyleEmailUiAppUi& aAppUi, |
|
356 CFSMailClient& aMailClient, |
|
357 CFsEmailSettingsListView& aView ) |
|
358 { |
|
359 FUNC_LOG; |
|
360 |
|
361 CFsEmailSettingsList* self = CFsEmailSettingsList::NewLC( |
|
362 aRect, |
|
363 aParent, |
|
364 aAppUi, |
|
365 aMailClient, |
|
366 aView ); |
|
367 CleanupStack::Pop( self ); |
|
368 |
|
369 return self; |
|
370 } |
|
371 |
|
372 // --------------------------------------------------------------------------- |
|
373 // Construct the control (first phase). |
|
374 // |
|
375 // @param aRect bounding rectangle |
|
376 // @param aParent owning parent, or NULL |
|
377 // @param aAppUi pointer to AppUi |
|
378 // @param aMailClient reference to freestyle mail client |
|
379 // --------------------------------------------------------------------------- |
|
380 // |
|
381 CFsEmailSettingsList* CFsEmailSettingsList::NewLC( |
|
382 const TRect& aRect, |
|
383 const CCoeControl* aParent, |
|
384 CFreestyleEmailUiAppUi& aAppUi, |
|
385 CFSMailClient& aMailClient, |
|
386 CFsEmailSettingsListView& aView ) |
|
387 { |
|
388 FUNC_LOG; |
|
389 |
|
390 CFsEmailSettingsList* self = new ( ELeave ) CFsEmailSettingsList(aAppUi, aMailClient, aView ); |
|
391 CleanupStack::PushL( self ); |
|
392 self->ConstructL( aRect, aParent); |
|
393 |
|
394 |
|
395 return self; |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------------------------- |
|
399 // Construct the control (first phase). |
|
400 // |
|
401 // @param aRect bounding rectangle |
|
402 // @param aParent owning parent, or NULL |
|
403 // @param aAppUi pointer to AppUi |
|
404 // @param aMailClient reference to freestyle mail client |
|
405 // --------------------------------------------------------------------------- |
|
406 // |
|
407 void CFsEmailSettingsList::ConstructL( |
|
408 const TRect& aRect, |
|
409 const CCoeControl* aParent) |
|
410 { |
|
411 FUNC_LOG; |
|
412 |
|
413 if ( aParent == NULL ) |
|
414 { |
|
415 CreateWindowL(); |
|
416 } |
|
417 else |
|
418 { |
|
419 SetContainerWindowL( *aParent ); |
|
420 } |
|
421 |
|
422 iFocusControl = NULL; |
|
423 InitializeControlsL(); |
|
424 SetRect( aRect ); |
|
425 ActivateL(); |
|
426 |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // Return the number of controls in the container (override) |
|
431 // @return count |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 TInt CFsEmailSettingsList::CountComponentControls() const |
|
435 { |
|
436 FUNC_LOG; |
|
437 return ( int ) ELastControl; |
|
438 } |
|
439 |
|
440 // --------------------------------------------------------------------------- |
|
441 // Get the control with the given index |
|
442 // @param aIndex Control index [0...n) (limited by #CountComponentControls) |
|
443 // @return Pointer to control |
|
444 // --------------------------------------------------------------------------- |
|
445 // |
|
446 CCoeControl* CFsEmailSettingsList::ComponentControl( TInt aIndex ) const |
|
447 { |
|
448 FUNC_LOG; |
|
449 |
|
450 switch ( aIndex ) |
|
451 { |
|
452 case EListBox: |
|
453 return iListBox; |
|
454 } |
|
455 |
|
456 return NULL; |
|
457 } |
|
458 |
|
459 // --------------------------------------------------------------------------- |
|
460 // SizeChanged |
|
461 // --------------------------------------------------------------------------- |
|
462 // |
|
463 void CFsEmailSettingsList::SizeChanged() |
|
464 { |
|
465 FUNC_LOG; |
|
466 |
|
467 CCoeControl::SizeChanged(); |
|
468 LayoutControls(); |
|
469 |
|
470 } |
|
471 |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // Layout components as specified in the UI Designer |
|
475 // --------------------------------------------------------------------------- |
|
476 // |
|
477 void CFsEmailSettingsList::LayoutControls() |
|
478 { |
|
479 FUNC_LOG; |
|
480 |
|
481 iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize() ); |
|
482 |
|
483 } |
|
484 |
|
485 // --------------------------------------------------------------------------- |
|
486 // Handle events from listbox. |
|
487 // --------------------------------------------------------------------------- |
|
488 // |
|
489 void CFsEmailSettingsList::HandleListBoxEventL( CEikListBox *aListBox, TListBoxEvent aEventType ) |
|
490 { |
|
491 FUNC_LOG; |
|
492 |
|
493 if ( aListBox ) |
|
494 { |
|
495 if ( aEventType == EEventItemSingleClicked || |
|
496 aEventType == EEventEnterKeyPressed ) |
|
497 { |
|
498 HandleUserSelectionsL(); |
|
499 } |
|
500 } |
|
501 |
|
502 } |
|
503 |
|
504 // --------------------------------------------------------------------------- |
|
505 // HandleUserSelectionsL |
|
506 // |
|
507 // check where we are in navigation and decide where to go |
|
508 // based on selection commands |
|
509 // --------------------------------------------------------------------------- |
|
510 // |
|
511 void CFsEmailSettingsList::HandleUserSelectionsL() |
|
512 { |
|
513 FUNC_LOG; |
|
514 |
|
515 TInt index = iListBox->CurrentItemIndex(); |
|
516 TInt count = Count(); |
|
517 |
|
518 // If we are at the main level |
|
519 if ( iCurrentSubView == EFsEmailSettingsMainListView ) |
|
520 { |
|
521 // Open global settings |
|
522 if ( index == 0 ) |
|
523 { |
|
524 // activate global settings list |
|
525 SetSelectedMainListIndex( index ); |
|
526 iAppUi.EnterFsEmailViewL( GlobalSettingsViewId ); |
|
527 } |
|
528 // Open selected mailbox settings |
|
529 else if ( index > 0 && index <= iMailboxCount ) |
|
530 { |
|
531 // set mailbox info |
|
532 CFSMailBox* mailbox = GetMailboxByIndexLC( index-1 ); |
|
533 iSelectedAccountInfo = mailbox->GetId(); |
|
534 iSelectedPluginSettings = mailbox->GetSettingsUid(); |
|
535 CleanupStack::PopAndDestroy( mailbox ); |
|
536 // don't active pimlist subview, set flag to false |
|
537 iPIMListActivation = EFalse; |
|
538 if ( iSelectedPluginSettings == TUid::Null() ) |
|
539 { |
|
540 #ifdef _DEBUG |
|
541 CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; |
|
542 informationNote->ExecuteLD(_L("No plugin Uid found")); |
|
543 #endif // _DEBUG |
|
544 } |
|
545 else |
|
546 { |
|
547 SetSelectedMainListIndex( index ); |
|
548 CreatePluginSubviewListL( iSelectedPluginSettings ); |
|
549 } |
|
550 } |
|
551 // Create PIM settings as a second level items |
|
552 else if ( index > iMailboxCount ) |
|
553 { |
|
554 CFSMailBox* mailbox = GetMailboxByIndexLC( iPIMSyncMailboxIndex ); |
|
555 iSelectedAccountInfo = mailbox->GetId(); |
|
556 iSelectedPluginSettings = mailbox->GetSettingsUid(); |
|
557 CleanupStack::PopAndDestroy( mailbox ); |
|
558 iPIMListActivation = ETrue; |
|
559 SetSelectedMainListIndex( index ); |
|
560 CreatePluginPIMListL( iSelectedPluginSettings ); |
|
561 } |
|
562 else // index < 0; this should never happen |
|
563 { |
|
564 __ASSERT_DEBUG( EFalse, Panic(EFSEmailUiUnexpectedValue) ); |
|
565 } |
|
566 } |
|
567 |
|
568 // In second level list, activate selected plugin settings view or |
|
569 // open PIM service dialog if first item selected in PIM list |
|
570 else |
|
571 { |
|
572 if ( iPIMServiceSettingsSelection && index == 0 ) |
|
573 { |
|
574 // open PIM service settings selection dialog |
|
575 OpenPIMServiceDialogL(); |
|
576 } |
|
577 else |
|
578 { |
|
579 ActivateMailSettingsPluginSubViewL( index ); |
|
580 } |
|
581 } |
|
582 |
|
583 } |
|
584 |
|
585 // --------------------------------------------------------------------------- |
|
586 // Handle key events. |
|
587 // --------------------------------------------------------------------------- |
|
588 // |
|
589 TKeyResponse CFsEmailSettingsList::OfferKeyEventL( |
|
590 const TKeyEvent& aKeyEvent, |
|
591 TEventCode aType ) |
|
592 { |
|
593 FUNC_LOG; |
|
594 |
|
595 // Handle shortcuts |
|
596 if ( aType == EEventKey ) |
|
597 { |
|
598 TInt commandId = iAppUi.ShortcutBinding().CommandForShortcutKey( aKeyEvent, CFSEmailUiShortcutBinding::EContextSettings ); |
|
599 if ( commandId >= 0 ) |
|
600 { |
|
601 iAppUi.View( SettingsViewId )->HandleCommandL( commandId ); |
|
602 } |
|
603 } |
|
604 |
|
605 if ( aKeyEvent.iCode == EKeyLeftArrow |
|
606 || aKeyEvent.iCode == EKeyRightArrow ) |
|
607 { |
|
608 // Listbox takes all events even if it doesn't use them |
|
609 return EKeyWasNotConsumed; |
|
610 } |
|
611 |
|
612 if ( iFocusControl != NULL |
|
613 && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed ) |
|
614 { |
|
615 return EKeyWasConsumed; |
|
616 } |
|
617 |
|
618 return CCoeControl::OfferKeyEventL( aKeyEvent, aType ); |
|
619 } |
|
620 |
|
621 |
|
622 // --------------------------------------------------------------------------- |
|
623 // Initialize each control upon creation. |
|
624 // --------------------------------------------------------------------------- |
|
625 // |
|
626 void CFsEmailSettingsList::InitializeControlsL() |
|
627 { |
|
628 FUNC_LOG; |
|
629 |
|
630 // Create list box control |
|
631 iListBox = new ( ELeave ) CSettingsListType; |
|
632 iListBox->SetContainerWindowL( *this ); |
|
633 { |
|
634 TResourceReader reader; |
|
635 iEikonEnv->CreateResourceReaderLC( reader, R_FS_EMAIL_SETTINGS_LIST_LIST_BOX ); |
|
636 iListBox->ConstructFromResourceL( reader ); |
|
637 CleanupStack::PopAndDestroy(); // reader internal state |
|
638 } |
|
639 // the listbox owns the items in the list and will free them |
|
640 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
641 |
|
642 // setup the icon array so graphics-style boxes work |
|
643 SetupListBoxIconsL(); |
|
644 |
|
645 // Create scrollbar |
|
646 iListBox->CreateScrollBarFrameL(); |
|
647 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
648 CEikScrollBarFrame::EOff, |
|
649 CEikScrollBarFrame::EAuto ); |
|
650 |
|
651 iListBox->SetFocus( ETrue ); |
|
652 iFocusControl = iListBox; |
|
653 |
|
654 // event listener this class |
|
655 iListBox->SetListBoxObserver( this ); |
|
656 |
|
657 } |
|
658 |
|
659 |
|
660 // --------------------------------------------------------------------------- |
|
661 // Handle global resource changes, such as scalable UI or skin events (override) |
|
662 // --------------------------------------------------------------------------- |
|
663 // |
|
664 void CFsEmailSettingsList::HandleResourceChange( TInt aType ) |
|
665 { |
|
666 FUNC_LOG; |
|
667 |
|
668 CCoeControl::HandleResourceChange( aType ); |
|
669 SetRect( iAvkonViewAppUi->View( SettingsViewId )->ClientRect() ); |
|
670 |
|
671 } |
|
672 |
|
673 // --------------------------------------------------------------------------- |
|
674 // Draw container contents. |
|
675 // --------------------------------------------------------------------------- |
|
676 // |
|
677 void CFsEmailSettingsList::Draw( const TRect& aRect ) const |
|
678 { |
|
679 FUNC_LOG; |
|
680 |
|
681 CWindowGc& gc = SystemGc(); |
|
682 gc.Clear( aRect ); |
|
683 |
|
684 } |
|
685 |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // Count |
|
689 // |
|
690 // Retuns number of item in list |
|
691 // --------------------------------------------------------------------------- |
|
692 // |
|
693 TInt CFsEmailSettingsList::Count() |
|
694 { |
|
695 FUNC_LOG; |
|
696 |
|
697 CDesCArray* itemArray = static_cast<CDesCArray*>( iListBox->Model()->ItemTextArray() ); |
|
698 TInt count( itemArray->Count() ); |
|
699 |
|
700 return count; |
|
701 } |
|
702 |
|
703 // --------------------------------------------------------------------------- |
|
704 // Get the listbox pointer. |
|
705 // --------------------------------------------------------------------------- |
|
706 // |
|
707 CSettingsListType* CFsEmailSettingsList::ListBox() |
|
708 { |
|
709 FUNC_LOG; |
|
710 return iListBox; |
|
711 } |
|
712 |
|
713 // --------------------------------------------------------------------------- |
|
714 // Get the listbox pointer. |
|
715 // --------------------------------------------------------------------------- |
|
716 // |
|
717 TBool CFsEmailSettingsList::PIMSyncItemVisible() |
|
718 { |
|
719 FUNC_LOG; |
|
720 return ( iPIMSyncMailboxIndex == -1 ) ? EFalse : ETrue; |
|
721 } |
|
722 |
|
723 // --------------------------------------------------------------------------- |
|
724 // Create a list box item for plain text |
|
725 // --------------------------------------------------------------------------- |
|
726 // |
|
727 HBufC* CFsEmailSettingsList::CreateListBoxItemLC( |
|
728 const TDesC& aMainText ) |
|
729 { |
|
730 FUNC_LOG; |
|
731 |
|
732 _LIT ( KStringHeader, "\t%S" ); |
|
733 HBufC* temp = HBufC::NewLC( aMainText.Length() + KStringHeader().Length() ); |
|
734 TPtr tempPtr = temp->Des(); |
|
735 tempPtr.Format( KStringHeader(), &aMainText ); |
|
736 |
|
737 return temp; |
|
738 } |
|
739 |
|
740 // --------------------------------------------------------------------------- |
|
741 // Create a list box item for text and icon |
|
742 // --------------------------------------------------------------------------- |
|
743 // |
|
744 HBufC* CFsEmailSettingsList::CreateListBoxItemLC( |
|
745 const TDesC& aMainText, |
|
746 TInt aIconNum ) |
|
747 { |
|
748 FUNC_LOG; |
|
749 |
|
750 _LIT ( KStringHeader, "\t%S\t%d" ); |
|
751 HBufC* temp = HBufC::NewLC( aMainText.Length() + KStringHeader().Length() ); |
|
752 TPtr tempPtr = temp->Des(); |
|
753 tempPtr.Format( KStringHeader(), &aMainText, aIconNum ); |
|
754 |
|
755 return temp; |
|
756 } |
|
757 |
|
758 // --------------------------------------------------------------------------- |
|
759 // Insert given item in a list |
|
760 // --------------------------------------------------------------------------- |
|
761 // |
|
762 void CFsEmailSettingsList::AppendItemL( TDesC& aListItem ) |
|
763 { |
|
764 FUNC_LOG; |
|
765 |
|
766 CDesCArray* itemArray = static_cast<CDesCArray*>( |
|
767 iListBox->Model()->ItemTextArray() ); |
|
768 itemArray->AppendL( aListItem ); |
|
769 } |
|
770 |
|
771 // --------------------------------------------------------------------------- |
|
772 // Set up the list's icon array. |
|
773 // --------------------------------------------------------------------------- |
|
774 // |
|
775 void CFsEmailSettingsList::SetupListBoxIconsL() |
|
776 { |
|
777 FUNC_LOG; |
|
778 |
|
779 CArrayPtr<CGulIcon>* icons = new (ELeave) CArrayPtrFlat<CGulIcon>( 3 ); |
|
780 iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
781 } |
|
782 |
|
783 // --------------------------------------------------------------------------- |
|
784 // ProtocolBrandingIconL |
|
785 // |
|
786 // Sets mailbox protocol branding icon to list box by given id |
|
787 // --------------------------------------------------------------------------- |
|
788 // |
|
789 void CFsEmailSettingsList::ProtocolBrandingIconL( TFSMailMsgId aMailBoxId ) |
|
790 { |
|
791 FUNC_LOG; |
|
792 |
|
793 MFSMailBrandManager& brandManager = iAppUi.GetMailClient()->GetBrandManagerL(); |
|
794 CGulIcon* mailBoxIcon(0); |
|
795 TRAPD( err, mailBoxIcon = brandManager.GetGraphicL( EFSMailboxIcon, aMailBoxId ) ); |
|
796 |
|
797 if ( err != KErrNone || !mailBoxIcon ) |
|
798 { |
|
799 CFbsBitmap* bitmap(0); |
|
800 CFbsBitmap* mask(0); |
|
801 |
|
802 TFileName iconFileName; |
|
803 TFsEmailUiUtility::GetFullIconFileNameL( iconFileName ); |
|
804 |
|
805 // <cmail> icons changed |
|
806 AknIconUtils::CreateIconL( bitmap , mask , iconFileName, |
|
807 EMbmFreestyleemailuiQgn_indi_cmail_drop_email_account, |
|
808 EMbmFreestyleemailuiQgn_indi_cmail_drop_email_account_mask ); |
|
809 // </cmail> |
|
810 CleanupStack::PushL( bitmap ); |
|
811 CleanupStack::PushL( mask ); |
|
812 |
|
813 // create default mailbox icon from bitmaps |
|
814 mailBoxIcon = CGulIcon::NewL( bitmap, mask ); |
|
815 CleanupStack::Pop( mask ); |
|
816 CleanupStack::Pop( bitmap ); |
|
817 } |
|
818 |
|
819 CArrayPtr<CGulIcon>* icons = iListBox->ItemDrawer()->ColumnData()->IconArray(); |
|
820 CleanupStack::PushL( mailBoxIcon ); |
|
821 icons->AppendL( mailBoxIcon ); |
|
822 CleanupStack::Pop( mailBoxIcon ); |
|
823 } |
|
824 |
|
825 |
|
826 // --------------------------------------------------------------------------- |
|
827 // ClearListL |
|
828 // |
|
829 // Removes all items from list |
|
830 // --------------------------------------------------------------------------- |
|
831 // |
|
832 void CFsEmailSettingsList::ClearListL() |
|
833 { |
|
834 FUNC_LOG; |
|
835 |
|
836 CDesCArray* itemArray = static_cast<CDesCArray*>( |
|
837 iListBox->Model()->ItemTextArray() ); |
|
838 itemArray->Reset(); |
|
839 iListBox->ItemDrawer()->ColumnData()->IconArray()->ResetAndDestroy(); |
|
840 iListBox->HandleItemRemovalL(); |
|
841 } |
|
842 |
|
843 // --------------------------------------------------------------------------- |
|
844 // GetMailboxByIndexLC |
|
845 // |
|
846 // @return CFSMailBox pointer, ownership is transferred |
|
847 // --------------------------------------------------------------------------- |
|
848 // |
|
849 CFSMailBox* CFsEmailSettingsList::GetMailboxByIndexLC( const TInt& aIndex ) const |
|
850 { |
|
851 FUNC_LOG; |
|
852 |
|
853 RPointerArray<CFSMailBox> mailBoxes; |
|
854 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
855 mailBoxes.Reset(); |
|
856 TFSMailMsgId plugin; |
|
857 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
858 CFSMailBox* mailbox = NULL; |
|
859 if ( aIndex > -1 && aIndex < mailBoxes.Count() ) |
|
860 { |
|
861 mailbox = iMailClient.GetMailBoxByUidL( mailBoxes[aIndex]->GetId() ); |
|
862 } |
|
863 User::LeaveIfNull( mailbox ); |
|
864 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
865 CleanupStack::PushL( mailbox ); |
|
866 return mailbox; |
|
867 } |
|
868 |
|
869 // --------------------------------------------------------------------------- |
|
870 // GetMailBoxByIdL |
|
871 // |
|
872 // @return CFSMailBox pointer, ownership is transferred |
|
873 // --------------------------------------------------------------------------- |
|
874 // |
|
875 CFSMailBox* CFsEmailSettingsList::GetMailBoxByIdL( const TUint& aMailboxId ) const |
|
876 { |
|
877 FUNC_LOG; |
|
878 |
|
879 RPointerArray<CFSMailBox> mailBoxes; |
|
880 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
881 mailBoxes.Reset(); |
|
882 TFSMailMsgId plugin; |
|
883 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
884 CFSMailBox* mailbox = NULL; |
|
885 for ( TInt i = 0; i < mailBoxes.Count(); ++i ) |
|
886 { |
|
887 if ( mailBoxes[i]->GetId().Id() == aMailboxId ) |
|
888 { |
|
889 TRAP_IGNORE( mailbox = iMailClient.GetMailBoxByUidL( mailBoxes[i]->GetId() ) ); |
|
890 break; |
|
891 } |
|
892 } |
|
893 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
894 return mailbox; |
|
895 } |
|
896 |
|
897 // --------------------------------------------------------------------------- |
|
898 // GetMailboxCountL |
|
899 // |
|
900 // @return TInt amount of mailboxes |
|
901 // --------------------------------------------------------------------------- |
|
902 // |
|
903 TInt CFsEmailSettingsList::GetMailboxCountL() const |
|
904 { |
|
905 FUNC_LOG; |
|
906 |
|
907 RPointerArray<CFSMailBox> mailBoxes; |
|
908 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
909 mailBoxes.Reset(); |
|
910 TFSMailMsgId plugin; |
|
911 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
912 TInt count = mailBoxes.Count(); |
|
913 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
914 |
|
915 return count; |
|
916 } |
|
917 |
|
918 // --------------------------------------------------------------------------- |
|
919 // CreateAccountListL |
|
920 // Creates mailbox list for settings |
|
921 // @return void |
|
922 // --------------------------------------------------------------------------- |
|
923 // |
|
924 void CFsEmailSettingsList::CreateAccountListL() |
|
925 { |
|
926 FUNC_LOG; |
|
927 |
|
928 LoadAccountsToListL(); |
|
929 |
|
930 // we are on first level of the list box |
|
931 iCurrentSubView = EFsEmailSettingsMainListView; |
|
932 |
|
933 } |
|
934 |
|
935 // --------------------------------------------------------------------------- |
|
936 // Get2ndLevelListIndicator |
|
937 // Indicates the state of list. Are the "second level" of items displayed |
|
938 // @return TBool |
|
939 // --------------------------------------------------------------------------- |
|
940 // |
|
941 TBool CFsEmailSettingsList::Get2ndLevelListIndicator() |
|
942 { |
|
943 FUNC_LOG; |
|
944 return ( iCurrentSubView != EFsEmailSettingsMainListView ); |
|
945 } |
|
946 |
|
947 // --------------------------------------------------------------------------- |
|
948 // SetPluginSettingsUid |
|
949 // @return void |
|
950 // --------------------------------------------------------------------------- |
|
951 // |
|
952 void CFsEmailSettingsList::SetPluginSettingsUid( const TUid& aPluginId ) |
|
953 { |
|
954 FUNC_LOG; |
|
955 iSelectedPluginSettings = aPluginId; |
|
956 } |
|
957 |
|
958 // --------------------------------------------------------------------------- |
|
959 // GetSettingsPluginL |
|
960 // Creates needed settings plugin instance and register it to view stack |
|
961 // Ownership is not transferred |
|
962 // @return CESMailSettingsPlugin* |
|
963 // --------------------------------------------------------------------------- |
|
964 // |
|
965 CESMailSettingsPlugin* CFsEmailSettingsList::GetSettingsPluginL( TUid aUid ) |
|
966 { |
|
967 FUNC_LOG; |
|
968 CESMailSettingsPlugin* settingsPlugin = |
|
969 static_cast<CESMailSettingsPlugin*>( iAppUi.View( aUid ) ); |
|
970 |
|
971 if ( settingsPlugin == NULL ) |
|
972 { |
|
973 TInt err( KErrNone ); |
|
974 |
|
975 TRAP( err, settingsPlugin = CESMailSettingsPlugin::NewL( aUid );); |
|
976 if ( err == KErrNoMemory ) |
|
977 { |
|
978 User::Leave( err ); |
|
979 } |
|
980 else if ( err == KErrNone ) |
|
981 { |
|
982 CleanupStack::PushL(settingsPlugin); |
|
983 iAppUi.AddViewL( settingsPlugin ); |
|
984 CleanupStack::Pop(settingsPlugin); |
|
985 } |
|
986 else |
|
987 { |
|
988 } |
|
989 } |
|
990 |
|
991 return settingsPlugin; |
|
992 } |
|
993 |
|
994 |
|
995 // --------------------------------------------------------------------------- |
|
996 // SetSelectedSubListIndex |
|
997 // @return void |
|
998 // --------------------------------------------------------------------------- |
|
999 // |
|
1000 void CFsEmailSettingsList::SetSelectedSubListIndex( TInt aIndex ) |
|
1001 { |
|
1002 FUNC_LOG; |
|
1003 if ( aIndex >= 0 ) |
|
1004 { |
|
1005 iSelectedSubListIndex = aIndex; |
|
1006 } |
|
1007 else |
|
1008 { |
|
1009 iSelectedSubListIndex = 0; |
|
1010 } |
|
1011 } |
|
1012 |
|
1013 // --------------------------------------------------------------------------- |
|
1014 // SetSelectedMainListIndex |
|
1015 // Saves mailbox list index to parent when settings plugin view is activated |
|
1016 // because this container is destroyed during the view switch |
|
1017 // @return void |
|
1018 // --------------------------------------------------------------------------- |
|
1019 // |
|
1020 void CFsEmailSettingsList::SetSelectedMainListIndex( TInt aIndex ) |
|
1021 { |
|
1022 FUNC_LOG; |
|
1023 CFsEmailSettingsListView* parent = |
|
1024 static_cast<CFsEmailSettingsListView*>( iAppUi.View( SettingsViewId ) ); |
|
1025 |
|
1026 if ( aIndex >= 0 ) |
|
1027 { |
|
1028 parent->SetSelectedMainListIndex( aIndex ); |
|
1029 } |
|
1030 } |
|
1031 |
|
1032 // --------------------------------------------------------------------------- |
|
1033 // GetSelectedMainListIndex |
|
1034 // Returns latest mailbox list item index which is saved in parent view |
|
1035 // @return void |
|
1036 // --------------------------------------------------------------------------- |
|
1037 // |
|
1038 TInt CFsEmailSettingsList::GetSelectedMainListIndex() const |
|
1039 { |
|
1040 FUNC_LOG; |
|
1041 CFsEmailSettingsListView* parent = |
|
1042 static_cast<CFsEmailSettingsListView*>( iAppUi.View( SettingsViewId ) ); |
|
1043 |
|
1044 TInt index = parent->GetSelectedMainListIndex(); |
|
1045 |
|
1046 if ( index < 0 ) |
|
1047 { |
|
1048 index = 0; |
|
1049 } |
|
1050 |
|
1051 return index; |
|
1052 } |
|
1053 |
|
1054 // --------------------------------------------------------------------------- |
|
1055 // LoadAccountsToListL |
|
1056 // Loads global settings and account names to list dynamically |
|
1057 // from fs mail client |
|
1058 // @return void |
|
1059 // --------------------------------------------------------------------------- |
|
1060 // |
|
1061 void CFsEmailSettingsList::LoadAccountsToListL() |
|
1062 { |
|
1063 FUNC_LOG; |
|
1064 |
|
1065 // Remove current items |
|
1066 ClearListL(); |
|
1067 // Insert Global settings as a first item |
|
1068 HBufC* localizedText = StringLoader::LoadLC( |
|
1069 R_FS_EMAIL_SETTINGS_LIST_GLOBAL_SETTINGS_TXT ); |
|
1070 HBufC* listItemBuffer = CreateListBoxItemLC( *localizedText ); |
|
1071 AppendItemL( *listItemBuffer ); |
|
1072 CleanupStack::PopAndDestroy( 2, localizedText ); // localizedText listItemBuffer |
|
1073 |
|
1074 // get mailboxes from every plugin |
|
1075 RPointerArray<CFSMailBox> mailBoxes; |
|
1076 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
1077 mailBoxes.Reset(); |
|
1078 TFSMailMsgId plugin; |
|
1079 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
1080 |
|
1081 TUid PIMpluginUid = TUid::Null(); |
|
1082 // Set initial pim sync values |
|
1083 iPIMSyncCount = 0; |
|
1084 iPIMSyncMailboxIndex = KErrNotFound; |
|
1085 |
|
1086 iMailboxCount = mailBoxes.Count(); |
|
1087 |
|
1088 |
|
1089 for ( TInt i=0 ; i < iMailboxCount ; ++i ) |
|
1090 { |
|
1091 CFSMailBox* mailBox = mailBoxes[i]; |
|
1092 |
|
1093 // get protocol icon index |
|
1094 ProtocolBrandingIconL( mailBox->GetId() ); |
|
1095 |
|
1096 // get mailbox name and insert it to listBox |
|
1097 TPtrC mbName = GetMailBoxNameL( *mailBox ); |
|
1098 listItemBuffer = CreateListBoxItemLC( mbName, i ); |
|
1099 AppendItemL( *listItemBuffer ); |
|
1100 CleanupStack::PopAndDestroy( listItemBuffer ); // listItemBuffer |
|
1101 |
|
1102 // Does mailbox have settings plugin |
|
1103 if ( mailBox->GetSettingsUid() != TUid::Null() ) |
|
1104 { |
|
1105 // load settings ECOM plugin |
|
1106 TUid pluginUid = mailBox->GetSettingsUid(); |
|
1107 CESMailSettingsPlugin* tempPlugin; |
|
1108 tempPlugin = GetSettingsPluginL( pluginUid ); // ownership not transferred |
|
1109 |
|
1110 if ( tempPlugin != NULL ) |
|
1111 { |
|
1112 // check if mailboxes can handle PIM sync |
|
1113 TBool canHandlePIMSync = tempPlugin->CanHandlePIMSync(); |
|
1114 if ( canHandlePIMSync && PIMpluginUid != pluginUid ) |
|
1115 { |
|
1116 PIMpluginUid = pluginUid; |
|
1117 ++iPIMSyncCount; |
|
1118 if ( tempPlugin->IsSelectedForPIMSync() ) |
|
1119 { |
|
1120 iPIMSyncMailboxIndex = i; |
|
1121 } |
|
1122 // if protocol supports PIM sync, but is not selected yet |
|
1123 if ( iPIMSyncCount > 0 && iPIMSyncMailboxIndex == -1 ) |
|
1124 { |
|
1125 iPIMSyncMailboxIndex = i; |
|
1126 } |
|
1127 } |
|
1128 } |
|
1129 } |
|
1130 else |
|
1131 { |
|
1132 } |
|
1133 } |
|
1134 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
1135 |
|
1136 // if one of the mailboxes can handle PIM sync |
|
1137 // display PIM settings item in list. |
|
1138 if ( iPIMSyncCount > 0 ) |
|
1139 { |
|
1140 HBufC* text2 = StringLoader::LoadLC( R_FS_EMAIL_SETTINGS_LIST_PIM_SETTINGS_TXT ); |
|
1141 listItemBuffer = CreateListBoxItemLC( *text2 ); |
|
1142 AppendItemL( *listItemBuffer ); |
|
1143 CleanupStack::PopAndDestroy( 2, text2 ); // text2 listItemBuffer |
|
1144 } |
|
1145 |
|
1146 // update list |
|
1147 iListBox->HandleItemAdditionL(); |
|
1148 if ( GetSelectedMainListIndex() > iListBox->BottomItemIndex() ) |
|
1149 { |
|
1150 iListBox->SetCurrentItemIndex( 0 ) ; |
|
1151 } |
|
1152 else if ( GetSelectedMainListIndex() < 0 ) |
|
1153 { |
|
1154 iListBox->SetCurrentItemIndex( 0 ) ; |
|
1155 } |
|
1156 else |
|
1157 { |
|
1158 iListBox->SetCurrentItemIndex( GetSelectedMainListIndex() ); |
|
1159 } |
|
1160 } |
|
1161 |
|
1162 |
|
1163 // --------------------------------------------------------------------------- |
|
1164 // DisplayCreateMailboxNoteIfNeededL |
|
1165 // @return void |
|
1166 // --------------------------------------------------------------------------- |
|
1167 // |
|
1168 void CFsEmailSettingsList::DisplayCreateMailboxNoteIfNeededL() |
|
1169 { |
|
1170 FUNC_LOG; |
|
1171 RPointerArray<CFSMailBox> mailBoxes; |
|
1172 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
1173 mailBoxes.Reset(); |
|
1174 TFSMailMsgId plugin; |
|
1175 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
1176 |
|
1177 // display "create mailbox" query if no mailboxes defined |
|
1178 TInt mailboxCount = mailBoxes.Count(); |
|
1179 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
1180 |
|
1181 // Display query if count == zero |
|
1182 if ( mailboxCount == 0 ) |
|
1183 { |
|
1184 if ( TFsEmailUiUtility::ShowConfirmationQueryL( R_FS_EMAIL_SETTINGS_ADD_MAILBOX_TXT ) ) |
|
1185 { |
|
1186 AddAccountL(); |
|
1187 } |
|
1188 } |
|
1189 } |
|
1190 |
|
1191 |
|
1192 // --------------------------------------------------------------------------- |
|
1193 // CreatePluginSubviewListL |
|
1194 // Fill list with captions returned by settings ECOM plugin |
|
1195 // @param aPluginId implementation TUid of the settings ECom plugin |
|
1196 // @return void |
|
1197 // --------------------------------------------------------------------------- |
|
1198 // |
|
1199 void CFsEmailSettingsList::CreatePluginSubviewListL( const TUid& aPluginId ) |
|
1200 { |
|
1201 FUNC_LOG; |
|
1202 |
|
1203 // Remove items |
|
1204 ClearListL(); |
|
1205 |
|
1206 // change list content to account specific settings |
|
1207 HBufC *listString = NULL; |
|
1208 |
|
1209 // get pointer to plugin settings that user selected |
|
1210 iSelectedPluginSettings = aPluginId; |
|
1211 CESMailSettingsPlugin* settingsPlugin = GetSettingsPluginL( |
|
1212 iSelectedPluginSettings ); |
|
1213 |
|
1214 // check do we want to load long or short caption depending on screen size |
|
1215 TBool longCaption = EFalse; |
|
1216 if ( Rect().Width() > 240 ) |
|
1217 { |
|
1218 longCaption = ETrue; |
|
1219 } |
|
1220 |
|
1221 TInt subViewCount( 0 ); |
|
1222 if ( settingsPlugin != NULL ) |
|
1223 { |
|
1224 subViewCount = settingsPlugin->MailSettingsSubviewCount(); |
|
1225 } |
|
1226 else |
|
1227 { |
|
1228 } |
|
1229 |
|
1230 // load setting view names to list |
|
1231 TInt index = 0; |
|
1232 if ( subViewCount > 0 ) |
|
1233 { |
|
1234 while ( index < subViewCount ) |
|
1235 { |
|
1236 TPtrC subViewCaption = settingsPlugin->MailSettingsSubviewCaption( |
|
1237 iSelectedAccountInfo, index, longCaption ); |
|
1238 listString = CreateListBoxItemLC( subViewCaption ); |
|
1239 AppendItemL( *listString ); |
|
1240 CleanupStack::PopAndDestroy( listString ); |
|
1241 ++index; |
|
1242 } |
|
1243 iListBox->HandleItemAdditionL(); |
|
1244 iListBox->SetCurrentItemIndex( iSelectedSubListIndex ); |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 // activate POP/IMAP view |
|
1249 ActivateMailSettingsPluginSubViewL( -1 ); |
|
1250 } |
|
1251 iCurrentSubView = EFsEmailSettingsMailboxView; |
|
1252 } |
|
1253 |
|
1254 // --------------------------------------------------------------------------- |
|
1255 // CreatePluginPIMListL |
|
1256 // Fill list with PIM captions returned by settings ECOM plugin |
|
1257 // This list is displayed only with Intellisync or Mfe account |
|
1258 // @param aPluginId implementation TUid of the settings ECom plugin |
|
1259 // @return void |
|
1260 // --------------------------------------------------------------------------- |
|
1261 // |
|
1262 void CFsEmailSettingsList::CreatePluginPIMListL( const TUid& aPluginId ) |
|
1263 { |
|
1264 FUNC_LOG; |
|
1265 |
|
1266 // Remove items |
|
1267 ClearListL(); |
|
1268 |
|
1269 // change list content to account specific settings |
|
1270 TInt index = 0; |
|
1271 HBufC *listString = NULL; |
|
1272 |
|
1273 // get pointer to plugin settings that user selected |
|
1274 iSelectedPluginSettings = aPluginId; |
|
1275 CESMailSettingsPlugin* settingsPlugin = GetSettingsPluginL( |
|
1276 iSelectedPluginSettings ); |
|
1277 |
|
1278 // When we return from the plugin PIM settings we don't know if there is |
|
1279 // one or two mailboxes that contains PIM settings. |
|
1280 // So we veed to check that here: |
|
1281 if(iPIMSyncCount == 0) |
|
1282 { |
|
1283 TUid PIMpluginUid = TUid::Null(); |
|
1284 // get mailboxes from every plugin |
|
1285 RPointerArray<CFSMailBox> mailBoxes; |
|
1286 CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
1287 mailBoxes.Reset(); |
|
1288 TFSMailMsgId plugin; |
|
1289 iMailClient.ListMailBoxes( plugin, mailBoxes ); |
|
1290 |
|
1291 for ( TInt i = 0; i < mailBoxes.Count(); ++i ) |
|
1292 { |
|
1293 // get mailbox name and insert it to listBox |
|
1294 CFSMailBox* mailBox = mailBoxes[i]; |
|
1295 TDesC& name = mailBox->GetName(); |
|
1296 // Does mailbox have settings plugin |
|
1297 if ( mailBox->GetSettingsUid() != TUid::Null() ) |
|
1298 { |
|
1299 // load settings ECOM plugin |
|
1300 TUid pluginUid = mailBox->GetSettingsUid(); |
|
1301 CESMailSettingsPlugin* tempPlugin; |
|
1302 tempPlugin = GetSettingsPluginL( pluginUid ); // ownership not transferred |
|
1303 |
|
1304 if ( tempPlugin != NULL ) |
|
1305 { |
|
1306 // check if mailboxes can handle PIM sync |
|
1307 TBool canHandlePIMSync = tempPlugin->CanHandlePIMSync(); |
|
1308 if ( canHandlePIMSync && PIMpluginUid != pluginUid ) |
|
1309 { |
|
1310 ++iPIMSyncCount; |
|
1311 } |
|
1312 } |
|
1313 } |
|
1314 } |
|
1315 CleanupStack::PopAndDestroy( &mailBoxes ); |
|
1316 } |
|
1317 |
|
1318 // If there are more than one plugin that is capable of syncing personal |
|
1319 // information, then user needs to select which is used |
|
1320 if ( iPIMSyncCount > 1 ) |
|
1321 { |
|
1322 HBufC* text = StringLoader::LoadLC( R_FS_EMAIL_SETTINGS_PIM_SERVICE_TXT ); |
|
1323 listString = CreateListBoxItemLC( *text ); |
|
1324 AppendItemL( *listString ); |
|
1325 CleanupStack::PopAndDestroy( 2, text ); // text, listString |
|
1326 iPIMServiceSettingsSelection = ETrue; |
|
1327 } |
|
1328 |
|
1329 |
|
1330 // check do we want to load long or short caption depending on screen size |
|
1331 TBool longCaption = EFalse; |
|
1332 if ( Rect().Width() > 240 ) |
|
1333 { |
|
1334 longCaption = ETrue; |
|
1335 } |
|
1336 |
|
1337 TInt subViewCount(0); |
|
1338 if ( settingsPlugin ) |
|
1339 { |
|
1340 subViewCount = settingsPlugin->PIMSettingsSubviewCount(); |
|
1341 } |
|
1342 |
|
1343 // load setting view names to list |
|
1344 while ( subViewCount > index ) |
|
1345 { |
|
1346 TPtrC subViewCaption = settingsPlugin->PIMSettingsSubviewCaption( |
|
1347 iSelectedAccountInfo, index, longCaption ); |
|
1348 listString = CreateListBoxItemLC( subViewCaption ); |
|
1349 AppendItemL( *listString ); |
|
1350 CleanupStack::PopAndDestroy( listString ); // listString |
|
1351 ++index; |
|
1352 } |
|
1353 |
|
1354 iListBox->HandleItemAdditionL(); |
|
1355 iListBox->SetCurrentItemIndex( iSelectedSubListIndex ); |
|
1356 iCurrentSubView = EFsEmailSettingsPimView; |
|
1357 } |
|
1358 |
|
1359 |
|
1360 // --------------------------------------------------------------------------- |
|
1361 // SetDefaultPIMAccountL |
|
1362 // Set account specific variables point to a selected PIM account |
|
1363 // @return void |
|
1364 // --------------------------------------------------------------------------- |
|
1365 // |
|
1366 void CFsEmailSettingsList::SetDefaultPIMAccountL() |
|
1367 { |
|
1368 FUNC_LOG; |
|
1369 CFSMailBox* mailbox; |
|
1370 |
|
1371 for ( TInt i = 0 ; i < iMailboxCount ; ++i ) |
|
1372 { |
|
1373 mailbox = GetMailboxByIndexLC(i); |
|
1374 TUid pluginUid = mailbox->GetSettingsUid(); |
|
1375 CESMailSettingsPlugin* tempPlugin; |
|
1376 tempPlugin = GetSettingsPluginL( pluginUid ); |
|
1377 if ( tempPlugin != NULL |
|
1378 && tempPlugin->CanHandlePIMSync() |
|
1379 && tempPlugin->IsSelectedForPIMSync() ) |
|
1380 { |
|
1381 SetSelectedAccountInfo( mailbox->GetId() ); |
|
1382 iSelectedPluginSettings = pluginUid; |
|
1383 } |
|
1384 CleanupStack::PopAndDestroy( mailbox ); |
|
1385 } |
|
1386 } |
|
1387 |
|
1388 // --------------------------------------------------------------------------- |
|
1389 // GetMailBoxNameL |
|
1390 // Get text pointer with the (possibly branded) mailbox name. Mailbox or |
|
1391 // framework owns the pointed data. |
|
1392 // --------------------------------------------------------------------------- |
|
1393 // |
|
1394 TPtrC CFsEmailSettingsList::GetMailBoxNameL( const CFSMailBox& aMailBox ) const |
|
1395 { |
|
1396 FUNC_LOG; |
|
1397 // Branded mailbox name is nowadays set in new mailbox event |
|
1398 // handling, so we don't need to use brand manager here anymore. |
|
1399 const TDesC& name = aMailBox.GetName(); |
|
1400 |
|
1401 TPtrC ret; |
|
1402 ret.Set( name ); |
|
1403 |
|
1404 return ret; |
|
1405 } |
|
1406 |
|
1407 // --------------------------------------------------------------------------- |
|
1408 // ActivateMailSettingsPluginSubViewL |
|
1409 // Activate selected mail settings plugin subview |
|
1410 // @return void |
|
1411 // --------------------------------------------------------------------------- |
|
1412 // |
|
1413 void CFsEmailSettingsList::ActivateMailSettingsPluginSubViewL( TInt aSubViewId ) |
|
1414 { |
|
1415 FUNC_LOG; |
|
1416 |
|
1417 TUid messageId; |
|
1418 CESMailSettingsPlugin::TSubViewActivationData activationData; |
|
1419 TInt subViewId = iListBox->CurrentItemIndex(); |
|
1420 activationData.iAccount = iSelectedAccountInfo; |
|
1421 activationData.iSubviewId = aSubViewId; |
|
1422 activationData.iLaunchedOutsideFSEmail = EFalse; |
|
1423 |
|
1424 if ( iPIMListActivation ) |
|
1425 { |
|
1426 messageId = TUid::Uid( CESMailSettingsPlugin::EActivatePIMSettingsSubview ); |
|
1427 // use account selected for PIM sync |
|
1428 SetDefaultPIMAccountL(); |
|
1429 iPIMListActivation = EFalse; |
|
1430 // pass information to the plugin side that we were in the personal information management subview |
|
1431 activationData.iPimAccount = ETrue; |
|
1432 } |
|
1433 else |
|
1434 { |
|
1435 messageId = TUid::Uid( CESMailSettingsPlugin::EActivateMailSettingsSubview ); |
|
1436 activationData.iPimAccount = EFalse; |
|
1437 } |
|
1438 |
|
1439 const TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> |
|
1440 pluginMessagePkg( activationData ); |
|
1441 TInt errNo( KErrNone ); |
|
1442 TRAP( errNo, iAppUi.EnterPluginSettingsViewL( |
|
1443 iSelectedPluginSettings, messageId, pluginMessagePkg ); ); |
|
1444 if ( errNo != KErrNone ) |
|
1445 { |
|
1446 } |
|
1447 } |
|
1448 |
|
1449 // --------------------------------------------------------------------------- |
|
1450 // SetSelectedAccountInfo |
|
1451 // Set given account info as a member data |
|
1452 // @param aAccountInfo |
|
1453 // @return void |
|
1454 // --------------------------------------------------------------------------- |
|
1455 // |
|
1456 void CFsEmailSettingsList::SetSelectedAccountInfo( const TFSMailMsgId& aAccountInfo ) |
|
1457 { |
|
1458 FUNC_LOG; |
|
1459 |
|
1460 iSelectedAccountInfo = aAccountInfo; |
|
1461 |
|
1462 } |
|
1463 |
|
1464 // --------------------------------------------------------------------------- |
|
1465 // AddAccount |
|
1466 // Handles new account creation with wizard |
|
1467 // @return void |
|
1468 // --------------------------------------------------------------------------- |
|
1469 // |
|
1470 void CFsEmailSettingsList::AddAccountL() |
|
1471 { |
|
1472 FUNC_LOG; |
|
1473 |
|
1474 iAppUi.LaunchWizardL(); |
|
1475 |
|
1476 } |
|
1477 |
|
1478 // --------------------------------------------------------------------------- |
|
1479 // RemoveAccount |
|
1480 // Handle account removal from fs mail client |
|
1481 // @return void |
|
1482 // --------------------------------------------------------------------------- |
|
1483 // |
|
1484 void CFsEmailSettingsList::RemoveAccountL() |
|
1485 { |
|
1486 FUNC_LOG; |
|
1487 |
|
1488 // Make sure that FSMailServer is running, so that the mailbox is removed |
|
1489 // also from MCE. Let's do it already here, so that the server has some |
|
1490 // time to launch itself before the actual mailbox deletion happens. |
|
1491 TFsEmailUiUtility::EnsureFsMailServerIsRunning( iEikonEnv->WsSession() ); |
|
1492 |
|
1493 // if item index is 0 then we are on global settings item |
|
1494 // this shouldn't be happening, but just in case |
|
1495 iDeletedIndex = iListBox->CurrentItemIndex(); |
|
1496 if ( iDeletedIndex == 0 ) |
|
1497 { |
|
1498 return; |
|
1499 } |
|
1500 |
|
1501 // get mailbox |
|
1502 CFSMailBox* mailBox = GetMailboxByIndexLC(iDeletedIndex-1); |
|
1503 CAknQueryDialog* queryNote = new ( ELeave ) CAknQueryDialog(); |
|
1504 CleanupStack::PushL( queryNote ); |
|
1505 |
|
1506 // load remove mailbox text from resource |
|
1507 HBufC* question = StringLoader::LoadLC( |
|
1508 R_FS_EMAIL_SETTINGS_REMOVE_MAILBOX_TXT, |
|
1509 mailBox->GetName() ); |
|
1510 |
|
1511 queryNote->SetPromptL( *question ); |
|
1512 CleanupStack::PopAndDestroy( question ); |
|
1513 CleanupStack::Pop( queryNote ); |
|
1514 |
|
1515 // launch note and check answer |
|
1516 if ( queryNote->ExecuteLD( R_FSEMAIL_QUERY_DIALOG ) ) |
|
1517 { |
|
1518 // check if protocol supports delete |
|
1519 if ( mailBox->HasCapability( EFSMBoxCapaCanBeDeleted ) ) |
|
1520 { |
|
1521 // start wait note |
|
1522 iWaitDialog = new (ELeave) CAknWaitDialog( |
|
1523 (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), EFalse ); |
|
1524 iWaitDialog->PrepareLC( R_FS_WAIT_NOTE_REMOVING_MAILBOX ); |
|
1525 iWaitDialog->SetCallback( this ); |
|
1526 iWaitDialog->RunLD(); |
|
1527 // Set email indicator off. |
|
1528 TFsEmailUiUtility::ToggleEmailIconL(EFalse); |
|
1529 // delete mailbox and wait event (RequestResponseL) |
|
1530 iDeleteMailboxId = iMailClient.DeleteMailBoxByUidL( mailBox->GetId(), *this ); |
|
1531 } |
|
1532 } |
|
1533 CleanupStack::PopAndDestroy(); // mailBox |
|
1534 } |
|
1535 |
|
1536 |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // RequestResponseL |
|
1539 // handles request state from mail client |
|
1540 // @return void |
|
1541 // --------------------------------------------------------------------------- |
|
1542 // |
|
1543 void CFsEmailSettingsList::RequestResponseL( TFSProgress /*aEvent*/, TInt /*aRequestId*/ ) |
|
1544 { |
|
1545 FUNC_LOG; |
|
1546 if( iWaitDialog ) |
|
1547 { |
|
1548 iWaitDialog->ProcessFinishedL(); |
|
1549 // refresh settings mailboxlist |
|
1550 if ( GetSelectedMainListIndex() > 0 ) |
|
1551 { |
|
1552 SetSelectedMainListIndex( GetSelectedMainListIndex()-1 ); |
|
1553 } |
|
1554 else |
|
1555 { |
|
1556 SetSelectedMainListIndex( 0 ); |
|
1557 } |
|
1558 |
|
1559 LoadAccountsToListL(); |
|
1560 // refresh launcher grid |
|
1561 CFSEmailUiLauncherGridVisualiser* grid = |
|
1562 static_cast<CFSEmailUiLauncherGridVisualiser*>( iAppUi.View( AppGridId ) ); |
|
1563 grid->RefreshLauncherViewL(); |
|
1564 } |
|
1565 iWaitDialog = NULL; |
|
1566 } |
|
1567 |
|
1568 // --------------------------------------------------------------------------- |
|
1569 // DialogDismissedL |
|
1570 // called when wait has ended |
|
1571 // @return void |
|
1572 // --------------------------------------------------------------------------- |
|
1573 // |
|
1574 void CFsEmailSettingsList::DialogDismissedL( TInt /*aButtonId */ ) |
|
1575 { |
|
1576 FUNC_LOG; |
|
1577 iWaitDialog = NULL; |
|
1578 } |
|
1579 |
|
1580 // --------------------------------------------------------------------------- |
|
1581 // OpenPIMServiceDialog |
|
1582 // @return void |
|
1583 // --------------------------------------------------------------------------- |
|
1584 // |
|
1585 void CFsEmailSettingsList::OpenPIMServiceDialogL() |
|
1586 { |
|
1587 FUNC_LOG; |
|
1588 CPIMSettingItemListDlg* dlg = new (ELeave) CPIMSettingItemListDlg( iMailClient ); |
|
1589 dlg->ExecuteLD( R_FS_PIMSETTINGITEMLIST_DIALOG ); |
|
1590 } |
|
1591 |
|
1592 // --------------------------------------------------------------------------- |
|
1593 // SetPimListActivation |
|
1594 // @return void |
|
1595 // --------------------------------------------------------------------------- |
|
1596 // |
|
1597 void CFsEmailSettingsList::SetPimListActivation(TBool aActivation) |
|
1598 { |
|
1599 FUNC_LOG; |
|
1600 iPIMListActivation = aActivation; |
|
1601 } |
|
1602 |
|
1603 // --------------------------------------------------------------------------- |
|
1604 // Creates and passes ownership of title pane text appropriate for the current |
|
1605 // view |
|
1606 // --------------------------------------------------------------------------- |
|
1607 // |
|
1608 HBufC* CFsEmailSettingsList::CreateTitlePaneTextLC() const |
|
1609 { |
|
1610 FUNC_LOG; |
|
1611 HBufC* text = NULL; |
|
1612 |
|
1613 switch ( iCurrentSubView ) |
|
1614 { |
|
1615 case EFsEmailSettingsMailboxView: |
|
1616 { |
|
1617 // Use mailbox name as title pane text in the mailbox view |
|
1618 TInt curMailBoxIdx = GetSelectedMainListIndex()-1; |
|
1619 if ( curMailBoxIdx < 0 ) |
|
1620 { |
|
1621 text = StringLoader::LoadLC( R_FS_EMAIL_SETTINGS_TITLE ); |
|
1622 break; |
|
1623 } |
|
1624 CFSMailBox* mailBox = GetMailboxByIndexLC( curMailBoxIdx ); |
|
1625 TPtrC mailBoxName = GetMailBoxNameL( *mailBox ); |
|
1626 text = mailBoxName.AllocL(); |
|
1627 CleanupStack::PopAndDestroy( mailBox ); |
|
1628 CleanupStack::PushL( text ); |
|
1629 } |
|
1630 break; |
|
1631 case EFsEmailSettingsPimView: |
|
1632 { |
|
1633 text = StringLoader::LoadLC( R_FS_EMAIL_PIM_SETTINGS_TITLE ); |
|
1634 } |
|
1635 break; |
|
1636 case EFsEmailSettingsMainListView: |
|
1637 default: |
|
1638 { |
|
1639 text = StringLoader::LoadLC( R_FS_EMAIL_SETTINGS_TITLE ); |
|
1640 } |
|
1641 break; |
|
1642 } |
|
1643 |
|
1644 return text; |
|
1645 } |
|
1646 |
|
1647 // --------------------------------------------------------------------------- |
|
1648 // Move list focus to top |
|
1649 // --------------------------------------------------------------------------- |
|
1650 // |
|
1651 void CFsEmailSettingsList::GoToTop() |
|
1652 { |
|
1653 FUNC_LOG; |
|
1654 TInt count = iListBox->Model()->NumberOfItems(); |
|
1655 if ( count ) |
|
1656 { |
|
1657 iListBox->SetCurrentItemIndexAndDraw( 0 ); |
|
1658 } |
|
1659 } |
|
1660 |
|
1661 // --------------------------------------------------------------------------- |
|
1662 // Move list focus to bottom |
|
1663 // --------------------------------------------------------------------------- |
|
1664 // |
|
1665 void CFsEmailSettingsList::GoToBottom() |
|
1666 { |
|
1667 FUNC_LOG; |
|
1668 TInt count = iListBox->Model()->NumberOfItems(); |
|
1669 if ( count ) |
|
1670 { |
|
1671 iListBox->SetCurrentItemIndexAndDraw( count-1 ); |
|
1672 } |
|
1673 } |
|
1674 |
|
1675 // --------------------------------------------------------------------------- |
|
1676 // Move selector one page up |
|
1677 // --------------------------------------------------------------------------- |
|
1678 // |
|
1679 void CFsEmailSettingsList::PageUp() |
|
1680 { |
|
1681 FUNC_LOG; |
|
1682 TInt count = iListBox->Model()->NumberOfItems(); |
|
1683 if ( count ) |
|
1684 { |
|
1685 TInt itemsOnPage = ListBox()->BottomItemIndex() - ListBox()->TopItemIndex(); |
|
1686 TInt currentIdx = ListBox()->CurrentItemIndex(); |
|
1687 TInt newIdx = Max( 0, currentIdx - itemsOnPage ); |
|
1688 ListBox()->SetCurrentItemIndexAndDraw( newIdx ); |
|
1689 } |
|
1690 } |
|
1691 |
|
1692 // --------------------------------------------------------------------------- |
|
1693 // Move selector one page down |
|
1694 // --------------------------------------------------------------------------- |
|
1695 // |
|
1696 void CFsEmailSettingsList::PageDown() |
|
1697 { |
|
1698 FUNC_LOG; |
|
1699 TInt count = ListBox()->Model()->NumberOfItems(); |
|
1700 if ( count ) |
|
1701 { |
|
1702 TInt itemsOnPage = ListBox()->BottomItemIndex() - ListBox()->TopItemIndex(); |
|
1703 TInt currentIdx = ListBox()->CurrentItemIndex(); |
|
1704 TInt newIdx = Min( count-1, currentIdx + itemsOnPage ); |
|
1705 ListBox()->SetCurrentItemIndexAndDraw( newIdx ); |
|
1706 } |
|
1707 } |
|
1708 |