|
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 //To observe scrollbar events |
|
368 listBox->ScrollBarFrame()->SetScrollBarFrameObserver( this ); |
|
369 iMsgListContainer->ActivateL(); |
|
370 if ( !iListViewFlags.MceFlag( EMceUiFlagsContainerAddedToStack ) ) |
|
371 { |
|
372 AppUi()->AddToStackL(*this,iMsgListContainer); |
|
373 iListViewFlags.SetMceFlag( EMceUiFlagsContainerAddedToStack ); |
|
374 } |
|
375 |
|
376 if ( iEmptyListContainer ) |
|
377 { |
|
378 AppUi()->RemoveFromStack(iEmptyListContainer); |
|
379 delete iEmptyListContainer; |
|
380 iEmptyListContainer = NULL; |
|
381 } |
|
382 |
|
383 listBox->SetTopItemIndex( iTopItemIndex ); |
|
384 if ( iSelectionFolderId > KMsvRootIndexEntryId ) |
|
385 { |
|
386 TInt index = iMsgListContainer->ItemIndex( iSelectionFolderId ); |
|
387 if ( index > KErrNotFound ) |
|
388 { |
|
389 listBox->SetCurrentItemIndex( index ); |
|
390 listBox->UpdateScrollBarsL(); |
|
391 } |
|
392 iSelectionFolderId = KMsvNullIndexEntryId; |
|
393 } |
|
394 else if ( iSelectedIndex >= 0 ) |
|
395 { |
|
396 listBox->SetCurrentItemIndex( iSelectedIndex ); |
|
397 listBox->UpdateScrollBarsL(); |
|
398 } |
|
399 listBox->DrawNow(); |
|
400 |
|
401 // Fetch pointer to the default title pane control |
|
402 |
|
403 CAknTitlePane* title=iMceUi->TitlePaneL(); |
|
404 HBufC* text = StringLoader::LoadLC( R_MCE_MAIN_VIEW_TITLE, iEikonEnv ); |
|
405 title->SetTextL( *text ); |
|
406 CleanupStack::PopAndDestroy(); // text |
|
407 |
|
408 iMceViewActivated = ETrue; |
|
409 MCELOGGER_LEAVEFN("CreateContainerAndActivateL()"); |
|
410 MCELOGGER_WRITE_TIMESTAMP("Main view activated at "); |
|
411 } |
|
412 |
|
413 |
|
414 // ---------------------------------------------------- |
|
415 // CMceMainViewListView::DoDeactivate |
|
416 // ---------------------------------------------------- |
|
417 void CMceMainViewListView::DoDeactivate() |
|
418 { |
|
419 if ( iEmptyListContainer ) |
|
420 { |
|
421 AppUi()->RemoveFromStack(iEmptyListContainer); |
|
422 delete iEmptyListContainer; |
|
423 iEmptyListContainer = NULL; |
|
424 } |
|
425 |
|
426 if ( iMsgListContainer ) |
|
427 { |
|
428 iSelectedIndex = iMsgListContainer->CurrentItemIndex(); |
|
429 iTopItemIndex = iMsgListContainer->ListBox()->TopItemIndex(); |
|
430 if ( iListViewFlags.MceFlag( EMceUiFlagsContainerAddedToStack ) ) |
|
431 { |
|
432 AppUi()->RemoveFromStack(iMsgListContainer); |
|
433 iListViewFlags.ClearMceFlag( EMceUiFlagsContainerAddedToStack ); |
|
434 } |
|
435 } |
|
436 iMceViewActivated = EFalse; |
|
437 } |
|
438 |
|
439 // ---------------------------------------------------- |
|
440 // CMceMainViewListView::HandleListBoxEventL |
|
441 // ---------------------------------------------------- |
|
442 void CMceMainViewListView::HandleListBoxEventL( |
|
443 CEikListBox* /*aListBox*/, |
|
444 TListBoxEvent aEventType ) |
|
445 { |
|
446 switch(aEventType) |
|
447 { |
|
448 case EEventEnterKeyPressed: |
|
449 case EEventItemSingleClicked: |
|
450 ChangeViewL(); |
|
451 break; |
|
452 case EEventItemDraggingActioned: |
|
453 if ( iMsgListContainer ) |
|
454 { |
|
455 iMsgListContainer->SetMskL(); |
|
456 } |
|
457 break; |
|
458 case EEventPanningStarted: |
|
459 case EEventFlickStarted: |
|
460 iFlick = ETrue; |
|
461 break; |
|
462 case EEventPanningStopped: |
|
463 case EEventFlickStopped: |
|
464 iFlick = EFalse; |
|
465 break; |
|
466 default: |
|
467 break; |
|
468 |
|
469 } |
|
470 } |
|
471 |
|
472 // ---------------------------------------------------- |
|
473 // CMceMainViewListView::HandleCommandL |
|
474 // ---------------------------------------------------- |
|
475 void CMceMainViewListView::HandleCommandL( TInt aCommand ) |
|
476 { |
|
477 MCELOGGER_WRITE_FORMAT("CMceMainViewListView::HandleCommandL: aCommand: %d", aCommand); |
|
478 if ( !iMceViewActivated ) |
|
479 { |
|
480 return; |
|
481 } |
|
482 |
|
483 switch (aCommand) |
|
484 { |
|
485 case EAknSoftkeyExit: |
|
486 iMceUi->HandleCommandL( EEikCmdExit ); |
|
487 break; |
|
488 case EAknCmdOpen: |
|
489 case EMceCmdSelect: |
|
490 ChangeViewL(); |
|
491 break; |
|
492 case EMceCmdConnect: |
|
493 { |
|
494 iFolderEntry->SetEntryL(KMsvRootIndexEntryIdValue); |
|
495 |
|
496 const TMsvEntry entry = iFolderEntry->ChildDataL( iMsgListContainer->CurrentItemId() ); |
|
497 if ( entry.iType.iUid == KUidMsvServiceEntryValue ) |
|
498 { |
|
499 iMceUi->GoOnlineL( entry.Id() ); |
|
500 } |
|
501 } |
|
502 break; |
|
503 case EMceCmdCloseConnection: |
|
504 { |
|
505 iMceUi->CloseConnectionWithListQueryL(); |
|
506 } |
|
507 break; |
|
508 case EAknCmdHideInBackground: |
|
509 break; |
|
510 case EMceDefaultConversationsView: |
|
511 if ( SetMceDefaultViewL(KMceConversationview) ) |
|
512 { |
|
513 ShowConfirmationNoteL(R_DEFAULTVIEW_CONVERSATION_SELECTED); |
|
514 } |
|
515 break; |
|
516 |
|
517 case EMceDefaultInboxView: |
|
518 if ( SetMceDefaultViewL(KMceInboxView) ) |
|
519 { |
|
520 ShowConfirmationNoteL(R_DEFAULTVIEW_INBOX_SELECTED); |
|
521 } |
|
522 break; |
|
523 case EMceCmdSettings: |
|
524 { |
|
525 if (( iEmailClientIntegration )&&(!iEmailFramework)) |
|
526 { |
|
527 // these have to be updated here because when a mailbox setup wizard is launched |
|
528 // from MCE Settings dialog this view's DoDeactivate will not be entered (because of |
|
529 // CAknInputBlock used used in wizard launching). |
|
530 iSelectedIndex = iMsgListContainer->CurrentItemIndex(); |
|
531 iTopItemIndex = iMsgListContainer->ListBox()->TopItemIndex(); |
|
532 |
|
533 } |
|
534 iMceUi->HandleCommandL( aCommand ); |
|
535 break; |
|
536 |
|
537 } |
|
538 default: |
|
539 if ( iAiwServiceHandler && FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) && |
|
540 KAiwCmdSynchronize == iAiwServiceHandler->ServiceCmdByMenuCmd(aCommand) ) |
|
541 { |
|
542 TInt appId = EGenericParamMessageItemEMail; |
|
543 const TMceListItem& tempItem = iMsgListContainer->CurrentItemListItem(); |
|
544 TMsvEntry entry; |
|
545 TRAP_IGNORE( iMceUi->GetEntryL(tempItem.iMsvId,entry) ); |
|
546 CAiwGenericParamList* list = AiwSyncParamListLC( appId, entry.iDetails ); |
|
547 iAiwServiceHandler->ExecuteMenuCmdL(aCommand, *list, |
|
548 iAiwServiceHandler->OutParamListL()); |
|
549 CleanupStack::PopAndDestroy(list); |
|
550 } |
|
551 else |
|
552 { |
|
553 iMceUi->HandleCommandL( aCommand ); |
|
554 } |
|
555 break; |
|
556 } |
|
557 MCELOGGER_LEAVEFN("CMceMainViewListView::HandleCommandL()"); |
|
558 } |
|
559 |
|
560 // ---------------------------------------------------- |
|
561 // CMceMainViewListView::ProcessCommandL |
|
562 // ---------------------------------------------------- |
|
563 void CMceMainViewListView::ProcessCommandL(TInt aCommand) |
|
564 { |
|
565 MCELOGGER_ENTERFN("CMceMainViewListView::ProcessCommandL"); |
|
566 if ( !iMceUi->IsEditorOpen() && !iEmptyListContainer ) |
|
567 { |
|
568 CAknView::ProcessCommandL( aCommand ); |
|
569 } |
|
570 #ifdef _DEBUG |
|
571 else |
|
572 { |
|
573 MCELOGGER_WRITE("CMceMainViewListView::ProcessCommandL: Editor is open so don't call CAknView::ProcessCommandL"); |
|
574 } |
|
575 #endif |
|
576 MCELOGGER_LEAVEFN("CMceMainViewListView::ProcessCommandL"); |
|
577 } |
|
578 |
|
579 // ---------------------------------------------------- |
|
580 // CMceMainViewListView::ChangeViewL |
|
581 // ---------------------------------------------------- |
|
582 void CMceMainViewListView::ChangeViewL() |
|
583 { |
|
584 if ( iMceUi->IsEditorOpen() ) |
|
585 { |
|
586 MCELOGGER_WRITE("CMceMainViewListView::ChangeViewL: do nothing because already editing one"); |
|
587 return; |
|
588 } |
|
589 const TMceListItem& tempItem = iMsgListContainer->CurrentItemListItem(); |
|
590 if ( !tempItem.iExtraItem ) |
|
591 { |
|
592 TMsvId service; |
|
593 TMsvEntry child; |
|
594 User::LeaveIfError( iSession->GetEntry( tempItem.iMsvId, service, child ) ); |
|
595 __ASSERT_DEBUG( (child.iType == KUidMsvFolderEntry || child.iType == KUidMsvServiceEntry), Panic( EMceMainViewCannotChangeView ) ); |
|
596 if ( child.iType == KUidMsvFolderEntry ) |
|
597 { |
|
598 iMceUi->OpenFolderViewL( child.Id() ); |
|
599 iMceUi->ShowTabsL( child.Id() ); |
|
600 } |
|
601 else // if ( child.iType == KUidMsvServiceEntry ) |
|
602 { |
|
603 if ( iMceUi->IsSyncronizingL( child ) ) |
|
604 { |
|
605 //cannot open during suncML mail syncronizing |
|
606 return; |
|
607 } |
|
608 // Explanation: This part of code will launch Custom email application for |
|
609 // configured mtm plugin. For the other accounts behavior will not change. |
|
610 |
|
611 // If MTM plugin ID matches the one in the repository we'll let Mtm plugin |
|
612 // launch the mailbox view |
|
613 if ( ( iEmailClientIntegration && (!iEmailFramework)) && ( iMtmPluginId != 0 ) && |
|
614 ( child.iMtm.iUid == iMtmPluginId ) ) |
|
615 { |
|
616 iMceUi->OpenMtmMailboxViewL( child ); |
|
617 } |
|
618 else |
|
619 { |
|
620 iMceUi->OpenRemoteMailboxViewL( child.Id() ); |
|
621 } |
|
622 } |
|
623 |
|
624 } |
|
625 else if ( tempItem.iMsvId == KMceWriteMessageId ) |
|
626 { |
|
627 iMceUi->LaunchUniEditorL(); |
|
628 } |
|
629 else if ( tempItem.iMsvId == KMceNoMailboxesListId ) |
|
630 { |
|
631 CMuiuLock* repositoryLock = CMuiuLock::NewL( KCRUidMuiuVariation ); |
|
632 CleanupStack::PushL( repositoryLock ); |
|
633 TInt err = repositoryLock->Reserve(); |
|
634 if ( !err ) |
|
635 { |
|
636 if ( iEmailClientIntegration ) |
|
637 { |
|
638 // LAUNCH S60 wizard (with confirmation query) |
|
639 CAknQueryDialog* confDialog = CAknQueryDialog::NewL(); |
|
640 if ( confDialog->ExecuteLD( R_MCE_CREATE_MBOX_CONFIRMATION ) ) |
|
641 { |
|
642 iMceUi->CreateNewAccountL( KSenduiMtmSmtpUid, |
|
643 KMsvNullIndexEntryId ); |
|
644 } |
|
645 // Release repository |
|
646 repositoryLock->Release(); |
|
647 CleanupStack::PopAndDestroy( repositoryLock ); |
|
648 return; |
|
649 } // iEmailClientIntegration |
|
650 CImumInternalApi* emailApiPtr = |
|
651 iMsgListContainer->ListItems()->GetEmailApi(); |
|
652 |
|
653 //Deny creating new mail account if TARM is active. |
|
654 if( !emailApiPtr->IsEmailFeatureSupportedL( |
|
655 CImumInternalApi::EMailLockedSettings, R_QTN_SELEC_PROTECTED_SETTING ) ) |
|
656 { |
|
657 CAknQueryDialog* confDialog = CAknQueryDialog::NewL(); |
|
658 if ( confDialog->ExecuteLD( R_MCE_CREATE_MBOX_CONFIRMATION ) ) |
|
659 { |
|
660 iMceUi->CreateNewAccountL( KSenduiMtmSmtpUid, KMsvNullIndexEntryId ); |
|
661 } |
|
662 } |
|
663 } |
|
664 else |
|
665 { |
|
666 // Show information note: General Settings has opened settings |
|
667 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( |
|
668 CAknNoteDialog::ENoTone, CAknNoteDialog::ELongTimeout); |
|
669 dlg->ExecuteLD(R_MCE_NOTE_SETTINGS_OPEN_GS); |
|
670 } |
|
671 |
|
672 // Release repository |
|
673 repositoryLock->Release(); |
|
674 CleanupStack::PopAndDestroy( repositoryLock ); |
|
675 |
|
676 |
|
677 } |
|
678 else if ( tempItem.iMsvId == KMceDeliveryReportsId ) |
|
679 { |
|
680 iSelectedIndex = iMsgListContainer->CurrentItemIndex(); |
|
681 iTopItemIndex = iMsgListContainer->ListBox()->TopItemIndex(); |
|
682 iSelectionFolderId = KMsvNullIndexEntryId; |
|
683 iMceUi->ActivateLocalViewL( KMceDeliveryReportViewId ); |
|
684 iMceUi->ShowTabsL( 0, ETrue ); |
|
685 // first parameter ignored when opening delivery reports view |
|
686 } |
|
687 else |
|
688 { |
|
689 StartAppL( tempItem.iMsvId ); |
|
690 } |
|
691 } |
|
692 |
|
693 |
|
694 // ---------------------------------------------------- |
|
695 // CMceMainViewListView::StartAppL |
|
696 // ---------------------------------------------------- |
|
697 void CMceMainViewListView::StartAppL( TInt aCommandId ) |
|
698 { |
|
699 HBufC* commandText = iMsgListContainer->ListItems()->ExtraItemCommandLC( aCommandId ); |
|
700 TPtr tempText = commandText->Des(); |
|
701 if ( tempText.Length() ) |
|
702 { |
|
703 TLex lex( tempText ); |
|
704 TUid uid; |
|
705 uid.iUid = 0; |
|
706 if ( lex.Val( uid.iUid ) == KErrNone && uid.iUid != 0 ) |
|
707 { |
|
708 RWsSession wsServer; |
|
709 User::LeaveIfError( wsServer.Connect() ); |
|
710 CleanupClosePushL( wsServer ); |
|
711 TApaTaskList taskList( wsServer ); |
|
712 TApaTask task(taskList.FindApp( uid )); |
|
713 if ( task.Exists() ) |
|
714 { |
|
715 task.BringToForeground(); |
|
716 } |
|
717 else |
|
718 { |
|
719 TApaAppInfo appInfo; |
|
720 TApaAppCapabilityBuf capabilityBuf; |
|
721 RApaLsSession lsSession; |
|
722 User::LeaveIfError( lsSession.Connect() ); |
|
723 CleanupClosePushL( lsSession ); |
|
724 User::LeaveIfError(lsSession.GetAppInfo(appInfo, uid )); |
|
725 User::LeaveIfError(lsSession.GetAppCapability(capabilityBuf, uid )); |
|
726 TApaAppCapability& caps = capabilityBuf(); |
|
727 |
|
728 TFileName appName = appInfo.iFullName; |
|
729 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
730 cmdLine->SetExecutableNameL(appName); |
|
731 |
|
732 if (caps.iLaunchInBackground) |
|
733 { |
|
734 cmdLine->SetCommandL(EApaCommandBackground); |
|
735 } |
|
736 else |
|
737 { |
|
738 cmdLine->SetCommandL(EApaCommandRun); |
|
739 } |
|
740 |
|
741 User::LeaveIfError(lsSession.StartApp(*cmdLine)); |
|
742 |
|
743 CleanupStack::PopAndDestroy(cmdLine); |
|
744 CleanupStack::PopAndDestroy(); // lsSession |
|
745 } // else |
|
746 CleanupStack::PopAndDestroy(); // wsServer |
|
747 } |
|
748 else |
|
749 { |
|
750 CSchemeHandler* handler = CSchemeHandler::NewL( tempText ); |
|
751 CleanupStack::PushL( handler ); |
|
752 handler->HandleUrlStandaloneL(); |
|
753 CleanupStack::PopAndDestroy( handler ); |
|
754 } |
|
755 } |
|
756 CleanupStack::PopAndDestroy( commandText ); |
|
757 } |
|
758 |
|
759 |
|
760 // ---------------------------------------------------- |
|
761 // CMceMainViewListView::DynInitMenuPaneL |
|
762 // ---------------------------------------------------- |
|
763 void CMceMainViewListView::DynInitMenuPaneL( |
|
764 TInt aResourceId, |
|
765 CEikMenuPane* aMenuPane ) |
|
766 { |
|
767 if ( !iMceViewActivated ) |
|
768 { |
|
769 return; |
|
770 } |
|
771 |
|
772 if ( FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) ) |
|
773 { |
|
774 if ( !iAiwServiceHandler ) |
|
775 { |
|
776 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
777 } |
|
778 if ( !iListViewFlags.MceFlag(EMceUiFlagsMainViewAiwCreated) ) |
|
779 { |
|
780 iAiwServiceHandler->AttachMenuL( R_MCE_MAIN_VIEW_MENU, R_AIWMCE_INTEREST ); // execute this only once |
|
781 iListViewFlags.SetMceFlag(EMceUiFlagsMainViewAiwCreated); |
|
782 } |
|
783 if (iAiwServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
784 { |
|
785 return; |
|
786 } |
|
787 } |
|
788 |
|
789 const TMceListItem& tempItem = iMsgListContainer->CurrentItemListItem(); |
|
790 if ( aResourceId == R_MCE_MAIN_VIEW_MENU && |
|
791 tempItem.iExtraItem && tempItem.iMsvId == KMceWriteMessageId ) |
|
792 { |
|
793 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
794 } |
|
795 |
|
796 if ( aResourceId == R_MCE_MAIN_VIEW_MENU ) |
|
797 { |
|
798 aMenuPane->SetItemDimmed( EMceCmdAiwPlaceholder, ETrue ); |
|
799 if ( FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) ) |
|
800 { |
|
801 TMsvEntry entry; |
|
802 TRAP_IGNORE( iMceUi->GetEntryL(tempItem.iMsvId,entry) ); |
|
803 if ( entry.iMtm == KSenduiMtmSyncMLEmailUid ) |
|
804 { |
|
805 // Focused item is a syncML mailbox, show the SyncML AIW plugin menu |
|
806 aMenuPane->SetItemDimmed( EMceCmdAiwPlaceholder, EFalse ); |
|
807 iAiwServiceHandler->InitializeMenuPaneL( *aMenuPane, aResourceId, |
|
808 EMceCmdFirstSyncmlAiwCommand, iAiwServiceHandler->InParamListL()); |
|
809 } |
|
810 } |
|
811 } |
|
812 if ( aResourceId == R_MCE_DEFAULT_VIEW_SUBMENU ) |
|
813 { |
|
814 TInt defaultview = KErrGeneral; |
|
815 defaultview = GetMceDefaultViewL(); |
|
816 if(defaultview == KMceInboxView ) |
|
817 { |
|
818 aMenuPane->SetItemButtonState( EMceDefaultInboxView, |
|
819 EEikMenuItemSymbolOn ); |
|
820 } |
|
821 else if(defaultview == KMceConversationview ) |
|
822 { |
|
823 aMenuPane->SetItemButtonState( EMceDefaultConversationsView, |
|
824 EEikMenuItemSymbolOn ); |
|
825 } |
|
826 } |
|
827 |
|
828 iMceUi->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
829 } |
|
830 |
|
831 |
|
832 // ---------------------------------------------------- |
|
833 // CMceMainViewListView::HandleSessionEventL |
|
834 // ---------------------------------------------------- |
|
835 void CMceMainViewListView::HandleSessionEventL( |
|
836 TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
837 { |
|
838 MCELOGGER_WRITE_TIMESTAMP("CMceMainViewListView::HandleSessionEventL() start"); |
|
839 switch (aEvent) |
|
840 { |
|
841 case EMsvEntriesChanged: |
|
842 case EMsvEntriesCreated: |
|
843 case EMsvEntriesDeleted: |
|
844 { |
|
845 TMsvId changedFolderId = (*(TMsvId*) (aArg2)); |
|
846 if ( iMsgListContainer && |
|
847 changedFolderId == KMsvRootIndexEntryIdValue |
|
848 ) |
|
849 { |
|
850 // something changed to root, update main view list, if |
|
851 // the mailbox creation is not ongoing |
|
852 if ( !(iMceUi->MailboxCreationOn()) ) |
|
853 { |
|
854 iMsgListContainer->ListItems()->HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
855 iMsgListContainer->ListBox()->DrawDeferred(); |
|
856 } |
|
857 } |
|
858 // Coverty fix, Forward NULL |
|
859 if ( iMsgListContainer ) |
|
860 { |
|
861 CheckMainViewBitmapL( changedFolderId ); |
|
862 } |
|
863 break; |
|
864 } |
|
865 |
|
866 case EMsvEntriesMoved: |
|
867 { |
|
868 TMsvId changedFolderId = (*(TMsvId*) (aArg2)); |
|
869 CheckMainViewBitmapL( changedFolderId ); |
|
870 changedFolderId = (*(TMsvId*) (aArg3)); |
|
871 CheckMainViewBitmapL( changedFolderId ); |
|
872 break; |
|
873 } |
|
874 |
|
875 case EMsvCloseSession: |
|
876 { |
|
877 iMsgListContainer->ListItems()->HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
878 iSession->RemoveObserver( *this ); |
|
879 } |
|
880 break; |
|
881 |
|
882 default: |
|
883 break; |
|
884 } |
|
885 // CMceMainViewListView::HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
886 MCELOGGER_WRITE_TIMESTAMP("CMceMainViewListView::HandleSessionEventL() end"); |
|
887 |
|
888 } |
|
889 |
|
890 // ---------------------------------------------------- |
|
891 // CMceMainViewListView::SetSelectedFolderId |
|
892 // ---------------------------------------------------- |
|
893 void CMceMainViewListView::SetSelectedFolderId( TMsvId aFolderId ) |
|
894 { |
|
895 iSelectionFolderId = aFolderId; |
|
896 iSelectedIndex = KErrNotFound; |
|
897 } |
|
898 |
|
899 // ---------------------------------------------------- |
|
900 // CMceMainViewListView::SetDeliveryReportsSelected |
|
901 // ---------------------------------------------------- |
|
902 void CMceMainViewListView::SetDeliveryReportsSelected( ) |
|
903 { |
|
904 iSelectionFolderId = KMsvNullIndexEntryId; |
|
905 iSelectedIndex = iMsgListContainer->ListItems()->ExtraItemIndex( KMceDeliveryReportsListIdValue ); |
|
906 // delivery reports always last! |
|
907 } |
|
908 |
|
909 // ---------------------------------------------------- |
|
910 // CMceMainViewListView::HandleMsgServerStartupL |
|
911 // ---------------------------------------------------- |
|
912 void CMceMainViewListView::HandleMsgServerStartupL() |
|
913 { |
|
914 iSession->AddObserverL( *this ); |
|
915 iMsvSessionReady = ETrue; |
|
916 delete iFolderEntry; |
|
917 iFolderEntry = NULL; |
|
918 iFolderEntry = CMsvEntry::NewL( |
|
919 *iSession, |
|
920 KMsvRootIndexEntryIdValue, |
|
921 TMsvSelectionOrdering( |
|
922 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
923 |
|
924 CreateContainerAndActivateL(); |
|
925 |
|
926 TMsvId mailboxId = NULL; // the first mailbox id, in which there is unread mail |
|
927 TInt mailboxCount = 0; // the count of mailboxes, in which there are unread mail |
|
928 |
|
929 if ( iPerformOperationAfterMsgStart == KMceShowMail ) |
|
930 { |
|
931 iPerformOperationAfterMsgStart = 0; |
|
932 mailboxCount = MailboxWithUnreadMessagesL( mailboxId ); |
|
933 |
|
934 if ( mailboxId ) |
|
935 { |
|
936 if ( mailboxCount == 1 ) |
|
937 { |
|
938 //activate remote folder view using mailboxId |
|
939 ActivateViewL ( KMessagingCentreMessageViewUid, TUid::Uid( mailboxId ),KNullDesC8() ); |
|
940 } |
|
941 else if ( mailboxCount > 1 ) |
|
942 { |
|
943 // launched from outside: |
|
944 // in several mailboxes unread mail, activate the first mailbox |
|
945 TInt mailboxIndex = iMsgListContainer->ItemIndex( mailboxId ); |
|
946 iMsgListContainer->ListBox()->SetCurrentItemIndex( mailboxIndex ); |
|
947 iMsgListContainer->ListBox()->DrawDeferred(); |
|
948 } |
|
949 } |
|
950 } |
|
951 else if ( iPerformOperationAfterMsgStart == KMceShowAudioMessage ) |
|
952 { |
|
953 iPerformOperationAfterMsgStart = 0; |
|
954 //activate remote folder view using inboxId |
|
955 ActivateViewL ( KMessagingCentreMessageViewUid, TUid::Uid( KMsvGlobalInBoxIndexEntryIdValue ),KNullDesC8() ); |
|
956 } |
|
957 } |
|
958 |
|
959 |
|
960 // ---------------------------------------------------- |
|
961 // CMceMainViewListView::ConstructMainViewL |
|
962 // resets main view and constructs it again |
|
963 // ---------------------------------------------------- |
|
964 void CMceMainViewListView::ConstructMainViewL() |
|
965 { |
|
966 TInt origIndex = iMsgListContainer->CurrentItemIndex(); |
|
967 TInt origCount = iMsgListContainer->ListItems()->Count(); |
|
968 TMsvId folderid = iMsgListContainer->CurrentItemId(); |
|
969 |
|
970 CMceMainViewListItemArray* listArray = iMsgListContainer->ListItems(); |
|
971 listArray->Reset(); |
|
972 listArray->ConstructMainViewL(); |
|
973 |
|
974 TInt newIndex = KMceWriteMessageAddIndex; |
|
975 if ( origIndex == ( origCount - 1)) |
|
976 { |
|
977 //delivery reports |
|
978 newIndex = listArray->Count() - 1; |
|
979 } |
|
980 else if ( origIndex == KMceWriteMessageAddIndex ) |
|
981 { |
|
982 //new message |
|
983 newIndex = KMceWriteMessageAddIndex; |
|
984 } |
|
985 else |
|
986 { |
|
987 //base folders and remote mailboxes |
|
988 newIndex = iMsgListContainer->ItemIndex( folderid ); |
|
989 if ( newIndex < KMceWriteMessageAddIndex || newIndex > |
|
990 ( listArray->Count() - 1 ) ) |
|
991 { |
|
992 newIndex = KMceNoRemotemailboxesAddIndex; |
|
993 } |
|
994 } |
|
995 iMsgListContainer->ListBox()->SetCurrentItemIndex( newIndex ); |
|
996 } |
|
997 |
|
998 // ---------------------------------------------------- |
|
999 // CMceMainViewListView::CheckMainViewBitmapL |
|
1000 // ---------------------------------------------------- |
|
1001 void CMceMainViewListView::CheckMainViewBitmapL( TMsvId aChangedFolderId ) const |
|
1002 { |
|
1003 TMsvId service; |
|
1004 TMsvEntry child; |
|
1005 if ( iSession->GetEntry( aChangedFolderId, service, child ) == KErrNone ) |
|
1006 { |
|
1007 TInt changedIndex = KErrNotFound; |
|
1008 if ( child.iMtm == KSenduiMtmImap4Uid ) |
|
1009 { |
|
1010 changedIndex = iMsgListContainer->ItemIndex( service ); |
|
1011 } |
|
1012 else if ( child.iMtm == KUidMsvLocalServiceMtm ) |
|
1013 { |
|
1014 if ( child.Parent() == KMceDocumentsEntryId ) |
|
1015 { |
|
1016 changedIndex = iMsgListContainer->ItemIndex( KMceDocumentsEntryId ); |
|
1017 } |
|
1018 else |
|
1019 { |
|
1020 changedIndex = iMsgListContainer->ItemIndex( child.Id() ); |
|
1021 } |
|
1022 } |
|
1023 else |
|
1024 { |
|
1025 changedIndex = iMsgListContainer->ItemIndex( aChangedFolderId ); |
|
1026 } |
|
1027 |
|
1028 if ( changedIndex != KErrNotFound ) |
|
1029 { |
|
1030 CMceMainViewListItemArray* array = static_cast<CMceMainViewListItemArray*>(iMsgListContainer->ListItems()); |
|
1031 array->ResetIconIndexL( changedIndex ); |
|
1032 } |
|
1033 } |
|
1034 } |
|
1035 |
|
1036 // ---------------------------------------------------- |
|
1037 // CMceMainViewListView::ResetBitmaps |
|
1038 // ---------------------------------------------------- |
|
1039 void CMceMainViewListView::ResetBitmapsL( ) const |
|
1040 { |
|
1041 CMceMainViewListItemArray* array = static_cast<CMceMainViewListItemArray*>(iMsgListContainer->ListItems()); |
|
1042 array->StartListUpdateL(); |
|
1043 } |
|
1044 |
|
1045 // ---------------------------------------------------- |
|
1046 // CMceMainViewListView::SetSpecialMSKButtonL |
|
1047 // ---------------------------------------------------- |
|
1048 void CMceMainViewListView::SetSpecialMSKButtonL(TInt aResourceId) |
|
1049 { |
|
1050 if ( iDrawListbox ) |
|
1051 { |
|
1052 CEikButtonGroupContainer* cba = Cba(); |
|
1053 cba->SetCommandL( KMSKPosition, aResourceId ); |
|
1054 cba->DrawDeferred(); |
|
1055 } |
|
1056 } |
|
1057 |
|
1058 // ---------------------------------------------------- |
|
1059 // CMceMainViewListView::MailboxWithUnreadMessagesL |
|
1060 // ---------------------------------------------------- |
|
1061 TInt CMceMainViewListView::MailboxWithUnreadMessagesL( TMsvId& aFirstMailboxId ) |
|
1062 { |
|
1063 TInt mailboxCount = 0; |
|
1064 aFirstMailboxId = 0; |
|
1065 |
|
1066 // launched from outside: |
|
1067 // check mailboxes, also syncml mailboxes |
|
1068 iFolderEntry->SetEntryL( KMsvRootIndexEntryIdValue ); |
|
1069 CMsvEntrySelection* sel=iFolderEntry->ChildrenWithTypeL( KUidMsvServiceEntry ); |
|
1070 |
|
1071 CleanupStack::PushL( sel ); |
|
1072 const TMsvEntry* tentry=NULL; |
|
1073 TBool read = EFalse; |
|
1074 |
|
1075 for ( TInt cc = 0; cc < sel->Count(); cc++ ) |
|
1076 { |
|
1077 tentry=&( iFolderEntry->ChildDataL( (*sel)[cc] ) ); |
|
1078 if ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, tentry->iMtm ) ) |
|
1079 { |
|
1080 TInt messageCount = 0; |
|
1081 TInt unreadCount = 0; |
|
1082 read = iBitmapResolver.HasUnreadMessagesL( tentry->Id(), messageCount, unreadCount ); |
|
1083 if ( read ) |
|
1084 { |
|
1085 mailboxCount++; |
|
1086 if ( !aFirstMailboxId ) |
|
1087 { |
|
1088 aFirstMailboxId = tentry->Id(); |
|
1089 } |
|
1090 } |
|
1091 } |
|
1092 } |
|
1093 |
|
1094 CleanupStack::PopAndDestroy( sel ); |
|
1095 return mailboxCount; |
|
1096 } |
|
1097 |
|
1098 // ---------------------------------------------------- |
|
1099 // CMceMainViewListView::MceListItemArrayChangedL |
|
1100 // ---------------------------------------------------- |
|
1101 void CMceMainViewListView::MceListItemArrayChangedL() |
|
1102 { |
|
1103 if ( iMceViewActivated && iMsgListContainer ) |
|
1104 { |
|
1105 CAknDoubleLargeStyleListBox* listBox = REINTERPRET_CAST( CAknDoubleLargeStyleListBox*, |
|
1106 iMsgListContainer->ListBox() ); |
|
1107 if ( listBox ) |
|
1108 { |
|
1109 listBox->DrawDeferred(); |
|
1110 } |
|
1111 } |
|
1112 } |
|
1113 |
|
1114 // ---------------------------------------------------- |
|
1115 // CMceMainViewListView::MceListItemArrayFlickEvent |
|
1116 // ---------------------------------------------------- |
|
1117 TBool CMceMainViewListView::MceListItemArrayFlickEvent() |
|
1118 { |
|
1119 return iFlick; |
|
1120 } |
|
1121 |
|
1122 // ---------------------------------------------------- |
|
1123 // CMceMainViewListView::AiwSyncParamListLC |
|
1124 // ---------------------------------------------------- |
|
1125 CAiwGenericParamList* CMceMainViewListView::AiwSyncParamListLC(TInt /*aId*/, const TDesC& aText) |
|
1126 { |
|
1127 TAiwVariant variant; |
|
1128 variant.Set(KNullDesC); |
|
1129 TAiwGenericParam param(EGenericParamMessageItemEMail, variant); |
|
1130 |
|
1131 TAiwVariant variant2; |
|
1132 variant2.Set(aText); |
|
1133 TAiwGenericParam param2(EGenericParamMessageItemMbox, variant2); |
|
1134 |
|
1135 CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); |
|
1136 list->AppendL(param); |
|
1137 list->AppendL(param2); |
|
1138 |
|
1139 return list; |
|
1140 } |
|
1141 |
|
1142 // ---------------------------------------------------- |
|
1143 // CMceMainViewListView::ListContainer |
|
1144 // ---------------------------------------------------- |
|
1145 CMceMainViewListContainer* CMceMainViewListView::ListContainer() const |
|
1146 { |
|
1147 return iMsgListContainer; |
|
1148 } |
|
1149 |
|
1150 // ---------------------------------------------------- |
|
1151 // CMceMainViewListView::HandleClientRectChange |
|
1152 // ---------------------------------------------------- |
|
1153 void CMceMainViewListView::HandleClientRectChange() |
|
1154 { |
|
1155 if (iMsgListContainer) |
|
1156 { |
|
1157 iMsgListContainer->SetRect(ClientRect()); |
|
1158 } |
|
1159 } |
|
1160 |
|
1161 // --------------------------------------------------------- |
|
1162 // CConversationListView::ShowInformationNoteL |
|
1163 // Shows a note to the user if the default view selection was successful |
|
1164 // --------------------------------------------------------- |
|
1165 // |
|
1166 void CMceMainViewListView::ShowConfirmationNoteL(TInt aResourceID) |
|
1167 { |
|
1168 HBufC* prompt = NULL; |
|
1169 prompt = StringLoader::LoadLC( aResourceID, iCoeEnv ); |
|
1170 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
1171 dlg->ExecuteLD( R_MCE_OK_EMPTY_CONFIRMATION, prompt->Des() ); |
|
1172 CleanupStack::PopAndDestroy( prompt ); |
|
1173 } |
|
1174 |
|
1175 // --------------------------------------------------------- |
|
1176 // CMceMainViewListView::SetMceDefaultViewL |
|
1177 // Sets the central repository for the default view activation when |
|
1178 // a new message arrives |
|
1179 // --------------------------------------------------------- |
|
1180 // |
|
1181 TBool CMceMainViewListView::SetMceDefaultViewL(TBool aVal) |
|
1182 { |
|
1183 CRepository* repository = NULL; |
|
1184 TRAPD( ret, repository = CRepository::NewL(KCRUidMuiuSettings) ); |
|
1185 if ( ret == KErrNone ) |
|
1186 { |
|
1187 CleanupStack::PushL( repository ); |
|
1188 repository->Set(KMuiuMceDefaultView,aVal); |
|
1189 CleanupStack::PopAndDestroy( repository ); |
|
1190 if(iMsgListContainer) |
|
1191 { |
|
1192 iMsgListContainer->ListItems()->SetDefaultViewSettings(aVal); |
|
1193 iMsgListContainer->ListBox()->DrawDeferred(); |
|
1194 } |
|
1195 return ETrue; |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 return EFalse; |
|
1200 } |
|
1201 } |
|
1202 // --------------------------------------------------------- |
|
1203 // CMceMainViewListView::GetMceDefaultViewL |
|
1204 // Get the central repository value of the current default view |
|
1205 // --------------------------------------------------------- |
|
1206 // |
|
1207 TInt CMceMainViewListView::GetMceDefaultViewL() |
|
1208 { |
|
1209 CRepository* repository = NULL; |
|
1210 TInt keyvalue; |
|
1211 TRAPD( ret, repository = CRepository::NewL(KCRUidMuiuSettings) ); |
|
1212 if ( ret == KErrNone ) |
|
1213 { |
|
1214 CleanupStack::PushL( repository ); |
|
1215 repository->Get(KMuiuMceDefaultView,keyvalue); |
|
1216 CleanupStack::PopAndDestroy( repository ); |
|
1217 return keyvalue; |
|
1218 } |
|
1219 else |
|
1220 { |
|
1221 return KErrNotFound; |
|
1222 } |
|
1223 } |
|
1224 // --------------------------------------------------------- |
|
1225 // CMceMainViewListView::HandleScrollEventL |
|
1226 // To take old bitmapindex for list items When |
|
1227 // stylus is down on scroll bar thumb and dragged |
|
1228 // Calculate new bitmapindex when scrollbar thumb drag is stopped |
|
1229 // --------------------------------------------------------- |
|
1230 // |
|
1231 void CMceMainViewListView::HandleScrollEventL(CEikScrollBar* aScrollBar, |
|
1232 TEikScrollEvent aEventType) |
|
1233 { |
|
1234 switch (aEventType) |
|
1235 { |
|
1236 case EEikScrollThumbDragVert: |
|
1237 iFlick = ETrue; |
|
1238 break; |
|
1239 case EEikScrollThumbReleaseVert: |
|
1240 iFlick = EFalse; |
|
1241 break; |
|
1242 default: |
|
1243 break; |
|
1244 } |
|
1245 CAknDoubleLargeStyleListBox* listBox = |
|
1246 REINTERPRET_CAST( CAknDoubleLargeStyleListBox*, |
|
1247 iMsgListContainer->ListBox() ); |
|
1248 listBox->HandleScrollEventL( aScrollBar, aEventType ); |
|
1249 } |
|
1250 // End of File |