|
1 /* |
|
2 * Copyright (c) 2006 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 * folder subscription dialog |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "emailtrace.h" |
|
22 #include <mtmuibas.h> |
|
23 #include <imapcmds.h> |
|
24 #include <gulicon.h> |
|
25 #include <eikclb.h> |
|
26 #include <eikclbd.h> |
|
27 #include <eiktxlbm.h> |
|
28 #include <aknlists.h> |
|
29 #include <AknIconArray.h> |
|
30 #include <StringLoader.h> |
|
31 #include <hlplch.h> |
|
32 #include <AknQueryDialog.h> |
|
33 #include <AknWaitDialog.h> //<cmail> |
|
34 #include <mtudcbas.h> |
|
35 #include <data_caging_path_literals.hrh> |
|
36 #include <SendUiConsts.h> |
|
37 #include <muiu.mbg> |
|
38 #include <ipssossettings.rsg> |
|
39 //<cmail> |
|
40 #include <featmgr.h> |
|
41 //</cmail> |
|
42 #include "CFSMailCommon.h" |
|
43 //</cmail> |
|
44 #include <imapset.h> |
|
45 #include <akntitle.h> |
|
46 |
|
47 #include "ipssetutilsconsts.h" |
|
48 #include "ipssetutils.h" |
|
49 #include "ipssetuictrlsoftkey.h" |
|
50 #include "ipssetuifolderlistarray.h" |
|
51 #include "ipssetutilsoperationwait.h" |
|
52 #include "ipssetui.h" |
|
53 #include "ipsplgconnectandrefreshfolderlist.h" |
|
54 |
|
55 #include "ipssetuifoldersubscription.h" |
|
56 |
|
57 #include "FreestyleEmailUiConstants.h" |
|
58 #include <csxhelp/cmail.hlp.hrh> |
|
59 |
|
60 // Correct path is added to literal when it is used. |
|
61 _LIT(KIpsSetUiBitmapFile, "z:muiu.MBM"); |
|
62 const TInt KImumFolderArrayVisibleItems = 5; |
|
63 const TInt KImumFolderIconArrayGranularity = 6; |
|
64 |
|
65 // ---------------------------------------------------------------------------- |
|
66 // CIpsSetUiSubscriptionDialog::NewL |
|
67 // ---------------------------------------------------------------------------- |
|
68 // |
|
69 CIpsSetUiSubscriptionDialog* CIpsSetUiSubscriptionDialog::NewL( |
|
70 TUint64& aFlags, |
|
71 TMsvId aServiceId, |
|
72 CMsvSession& aSession, |
|
73 CAknTitlePane& aTitlePane, |
|
74 const TDesC& aTitlePaneText ) |
|
75 { |
|
76 FUNC_LOG; |
|
77 CIpsSetUiSubscriptionDialog* self = |
|
78 new ( ELeave ) CIpsSetUiSubscriptionDialog( |
|
79 aFlags, |
|
80 aServiceId, |
|
81 aSession, |
|
82 aTitlePane ); |
|
83 |
|
84 CleanupStack::PushL(self); |
|
85 self->ConstructL( aTitlePaneText ); |
|
86 CleanupStack::Pop( self ); |
|
87 return self; |
|
88 } |
|
89 |
|
90 // ---------------------------------------------------------------------------- |
|
91 // CIpsSetUiSubscriptionDialog::~CIpsSetUiSubscriptionDialog |
|
92 // ---------------------------------------------------------------------------- |
|
93 // |
|
94 CIpsSetUiSubscriptionDialog::~CIpsSetUiSubscriptionDialog() |
|
95 { |
|
96 FUNC_LOG; |
|
97 iSession.RemoveObserver(*this); |
|
98 delete iBaseMtm; |
|
99 iBaseMtm = NULL; |
|
100 delete iContextEntry; |
|
101 iContextEntry = NULL; |
|
102 delete iFolderListArray; |
|
103 iFolderListArray = NULL; |
|
104 delete iSoftkeys; |
|
105 iSoftkeys = NULL; |
|
106 delete iMtmRegistry; |
|
107 iMtmRegistry = NULL; |
|
108 delete iOldTitlePaneText; |
|
109 iOldTitlePaneText = NULL; |
|
110 delete iAsyncWaitNote; |
|
111 iAsyncWaitNote = NULL; |
|
112 //<cmail> |
|
113 delete iAsyncHelper; |
|
114 iAsyncHelper = NULL; |
|
115 if(iEntrySelection) |
|
116 delete iEntrySelection; |
|
117 iEntrySelection = NULL; |
|
118 //</cmail> |
|
119 } |
|
120 |
|
121 // ---------------------------------------------------------------------------- |
|
122 // CIpsSetUiSubscriptionDialog::CIpsSetUiSubscriptionDialog |
|
123 // ---------------------------------------------------------------------------- |
|
124 // |
|
125 CIpsSetUiSubscriptionDialog::CIpsSetUiSubscriptionDialog( |
|
126 TUint64& aFlags, |
|
127 TMsvId aServiceId, |
|
128 CMsvSession& aSession, |
|
129 CAknTitlePane& aTitlePane ) |
|
130 : |
|
131 iFlags( aFlags ), |
|
132 iServiceId( aServiceId ), |
|
133 iSession( aSession ), |
|
134 iTitlePane( aTitlePane ) |
|
135 , iState(CIpsSetUiSubscriptionDialog::EIdle), //<cmail> |
|
136 iFetchDialogDismissed(EFalse), iMultipleStarted(EFalse) //<cmail> |
|
137 { |
|
138 FUNC_LOG; |
|
139 } |
|
140 |
|
141 // ---------------------------------------------------------------------------- |
|
142 // CIpsSetUiSubscriptionDialog::ConstructL |
|
143 // ---------------------------------------------------------------------------- |
|
144 // |
|
145 void CIpsSetUiSubscriptionDialog::ConstructL( const TDesC& aTitlePaneText ) |
|
146 { |
|
147 FUNC_LOG; |
|
148 CAknDialog::ConstructL( R_IPS_SET_SETTINGS_SUBSCRIBE_MENU ); |
|
149 |
|
150 // BaseMTM interface is required for subscribing and unsubscribing folders |
|
151 iMtmRegistry = CClientMtmRegistry::NewL( iSession ); |
|
152 iBaseMtm = iMtmRegistry->NewMtmL( KSenduiMtmImap4Uid ); |
|
153 iBaseMtm->SwitchCurrentEntryL(iServiceId); |
|
154 |
|
155 iSession.AddObserverL(*this); |
|
156 iOrdering = TMsvSelectionOrdering(KMsvGroupByType, EMsvSortByDetails, ETrue); |
|
157 iContextEntry = CMsvEntry::NewL(iSession, iServiceId, iOrdering); |
|
158 iFolderListArray = CIpsSetUiFolderListArray::NewL( iSession, iServiceId ); |
|
159 iOpenedFolderId = iServiceId; |
|
160 delete iOldTitlePaneText; |
|
161 iOldTitlePaneText = NULL; |
|
162 iOldTitlePaneText = iTitlePane.Text()->Alloc(); |
|
163 iTitlePane.SetTextL( aTitlePaneText ); |
|
164 //<cmail> |
|
165 iAsyncHelper = new (ELeave) CSubscriptionDialogActiveHelper(this); |
|
166 //</cmail> |
|
167 } |
|
168 |
|
169 /****************************************************************************** |
|
170 |
|
171 Init |
|
172 |
|
173 ******************************************************************************/ |
|
174 |
|
175 // ---------------------------------------------------------------------------- |
|
176 // CIpsSetUiSubscriptionDialog::PreLayoutDynInitL |
|
177 // ---------------------------------------------------------------------------- |
|
178 // |
|
179 void CIpsSetUiSubscriptionDialog::PreLayoutDynInitL() |
|
180 { |
|
181 FUNC_LOG; |
|
182 // <cmail> |
|
183 |
|
184 /*TBool refreshed = EFalse; |
|
185 CAknQueryDialog* confDialog = CAknQueryDialog::NewL(); |
|
186 if( confDialog->ExecuteLD( R_IPS_SET_CONNECT_FOR_UPDATE ) ) |
|
187 { |
|
188 refreshed = ETrue; |
|
189 CreateOperationL( EIpsSetUiRefreshFolderList ); |
|
190 } |
|
191 |
|
192 if( refreshed ) |
|
193 { |
|
194 iFolderListArray->RefreshFolderListArrayL(); |
|
195 }*/ |
|
196 // </cmail> |
|
197 CEikColumnListBox* listBox = |
|
198 static_cast< CEikColumnListBox* >( Control( EIpsSetUiIdFolderListBox ) ); |
|
199 |
|
200 listBox->SetListBoxObserver( this ); |
|
201 |
|
202 // Create scroll bar |
|
203 listBox->CreateScrollBarFrameL(); |
|
204 listBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
205 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
206 |
|
207 CTextListBoxModel* model = listBox->Model(); |
|
208 model->SetItemTextArray( iFolderListArray ); |
|
209 listBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
210 |
|
211 HBufC* emptyText = |
|
212 StringLoader::LoadLC( R_FSE_SETTINGS_MAIL_NOTE_NOTUPDATED ); |
|
213 |
|
214 listBox->View()->SetListEmptyTextL( emptyText->Des() ); |
|
215 |
|
216 CArrayPtrFlat<CGulIcon>* icons |
|
217 = new(ELeave) CAknIconArray( KImumFolderIconArrayGranularity ); |
|
218 |
|
219 CleanupStack::PushL( icons ); |
|
220 |
|
221 // create icon array |
|
222 TFileName fileName; |
|
223 |
|
224 TParse tp; |
|
225 tp.Set( KIpsSetUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
226 fileName.Copy( tp.FullName() ); |
|
227 |
|
228 AppendIconsL( fileName, icons ); |
|
229 |
|
230 reinterpret_cast<CAknSingleGraphicStyleListBox*>( listBox )-> |
|
231 ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
232 |
|
233 |
|
234 CleanupStack::Pop( icons ); |
|
235 CleanupStack::PopAndDestroy( emptyText ); |
|
236 |
|
237 } |
|
238 |
|
239 // ---------------------------------------------------------------------------- |
|
240 // CIpsSetUiSubscriptionDialog::PostLayoutDynInitL |
|
241 // ---------------------------------------------------------------------------- |
|
242 // |
|
243 void CIpsSetUiSubscriptionDialog::PostLayoutDynInitL() |
|
244 { |
|
245 FUNC_LOG; |
|
246 iSoftkeys = CIpsSetUiCtrlSoftkey::NewL( ButtonGroupContainer() ); |
|
247 // Set this dialog for button listening |
|
248 iSoftkeys->SetMSKLabelling( ETrue ); |
|
249 iSoftkeys->UpdateMiddleSoftkeyLabelL( |
|
250 GetResourceForMiddlekey(), EAknSoftkeyOpen, NULL ); |
|
251 |
|
252 } |
|
253 |
|
254 // ---------------------------------------------------------------------------- |
|
255 // CIpsSetUiSubscriptionDialog::DynInitMenuPaneL |
|
256 // ---------------------------------------------------------------------------- |
|
257 // |
|
258 void CIpsSetUiSubscriptionDialog::DynInitMenuPaneL( |
|
259 TInt aResourceId, |
|
260 CEikMenuPane* aMenuPane ) |
|
261 { |
|
262 FUNC_LOG; |
|
263 TMsvId folderId = CurrentFolder(); |
|
264 if ( folderId == KErrNotFound ) |
|
265 { |
|
266 if ( aResourceId == R_IPS_SET_SETTINGS_SUBSCRIBE_MENUPANE ) |
|
267 { |
|
268 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
269 { |
|
270 // remove help support in pf5250 |
|
271 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
272 } |
|
273 |
|
274 aMenuPane->SetItemDimmed( EIpsSetUiFolderOpenFolder, ETrue ); |
|
275 aMenuPane->SetItemDimmed( EIpsSetUiFolderSubscribe, ETrue ); |
|
276 aMenuPane->SetItemDimmed( EIpsSetUiFolderUnsubscribe, ETrue ); |
|
277 } |
|
278 } |
|
279 else |
|
280 { |
|
281 TMsvId prevEntry = iContextEntry->Entry().Id(); |
|
282 iContextEntry->SetEntryL( folderId ); |
|
283 const TMsvEmailEntry emailEntry( iContextEntry->Entry() ); |
|
284 |
|
285 if ( aResourceId == R_IPS_SET_SETTINGS_SUBSCRIBE_MENUPANE ) |
|
286 { |
|
287 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
288 { |
|
289 // remove help support in pf5250 |
|
290 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue); |
|
291 } |
|
292 |
|
293 if ( !ContextHasChildFolders() ) |
|
294 { |
|
295 aMenuPane->SetItemDimmed( EIpsSetUiFolderOpenFolder, ETrue ); |
|
296 } |
|
297 if ( IpsSetUtils::IsInbox( iSession, emailEntry ) ) |
|
298 { |
|
299 //inbox subscription cannot be changed |
|
300 aMenuPane->SetItemDimmed( EIpsSetUiFolderSubscribe, ETrue ); |
|
301 aMenuPane->SetItemDimmed( EIpsSetUiFolderUnsubscribe, ETrue ); |
|
302 } |
|
303 else |
|
304 { |
|
305 aMenuPane->SetItemDimmed( |
|
306 EIpsSetUiFolderSubscribe, emailEntry.LocalSubscription() ); |
|
307 aMenuPane->SetItemDimmed( |
|
308 EIpsSetUiFolderUnsubscribe, !emailEntry.LocalSubscription() ); |
|
309 } |
|
310 } |
|
311 |
|
312 iContextEntry->SetEntryL( prevEntry ); |
|
313 } |
|
314 |
|
315 } |
|
316 |
|
317 /****************************************************************************** |
|
318 |
|
319 Events |
|
320 |
|
321 ******************************************************************************/ |
|
322 |
|
323 // ---------------------------------------------------------------------------- |
|
324 // CIpsSetUiSubscriptionDialog::HandleSessionEventL |
|
325 // ---------------------------------------------------------------------------- |
|
326 // |
|
327 void CIpsSetUiSubscriptionDialog::HandleSessionEventL(TMsvSessionEvent aEvent, |
|
328 TAny* aArg1, TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
329 { |
|
330 FUNC_LOG; |
|
331 if(aEvent!=EMsvEntriesChanged) |
|
332 return; |
|
333 |
|
334 CMsvEntrySelection& sel=*static_cast<CMsvEntrySelection*>(aArg1); |
|
335 if(sel.Find(CurrentFolder())!=KErrNotFound) |
|
336 { |
|
337 CEikColumnListBox* listBox = static_cast<CEikColumnListBox*>( |
|
338 Control(EIpsSetUiIdFolderListBox)); |
|
339 listBox->DrawNow(); |
|
340 } |
|
341 } |
|
342 |
|
343 // ---------------------------------------------------------------------------- |
|
344 // CIpsSetUiSubscriptionDialog::OkToExitL |
|
345 // ---------------------------------------------------------------------------- |
|
346 // |
|
347 TBool CIpsSetUiSubscriptionDialog::OkToExitL(TInt aButtonId) |
|
348 { |
|
349 FUNC_LOG; |
|
350 TBool exit=EFalse; |
|
351 CEikColumnListBox* listBox = static_cast<CEikColumnListBox*>( |
|
352 Control(EIpsSetUiIdFolderListBox)); |
|
353 const TInt oldCount = listBox->Model()->NumberOfItems(); |
|
354 |
|
355 switch(aButtonId) |
|
356 { |
|
357 case EAknSoftkeyOptions: |
|
358 return CAknDialog::OkToExitL( EAknSoftkeyOptions ); |
|
359 |
|
360 case EIpsSetUiFolderSubscribe: |
|
361 case EIpsSetUiFolderUnsubscribe: |
|
362 |
|
363 CreateOperationL( aButtonId ); |
|
364 break; |
|
365 |
|
366 case EAknSoftkeyClose: |
|
367 exit = ETrue; |
|
368 break; |
|
369 |
|
370 case EIpsSetUiFolderOpenFolder: |
|
371 // open folder which has subfolders... |
|
372 iContextEntry->SetEntryL( CurrentFolder() ); |
|
373 if ( ContextHasChildFolders() ) |
|
374 { |
|
375 iOpenedFolderId = CurrentFolder(); |
|
376 iFolderListArray->ChangEIpsSetUiFolderL( CurrentFolder() ); |
|
377 if ( listBox->Model()->NumberOfItems() ) |
|
378 { |
|
379 listBox->SetTopItemIndex( 0 ); |
|
380 listBox->SetCurrentItemIndex( 0 ); |
|
381 } |
|
382 if ( oldCount > listBox->Model()->NumberOfItems() ) |
|
383 { |
|
384 listBox->HandleItemRemovalL(); |
|
385 } |
|
386 else |
|
387 { |
|
388 listBox->HandleItemAdditionL(); |
|
389 } |
|
390 } |
|
391 break; |
|
392 |
|
393 case EIpsSetUiRefreshFolderList: |
|
394 // Always after successfull update go to root view, |
|
395 // no matter where in the folder tree we are |
|
396 iContextEntry->SetEntryL( iServiceId ); |
|
397 iFolderListArray->ChangEIpsSetUiFolderL( iServiceId ); |
|
398 if ( listBox->Model()->NumberOfItems() ) |
|
399 { |
|
400 listBox->SetTopItemIndex( 0 ); |
|
401 listBox->SetCurrentItemIndex( 0 ); |
|
402 } |
|
403 if ( oldCount > listBox->Model()->NumberOfItems() ) |
|
404 { |
|
405 listBox->HandleItemRemovalL(); |
|
406 } |
|
407 else |
|
408 { |
|
409 listBox->HandleItemAdditionL(); |
|
410 } |
|
411 break; |
|
412 case EAknSoftkeyBack: |
|
413 { |
|
414 if( iContextEntry->Entry().iType == KUidMsvServiceEntry ) |
|
415 { |
|
416 //Only exit if current folder is service |
|
417 if ( iOldTitlePaneText ) |
|
418 { |
|
419 iTitlePane.SetTextL( *iOldTitlePaneText ); |
|
420 } |
|
421 exit = ETrue; |
|
422 break; |
|
423 } |
|
424 |
|
425 TMsvId folderToBeSelected = iOpenedFolderId; |
|
426 iContextEntry->SetEntryL( iOpenedFolderId ); |
|
427 |
|
428 iOpenedFolderId = iContextEntry->Entry().Parent(); |
|
429 iFolderListArray->ChangEIpsSetUiFolderL( iOpenedFolderId ); |
|
430 iContextEntry->SetEntryL( iOpenedFolderId ); |
|
431 |
|
432 if ( oldCount > listBox->Model()->NumberOfItems() ) |
|
433 { |
|
434 listBox->HandleItemRemovalL(); |
|
435 } |
|
436 else |
|
437 { |
|
438 listBox->HandleItemAdditionL(); |
|
439 } |
|
440 |
|
441 TInt loop; |
|
442 for ( loop = iContextEntry->Count()-1; loop >= 0; loop-- ) |
|
443 { |
|
444 if ( folderToBeSelected == (*iContextEntry)[loop].Id() ) |
|
445 { |
|
446 break; |
|
447 } |
|
448 } |
|
449 if ( loop < 0 ) |
|
450 { |
|
451 loop = 0; |
|
452 } |
|
453 listBox->SetTopItemIndex( ( loop > KImumFolderArrayVisibleItems ? |
|
454 loop - KImumFolderArrayVisibleItems : 0 ) ); |
|
455 listBox->SetCurrentItemIndex( loop ); |
|
456 } |
|
457 break; |
|
458 |
|
459 case EEikCmdExit: |
|
460 exit = ETrue; |
|
461 // Issue exit to the dialog |
|
462 iFlags |= EIpsSetUiShouldExit; |
|
463 break; |
|
464 |
|
465 default: |
|
466 break; |
|
467 }; |
|
468 |
|
469 listBox->DrawNow(); |
|
470 //<cmail> |
|
471 if(exit) |
|
472 { |
|
473 CancelAllAsyncRequests(); |
|
474 if(iAsyncWaitNote && (!iFetchDialogDismissed)) |
|
475 iAsyncWaitNote->ProcessFinishedL(); |
|
476 } |
|
477 //</cmail> |
|
478 return exit; |
|
479 } |
|
480 |
|
481 // ---------------------------------------------------------------------------- |
|
482 // CIpsSetUiSubscriptionDialog::HandleListBoxEventL |
|
483 // ---------------------------------------------------------------------------- |
|
484 // |
|
485 void CIpsSetUiSubscriptionDialog::HandleListBoxEventL( |
|
486 CEikListBox* /*aListBox*/, |
|
487 TListBoxEvent aEventType ) |
|
488 { |
|
489 FUNC_LOG; |
|
490 if( aEventType == EEventItemSingleClicked || |
|
491 aEventType == EEventEnterKeyPressed ) |
|
492 { |
|
493 TMsvId prevEntry = iContextEntry->Entry().Id(); |
|
494 |
|
495 CEikColumnListBox* listBox = |
|
496 static_cast<CEikColumnListBox*>( |
|
497 Control( EIpsSetUiIdFolderListBox ) ); |
|
498 iContextEntry->SetEntryL( CurrentFolder() ); |
|
499 |
|
500 if ( listBox->Model()->NumberOfItems() && |
|
501 ContextHasChildFolders() ) |
|
502 { |
|
503 //if has childs, open folder |
|
504 OkToExitL( EIpsSetUiFolderOpenFolder ); |
|
505 } |
|
506 else |
|
507 { |
|
508 //if not, change subs state of the folder |
|
509 const TMsvEmailEntry emailEntry( iContextEntry->Entry() ); |
|
510 |
|
511 if ( IpsSetUtils::IsInbox( iSession, emailEntry ) ) |
|
512 { |
|
513 //inbox cannot be changed |
|
514 iContextEntry->SetEntryL( prevEntry ); |
|
515 return; |
|
516 } |
|
517 |
|
518 if ( emailEntry.LocalSubscription() ) |
|
519 { |
|
520 |
|
521 CreateOperationL( EIpsSetUiFolderUnsubscribe ); |
|
522 } |
|
523 else |
|
524 { |
|
525 |
|
526 CreateOperationL( EIpsSetUiFolderSubscribe ); |
|
527 } |
|
528 listBox->DrawNow(); |
|
529 iContextEntry->SetEntryL( prevEntry ); |
|
530 } |
|
531 // Don't set prev entry here because we're opening it, |
|
532 // so it will be valid |
|
533 } |
|
534 } |
|
535 |
|
536 |
|
537 // ---------------------------------------------------------------------------- |
|
538 // CIpsSetUiSubscriptionDialog::OfferKeyEventL |
|
539 // ---------------------------------------------------------------------------- |
|
540 // |
|
541 TKeyResponse CIpsSetUiSubscriptionDialog::OfferKeyEventL( |
|
542 const TKeyEvent& aKeyEvent, |
|
543 TEventCode aType ) |
|
544 { |
|
545 FUNC_LOG; |
|
546 // For key up events, update the middle softkey label |
|
547 if ( aType == EEventKeyDown && aKeyEvent.iScanCode == EStdKeyDevice3 ) |
|
548 { |
|
549 switch( CheckMSKState() ) |
|
550 { |
|
551 case EIpsSetUiFolderOpenFolder: |
|
552 ProcessCommandL( EIpsSetUiFolderOpenFolder ); |
|
553 break; |
|
554 case EIpsSetUiFolderUnsubscribe: |
|
555 ProcessCommandL( EIpsSetUiFolderUnsubscribe ); |
|
556 break; |
|
557 case EIpsSetUiFolderSubscribe: |
|
558 ProcessCommandL( EIpsSetUiFolderSubscribe ); |
|
559 break; |
|
560 default: |
|
561 break; |
|
562 } |
|
563 } |
|
564 |
|
565 if ( aType == EEventKeyUp ) |
|
566 { |
|
567 iSoftkeys->UpdateMiddleSoftkeyLabelL( |
|
568 GetResourceForMiddlekey(), EAknSoftkeyOpen, NULL ); |
|
569 } |
|
570 |
|
571 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
572 } |
|
573 |
|
574 // ---------------------------------------------------------------------------- |
|
575 // CIpsSetUiSubscriptionDialog::ProcessCommandL |
|
576 // ---------------------------------------------------------------------------- |
|
577 // |
|
578 void CIpsSetUiSubscriptionDialog::ProcessCommandL( TInt aCommandId ) |
|
579 { |
|
580 FUNC_LOG; |
|
581 if ( MenuShowing() ) |
|
582 { |
|
583 HideMenu(); |
|
584 } |
|
585 |
|
586 CAknDialog::ProcessCommandL(aCommandId); |
|
587 switch( aCommandId ) |
|
588 { |
|
589 case EAknSoftkeyOk: |
|
590 case EAknSoftkeyOpen: |
|
591 HandleListBoxEventL( NULL, EEventEnterKeyPressed ); |
|
592 break; |
|
593 |
|
594 case EIpsSetUiFolderOpenFolder: |
|
595 OkToExitL( EIpsSetUiFolderOpenFolder ); |
|
596 break; |
|
597 case EIpsSetUiFolderSubscribe: |
|
598 case EIpsSetUiFolderUnsubscribe: |
|
599 { |
|
600 TMsvEntry tEntry; |
|
601 TMsvId service; |
|
602 iSession.GetEntry( CurrentFolder(), service, tEntry ); |
|
603 const TMsvEmailEntry emailEntry( tEntry ); |
|
604 |
|
605 CreateOperationL( aCommandId ); |
|
606 } |
|
607 break; |
|
608 case EIpsSetUiRefreshFolderList: |
|
609 SynchronisEIpsSetUiFoldersL(); |
|
610 iFolderListArray->RefreshFolderListArrayL(); |
|
611 OkToExitL( EIpsSetUiRefreshFolderList ); |
|
612 break; |
|
613 |
|
614 case EAknCmdHelp: |
|
615 { |
|
616 LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
617 break; |
|
618 } |
|
619 |
|
620 case EEikCmdExit: |
|
621 TryExitL( aCommandId ); |
|
622 break; |
|
623 default: |
|
624 iEikonEnv->EikAppUi()->HandleCommandL(aCommandId); |
|
625 break; |
|
626 } |
|
627 } |
|
628 |
|
629 /****************************************************************************** |
|
630 |
|
631 Tools |
|
632 |
|
633 ******************************************************************************/ |
|
634 |
|
635 // ---------------------------------------------------------------------------- |
|
636 // CIpsSetUiSubscriptionDialog::SynchronisEIpsSetUiFoldersL |
|
637 // ---------------------------------------------------------------------------- |
|
638 // |
|
639 void CIpsSetUiSubscriptionDialog::SynchronisEIpsSetUiFoldersL() |
|
640 { |
|
641 FUNC_LOG; |
|
642 CreateOperationL( EIpsSetUiRefreshFolderList ); |
|
643 } |
|
644 |
|
645 // ---------------------------------------------------------------------------- |
|
646 // CIpsSetUiSubscriptionDialog::CreateOperationL |
|
647 // ---------------------------------------------------------------------------- |
|
648 // |
|
649 void CIpsSetUiSubscriptionDialog::CreateOperationL( TInt aButtonId ) |
|
650 { |
|
651 FUNC_LOG; |
|
652 //<cmail> |
|
653 //only one outstanding operation at a time is allowed |
|
654 if ( iState != CIpsSetUiSubscriptionDialog::EIdle) |
|
655 { |
|
656 return; |
|
657 } |
|
658 if(iEntrySelection) |
|
659 { |
|
660 delete iEntrySelection; |
|
661 iEntrySelection = NULL; |
|
662 } |
|
663 iEntrySelection = new (ELeave) CMsvEntrySelection; |
|
664 //CleanupStack::PushL(mySelection); |
|
665 TBuf8<1> dummyParam; |
|
666 |
|
667 MFSMailRequestObserver* dummyFSObserver = NULL; |
|
668 CIpsPlgTimerOperation* timer = NULL; |
|
669 TFSMailMsgId mailboxId; |
|
670 //CIpsSetUtilsOperationWait* wait = CIpsSetUtilsOperationWait::NewLC(); |
|
671 //</cmail> |
|
672 |
|
673 switch(aButtonId) |
|
674 { |
|
675 case EIpsSetUiFolderSubscribe: |
|
676 case EIpsSetUiFolderUnsubscribe: |
|
677 { |
|
678 //check for child / parent folders for question "want to subscribe/ |
|
679 //unsub whole tree branch?" eat softkey commands. If user would leave |
|
680 //while subscription process in progress, it will crash. Only for |
|
681 //subscribe operations. We need to be able to cancel folder list update |
|
682 //operation |
|
683 iSoftkeys->SetAbsorb( ETrue ); |
|
684 |
|
685 //<cmail> |
|
686 HandleSubscriptionL( aButtonId, *iEntrySelection ); |
|
687 iCount = iEntrySelection->Count(); |
|
688 if( iCount > 1 ) |
|
689 { |
|
690 //if more than one folder, we need to |
|
691 //do a batch of subscribe commands |
|
692 CMsvOperation* aMsvOperation = iBaseMtm->InvokeAsyncFunctionL( KIMAP4MTMStartBatch, |
|
693 *iEntrySelection, dummyParam, iAsyncHelper->iStatus); |
|
694 iAsyncHelper->Start(aMsvOperation); //ownership transferred |
|
695 iMultipleStarted = ETrue; |
|
696 iState = aButtonId==EIpsSetUiFolderSubscribe? |
|
697 CIpsSetUiSubscriptionDialog::EMultipleSubscribe: |
|
698 CIpsSetUiSubscriptionDialog::EMultipleUnsubscribe; |
|
699 } |
|
700 else if (iCount) //single operation |
|
701 { |
|
702 //for only selected folder, no batch needed |
|
703 CMsvOperation* aMsvOperation = iBaseMtm->InvokeAsyncFunctionL( |
|
704 (aButtonId==EIpsSetUiFolderSubscribe? |
|
705 KIMAP4MTMLocalSubscribe:KIMAP4MTMLocalUnsubscribe), |
|
706 *iEntrySelection, dummyParam, iAsyncHelper->iStatus); |
|
707 iAsyncHelper->Start(aMsvOperation);//ownership transferred |
|
708 iState = ESingleOperation; |
|
709 } |
|
710 ShowWaitNoteL(); |
|
711 } |
|
712 break; |
|
713 |
|
714 case EIpsSetUiRefreshFolderList: |
|
715 { |
|
716 mailboxId.SetId( iServiceId ); |
|
717 iEntrySelection->AppendL(iServiceId); |
|
718 |
|
719 CMsvOperation* aMsvOperation = CIpsPlgConnectAndRefreshFolderList::NewL( |
|
720 iSession, |
|
721 CActive::EPriorityStandard, |
|
722 iAsyncHelper->iStatus, |
|
723 iServiceId, |
|
724 mailboxId, |
|
725 *iEntrySelection, |
|
726 *dummyFSObserver, |
|
727 *timer ); |
|
728 |
|
729 iAsyncHelper->Start(aMsvOperation);//ownership transferred |
|
730 iState = ESingleOperation; |
|
731 ShowWaitNoteL(); |
|
732 } |
|
733 break; |
|
734 |
|
735 default: |
|
736 break; |
|
737 }; |
|
738 |
|
739 if( aButtonId == EIpsSetUiFolderSubscribe || |
|
740 aButtonId == EIpsSetUiFolderUnsubscribe ) |
|
741 { |
|
742 iSoftkeys->SetAbsorb( EFalse ); |
|
743 } |
|
744 //</cmail> |
|
745 } |
|
746 |
|
747 // ---------------------------------------------------------------------------- |
|
748 // CIpsSetUiSubscriptionDialog::ContextHasChildFolders |
|
749 // ---------------------------------------------------------------------------- |
|
750 // |
|
751 TBool CIpsSetUiSubscriptionDialog::ContextHasChildFolders() const |
|
752 { |
|
753 FUNC_LOG; |
|
754 TInt index=iContextEntry->Count()-1; |
|
755 while (index>=0 && (*iContextEntry)[index].iType!=KUidMsvFolderEntry) |
|
756 index--; |
|
757 |
|
758 if(index!=-1) |
|
759 return ETrue; |
|
760 |
|
761 return EFalse; |
|
762 } |
|
763 |
|
764 // ---------------------------------------------------------------------------- |
|
765 // CIpsSetUiSubscriptionDialog::DisplayFinalProgressDialog |
|
766 // ---------------------------------------------------------------------------- |
|
767 // |
|
768 void CIpsSetUiSubscriptionDialog::DisplayFinalProgressDialog( |
|
769 CMsvOperation& /* aCompletedOperation */ ) const |
|
770 { |
|
771 FUNC_LOG; |
|
772 //iBaseMtm->DisplayProgressSummary(aCompletedOperation.FinalProgress()); |
|
773 } |
|
774 |
|
775 // ---------------------------------------------------------------------------- |
|
776 // CIpsSetUiSubscriptionDialog::AppendIconsL |
|
777 // ---------------------------------------------------------------------------- |
|
778 // |
|
779 void CIpsSetUiSubscriptionDialog::AppendIconsL( |
|
780 TFileName& aFileName, |
|
781 CArrayPtrFlat<CGulIcon>* aIcons) |
|
782 { |
|
783 FUNC_LOG; |
|
784 MAknsSkinInstance* skins = AknsUtils::SkinInstance(); |
|
785 TAknsItemID id; |
|
786 CFbsBitmap* bitmap; |
|
787 CFbsBitmap* bitmapMask; |
|
788 TBool found = ETrue; |
|
789 |
|
790 |
|
791 for( TInt i=EMbmMuiuQgn_prop_folder_small; |
|
792 i<EMbmMuiuQgn_prop_folder_sub_unsubs_new+1; i++ ) |
|
793 { |
|
794 CGulIcon* icon = NULL; |
|
795 found = ETrue; |
|
796 switch( i ) |
|
797 { |
|
798 case EMbmMuiuQgn_prop_folder_small: |
|
799 id.Set( KAknsIIDQgnPropFolderSmall ); |
|
800 break; |
|
801 case EMbmMuiuQgn_prop_folder_subs: |
|
802 id.Set( KAknsIIDQgnPropFolderSubs ); |
|
803 break; |
|
804 case EMbmMuiuQgn_prop_folder_subs_new: |
|
805 id.Set( KAknsIIDQgnPropFolderSubsNew ); |
|
806 break; |
|
807 case EMbmMuiuQgn_prop_folder_sub_small: |
|
808 id.Set( KAknsIIDQgnPropFolderSubSmall ); |
|
809 break; |
|
810 case EMbmMuiuQgn_prop_folder_sub_subs: |
|
811 id.Set( KAknsIIDQgnPropFolderSubSubs ); |
|
812 break; |
|
813 case EMbmMuiuQgn_prop_folder_sub_subs_new: |
|
814 id.Set( KAknsIIDQgnPropFolderSubSubsNew ); |
|
815 break; |
|
816 case EMbmMuiuQgn_prop_folder_unsubs_new: |
|
817 id.Set( KAknsIIDQgnPropFolderUnsubsNew ); |
|
818 break; |
|
819 case EMbmMuiuQgn_prop_folder_sub_unsubs_new: |
|
820 id.Set( KAknsIIDQgnPropFolderSubUnsubsNew ); |
|
821 break; |
|
822 default: |
|
823 found = EFalse; |
|
824 break; |
|
825 } |
|
826 |
|
827 |
|
828 if( found ) |
|
829 { |
|
830 AknsUtils::CreateIconL( skins, id, bitmap, |
|
831 bitmapMask, aFileName, i, i + 1 ); |
|
832 |
|
833 icon = CGulIcon::NewL( bitmap, bitmapMask ); |
|
834 |
|
835 // ownership of bitmap and mask transfered to icon |
|
836 CleanupStack::PushL( icon ); |
|
837 aIcons->AppendL( icon ); |
|
838 CleanupStack::Pop( icon ); // icon |
|
839 } |
|
840 } |
|
841 |
|
842 } |
|
843 |
|
844 // ---------------------------------------------------------------------------- |
|
845 // CIpsSetUiSubscriptionDialog::CurrentFolder |
|
846 // ---------------------------------------------------------------------------- |
|
847 // |
|
848 TMsvId CIpsSetUiSubscriptionDialog::CurrentFolder() |
|
849 { |
|
850 FUNC_LOG; |
|
851 CEikColumnListBox* listBox = |
|
852 static_cast<CEikColumnListBox*>(Control(EIpsSetUiIdFolderListBox)); |
|
853 TInt curIndex = listBox->CurrentItemIndex(); |
|
854 |
|
855 return ( curIndex == KErrNotFound ? |
|
856 curIndex : iFolderListArray->Id( curIndex ) ); |
|
857 } |
|
858 |
|
859 // ---------------------------------------------------------------------------- |
|
860 // CIpsSetUiSubscriptionDialog::LaunchHelpL |
|
861 // Launch help using context |
|
862 // |
|
863 // ---------------------------------------------------------------------------- |
|
864 // |
|
865 void CIpsSetUiSubscriptionDialog::LaunchHelpL( const TDesC& aContext ) |
|
866 { |
|
867 FUNC_LOG; |
|
868 CArrayFix< TCoeHelpContext >* cntx = new( ELeave ) CArrayFixFlat< TCoeHelpContext >( 1 ); |
|
869 CleanupStack::PushL( cntx ); |
|
870 cntx->AppendL( TCoeHelpContext( KFSEmailUiUid, aContext ) ); |
|
871 CleanupStack::Pop( cntx ); |
|
872 HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), cntx ); |
|
873 |
|
874 } |
|
875 |
|
876 // ---------------------------------------------------------------------------- |
|
877 // CIpsSetUiSubscriptionDialog::GetHelpContext |
|
878 // Returns helpcontext as aContext |
|
879 // |
|
880 // ---------------------------------------------------------------------------- |
|
881 // |
|
882 void CIpsSetUiSubscriptionDialog::GetHelpContext |
|
883 (TCoeHelpContext& aContext) const |
|
884 { |
|
885 FUNC_LOG; |
|
886 // when this string appears in mce.hlp.hrh, remove this _LIT !!!!! |
|
887 _LIT(KMCE_HLP_SETT_MAILFOLDER_UPD,"MCE_HLP_SETT_MAILFOLDER_UPD"); |
|
888 const TUid KUidMce ={0x100058C5}; |
|
889 aContext.iMajor = KUidMce; |
|
890 aContext.iContext = KMCE_HLP_SETT_MAILFOLDER_UPD; |
|
891 } |
|
892 |
|
893 // ---------------------------------------------------------------------------- |
|
894 // CIpsSetUiSubscriptionDialog::HandleSubscriptionL() |
|
895 // ---------------------------------------------------------------------------- |
|
896 // |
|
897 void CIpsSetUiSubscriptionDialog::HandleSubscriptionL( |
|
898 TInt aSubType, |
|
899 CMsvEntrySelection& aSelection ) |
|
900 { |
|
901 FUNC_LOG; |
|
902 TMsvId current = CurrentFolder(); |
|
903 |
|
904 if( iFolderListArray->ContextHasChildren( current ) ) |
|
905 { |
|
906 //CMsvEntry is used this way because GetContextChildrenL is recursive. |
|
907 //Otherwise CMsvEntry objects would be created several times before the |
|
908 //first one is deleted which consumes lots of memory. Now we just set |
|
909 //new CMsvEntry over this one several times. |
|
910 CMsvEntry* entry = CMsvEntry::NewL(iSession, current, iOrdering); |
|
911 CleanupStack::PushL( entry ); |
|
912 CMsvEntrySelection* sel = |
|
913 iFolderListArray->GetContextChildrenL( current, *entry ); |
|
914 CleanupStack::PopAndDestroy( entry ); |
|
915 |
|
916 CleanupStack::PushL( sel ); |
|
917 |
|
918 TBool allFolders = CheckAreAllFoldersIncludedL( aSubType, sel ); |
|
919 |
|
920 CAknQueryDialog* subsQuery = new(ELeave) CAknQueryDialog; |
|
921 |
|
922 switch( aSubType ) |
|
923 { |
|
924 case EIpsSetUiFolderSubscribe: |
|
925 { |
|
926 //subscribe also all sub folders? |
|
927 subsQuery->PrepareLC( R_IPS_SET_DO_SUBS_FOR_SUBFOLDERS ); |
|
928 } |
|
929 break; |
|
930 case EIpsSetUiFolderUnsubscribe: |
|
931 { |
|
932 //unsubscribe also all sub folders? |
|
933 subsQuery->PrepareLC( R_IPS_SET_DO_UNSUBS_FOR_SUBFOLDERS ); |
|
934 } |
|
935 break; |
|
936 default: |
|
937 User::Leave( KErrNotSupported ); |
|
938 break; |
|
939 }//switch |
|
940 |
|
941 |
|
942 TInt ret = 1;//by default do all subfolders |
|
943 |
|
944 //if all subfolders already subbed / unsubbed, no need for query |
|
945 if( !allFolders ) |
|
946 { |
|
947 ret = subsQuery->RunLD(); |
|
948 } |
|
949 else |
|
950 { |
|
951 CleanupStack::PopAndDestroy( subsQuery ); |
|
952 } |
|
953 |
|
954 if( ret ) |
|
955 { |
|
956 //append all sub folders |
|
957 |
|
958 TInt count = sel->Count(); |
|
959 |
|
960 //first append current |
|
961 aSelection.AppendL( current ); |
|
962 |
|
963 //then the children |
|
964 TInt i; |
|
965 for( i=0; i<count; i++ ) |
|
966 { |
|
967 aSelection.AppendL( sel->At(i) ); |
|
968 } |
|
969 } |
|
970 else |
|
971 { |
|
972 //only selected |
|
973 aSelection.AppendL( current ); |
|
974 } |
|
975 |
|
976 CleanupStack::PopAndDestroy( sel ); |
|
977 }//if |
|
978 else |
|
979 { |
|
980 //no children, append only current |
|
981 aSelection.AppendL( current ); |
|
982 } |
|
983 } |
|
984 |
|
985 // ---------------------------------------------------------------------------- |
|
986 // CIpsSetUiSubscriptionDialog::CheckAreAllFoldersIncludedL |
|
987 // ---------------------------------------------------------------------------- |
|
988 // |
|
989 TBool CIpsSetUiSubscriptionDialog::CheckAreAllFoldersIncludedL( |
|
990 TInt aSubType, |
|
991 CMsvEntrySelection* sel ) |
|
992 { |
|
993 FUNC_LOG; |
|
994 TMsvEntry tEntry; |
|
995 TMsvId service; |
|
996 |
|
997 TInt count = sel->Count(); |
|
998 TInt i; |
|
999 TInt result = 0; |
|
1000 |
|
1001 for( i=0; i<count; i++ ) |
|
1002 { |
|
1003 iSession.GetEntry( sel->At(i), service, tEntry ); |
|
1004 TMsvEmailEntry emailEntry( tEntry ); |
|
1005 |
|
1006 if( aSubType == EIpsSetUiFolderSubscribe ) |
|
1007 { |
|
1008 //count all subscribed entries |
|
1009 if( emailEntry.LocalSubscription() ) |
|
1010 { |
|
1011 result++; |
|
1012 } |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 //count all unsubscribed entries |
|
1017 if( !emailEntry.LocalSubscription() ) |
|
1018 { |
|
1019 result++; |
|
1020 } |
|
1021 } |
|
1022 } |
|
1023 |
|
1024 if( count == result ) |
|
1025 { |
|
1026 return ETrue; |
|
1027 } |
|
1028 |
|
1029 return EFalse; |
|
1030 |
|
1031 } |
|
1032 |
|
1033 // ---------------------------------------------------------------------------- |
|
1034 // CIpsSetUiBaseDialog::CheckMSKState() |
|
1035 // ---------------------------------------------------------------------------- |
|
1036 // |
|
1037 TInt CIpsSetUiSubscriptionDialog::CheckMSKState() |
|
1038 { |
|
1039 FUNC_LOG; |
|
1040 TInt ret(KErrNotFound); |
|
1041 |
|
1042 // open subfolder view if current folder have them |
|
1043 if( iFolderListArray->ContextHasChildren( CurrentFolder() ) ) |
|
1044 { |
|
1045 ret = EIpsSetUiFolderOpenFolder; |
|
1046 } |
|
1047 // subscribe/unsubscribe |
|
1048 else |
|
1049 { |
|
1050 TMsvId prevEntry = iContextEntry->Entry().Id(); |
|
1051 TMsvId folderId = CurrentFolder(); |
|
1052 TRAP_IGNORE(iContextEntry->SetEntryL( folderId ) ); |
|
1053 const TMsvEmailEntry emailEntry( iContextEntry->Entry() ); |
|
1054 |
|
1055 if( IpsSetUtils::IsInbox( iSession, emailEntry ) ) |
|
1056 { |
|
1057 ret = KErrNotFound; |
|
1058 } |
|
1059 else if( emailEntry.LocalSubscription() ) |
|
1060 { |
|
1061 ret = EIpsSetUiFolderUnsubscribe; |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 ret = EIpsSetUiFolderSubscribe; |
|
1066 } |
|
1067 TRAP_IGNORE( iContextEntry->SetEntryL( prevEntry ) ); |
|
1068 } |
|
1069 return ret; |
|
1070 } |
|
1071 |
|
1072 |
|
1073 // ---------------------------------------------------------------------------- |
|
1074 // CIpsSetUiBaseDialog::GetResourceForMiddlekey() |
|
1075 // ---------------------------------------------------------------------------- |
|
1076 // |
|
1077 TInt CIpsSetUiSubscriptionDialog::GetResourceForMiddlekey() |
|
1078 { |
|
1079 FUNC_LOG; |
|
1080 //#ifdef MSK |
|
1081 TInt resource = KErrNotFound; |
|
1082 |
|
1083 switch( CheckMSKState() ) |
|
1084 { |
|
1085 case EIpsSetUiFolderOpenFolder: |
|
1086 resource = R_FSE_SETTINGS_MAIL_FOLDER_OPEN; |
|
1087 break; |
|
1088 case EIpsSetUiFolderUnsubscribe: |
|
1089 resource = R_FSE_SETTINGS_MAIL_FOLDER_UNSUBSCRIBE; |
|
1090 break; |
|
1091 case EIpsSetUiFolderSubscribe: |
|
1092 resource = R_FSE_SETTINGS_MAIL_FOLDER_SUBSCRIBE; |
|
1093 break; |
|
1094 default: |
|
1095 resource = KErrNotFound; |
|
1096 break; |
|
1097 } |
|
1098 |
|
1099 return resource; |
|
1100 /* |
|
1101 #else |
|
1102 return KErrNotFound; |
|
1103 #endif |
|
1104 */ |
|
1105 } |
|
1106 |
|
1107 //<cmail> |
|
1108 // ---------------------------------------------------------------------------- |
|
1109 // CIpsSetUiSubscriptionDialog::HandleAsyncRequestCompletedL |
|
1110 // ---------------------------------------------------------------------------- |
|
1111 // |
|
1112 void CIpsSetUiSubscriptionDialog::HandleAsyncRequestCompletedL( TInt /*aErrorId*/ ) |
|
1113 { |
|
1114 FUNC_LOG; |
|
1115 switch (iState) |
|
1116 { |
|
1117 case CIpsSetUiSubscriptionDialog::EIdle: |
|
1118 //just ignore |
|
1119 break; |
|
1120 |
|
1121 case CIpsSetUiSubscriptionDialog::ESingleOperation: |
|
1122 if(iAsyncWaitNote && (!iFetchDialogDismissed)) |
|
1123 iAsyncWaitNote->ProcessFinishedL(); |
|
1124 iState = CIpsSetUiSubscriptionDialog::EIdle; |
|
1125 iSoftkeys->UpdateMiddleSoftkeyLabelL( |
|
1126 GetResourceForMiddlekey(), EAknSoftkeyOpen, NULL ); |
|
1127 break; |
|
1128 |
|
1129 case CIpsSetUiSubscriptionDialog::EMultipleSubscribe: |
|
1130 case CIpsSetUiSubscriptionDialog::EMultipleUnsubscribe: |
|
1131 if(iMultipleStarted) |
|
1132 { |
|
1133 iMultipleStarted = EFalse; |
|
1134 } |
|
1135 else if(iCount) // dont delete in case iCount become 0 |
|
1136 //becausae of messagingfw does not work as specified we can't let iEntrySelection |
|
1137 //empty for KIMAP4MTMEndBatch command |
|
1138 iEntrySelection->Delete(0); |
|
1139 TBuf8<1> dummyParam; |
|
1140 if( iCount ) // if still some entries left for processing |
|
1141 { |
|
1142 CMsvOperation* aMsvOperation = iBaseMtm->InvokeAsyncFunctionL( |
|
1143 (iState==CIpsSetUiSubscriptionDialog::EMultipleSubscribe? |
|
1144 KIMAP4MTMLocalSubscribe:KIMAP4MTMLocalUnsubscribe), |
|
1145 *iEntrySelection, dummyParam, iAsyncHelper->iStatus); |
|
1146 iAsyncHelper->Start(aMsvOperation); |
|
1147 iCount--; |
|
1148 } |
|
1149 else //end processing |
|
1150 { |
|
1151 CMsvOperation* aMsvOperation = iBaseMtm->InvokeAsyncFunctionL( KIMAP4MTMEndBatch, |
|
1152 *iEntrySelection, dummyParam, iAsyncHelper->iStatus); |
|
1153 iState = ESingleOperation; |
|
1154 iAsyncHelper->Start(aMsvOperation); |
|
1155 } |
|
1156 break; |
|
1157 } |
|
1158 } |
|
1159 |
|
1160 // ----------------------------------------------------------------------------- |
|
1161 // CIpsSetUiSubscriptionDialog::DialogDismissedL |
|
1162 // ----------------------------------------------------------------------------- |
|
1163 // |
|
1164 void CIpsSetUiSubscriptionDialog::DialogDismissedL( TInt aButtonId ) |
|
1165 { |
|
1166 FUNC_LOG; |
|
1167 if((aButtonId == EAknSoftkeyCancel) && |
|
1168 (iState!=CIpsSetUiSubscriptionDialog::EIdle)) |
|
1169 { |
|
1170 CancelAllAsyncRequests(); |
|
1171 } |
|
1172 iFetchDialogDismissed = ETrue; |
|
1173 } |
|
1174 |
|
1175 // ----------------------------------------------------------------------------- |
|
1176 // CIpsSetUiSubscriptionDialog::ShowWaitNoteL |
|
1177 // ----------------------------------------------------------------------------- |
|
1178 // |
|
1179 void CIpsSetUiSubscriptionDialog::ShowWaitNoteL() |
|
1180 { |
|
1181 FUNC_LOG; |
|
1182 if ( !iAsyncWaitNote ) |
|
1183 { |
|
1184 iAsyncWaitNote = new(ELeave)CAknWaitDialog( |
|
1185 (REINTERPRET_CAST(CEikDialog**,&iAsyncWaitNote)), EFalse); |
|
1186 iAsyncWaitNote->SetCallback(this); |
|
1187 iFetchDialogDismissed = EFalse; |
|
1188 iAsyncWaitNote->ExecuteLD(R_IPS_SETUI_WAIT_REFRESH_FOLDER_LIST_DIALOG); |
|
1189 } |
|
1190 } |
|
1191 |
|
1192 // ----------------------------------------------------------------------------- |
|
1193 // CIpsSetUiSubscriptionDialog::DialogDismissedL |
|
1194 // ----------------------------------------------------------------------------- |
|
1195 // |
|
1196 void CIpsSetUiSubscriptionDialog::CancelAllAsyncRequests() |
|
1197 { |
|
1198 FUNC_LOG; |
|
1199 iState = CIpsSetUiSubscriptionDialog::EIdle; |
|
1200 if(iAsyncHelper) |
|
1201 iAsyncHelper->Cancel(); |
|
1202 iMultipleStarted = EFalse; |
|
1203 } |
|
1204 |
|
1205 // ---------------------------------------------------------------------------- |
|
1206 // CSubscriptionDialogActiveHelper::CSubscriptionDialogActiveHelper |
|
1207 // ---------------------------------------------------------------------------- |
|
1208 // |
|
1209 CSubscriptionDialogActiveHelper::CSubscriptionDialogActiveHelper |
|
1210 (CIpsSetUiSubscriptionDialog* aSubscriptionDialog): |
|
1211 CActive(CActive::EPriorityStandard), |
|
1212 iMsvOperation(NULL) |
|
1213 { |
|
1214 FUNC_LOG; |
|
1215 iSubscriptionDialog = aSubscriptionDialog; |
|
1216 CActiveScheduler::Add(this); |
|
1217 } |
|
1218 |
|
1219 // ---------------------------------------------------------------------------- |
|
1220 // CSubscriptionDialogActiveHelper::~CSubscriptionDialogActiveHelper() |
|
1221 // ---------------------------------------------------------------------------- |
|
1222 // |
|
1223 CSubscriptionDialogActiveHelper::~CSubscriptionDialogActiveHelper() |
|
1224 { |
|
1225 FUNC_LOG; |
|
1226 //Cancel(); |
|
1227 iSubscriptionDialog = NULL; |
|
1228 if(iMsvOperation) |
|
1229 delete iMsvOperation; |
|
1230 } |
|
1231 |
|
1232 // ---------------------------------------------------------------------------- |
|
1233 // CSubscriptionDialogActiveHelper::Start() |
|
1234 // ---------------------------------------------------------------------------- |
|
1235 // |
|
1236 void CSubscriptionDialogActiveHelper::Start(CMsvOperation* aMsvOperation) |
|
1237 { |
|
1238 FUNC_LOG; |
|
1239 if(iMsvOperation) |
|
1240 delete iMsvOperation; |
|
1241 iMsvOperation = aMsvOperation; |
|
1242 SetActive(); |
|
1243 } |
|
1244 |
|
1245 // ---------------------------------------------------------------------------- |
|
1246 // CSubscriptionDialogActiveHelper::RunL() |
|
1247 // ---------------------------------------------------------------------------- |
|
1248 // |
|
1249 void CSubscriptionDialogActiveHelper::RunL() |
|
1250 { |
|
1251 FUNC_LOG; |
|
1252 if(iSubscriptionDialog) |
|
1253 iSubscriptionDialog->HandleAsyncRequestCompletedL(KErrNone); |
|
1254 } |
|
1255 |
|
1256 // ---------------------------------------------------------------------------- |
|
1257 // CSubscriptionDialogActiveHelper::DoCancel() |
|
1258 // ---------------------------------------------------------------------------- |
|
1259 // |
|
1260 void CSubscriptionDialogActiveHelper::DoCancel() |
|
1261 { |
|
1262 FUNC_LOG; |
|
1263 if(iMsvOperation) |
|
1264 iMsvOperation->Cancel(); |
|
1265 } |
|
1266 //</cmail> |
|
1267 |
|
1268 |
|
1269 // End of File |
|
1270 |