|
1 /* |
|
2 * Copyright (c) 2002 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 * Main view of the Mce. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <eikclbd.h> |
|
24 #include <msvuids.h> |
|
25 #include <AknQueryDialog.h> // CAknQueryDialog |
|
26 #include <StringLoader.h> // StringLoader |
|
27 #include <aknlists.h> |
|
28 #include <akntitle.h> // CAknTitlePane |
|
29 #include <SenduiMtmUids.h> // mtm uids |
|
30 #include <eikmenub.h> |
|
31 #include <msvids.h> |
|
32 #include <featmgr.h> |
|
33 #include <schemehandler.h> |
|
34 #include <ConeResLoader.h> |
|
35 #include <apgcli.h> |
|
36 #include <msvstd.hrh> |
|
37 |
|
38 #include <mce.rsg> |
|
39 #include "mceui.h" |
|
40 #include "MceSessionHolder.h" |
|
41 #include "MceBitmapResolver.h" |
|
42 #include "MceMainViewListContainer.h" |
|
43 #include "MceMainViewEmptyListContainer.h" |
|
44 #include "MceMainViewListView.h" |
|
45 #include "MceMainViewListItemArray.h" |
|
46 #include "MceCommands.hrh" |
|
47 #include "McePanic.h" |
|
48 |
|
49 #include <bldvariant.hrh> |
|
50 |
|
51 #include <MNcnInternalNotification.h> |
|
52 #include <NcnNotificationDefs.h> |
|
53 #include "MceListItem.h" |
|
54 #include "MceIds.hrh" |
|
55 #include "MceIds.h" |
|
56 #include <ImumInternalApi.h> |
|
57 #include <ImumInHealthServices.h> |
|
58 #include <muiumsvuiserviceutilitiesinternal.h> |
|
59 #include <MessagingDomainCRKeys.h> |
|
60 #include <miutset.h> |
|
61 #include <mtudreg.h> |
|
62 #include <muiuflags.h> |
|
63 #include <ImumInternalApi.h> |
|
64 #include <muiulock.h> |
|
65 #include <messaginginternalcrkeys.h> |
|
66 #include <aknnotedialog.h> |
|
67 |
|
68 // CONSTANTS |
|
69 const TInt KMceWriteMessageAddIndex = 0; |
|
70 // Add 'Write message' to the first |
|
71 const TInt KMceNoRemotemailboxesAddIndex = 3; |
|
72 // Add 'No mailboxes' right after 'Documents' |
|
73 const TInt KMceShowMail = 1; |
|
74 // Mce is activated from new contacts note for mail |
|
75 const TInt KMceShowAudioMessage = 3; |
|
76 // Mce is activated from new contacts note for audio message |
|
77 #define KMessagingCentreMessageViewUid TVwsViewId( TUid::Uid( KMceApplicationUidValue ),TUid::Uid( KMceMessageListViewIdValue ) ) |
|
78 // Mail technology type |
|
79 const TUid KMailTechnologyTypeUid = { 0x10001671 }; |
|
80 // The position of the middle soft key |
|
81 const TInt KMSKPosition = 3; |
|
82 |
|
83 |
|
84 // ================= MEMBER FUNCTIONS ======================= |
|
85 |
|
86 CMceMainViewListView* CMceMainViewListView::NewL( |
|
87 CMsvSessionPtr aSession, |
|
88 CMceSessionHolder& aSessionHolder, |
|
89 CMceBitmapResolver& aBitmapResolver ) |
|
90 { |
|
91 MCELOGGER_ENTERFN("CMceMainViewListView::NewL()"); |
|
92 CMceMainViewListView* self = new (ELeave) CMceMainViewListView( |
|
93 aSession, aSessionHolder, aBitmapResolver ); |
|
94 CleanupStack::PushL(self); |
|
95 self->ConstructL(); |
|
96 CleanupStack::Pop( self ); |
|
97 MCELOGGER_LEAVEFN("CMceMainViewListView::NewL()"); |
|
98 return self; |
|
99 } |
|
100 |
|
101 CMceMainViewListView::CMceMainViewListView( |
|
102 CMsvSessionPtr aSession, |
|
103 CMceSessionHolder& aSessionHolder, |
|
104 CMceBitmapResolver& aBitmapResolver ) |
|
105 : |
|
106 /* CMceMainViewListView( |
|
107 aSession, |
|
108 KMsvRootIndexEntryIdValue, |
|
109 aSessionHolder, aBitmapResolver ),*/ |
|
110 iSession( aSession ), |
|
111 iSessionHolder( aSessionHolder ), |
|
112 iBitmapResolver( aBitmapResolver ), |
|
113 iSelectedIndex( KErrNotFound ), |
|
114 iTopItemIndex( 0 ), |
|
115 iSelectionFolderId( KMsvNullIndexEntryId ), |
|
116 iEmailClientIntegration(EFalse), |
|
117 iSelectableEmail(EFalse), |
|
118 iEmailFramework(EFalse), |
|
119 iFlick(EFalse) |
|
120 { |
|
121 iSessionHolder.AddClient(); |
|
122 } |
|
123 |
|
124 CMceMainViewListView::~CMceMainViewListView() |
|
125 { |
|
126 |
|
127 if ( iEmptyListContainer ) |
|
128 { |
|
129 AppUi()->RemoveFromStack(iEmptyListContainer); |
|
130 delete iEmptyListContainer; |
|
131 iEmptyListContainer = NULL; |
|
132 } |
|
133 |
|
134 if (iMsgListContainer) |
|
135 { |
|
136 CAknDoubleLargeStyleListBox* listBox = REINTERPRET_CAST( CAknDoubleLargeStyleListBox*, |
|
137 iMsgListContainer->ListBox() ); |
|
138 |
|
139 listBox->ItemDrawer()->ColumnData() |
|
140 ->SetIconArray( NULL ); |
|
141 // prevent icon array to be destroyed by column data |
|
142 if ( iListViewFlags.MceFlag( EMceUiFlagsContainerAddedToStack ) ) |
|
143 { |
|
144 AppUi()->RemoveFromStack(iMsgListContainer); |
|
145 iListViewFlags.ClearMceFlag( EMceUiFlagsContainerAddedToStack ); |
|
146 } |
|
147 } |
|
148 delete iMsgListContainer; |
|
149 |
|
150 delete iFolderEntry; |
|
151 // iSession->RemoveObserver( *this ) is called in HandleSessionEventL() |
|
152 delete iAiwServiceHandler; |
|
153 |
|
154 iSessionHolder.RemoveClient(); |
|
155 |
|
156 } |
|
157 |
|
158 void CMceMainViewListView::ConstructL() |
|
159 { |
|
160 iMceUi = STATIC_CAST( CMceUi*, AppUi() ); |
|
161 FeatureManager::InitializeLibL(); |
|
162 if ( FeatureManager::FeatureSupported( KFeatureIdEmailMceIntegration ) ) |
|
163 { |
|
164 iEmailClientIntegration = ETrue; |
|
165 CRepository* repository = NULL; |
|
166 TRAPD( ret, repository = CRepository::NewL( |
|
167 KCRUidSelectableDefaultEmailSettings ) ); |
|
168 |
|
169 if ( ret == KErrNone ) |
|
170 { |
|
171 TInt err = repository->Get( KIntegratedEmailAppMtmPluginId, |
|
172 iMtmPluginId ); |
|
173 if ( err != KErrNone ) |
|
174 { |
|
175 iMtmPluginId = 0; |
|
176 } |
|
177 } |
|
178 delete repository; |
|
179 } |
|
180 |
|
181 if ( FeatureManager::FeatureSupported( KFeatureIdSelectableEmail ) ) |
|
182 { |
|
183 iSelectableEmail = ETrue; |
|
184 } |
|
185 if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) ) |
|
186 { |
|
187 iEmailFramework = ETrue; |
|
188 } |
|
189 FeatureManager::UnInitializeLib(); |
|
190 |
|
191 BaseConstructL( R_MCE_MAIN_VIEW ); |
|
192 // CMceMainViewListView::ConstructL( EMceListTypeMainView ); |
|
193 iMsgListContainer = CMceMainViewListContainer::NewL( |
|
194 ClientRect(), |
|
195 KMsvRootIndexEntryIdValue, |
|
196 EMceListTypeMainView ); |
|
197 iMsgListContainer->SetMopParent( this ); |
|
198 } |
|
199 |
|
200 // ---------------------------------------------------- |
|
201 // CMceMainViewListView::Id |
|
202 // ---------------------------------------------------- |
|
203 TUid CMceMainViewListView::Id() const |
|
204 { |
|
205 return KMceMainViewListViewId; |
|
206 } |
|
207 |
|
208 // ---------------------------------------------------- |
|
209 // CMceMainViewListView::DoActivateL |
|
210 // ---------------------------------------------------- |
|
211 void CMceMainViewListView::DoActivateL( |
|
212 const TVwsViewId& /*aPrevViewId*/, |
|
213 TUid aCustomMessageId, |
|
214 const TDesC8& /*aCustomMessage*/) |
|
215 { |
|
216 MCELOGGER_ENTERFN("CMceMainViewListView::DoActivateL"); |
|
217 |
|
218 if ( aCustomMessageId.iUid == KMceHideInBackground ) |
|
219 { |
|
220 iSelectedIndex = KMceWriteMessageAddIndex; |
|
221 ConstructMainViewL(); |
|
222 iMceUi->SetCustomControl(0); // Enable bring-to-foreground on view activation |
|
223 } |
|
224 |
|
225 iDrawListbox = ETrue; |
|
226 iPerformOperationAfterMsgStart = KErrNone; |
|
227 |
|
228 iMceUi->SetMceViewActive( EMceMainViewActive ); |
|
229 iMceUi->SetMainViewActivatedFlag( ); |
|
230 if ( !iMsvSessionReady ) |
|
231 { |
|
232 if ( !iEmptyListContainer ) |
|
233 { |
|
234 iEmptyListContainer = CMceMainViewEmptyListContainer::NewL( ClientRect() ); |
|
235 AppUi()->AddToStackL(*this,iEmptyListContainer); |
|
236 MCELOGGER_WRITE_TIMESTAMP("Main view: Empty container activated at "); |
|
237 CEikStatusPane* sp = StatusPane(); |
|
238 sp->DrawNow(); |
|
239 } |
|
240 if ( aCustomMessageId.iUid == KMceShowMail ) |
|
241 { |
|
242 iPerformOperationAfterMsgStart = KMceShowMail; |
|
243 } |
|
244 else if ( aCustomMessageId.iUid == KMceShowAudioMessage ) |
|
245 { |
|
246 iPerformOperationAfterMsgStart = KMceShowAudioMessage; |
|
247 } |
|
248 MCELOGGER_LEAVEFN("CMceMainViewListView::DoActivateL2"); |
|
249 return; |
|
250 } |
|
251 |
|
252 TMsvId mailboxId = NULL; // the first mailbox id, in which there is unread mail |
|
253 TInt mailboxCount = 0; // the count of mailboxes, in which there are unread mail |
|
254 |
|
255 if ( iMceUi->IsEditorOpen() ) |
|
256 { |
|
257 // something is embedded in mce, wait for that to be closed |
|
258 iMceUi->CloseEditorApp(); |
|
259 } |
|
260 |
|
261 if ( aCustomMessageId.iUid == KMceShowMail ) |
|
262 { |
|
263 MCELOGGER_WRITE("CMceMainViewListView::DoActivateL ClearDontExitOnNextOperationComplete"); |
|
264 iMceUi->SetDontExitOnNextOperationComplete(); |
|
265 |
|
266 mailboxCount = MailboxWithUnreadMessagesL( mailboxId ); |
|
267 MCELOGGER_WRITE_FORMAT("CMceMainViewListView::DoActivateL mailboxCount %d", mailboxCount); |
|
268 MCELOGGER_WRITE_FORMAT("CMceMainViewListView::DoActivateL mailboxId 0x%x", mailboxId ); |
|
269 |
|
270 if ( mailboxId && mailboxCount == 1 ) |
|
271 { |
|
272 //activate remote folder view using mailboxId |
|
273 ActivateViewL ( KMessagingCentreMessageViewUid, TUid::Uid( mailboxId ),KNullDesC8() ); |
|
274 MCELOGGER_LEAVEFN("CMceMainViewListView::DoActivateL3"); |
|
275 return; |
|
276 } |
|
277 } |
|
278 else if ( aCustomMessageId.iUid == KMceShowAudioMessage ) |
|
279 { |
|
280 //activate remote folder view using inboxId |
|
281 ActivateViewL ( KMessagingCentreMessageViewUid, TUid::Uid( KMsvGlobalInBoxIndexEntryIdValue ),KNullDesC8() ); |
|
282 MCELOGGER_LEAVEFN("CMceMainViewListView::DoActivateL4"); |
|
283 return; |
|
284 } |
|
285 |
|
286 if ( iMsvSessionReady ) |
|
287 { |
|
288 if ( iEmptyListContainer ) |
|
289 { |
|
290 AppUi()->RemoveFromStack(iEmptyListContainer); |
|
291 delete iEmptyListContainer; |
|
292 iEmptyListContainer = NULL; |
|
293 MCELOGGER_WRITE_TIMESTAMP("Main view: Empty container deleted at "); |
|
294 } |
|
295 CreateContainerAndActivateL(); |
|
296 //folders navi |
|
297 iMceUi->RemoveFolderTabs(); |
|
298 |
|
299 iMceUi->RemoveTabs(); |
|
300 SetSpecialMSKButtonL(R_MCE_MSK_BUTTON_OPEN); |
|
301 } |
|
302 /* else if ( !iEmptyListContainer ) |
|
303 { |
|
304 iEmptyListContainer = CMceMainViewEmptyListContainer::NewL( ClientRect() ); |
|
305 AppUi()->AddToStackL(*this,iEmptyListContainer); |
|
306 MCELOGGER_WRITE_TIMESTAMP("Main view: Empty container activated at "); |
|
307 }*/ |
|
308 iMceUi->SetMceViewActive( EMceMainViewActive ); |
|
309 |
|
310 if ( mailboxId && mailboxCount > 1 ) |
|
311 { |
|
312 // launched from outside: |
|
313 // in several mailboxes unread mail, activate the first mailbox |
|
314 TInt mailboxIndex = iMsgListContainer->ItemIndex( mailboxId ); |
|
315 iMsgListContainer->ListBox()->SetCurrentItemIndex( mailboxIndex ); |
|
316 iMsgListContainer->ListBox()->DrawDeferred(); |
|
317 } |
|
318 |
|
319 iMceUi->ToPhoneMemoryQueryL( iMsvSessionReady ); |
|
320 MCELOGGER_LEAVEFN("CMceMainViewListView::DoActivateL1"); |
|
321 |
|
322 } |
|
323 |
|
324 // ---------------------------------------------------- |
|
325 // CMceMainViewListView::CreateContainerAndActivateL |
|
326 // ---------------------------------------------------- |
|
327 void CMceMainViewListView::CreateContainerAndActivateL() |
|
328 { |
|
329 MCELOGGER_ENTERFN("CreateContainerAndActivateL()"); |
|
330 if ( iMsgListContainer ) |
|
331 { |
|
332 iMsgListContainer->CreateListItemsL( iSession, iBitmapResolver ); |
|
333 iMsgListContainer->ListItems()->SetListItemArrayObserver( this ); |
|
334 ResetBitmapsL(); |
|
335 iMsgListContainer->SetMskL(); |
|
336 TInt defaultview = KMceConversationview; |
|
337 defaultview = GetMceDefaultViewL(); |
|
338 if(defaultview != KErrNotFound) |
|
339 { |
|
340 iMsgListContainer->ListItems()->SetDefaultViewSettings(defaultview); |
|
341 } |
|
342 } |
|
343 if ( !iDrawListbox ) |
|
344 { |
|
345 return; |
|
346 } |
|
347 |
|
348 |
|
349 |
|
350 CAknDoubleLargeStyleListBox* listBox = REINTERPRET_CAST( CAknDoubleLargeStyleListBox*, |
|
351 iMsgListContainer->ListBox() ); |
|
352 |
|
353 listBox->CreateScrollBarFrameL( ETrue ); |
|
354 listBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
355 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
356 |
|
357 listBox->ItemDrawer()->ColumnData() |
|
358 ->SetIconArray( iBitmapResolver.IconArray() ); |
|
359 iMsgListContainer->SetRect(ClientRect()); |
|
360 // Handle the layout switch iMceUi->TitlePaneL() |
|
361 if ( iMceUi->ResourceChangeCalled() ) |
|
362 { |
|
363 iMsgListContainer->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
364 iMceUi->ResetResourceChange(); |
|
365 } |
|
366 listBox->SetListBoxObserver(this); |
|
367 |
|
368 iMsgListContainer->ActivateL(); |
|
369 if ( !iListViewFlags.MceFlag( EMceUiFlagsContainerAddedToStack ) ) |
|
370 { |
|
371 AppUi()->AddToStackL(*this,iMsgListContainer); |
|
372 iListViewFlags.SetMceFlag( EMceUiFlagsContainerAddedToStack ); |
|
373 } |
|
374 |
|
375 if ( iEmptyListContainer ) |
|
376 { |
|
377 AppUi()->RemoveFromStack(iEmptyListContainer); |
|
378 delete iEmptyListContainer; |
|
379 iEmptyListContainer = NULL; |
|
380 } |
|
381 |
|
382 listBox->SetTopItemIndex( iTopItemIndex ); |
|
383 if ( iSelectionFolderId > KMsvRootIndexEntryId ) |
|
384 { |
|
385 TInt index = iMsgListContainer->ItemIndex( iSelectionFolderId ); |
|
386 if ( index > KErrNotFound ) |
|
387 { |
|
388 listBox->SetCurrentItemIndex( index ); |
|
389 listBox->UpdateScrollBarsL(); |
|
390 } |
|
391 iSelectionFolderId = KMsvNullIndexEntryId; |
|
392 } |
|
393 else if ( iSelectedIndex >= 0 ) |
|
394 { |
|
395 listBox->SetCurrentItemIndex( iSelectedIndex ); |
|
396 listBox->UpdateScrollBarsL(); |
|
397 } |
|
398 listBox->DrawNow(); |
|
399 |
|
400 // Fetch pointer to the default title pane control |
|
401 |
|
402 CAknTitlePane* title=iMceUi->TitlePaneL(); |
|
403 HBufC* text = StringLoader::LoadLC( R_MCE_MAIN_VIEW_TITLE, iEikonEnv ); |
|
404 title->SetTextL( *text ); |
|
405 CleanupStack::PopAndDestroy(); // text |
|
406 |
|
407 iMceViewActivated = ETrue; |
|
408 MCELOGGER_LEAVEFN("CreateContainerAndActivateL()"); |
|
409 MCELOGGER_WRITE_TIMESTAMP("Main view activated at "); |
|
410 } |
|
411 |
|
412 |
|
413 // ---------------------------------------------------- |
|
414 // CMceMainViewListView::DoDeactivate |
|
415 // ---------------------------------------------------- |
|
416 void CMceMainViewListView::DoDeactivate() |
|
417 { |
|
418 if ( iEmptyListContainer ) |
|
419 { |
|
420 AppUi()->RemoveFromStack(iEmptyListContainer); |
|
421 delete iEmptyListContainer; |
|
422 iEmptyListContainer = NULL; |
|
423 } |
|
424 |
|
425 if ( iMsgListContainer ) |
|
426 { |
|
427 iSelectedIndex = iMsgListContainer->CurrentItemIndex(); |
|
428 iTopItemIndex = iMsgListContainer->ListBox()->TopItemIndex(); |
|
429 if ( iListViewFlags.MceFlag( EMceUiFlagsContainerAddedToStack ) ) |
|
430 { |
|
431 AppUi()->RemoveFromStack(iMsgListContainer); |
|
432 iListViewFlags.ClearMceFlag( EMceUiFlagsContainerAddedToStack ); |
|
433 } |
|
434 } |
|
435 iMceViewActivated = EFalse; |
|
436 } |
|
437 |
|
438 // ---------------------------------------------------- |
|
439 // CMceMainViewListView::HandleListBoxEventL |
|
440 // ---------------------------------------------------- |
|
441 void CMceMainViewListView::HandleListBoxEventL( |
|
442 CEikListBox* /*aListBox*/, |
|
443 TListBoxEvent aEventType ) |
|
444 { |
|
445 switch(aEventType) |
|
446 { |
|
447 case EEventEnterKeyPressed: |
|
448 case EEventItemSingleClicked: |
|
449 ChangeViewL(); |
|
450 break; |
|
451 case EEventItemDraggingActioned: |
|
452 if ( iMsgListContainer ) |
|
453 { |
|
454 iMsgListContainer->SetMskL(); |
|
455 } |
|
456 break; |
|
457 case EEventFlickStarted: |
|
458 iFlick = ETrue; |
|
459 break; |
|
460 case EEventFlickStopped: |
|
461 iFlick = EFalse; |
|
462 break; |
|
463 default: |
|
464 break; |
|
465 |
|
466 } |
|
467 } |
|
468 |
|
469 // ---------------------------------------------------- |
|
470 // CMceMainViewListView::HandleCommandL |
|
471 // ---------------------------------------------------- |
|
472 void CMceMainViewListView::HandleCommandL( TInt aCommand ) |
|
473 { |
|
474 MCELOGGER_WRITE_FORMAT("CMceMainViewListView::HandleCommandL: aCommand: %d", aCommand); |
|
475 if ( !iMceViewActivated ) |
|
476 { |
|
477 return; |
|
478 } |
|
479 |
|
480 switch (aCommand) |
|
481 { |
|
482 case EAknSoftkeyExit: |
|
483 iMceUi->HandleCommandL( EEikCmdExit ); |
|
484 break; |
|
485 case EAknCmdOpen: |
|
486 case EMceCmdSelect: |
|
487 ChangeViewL(); |
|
488 break; |
|
489 case EMceCmdConnect: |
|
490 { |
|
491 iFolderEntry->SetEntryL(KMsvRootIndexEntryIdValue); |
|
492 |
|
493 const TMsvEntry entry = iFolderEntry->ChildDataL( iMsgListContainer->CurrentItemId() ); |
|
494 if ( entry.iType.iUid == KUidMsvServiceEntryValue ) |
|
495 { |
|
496 iMceUi->GoOnlineL( entry.Id() ); |
|
497 } |
|
498 } |
|
499 break; |
|
500 case EMceCmdCloseConnection: |
|
501 { |
|
502 iMceUi->CloseConnectionWithListQueryL(); |
|
503 } |
|
504 break; |
|
505 case EAknCmdHideInBackground: |
|
506 break; |
|
507 case EMceDefaultConversationsView: |
|
508 if ( SetMceDefaultViewL(KMceConversationview) ) |
|
509 { |
|
510 ShowConfirmationNoteL(R_DEFAULTVIEW_CONVERSATION_SELECTED); |
|
511 } |
|
512 break; |
|
513 |
|
514 case EMceDefaultInboxView: |
|
515 if ( SetMceDefaultViewL(KMceInboxView) ) |
|
516 { |
|
517 ShowConfirmationNoteL(R_DEFAULTVIEW_INBOX_SELECTED); |
|
518 } |
|
519 break; |
|
520 case EMceCmdSettings: |
|
521 { |
|
522 if (( iEmailClientIntegration )&&(!iEmailFramework)) |
|
523 { |
|
524 // these have to be updated here because when a mailbox setup wizard is launched |
|
525 // from MCE Settings dialog this view's DoDeactivate will not be entered (because of |
|
526 // CAknInputBlock used used in wizard launching). |
|
527 iSelectedIndex = iMsgListContainer->CurrentItemIndex(); |
|
528 iTopItemIndex = iMsgListContainer->ListBox()->TopItemIndex(); |
|
529 |
|
530 } |
|
531 iMceUi->HandleCommandL( aCommand ); |
|
532 break; |
|
533 |
|
534 } |
|
535 default: |
|
536 if ( iAiwServiceHandler && FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) && |
|
537 KAiwCmdSynchronize == iAiwServiceHandler->ServiceCmdByMenuCmd(aCommand) ) |
|
538 { |
|
539 TInt appId = EGenericParamMessageItemEMail; |
|
540 const TMceListItem& tempItem = iMsgListContainer->CurrentItemListItem(); |
|
541 TMsvEntry entry; |
|
542 TRAP_IGNORE( iMceUi->GetEntryL(tempItem.iMsvId,entry) ); |
|
543 CAiwGenericParamList* list = AiwSyncParamListLC( appId, entry.iDetails ); |
|
544 iAiwServiceHandler->ExecuteMenuCmdL(aCommand, *list, |
|
545 iAiwServiceHandler->OutParamListL()); |
|
546 CleanupStack::PopAndDestroy(list); |
|
547 } |
|
548 else |
|
549 { |
|
550 iMceUi->HandleCommandL( aCommand ); |
|
551 } |
|
552 break; |
|
553 } |
|
554 MCELOGGER_LEAVEFN("CMceMainViewListView::HandleCommandL()"); |
|
555 } |
|
556 |
|
557 // ---------------------------------------------------- |
|
558 // CMceMainViewListView::ProcessCommandL |
|
559 // ---------------------------------------------------- |
|
560 void CMceMainViewListView::ProcessCommandL(TInt aCommand) |
|
561 { |
|
562 MCELOGGER_ENTERFN("CMceMainViewListView::ProcessCommandL"); |
|
563 if ( !iMceUi->IsEditorOpen() && !iEmptyListContainer ) |
|
564 { |
|
565 CAknView::ProcessCommandL( aCommand ); |
|
566 } |
|
567 #ifdef _DEBUG |
|
568 else |
|
569 { |
|
570 MCELOGGER_WRITE("CMceMainViewListView::ProcessCommandL: Editor is open so don't call CAknView::ProcessCommandL"); |
|
571 } |
|
572 #endif |
|
573 MCELOGGER_LEAVEFN("CMceMainViewListView::ProcessCommandL"); |
|
574 } |
|
575 |
|
576 // ---------------------------------------------------- |
|
577 // CMceMainViewListView::ChangeViewL |
|
578 // ---------------------------------------------------- |
|
579 void CMceMainViewListView::ChangeViewL() |
|
580 { |
|
581 if ( iMceUi->IsEditorOpen() ) |
|
582 { |
|
583 MCELOGGER_WRITE("CMceMainViewListView::ChangeViewL: do nothing because already editing one"); |
|
584 return; |
|
585 } |
|
586 const TMceListItem& tempItem = iMsgListContainer->CurrentItemListItem(); |
|
587 if ( !tempItem.iExtraItem ) |
|
588 { |
|
589 TMsvId service; |
|
590 TMsvEntry child; |
|
591 User::LeaveIfError( iSession->GetEntry( tempItem.iMsvId, service, child ) ); |
|
592 __ASSERT_DEBUG( (child.iType == KUidMsvFolderEntry || child.iType == KUidMsvServiceEntry), Panic( EMceMainViewCannotChangeView ) ); |
|
593 if ( child.iType == KUidMsvFolderEntry ) |
|
594 { |
|
595 iMceUi->OpenFolderViewL( child.Id() ); |
|
596 iMceUi->ShowTabsL( child.Id() ); |
|
597 } |
|
598 else // if ( child.iType == KUidMsvServiceEntry ) |
|
599 { |
|
600 if ( iMceUi->IsSyncronizingL( child ) ) |
|
601 { |
|
602 //cannot open during suncML mail syncronizing |
|
603 return; |
|
604 } |
|
605 // Explanation: This part of code will launch Custom email application for |
|
606 // configured mtm plugin. For the other accounts behavior will not change. |
|
607 |
|
608 // If MTM plugin ID matches the one in the repository we'll let Mtm plugin |
|
609 // launch the mailbox view |
|
610 if ( ( iEmailClientIntegration && (!iEmailFramework)) && ( iMtmPluginId != 0 ) && |
|
611 ( child.iMtm.iUid == iMtmPluginId ) ) |
|
612 { |
|
613 iMceUi->OpenMtmMailboxViewL( child ); |
|
614 } |
|
615 else |
|
616 { |
|
617 iMceUi->OpenRemoteMailboxViewL( child.Id() ); |
|
618 } |
|
619 } |
|
620 |
|
621 } |
|
622 else if ( tempItem.iMsvId == KMceWriteMessageId ) |
|
623 { |
|
624 iMceUi->LaunchUniEditorL(); |
|
625 } |
|
626 else if ( tempItem.iMsvId == KMceNoMailboxesListId ) |
|
627 { |
|
628 CMuiuLock* repositoryLock = CMuiuLock::NewL( KCRUidMuiuVariation ); |
|
629 CleanupStack::PushL( repositoryLock ); |
|
630 TInt err = repositoryLock->Reserve(); |
|
631 if ( !err ) |
|
632 { |
|
633 if ( iEmailClientIntegration ) |
|
634 { |
|
635 // LAUNCH S60 wizard (with confirmation query) |
|
636 CAknQueryDialog* confDialog = CAknQueryDialog::NewL(); |
|
637 if ( confDialog->ExecuteLD( R_MCE_CREATE_MBOX_CONFIRMATION ) ) |
|
638 { |
|
639 iMceUi->CreateNewAccountL( KSenduiMtmSmtpUid, |
|
640 KMsvNullIndexEntryId ); |
|
641 } |
|
642 // Release repository |
|
643 repositoryLock->Release(); |
|
644 CleanupStack::PopAndDestroy( repositoryLock ); |
|
645 return; |
|
646 } // iEmailClientIntegration |
|
647 CImumInternalApi* emailApiPtr = |
|
648 iMsgListContainer->ListItems()->GetEmailApi(); |
|
649 |
|
650 //Deny creating new mail account if TARM is active. |
|
651 if( !emailApiPtr->IsEmailFeatureSupportedL( |
|
652 CImumInternalApi::EMailLockedSettings, R_QTN_SELEC_PROTECTED_SETTING ) ) |
|
653 { |
|
654 CAknQueryDialog* confDialog = CAknQueryDialog::NewL(); |
|
655 if ( confDialog->ExecuteLD( R_MCE_CREATE_MBOX_CONFIRMATION ) ) |
|
656 { |
|
657 iMceUi->CreateNewAccountL( KSenduiMtmSmtpUid, KMsvNullIndexEntryId ); |
|
658 } |
|
659 } |
|
660 } |
|
661 else |
|
662 { |
|
663 // Show information note: General Settings has opened settings |
|
664 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( |
|
665 CAknNoteDialog::ENoTone, CAknNoteDialog::ELongTimeout); |
|
666 dlg->ExecuteLD(R_MCE_NOTE_SETTINGS_OPEN_GS); |
|
667 } |
|
668 |
|
669 // Release repository |
|
670 repositoryLock->Release(); |
|
671 CleanupStack::PopAndDestroy( repositoryLock ); |
|
672 |
|
673 |
|
674 } |
|
675 else if ( tempItem.iMsvId == KMceDeliveryReportsId ) |
|
676 { |
|
677 iSelectedIndex = iMsgListContainer->CurrentItemIndex(); |
|
678 iTopItemIndex = iMsgListContainer->ListBox()->TopItemIndex(); |
|
679 iSelectionFolderId = KMsvNullIndexEntryId; |
|
680 iMceUi->ActivateLocalViewL( KMceDeliveryReportViewId ); |
|
681 iMceUi->ShowTabsL( 0, ETrue ); |
|
682 // first parameter ignored when opening delivery reports view |
|
683 } |
|
684 else |
|
685 { |
|
686 StartAppL( tempItem.iMsvId ); |
|
687 } |
|
688 } |
|
689 |
|
690 |
|
691 // ---------------------------------------------------- |
|
692 // CMceMainViewListView::StartAppL |
|
693 // ---------------------------------------------------- |
|
694 void CMceMainViewListView::StartAppL( TInt aCommandId ) |
|
695 { |
|
696 HBufC* commandText = iMsgListContainer->ListItems()->ExtraItemCommandLC( aCommandId ); |
|
697 TPtr tempText = commandText->Des(); |
|
698 if ( tempText.Length() ) |
|
699 { |
|
700 TLex lex( tempText ); |
|
701 TUid uid; |
|
702 uid.iUid = 0; |
|
703 if ( lex.Val( uid.iUid ) == KErrNone && uid.iUid != 0 ) |
|
704 { |
|
705 RWsSession wsServer; |
|
706 User::LeaveIfError( wsServer.Connect() ); |
|
707 CleanupClosePushL( wsServer ); |
|
708 TApaTaskList taskList( wsServer ); |
|
709 TApaTask task(taskList.FindApp( uid )); |
|
710 if ( task.Exists() ) |
|
711 { |
|
712 task.BringToForeground(); |
|
713 } |
|
714 else |
|
715 { |
|
716 TApaAppInfo appInfo; |
|
717 TApaAppCapabilityBuf capabilityBuf; |
|
718 RApaLsSession lsSession; |
|
719 User::LeaveIfError( lsSession.Connect() ); |
|
720 CleanupClosePushL( lsSession ); |
|
721 User::LeaveIfError(lsSession.GetAppInfo(appInfo, uid )); |
|
722 User::LeaveIfError(lsSession.GetAppCapability(capabilityBuf, uid )); |
|
723 TApaAppCapability& caps = capabilityBuf(); |
|
724 |
|
725 TFileName appName = appInfo.iFullName; |
|
726 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
727 cmdLine->SetExecutableNameL(appName); |
|
728 |
|
729 if (caps.iLaunchInBackground) |
|
730 { |
|
731 cmdLine->SetCommandL(EApaCommandBackground); |
|
732 } |
|
733 else |
|
734 { |
|
735 cmdLine->SetCommandL(EApaCommandRun); |
|
736 } |
|
737 |
|
738 User::LeaveIfError(lsSession.StartApp(*cmdLine)); |
|
739 |
|
740 CleanupStack::PopAndDestroy(cmdLine); |
|
741 CleanupStack::PopAndDestroy(); // lsSession |
|
742 } // else |
|
743 CleanupStack::PopAndDestroy(); // wsServer |
|
744 } |
|
745 else |
|
746 { |
|
747 CSchemeHandler* handler = CSchemeHandler::NewL( tempText ); |
|
748 CleanupStack::PushL( handler ); |
|
749 handler->HandleUrlStandaloneL(); |
|
750 CleanupStack::PopAndDestroy( handler ); |
|
751 } |
|
752 } |
|
753 CleanupStack::PopAndDestroy( commandText ); |
|
754 } |
|
755 |
|
756 |
|
757 // ---------------------------------------------------- |
|
758 // CMceMainViewListView::DynInitMenuPaneL |
|
759 // ---------------------------------------------------- |
|
760 void CMceMainViewListView::DynInitMenuPaneL( |
|
761 TInt aResourceId, |
|
762 CEikMenuPane* aMenuPane ) |
|
763 { |
|
764 if ( !iMceViewActivated ) |
|
765 { |
|
766 return; |
|
767 } |
|
768 |
|
769 if ( FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) ) |
|
770 { |
|
771 if ( !iAiwServiceHandler ) |
|
772 { |
|
773 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
774 } |
|
775 if ( !iListViewFlags.MceFlag(EMceUiFlagsMainViewAiwCreated) ) |
|
776 { |
|
777 iAiwServiceHandler->AttachMenuL( R_MCE_MAIN_VIEW_MENU, R_AIWMCE_INTEREST ); // execute this only once |
|
778 iListViewFlags.SetMceFlag(EMceUiFlagsMainViewAiwCreated); |
|
779 } |
|
780 if (iAiwServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
781 { |
|
782 return; |
|
783 } |
|
784 } |
|
785 |
|
786 const TMceListItem& tempItem = iMsgListContainer->CurrentItemListItem(); |
|
787 if ( aResourceId == R_MCE_MAIN_VIEW_MENU && |
|
788 tempItem.iExtraItem && tempItem.iMsvId == KMceWriteMessageId ) |
|
789 { |
|
790 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
791 } |
|
792 |
|
793 if ( aResourceId == R_MCE_MAIN_VIEW_MENU ) |
|
794 { |
|
795 aMenuPane->SetItemDimmed( EMceCmdAiwPlaceholder, ETrue ); |
|
796 if ( FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) ) |
|
797 { |
|
798 TMsvEntry entry; |
|
799 TRAP_IGNORE( iMceUi->GetEntryL(tempItem.iMsvId,entry) ); |
|
800 if ( entry.iMtm == KSenduiMtmSyncMLEmailUid ) |
|
801 { |
|
802 // Focused item is a syncML mailbox, show the SyncML AIW plugin menu |
|
803 aMenuPane->SetItemDimmed( EMceCmdAiwPlaceholder, EFalse ); |
|
804 iAiwServiceHandler->InitializeMenuPaneL( *aMenuPane, aResourceId, |
|
805 EMceCmdFirstSyncmlAiwCommand, iAiwServiceHandler->InParamListL()); |
|
806 } |
|
807 } |
|
808 } |
|
809 if ( aResourceId == R_MCE_DEFAULT_VIEW_SUBMENU ) |
|
810 { |
|
811 TInt defaultview = KErrGeneral; |
|
812 defaultview = GetMceDefaultViewL(); |
|
813 if(defaultview == KMceInboxView ) |
|
814 { |
|
815 aMenuPane->SetItemButtonState( EMceDefaultInboxView, |
|
816 EEikMenuItemSymbolOn ); |
|
817 } |
|
818 else if(defaultview == KMceConversationview ) |
|
819 { |
|
820 aMenuPane->SetItemButtonState( EMceDefaultConversationsView, |
|
821 EEikMenuItemSymbolOn ); |
|
822 } |
|
823 } |
|
824 |
|
825 iMceUi->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
826 } |
|
827 |
|
828 |
|
829 // ---------------------------------------------------- |
|
830 // CMceMainViewListView::HandleSessionEventL |
|
831 // ---------------------------------------------------- |
|
832 void CMceMainViewListView::HandleSessionEventL( |
|
833 TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
834 { |
|
835 MCELOGGER_WRITE_TIMESTAMP("CMceMainViewListView::HandleSessionEventL() start"); |
|
836 switch (aEvent) |
|
837 { |
|
838 case EMsvEntriesChanged: |
|
839 case EMsvEntriesCreated: |
|
840 case EMsvEntriesDeleted: |
|
841 { |
|
842 TMsvId changedFolderId = (*(TMsvId*) (aArg2)); |
|
843 if ( iMsgListContainer && |
|
844 changedFolderId == KMsvRootIndexEntryIdValue |
|
845 ) |
|
846 { |
|
847 // something changed to root, update main view list, if |
|
848 // the mailbox creation is not ongoing |
|
849 if ( !(iMceUi->MailboxCreationOn()) ) |
|
850 { |
|
851 iMsgListContainer->ListItems()->HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
852 iMsgListContainer->ListBox()->DrawDeferred(); |
|
853 } |
|
854 } |
|
855 // Coverty fix, Forward NULL |
|
856 if ( iMsgListContainer ) |
|
857 { |
|
858 CheckMainViewBitmapL( changedFolderId ); |
|
859 } |
|
860 break; |
|
861 } |
|
862 |
|
863 case EMsvEntriesMoved: |
|
864 { |
|
865 TMsvId changedFolderId = (*(TMsvId*) (aArg2)); |
|
866 CheckMainViewBitmapL( changedFolderId ); |
|
867 changedFolderId = (*(TMsvId*) (aArg3)); |
|
868 CheckMainViewBitmapL( changedFolderId ); |
|
869 break; |
|
870 } |
|
871 |
|
872 case EMsvCloseSession: |
|
873 { |
|
874 iMsgListContainer->ListItems()->HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
875 iSession->RemoveObserver( *this ); |
|
876 } |
|
877 break; |
|
878 |
|
879 default: |
|
880 break; |
|
881 } |
|
882 // CMceMainViewListView::HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
883 MCELOGGER_WRITE_TIMESTAMP("CMceMainViewListView::HandleSessionEventL() end"); |
|
884 |
|
885 } |
|
886 |
|
887 // ---------------------------------------------------- |
|
888 // CMceMainViewListView::SetSelectedFolderId |
|
889 // ---------------------------------------------------- |
|
890 void CMceMainViewListView::SetSelectedFolderId( TMsvId aFolderId ) |
|
891 { |
|
892 iSelectionFolderId = aFolderId; |
|
893 iSelectedIndex = KErrNotFound; |
|
894 } |
|
895 |
|
896 // ---------------------------------------------------- |
|
897 // CMceMainViewListView::SetDeliveryReportsSelected |
|
898 // ---------------------------------------------------- |
|
899 void CMceMainViewListView::SetDeliveryReportsSelected( ) |
|
900 { |
|
901 iSelectionFolderId = KMsvNullIndexEntryId; |
|
902 iSelectedIndex = iMsgListContainer->ListItems()->ExtraItemIndex( KMceDeliveryReportsListIdValue ); |
|
903 // delivery reports always last! |
|
904 } |
|
905 |
|
906 // ---------------------------------------------------- |
|
907 // CMceMainViewListView::HandleMsgServerStartupL |
|
908 // ---------------------------------------------------- |
|
909 void CMceMainViewListView::HandleMsgServerStartupL() |
|
910 { |
|
911 iSession->AddObserverL( *this ); |
|
912 iMsvSessionReady = ETrue; |
|
913 delete iFolderEntry; |
|
914 iFolderEntry = NULL; |
|
915 iFolderEntry = CMsvEntry::NewL( |
|
916 *iSession, |
|
917 KMsvRootIndexEntryIdValue, |
|
918 TMsvSelectionOrdering( |
|
919 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
920 |
|
921 CreateContainerAndActivateL(); |
|
922 |
|
923 TMsvId mailboxId = NULL; // the first mailbox id, in which there is unread mail |
|
924 TInt mailboxCount = 0; // the count of mailboxes, in which there are unread mail |
|
925 |
|
926 if ( iPerformOperationAfterMsgStart == KMceShowMail ) |
|
927 { |
|
928 iPerformOperationAfterMsgStart = 0; |
|
929 mailboxCount = MailboxWithUnreadMessagesL( mailboxId ); |
|
930 |
|
931 if ( mailboxId ) |
|
932 { |
|
933 if ( mailboxCount == 1 ) |
|
934 { |
|
935 //activate remote folder view using mailboxId |
|
936 ActivateViewL ( KMessagingCentreMessageViewUid, TUid::Uid( mailboxId ),KNullDesC8() ); |
|
937 } |
|
938 else if ( mailboxCount > 1 ) |
|
939 { |
|
940 // launched from outside: |
|
941 // in several mailboxes unread mail, activate the first mailbox |
|
942 TInt mailboxIndex = iMsgListContainer->ItemIndex( mailboxId ); |
|
943 iMsgListContainer->ListBox()->SetCurrentItemIndex( mailboxIndex ); |
|
944 iMsgListContainer->ListBox()->DrawDeferred(); |
|
945 } |
|
946 } |
|
947 } |
|
948 else if ( iPerformOperationAfterMsgStart == KMceShowAudioMessage ) |
|
949 { |
|
950 iPerformOperationAfterMsgStart = 0; |
|
951 //activate remote folder view using inboxId |
|
952 ActivateViewL ( KMessagingCentreMessageViewUid, TUid::Uid( KMsvGlobalInBoxIndexEntryIdValue ),KNullDesC8() ); |
|
953 } |
|
954 } |
|
955 |
|
956 |
|
957 // ---------------------------------------------------- |
|
958 // CMceMainViewListView::ConstructMainViewL |
|
959 // resets main view and constructs it again |
|
960 // ---------------------------------------------------- |
|
961 void CMceMainViewListView::ConstructMainViewL() |
|
962 { |
|
963 TInt origIndex = iMsgListContainer->CurrentItemIndex(); |
|
964 TInt origCount = iMsgListContainer->ListItems()->Count(); |
|
965 TMsvId folderid = iMsgListContainer->CurrentItemId(); |
|
966 |
|
967 CMceMainViewListItemArray* listArray = iMsgListContainer->ListItems(); |
|
968 listArray->Reset(); |
|
969 listArray->ConstructMainViewL(); |
|
970 |
|
971 TInt newIndex = KMceWriteMessageAddIndex; |
|
972 if ( origIndex == ( origCount - 1)) |
|
973 { |
|
974 //delivery reports |
|
975 newIndex = listArray->Count() - 1; |
|
976 } |
|
977 else if ( origIndex == KMceWriteMessageAddIndex ) |
|
978 { |
|
979 //new message |
|
980 newIndex = KMceWriteMessageAddIndex; |
|
981 } |
|
982 else |
|
983 { |
|
984 //base folders and remote mailboxes |
|
985 newIndex = iMsgListContainer->ItemIndex( folderid ); |
|
986 if ( newIndex < KMceWriteMessageAddIndex || newIndex > |
|
987 ( listArray->Count() - 1 ) ) |
|
988 { |
|
989 newIndex = KMceNoRemotemailboxesAddIndex; |
|
990 } |
|
991 } |
|
992 iMsgListContainer->ListBox()->SetCurrentItemIndex( newIndex ); |
|
993 } |
|
994 |
|
995 // ---------------------------------------------------- |
|
996 // CMceMainViewListView::CheckMainViewBitmapL |
|
997 // ---------------------------------------------------- |
|
998 void CMceMainViewListView::CheckMainViewBitmapL( TMsvId aChangedFolderId ) const |
|
999 { |
|
1000 TMsvId service; |
|
1001 TMsvEntry child; |
|
1002 if ( iSession->GetEntry( aChangedFolderId, service, child ) == KErrNone ) |
|
1003 { |
|
1004 TInt changedIndex = KErrNotFound; |
|
1005 if ( child.iMtm == KSenduiMtmImap4Uid ) |
|
1006 { |
|
1007 changedIndex = iMsgListContainer->ItemIndex( service ); |
|
1008 } |
|
1009 else if ( child.iMtm == KUidMsvLocalServiceMtm ) |
|
1010 { |
|
1011 if ( child.Parent() == KMceDocumentsEntryId ) |
|
1012 { |
|
1013 changedIndex = iMsgListContainer->ItemIndex( KMceDocumentsEntryId ); |
|
1014 } |
|
1015 else |
|
1016 { |
|
1017 changedIndex = iMsgListContainer->ItemIndex( child.Id() ); |
|
1018 } |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 changedIndex = iMsgListContainer->ItemIndex( aChangedFolderId ); |
|
1023 } |
|
1024 |
|
1025 if ( changedIndex != KErrNotFound ) |
|
1026 { |
|
1027 CMceMainViewListItemArray* array = static_cast<CMceMainViewListItemArray*>(iMsgListContainer->ListItems()); |
|
1028 array->ResetIconIndexL( changedIndex ); |
|
1029 } |
|
1030 } |
|
1031 } |
|
1032 |
|
1033 // ---------------------------------------------------- |
|
1034 // CMceMainViewListView::ResetBitmaps |
|
1035 // ---------------------------------------------------- |
|
1036 void CMceMainViewListView::ResetBitmapsL( ) const |
|
1037 { |
|
1038 CMceMainViewListItemArray* array = static_cast<CMceMainViewListItemArray*>(iMsgListContainer->ListItems()); |
|
1039 array->StartListUpdateL(); |
|
1040 } |
|
1041 |
|
1042 // ---------------------------------------------------- |
|
1043 // CMceMainViewListView::SetSpecialMSKButtonL |
|
1044 // ---------------------------------------------------- |
|
1045 void CMceMainViewListView::SetSpecialMSKButtonL(TInt aResourceId) |
|
1046 { |
|
1047 if ( iDrawListbox ) |
|
1048 { |
|
1049 CEikButtonGroupContainer* cba = Cba(); |
|
1050 cba->SetCommandL( KMSKPosition, aResourceId ); |
|
1051 cba->DrawDeferred(); |
|
1052 } |
|
1053 } |
|
1054 |
|
1055 // ---------------------------------------------------- |
|
1056 // CMceMainViewListView::MailboxWithUnreadMessagesL |
|
1057 // ---------------------------------------------------- |
|
1058 TInt CMceMainViewListView::MailboxWithUnreadMessagesL( TMsvId& aFirstMailboxId ) |
|
1059 { |
|
1060 TInt mailboxCount = 0; |
|
1061 aFirstMailboxId = 0; |
|
1062 |
|
1063 // launched from outside: |
|
1064 // check mailboxes, also syncml mailboxes |
|
1065 iFolderEntry->SetEntryL( KMsvRootIndexEntryIdValue ); |
|
1066 CMsvEntrySelection* sel=iFolderEntry->ChildrenWithTypeL( KUidMsvServiceEntry ); |
|
1067 |
|
1068 CleanupStack::PushL( sel ); |
|
1069 const TMsvEntry* tentry=NULL; |
|
1070 TBool read = EFalse; |
|
1071 |
|
1072 for ( TInt cc = 0; cc < sel->Count(); cc++ ) |
|
1073 { |
|
1074 tentry=&( iFolderEntry->ChildDataL( (*sel)[cc] ) ); |
|
1075 if ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, tentry->iMtm ) ) |
|
1076 { |
|
1077 TInt messageCount = 0; |
|
1078 TInt unreadCount = 0; |
|
1079 read = iBitmapResolver.HasUnreadMessagesL( tentry->Id(), messageCount, unreadCount ); |
|
1080 if ( read ) |
|
1081 { |
|
1082 mailboxCount++; |
|
1083 if ( !aFirstMailboxId ) |
|
1084 { |
|
1085 aFirstMailboxId = tentry->Id(); |
|
1086 } |
|
1087 } |
|
1088 } |
|
1089 } |
|
1090 |
|
1091 CleanupStack::PopAndDestroy( sel ); |
|
1092 return mailboxCount; |
|
1093 } |
|
1094 |
|
1095 // ---------------------------------------------------- |
|
1096 // CMceMainViewListView::MceListItemArrayChangedL |
|
1097 // ---------------------------------------------------- |
|
1098 void CMceMainViewListView::MceListItemArrayChangedL() |
|
1099 { |
|
1100 if ( iMceViewActivated && iMsgListContainer ) |
|
1101 { |
|
1102 CAknDoubleLargeStyleListBox* listBox = REINTERPRET_CAST( CAknDoubleLargeStyleListBox*, |
|
1103 iMsgListContainer->ListBox() ); |
|
1104 if ( listBox ) |
|
1105 { |
|
1106 listBox->DrawDeferred(); |
|
1107 } |
|
1108 } |
|
1109 } |
|
1110 |
|
1111 // ---------------------------------------------------- |
|
1112 // CMceMainViewListView::MceListItemArrayFlickEvent |
|
1113 // ---------------------------------------------------- |
|
1114 TBool CMceMainViewListView::MceListItemArrayFlickEvent() |
|
1115 { |
|
1116 return iFlick; |
|
1117 } |
|
1118 |
|
1119 // ---------------------------------------------------- |
|
1120 // CMceMainViewListView::AiwSyncParamListLC |
|
1121 // ---------------------------------------------------- |
|
1122 CAiwGenericParamList* CMceMainViewListView::AiwSyncParamListLC(TInt /*aId*/, const TDesC& aText) |
|
1123 { |
|
1124 TAiwVariant variant; |
|
1125 variant.Set(KNullDesC); |
|
1126 TAiwGenericParam param(EGenericParamMessageItemEMail, variant); |
|
1127 |
|
1128 TAiwVariant variant2; |
|
1129 variant2.Set(aText); |
|
1130 TAiwGenericParam param2(EGenericParamMessageItemMbox, variant2); |
|
1131 |
|
1132 CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); |
|
1133 list->AppendL(param); |
|
1134 list->AppendL(param2); |
|
1135 |
|
1136 return list; |
|
1137 } |
|
1138 |
|
1139 // ---------------------------------------------------- |
|
1140 // CMceMainViewListView::ListContainer |
|
1141 // ---------------------------------------------------- |
|
1142 CMceMainViewListContainer* CMceMainViewListView::ListContainer() const |
|
1143 { |
|
1144 return iMsgListContainer; |
|
1145 } |
|
1146 |
|
1147 // ---------------------------------------------------- |
|
1148 // CMceMainViewListView::HandleClientRectChange |
|
1149 // ---------------------------------------------------- |
|
1150 void CMceMainViewListView::HandleClientRectChange() |
|
1151 { |
|
1152 if (iMsgListContainer) |
|
1153 { |
|
1154 iMsgListContainer->SetRect(ClientRect()); |
|
1155 } |
|
1156 } |
|
1157 |
|
1158 // --------------------------------------------------------- |
|
1159 // CConversationListView::ShowInformationNoteL |
|
1160 // Shows a note to the user if the default view selection was successful |
|
1161 // --------------------------------------------------------- |
|
1162 // |
|
1163 void CMceMainViewListView::ShowConfirmationNoteL(TInt aResourceID) |
|
1164 { |
|
1165 HBufC* prompt = NULL; |
|
1166 prompt = StringLoader::LoadLC( aResourceID, iCoeEnv ); |
|
1167 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
1168 dlg->ExecuteLD( R_MCE_OK_EMPTY_CONFIRMATION, prompt->Des() ); |
|
1169 CleanupStack::PopAndDestroy( prompt ); |
|
1170 } |
|
1171 |
|
1172 // --------------------------------------------------------- |
|
1173 // CMceMainViewListView::SetMceDefaultViewL |
|
1174 // Sets the central repository for the default view activation when |
|
1175 // a new message arrives |
|
1176 // --------------------------------------------------------- |
|
1177 // |
|
1178 TBool CMceMainViewListView::SetMceDefaultViewL(TBool aVal) |
|
1179 { |
|
1180 CRepository* repository = NULL; |
|
1181 TRAPD( ret, repository = CRepository::NewL(KCRUidMuiuSettings) ); |
|
1182 if ( ret == KErrNone ) |
|
1183 { |
|
1184 CleanupStack::PushL( repository ); |
|
1185 repository->Set(KMuiuMceDefaultView,aVal); |
|
1186 CleanupStack::PopAndDestroy( repository ); |
|
1187 if(iMsgListContainer) |
|
1188 { |
|
1189 iMsgListContainer->ListItems()->SetDefaultViewSettings(aVal); |
|
1190 iMsgListContainer->ListBox()->DrawDeferred(); |
|
1191 } |
|
1192 return ETrue; |
|
1193 } |
|
1194 else |
|
1195 { |
|
1196 return EFalse; |
|
1197 } |
|
1198 } |
|
1199 // --------------------------------------------------------- |
|
1200 // CMceMainViewListView::GetMceDefaultViewL |
|
1201 // Get the central repository value of the current default view |
|
1202 // --------------------------------------------------------- |
|
1203 // |
|
1204 TInt CMceMainViewListView::GetMceDefaultViewL() |
|
1205 { |
|
1206 CRepository* repository = NULL; |
|
1207 TInt keyvalue; |
|
1208 TRAPD( ret, repository = CRepository::NewL(KCRUidMuiuSettings) ); |
|
1209 if ( ret == KErrNone ) |
|
1210 { |
|
1211 CleanupStack::PushL( repository ); |
|
1212 repository->Get(KMuiuMceDefaultView,keyvalue); |
|
1213 CleanupStack::PopAndDestroy( repository ); |
|
1214 return keyvalue; |
|
1215 } |
|
1216 else |
|
1217 { |
|
1218 return KErrNotFound; |
|
1219 } |
|
1220 } |
|
1221 // End of File |