|
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 * This view is created when user opens folder. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <eikmenub.h> // menu stuff |
|
25 #include <apgcli.h> // RApaLsSession |
|
26 #include <msvuids.h> |
|
27 #include <msvids.h> |
|
28 #include <StringLoader.h> // StringLoader |
|
29 #include <aknlists.h> |
|
30 #include <akntitle.h> // CAknTitlePane |
|
31 #include <aknclearer.h> // CAknLocalScreenClearer |
|
32 #include <NpdApi.h> // CNotepadApi |
|
33 #include <SenduiMtmUids.h> // mtm uids |
|
34 |
|
35 #include "MceMessageListContainer.h" |
|
36 #include "MceOneRowMessageListContainer.h" |
|
37 #include "MceMessageListbox.h" |
|
38 #include "MceMessageListView.h" |
|
39 #include "MceMainViewListView.h" |
|
40 #include "MceSessionHolder.h" |
|
41 #include "MceBitmapResolver.h" |
|
42 #include "mceui.h" |
|
43 #include "MceCommands.hrh" |
|
44 #include <mce.rsg> |
|
45 |
|
46 #include <CommonContentPolicy.h> // banned mime types |
|
47 #include <MsgBioUids.h> // KMsgBioUidPictureMsg |
|
48 |
|
49 #include <bldvariant.hrh> |
|
50 #include <featmgr.h> |
|
51 #include <mmsconst.h> |
|
52 #include <MtmExtendedCapabilities.hrh> |
|
53 |
|
54 // MMS.Content.Upload |
|
55 #include <SenduiMtmUids.h> |
|
56 |
|
57 #include <centralrepository.h> |
|
58 #include <messaginginternalcrkeys.h> |
|
59 #include <MessagingDomainCRKeys.h> |
|
60 #include <messagingvariant.hrh> |
|
61 |
|
62 #include <AiwServiceHandler.h> |
|
63 #include <AiwGenericParam.hrh> |
|
64 #include <AiwVariant.h> |
|
65 #include <msvuids.h> |
|
66 #include <SendUiConsts.h> |
|
67 #include <msvstd.h> |
|
68 |
|
69 #include <akntoolbar.h> //CAknToolbar |
|
70 #include <eikcolib.h> //CEikAppUiFactory |
|
71 #include <MNcnInternalNotification.h> |
|
72 #include <NcnNotificationDefs.h> |
|
73 |
|
74 class CMsvStore; |
|
75 #include <muiucontactservice.h> //CMuiuContactService |
|
76 #include <miuthdr.h> // CImHeader |
|
77 #include <msvapi.h> //TMsvEntry::ReadStoreL |
|
78 #include <miutpars.h> //TImMessageField::GetValidInternetEmailAddressFromString(), |
|
79 |
|
80 |
|
81 #include <bacntf.h> // CEnvironmentChangeNotifier |
|
82 |
|
83 #include <AknDlgShut.h> // for AknDialogShutter |
|
84 #include <messaginginternalpskeys.h> |
|
85 // CONSTANTS |
|
86 const TInt KMceArraysGranularity = 4; |
|
87 |
|
88 const TInt KMceOnlyInboxInImap = 1; |
|
89 const TInt KMSKPosition = 3; |
|
90 |
|
91 // Mail technology type |
|
92 const TUid KMailTechnologyTypeUid = { 0x10001671 }; |
|
93 |
|
94 // These are for opening the viewer in inbox. |
|
95 // We need to wait possible opened editor to be closed before opening received message. |
|
96 const TInt KMceLaunchViewerStartTime = 1; // try to open viewer immediately |
|
97 const TInt KMceLaunchViewerRetryTime = 500000; // wait 0.5 secs for the next trial |
|
98 const TInt KMceLaunchViewerRetryCounter = 20; // so editors have approx 10 secs to save... |
|
99 |
|
100 // This is the paramater used to set mark as read/unread options menu |
|
101 const TBool KIsEmail = ETrue; |
|
102 |
|
103 // ================= MEMBER FUNCTIONS ======================= |
|
104 |
|
105 |
|
106 CMceMessageListView* CMceMessageListView::NewL( |
|
107 CMsvSessionPtr aSession, |
|
108 TMsvId aFolderId, |
|
109 CMceSessionHolder& aSessionHolder, |
|
110 CMceBitmapResolver& aBitmapResolver, |
|
111 CMceMainViewListView& aMainView ) |
|
112 { |
|
113 CMceMessageListView* self = new (ELeave) CMceMessageListView( |
|
114 aSession, aFolderId, aSessionHolder, aBitmapResolver, aMainView ); |
|
115 CleanupStack::PushL(self); |
|
116 self->ConstructL(); |
|
117 CleanupStack::Pop(); // self |
|
118 return self; |
|
119 } |
|
120 |
|
121 CMceMessageListView::CMceMessageListView( |
|
122 CMsvSessionPtr aSession, |
|
123 TMsvId aFolderId, |
|
124 CMceSessionHolder& aSessionHolder, |
|
125 CMceBitmapResolver& aBitmapResolver, |
|
126 CMceMainViewListView& aMainView ) |
|
127 : |
|
128 iSession( aSession ), |
|
129 iFolderId( aFolderId ), |
|
130 iSessionHolder( aSessionHolder ), |
|
131 iBitmapResolver( aBitmapResolver ), |
|
132 iSelectedIndex( KErrNotFound ), |
|
133 iMainViewListView( aMainView ), |
|
134 iSortOrder( EMceCmdSortByDate ), |
|
135 iOrdering( EFalse ), |
|
136 iContextCommand(EFalse) |
|
137 { |
|
138 iSessionHolder.AddClient(); |
|
139 iReadUnread = EFalse; |
|
140 } |
|
141 |
|
142 CMceMessageListView::~CMceMessageListView() |
|
143 { |
|
144 delete iListboxMailTypeObserver; |
|
145 delete iListboxInboxTypeObserver; |
|
146 if (iMsgListContainer) |
|
147 { |
|
148 SetMskObserver(EFalse); |
|
149 AppUi()->RemoveFromStack(iMsgListContainer); |
|
150 delete iMsgListContainer; |
|
151 } |
|
152 delete iInboxName; |
|
153 delete iRemoteMailboxEmptyText; |
|
154 delete iEmptyText; |
|
155 delete iMessageViewerLauncher; |
|
156 delete iLocalScreenClearer; |
|
157 delete iFolderItemArray; |
|
158 delete iDateTimeNotifier; |
|
159 delete iAiwServiceHandler; |
|
160 RProperty::Delete( KPSUidMuiu, KMceTemplatesDialog ); |
|
161 iSessionHolder.RemoveClient(); |
|
162 } |
|
163 |
|
164 void CMceMessageListView::ConstructL( ) |
|
165 { |
|
166 MCELOGGER_ENTERFN("CMceMessageListView::ConstructL"); |
|
167 |
|
168 BaseConstructL( R_MCE_FOLDER_VIEW ); |
|
169 iMceUi = STATIC_CAST( CMceUi*, AppUi() ); |
|
170 |
|
171 iInboxName = StringLoader::LoadL( R_INBOX_NAME, iEikonEnv ); |
|
172 iRemoteMailboxEmptyText = StringLoader::LoadL( R_MCE_TEXT_NO_EMAIL, iEikonEnv ); |
|
173 iEmptyText = StringLoader::LoadL( R_MCE_TEXT_NO_ITEMS, iEikonEnv ); |
|
174 iFolderItemArray = new(ELeave) CMceFolderItemArray( KMceArraysGranularity ); |
|
175 CRepository* repository = CRepository::NewL( KCRUidMuiuVariation ); |
|
176 TInt featureBitmask = 0; |
|
177 TInt error = repository->Get( KMuiuEmailConfigFlags,featureBitmask ); |
|
178 delete repository; |
|
179 repository = NULL; |
|
180 if ( error == KErrNone ) |
|
181 { |
|
182 iIsUnread = featureBitmask & KEmailFeatureIdEmailUnreadFunction; |
|
183 } |
|
184 else |
|
185 { |
|
186 iIsUnread = EFalse; |
|
187 } |
|
188 iListboxMailTypeObserver = CMceListboxTypeObserver::NewL( *this, KMuiuMailMessageListType ); |
|
189 iListboxInboxTypeObserver = CMceListboxTypeObserver::NewL( *this, KMuiuInboxMessageListType ); |
|
190 |
|
191 MCELOGGER_LEAVEFN("CMceMessageListView::ConstructL"); |
|
192 } |
|
193 |
|
194 // ---------------------------------------------------- |
|
195 // CMceMessageListView::DoActivateL |
|
196 // ---------------------------------------------------- |
|
197 void CMceMessageListView::DoActivateL( |
|
198 const TVwsViewId& aPrevViewId, |
|
199 TUid aCustomMessageId, /* Folder ID */ |
|
200 const TDesC8& /*aCustomMessage*/) |
|
201 { |
|
202 |
|
203 MCELOGGER_ENTERFN("CMceMessageListView::DoActivateL()"); |
|
204 |
|
205 // if new message is shown during disconnecting |
|
206 // prevent to exit from mce |
|
207 iMceUi->ClearExitAfterDisconnectFlag(); |
|
208 |
|
209 // Save the sort ordering in the message store |
|
210 // Set the default sort order |
|
211 iSortOrder = EMceCmdSortByDate; |
|
212 iOrdering = EFalse; |
|
213 if ( iMsgListContainer ) |
|
214 { |
|
215 TMsvId fId = iMsgListContainer->CurrentFolderId(); |
|
216 for( TInt loop = 0; loop < iFolderItemArray->Count() ; loop++ ) |
|
217 { |
|
218 TMceFolderItem item = ((*iFolderItemArray)[loop]); |
|
219 if ( item.iFolderId == fId && aPrevViewId == TDRVIEWID) |
|
220 { |
|
221 iSortOrder = item.iSortOrder; |
|
222 iOrdering = item.iOrdering; |
|
223 } |
|
224 } |
|
225 } |
|
226 if (aPrevViewId != TDRVIEWID ) |
|
227 { |
|
228 // Reset the sort order |
|
229 iFolderItemArray->Reset(); |
|
230 } |
|
231 if ( iMsgListContainer ) |
|
232 { |
|
233 iMsgListContainer->SetSortTypeL( iSortOrder, iOrdering ); |
|
234 } |
|
235 |
|
236 TMsvId id = 0; |
|
237 TBool editorLaunched = EFalse; |
|
238 TBool launchingFromOutside = EFalse; |
|
239 TInt msgMtmUid = 0; |
|
240 TMsvId service = KMsvLocalServiceIndexEntryId; |
|
241 TMsvEntry entry; |
|
242 |
|
243 if ( aCustomMessageId.iUid > KMsvRootIndexEntryId ) |
|
244 { |
|
245 |
|
246 if ( iSession->GetEntry( aCustomMessageId.iUid, service, entry ) != KErrNone ) |
|
247 { |
|
248 iSession->GetEntry( KMsvGlobalInBoxIndexEntryId, service, entry ); // this should always succeed! |
|
249 } |
|
250 |
|
251 // outside the app. |
|
252 launchingFromOutside = ETrue; |
|
253 //check, if message store has been changed from MMC to phone |
|
254 iMceUi->ToPhoneMemoryQueryL( ETrue ); |
|
255 |
|
256 // Set the forder containing the entry |
|
257 if ( entry.iType == KUidMsvMessageEntry ) |
|
258 { |
|
259 // The aCustomMessageId is an ID of a message, set Inbox |
|
260 SetFolderL( entry.Parent() ); |
|
261 id = aCustomMessageId.iUid; |
|
262 } |
|
263 else |
|
264 { |
|
265 // Set the folder based on the given ID |
|
266 iFolderId = aCustomMessageId.iUid; |
|
267 // this is performance optimization, start to launch viewer before container creation |
|
268 if ( !iMsgListContainer && entry.Id() == KMsvGlobalInBoxIndexEntryId ) |
|
269 { |
|
270 if ( LaunchViewerWhenOneUnreadL( msgMtmUid ) > KErrNotFound ) |
|
271 { |
|
272 editorLaunched = ETrue; |
|
273 } |
|
274 } |
|
275 } |
|
276 iMceUi->SetDontExitOnNextOperationComplete(); |
|
277 } |
|
278 |
|
279 if ( iMsgListContainer && |
|
280 iCurrentListType != GetFolderListBoxType()) |
|
281 { |
|
282 ListboxTypeChangedL(); |
|
283 } |
|
284 else |
|
285 { |
|
286 CreateListboxL(); |
|
287 } |
|
288 |
|
289 |
|
290 if ( iMsgListContainer && aPrevViewId == TDRVIEWID ) |
|
291 { |
|
292 // Save the sort ordering in the message store |
|
293 // Set the default sort order |
|
294 iSortOrder = EMceCmdSortByDate; |
|
295 iOrdering = EFalse; |
|
296 TMsvId fId = iFolderId; |
|
297 for( TInt loop = 0; loop < iFolderItemArray->Count() ; loop++ ) |
|
298 { |
|
299 TMceFolderItem item = ((*iFolderItemArray)[loop]); |
|
300 if ( item.iFolderId == fId ) |
|
301 { |
|
302 iSortOrder = item.iSortOrder; |
|
303 iOrdering = item.iOrdering; |
|
304 } |
|
305 } |
|
306 |
|
307 iMsgListContainer->SetSortTypeL( iSortOrder, iOrdering ); |
|
308 } |
|
309 |
|
310 iMsgListContainer->SetFolderL( iFolderId ); |
|
311 |
|
312 // Unset flag so one row list container knows that first subtitle is to be opened |
|
313 iMsgListContainer->SetContainerFlag( EMceOneRowFlagFirstSubtitleOpen, EFalse ); |
|
314 |
|
315 iMsgListContainer->ClearSelection(); |
|
316 iMsgListContainer->SetRect(ClientRect()); |
|
317 |
|
318 SetMskObserver( ETrue ); |
|
319 AppUi()->RemoveFromStack( iMsgListContainer ); |
|
320 AppUi()->AddToStackL( *this,iMsgListContainer ); |
|
321 iMsgListContainer->ActivateL(); |
|
322 iMsgListContainer->MakeVisible(ETrue); |
|
323 |
|
324 //const TMsvEntry& folderEntry = iMsgListContainer->FolderEntry(); |
|
325 |
|
326 entry = iMsgListContainer->FolderEntry(); |
|
327 |
|
328 if ( entry.Parent() == KMsvRootIndexEntryId && |
|
329 entry.iType == KUidMsvServiceEntry && |
|
330 entry.iMtm == KSenduiMtmImap4Uid && |
|
331 iMsgListContainer->Count() ) |
|
332 { |
|
333 // TODO: container and array should handle this? |
|
334 FindInboxAndOpenItL();// special handling for imap4 Inbox, folderEntry -> empty |
|
335 } |
|
336 |
|
337 if ( IsSyncMl() && launchingFromOutside ) |
|
338 { |
|
339 SyncMlFindInboxAndOpenItL(); |
|
340 } |
|
341 |
|
342 |
|
343 // Handle the resource change |
|
344 if ( iMceUi->ResourceChangeCalled() ) |
|
345 { |
|
346 iMsgListContainer->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
347 iMceUi->ResetResourceChange(); |
|
348 } |
|
349 |
|
350 SetEmptyTextL(); |
|
351 |
|
352 iMsgListContainer->ResetCurrentItemL(); |
|
353 |
|
354 // Fetch pointer to the default title pane control |
|
355 CAknTitlePane* title = iMceUi->TitlePaneL(); |
|
356 TMsvEntry serviceEntry; |
|
357 TMsvId serviceId; |
|
358 |
|
359 entry = iMsgListContainer->FolderEntry(); |
|
360 |
|
361 if ( (entry.iMtm == KSenduiMtmImap4Uid || IsSyncMl() ) && |
|
362 iSession->GetEntry( entry.iServiceId, serviceId, serviceEntry) == KErrNone ) |
|
363 { |
|
364 title->SetTextL( serviceEntry.iDetails ); |
|
365 } |
|
366 else |
|
367 { |
|
368 title->SetTextL( entry.iDetails ); |
|
369 } |
|
370 |
|
371 // Set the MSK for the view |
|
372 SetMSKButtonL(); |
|
373 |
|
374 iMceViewActivated = ETrue; |
|
375 |
|
376 TBool activateConnQueryTimer = ETrue; |
|
377 |
|
378 if ( launchingFromOutside ) |
|
379 { |
|
380 iMceUi->RemoveTabs(); // just to make sure, doesn't do anything if no tabs |
|
381 const TMsvId entryId = entry.Id(); |
|
382 |
|
383 if ( entry.Parent() == KMsvRootIndexEntryId || |
|
384 ( entry.iMtm == KSenduiMtmImap4Uid && !IsImapFolderOpenL( ) ) || |
|
385 entryId == KMsvGlobalInBoxIndexEntryId || |
|
386 entryId == KMsvGlobalOutBoxIndexEntryId || |
|
387 entryId == KMsvDraftEntryId || |
|
388 entryId == KMsvSentEntryId || |
|
389 entryId == KMceDocumentsEntryId || |
|
390 ( IsSyncMl() && entry.iRelatedId == KMsvGlobalInBoxIndexEntryId ) ) |
|
391 { |
|
392 if ( entry.iMtm == KSenduiMtmImap4Uid && entry.iDetails.CompareF( iInboxName->Des() ) == 0 ) |
|
393 { |
|
394 iMceUi->ShowTabsL( serviceId ); // this was got above so this points to correct service. |
|
395 } |
|
396 else |
|
397 { |
|
398 iMceUi->ShowTabsL( aCustomMessageId.iUid ); |
|
399 } |
|
400 } |
|
401 else |
|
402 { |
|
403 ChangeFolderL(ETrue); |
|
404 } |
|
405 |
|
406 if ( !editorLaunched ) |
|
407 { |
|
408 if ( iFolderId == KMsvGlobalOutBoxIndexEntryId || |
|
409 iFolderId == KMsvGlobalInBoxIndexEntryId || |
|
410 ( entry.Parent() == KMsvRootIndexEntryId && |
|
411 ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, entry.iMtm ) ) && |
|
412 entry.iType == KUidMsvServiceEntry ) || |
|
413 ( SyncMlOutboxInbox( KMsvGlobalInBoxIndexEntryId ) && |
|
414 entry.iType == KUidMsvServiceEntry) ) |
|
415 { |
|
416 if ( !FindUnreadMessageAndOpenItL( id ) ) |
|
417 { |
|
418 activateConnQueryTimer = ETrue; |
|
419 } |
|
420 else |
|
421 { |
|
422 activateConnQueryTimer = EFalse; |
|
423 } |
|
424 } |
|
425 } |
|
426 } |
|
427 |
|
428 |
|
429 iMceUi->SetMceViewActive( EMceMessageViewActive ); |
|
430 |
|
431 if ( activateConnQueryTimer ) |
|
432 { |
|
433 if ( entry.iMtm == KSenduiMtmImap4Uid || |
|
434 entry.iMtm == KSenduiMtmPop3Uid ) |
|
435 { |
|
436 iConnectionNote = ETrue; |
|
437 iMceUi->ActivateConnectionQueryTimerL( iFolderId ); |
|
438 } |
|
439 } |
|
440 |
|
441 iMsgListContainer->RefreshSelectionIndexesL ( EFalse ); |
|
442 iMsgListContainer->RefreshListbox(); |
|
443 |
|
444 // NCN reset, if the mail folder contains unread messages |
|
445 if ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, entry.iMtm ) && |
|
446 HasUnreadMessagesL() ) |
|
447 { |
|
448 iMceUi->HandleNotif(iMsgListContainer->FolderEntry().iServiceId); |
|
449 } |
|
450 |
|
451 if ( !iDateTimeNotifier ) |
|
452 { |
|
453 iDateTimeNotifier = CEnvironmentChangeNotifier::NewL( |
|
454 CActive::EPriorityLow, |
|
455 TCallBack( EnvironmentChanged, this ) ); |
|
456 } |
|
457 |
|
458 if ( !iDateTimeNotifier->IsActive() ) |
|
459 { |
|
460 iDateTimeNotifier->Start(); |
|
461 } |
|
462 |
|
463 MCELOGGER_LEAVEFN("CMceMessageListView::DoActivateL()"); |
|
464 } |
|
465 |
|
466 |
|
467 // ---------------------------------------------------- |
|
468 // CMceMessageListView::DoDeactivate |
|
469 // ---------------------------------------------------- |
|
470 void CMceMessageListView::DoDeactivate() |
|
471 { |
|
472 if (iMsgListContainer) |
|
473 { |
|
474 delete iDateTimeNotifier; |
|
475 iDateTimeNotifier = NULL; |
|
476 iMsgListContainer->MakeVisible(EFalse); |
|
477 AppUi()->RemoveFromStack(iMsgListContainer); |
|
478 delete iMsgListContainer; |
|
479 iMsgListContainer = NULL; |
|
480 } |
|
481 iMceViewActivated = EFalse; |
|
482 } |
|
483 |
|
484 |
|
485 // ---------------------------------------------------- |
|
486 // CMceMessageListView::HandleCommandL |
|
487 // ---------------------------------------------------- |
|
488 void CMceMessageListView::HandleCommandL( TInt aCommand ) |
|
489 { |
|
490 MCELOGGER_WRITE_FORMAT("CMceMessageListView::HandleCommandL: aCommand: %d", aCommand); |
|
491 |
|
492 if ( !iMceViewActivated ) |
|
493 { |
|
494 return; |
|
495 } |
|
496 |
|
497 switch (aCommand) |
|
498 { |
|
499 case EAknSoftkeyBack: |
|
500 if ( FolderOpenedL() ) |
|
501 { |
|
502 ChangeFolderL( ETrue ); |
|
503 } |
|
504 else |
|
505 { |
|
506 iConnectionNote = EFalse; |
|
507 HandleCloseL(); |
|
508 } |
|
509 break; |
|
510 case EAknCmdOpen: |
|
511 case EAknSoftkeyContextOptions: |
|
512 HandleOpenL(); |
|
513 break; |
|
514 case EAknCmdHideInBackground: |
|
515 // handled by app ui and sent directly to appui by avkon framework so ignore this by view. |
|
516 break; |
|
517 case EMceCmdConnect: |
|
518 { |
|
519 if ( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmImap4Uid || |
|
520 iMsgListContainer->FolderEntry().iMtm == KSenduiMtmPop3Uid ) |
|
521 { |
|
522 iMceUi->GoOnlineL( iMsgListContainer->FolderEntry().iServiceId ); |
|
523 } |
|
524 break; |
|
525 } |
|
526 case EMceCmdCloseConnection: |
|
527 { |
|
528 if ( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmImap4Uid || |
|
529 iMsgListContainer->FolderEntry().iMtm == KSenduiMtmPop3Uid ) |
|
530 { |
|
531 iMceUi->GoOfflineL( iMsgListContainer->FolderEntry().iServiceId ); |
|
532 } |
|
533 break; |
|
534 } |
|
535 case EAknCmdMark: |
|
536 { |
|
537 iMsgListContainer->AddCurrentItemToSelectionL(); |
|
538 SetMSKButtonL(); |
|
539 break; |
|
540 } |
|
541 case EAknCmdUnmark: |
|
542 { |
|
543 iMsgListContainer->RemoveCurrentItemFromSelection(); |
|
544 SetMSKButtonL(); |
|
545 break; |
|
546 } |
|
547 case EAknUnmarkAll: |
|
548 { |
|
549 iMsgListContainer->ClearSelection(); |
|
550 SetMSKButtonL(); |
|
551 break; |
|
552 } |
|
553 |
|
554 case EAknMarkAll: |
|
555 { |
|
556 iMsgListContainer->AddAllToSelectionL(); |
|
557 SetMSKButtonL(); |
|
558 break; |
|
559 } |
|
560 |
|
561 case EAknCmdMarkReadMsgs: |
|
562 { |
|
563 FindAllReadMsgAndMarkL(); |
|
564 break; |
|
565 } |
|
566 |
|
567 case EMceCmdSendViaIr: |
|
568 iMceUi->SendViaL( iMsgListContainer->CurrentItemId(), KSenduiMtmIrUid ); |
|
569 break; |
|
570 |
|
571 case EMceCmdSendViaBt: |
|
572 iMceUi->SendViaL( iMsgListContainer->CurrentItemId(), KSenduiMtmBtUid ); |
|
573 break; |
|
574 |
|
575 |
|
576 case EMceCmdSortByDate: |
|
577 case EMceCmdSortBySubject: |
|
578 case EMceCmdSortByRecipient: |
|
579 case EMceCmdSortBySender: |
|
580 case EMceCmdSortByType: |
|
581 HandleSortCommandL( aCommand ); |
|
582 break; |
|
583 |
|
584 case EMceCommandMMSContentUpload: |
|
585 // MMS.Content.Upload |
|
586 iMceUi->ShowUploadQueryL(); |
|
587 break; |
|
588 case EMceCmdDelete: |
|
589 // Cannot delete while the message viewer is being launched by the NCN |
|
590 if ( !iMessageViewerLauncher ) |
|
591 { |
|
592 iMceUi->HandleCommandL( aCommand ); |
|
593 } |
|
594 break; |
|
595 |
|
596 case EMceHCListCmdExpand: |
|
597 case EMceHCListCmdCollapse: |
|
598 case EMceHCListCmdCollapse1: |
|
599 case EMceHCListCmdCollapse2: |
|
600 HandleContainerOptionsCommandL( aCommand ); |
|
601 break; |
|
602 |
|
603 case EMceCmdNewFolder: |
|
604 case EMceCmdRenameFolder: |
|
605 iMsgListContainer->ClearSelection(); |
|
606 // drop through |
|
607 default: |
|
608 if ( iAiwServiceHandler && FeatureManager::FeatureSupported(KFeatureIdSyncMlDsEmail) && |
|
609 KAiwCmdSynchronize == iAiwServiceHandler->ServiceCmdByMenuCmd(aCommand)) |
|
610 { |
|
611 TInt appId = EGenericParamMessageItemEMail; |
|
612 const TMsvEntry entry = iMsgListContainer->FolderEntry(); |
|
613 CAiwGenericParamList* list = AiwSyncParamListLC( appId, entry.iDetails ); |
|
614 |
|
615 iAiwServiceHandler->ExecuteMenuCmdL(aCommand, *list, |
|
616 iAiwServiceHandler->OutParamListL() ); |
|
617 CleanupStack::PopAndDestroy(list); |
|
618 } |
|
619 // NSS Handling MessageReader AIW command |
|
620 else if( iAiwServiceHandler && KAiwCmdView == iAiwServiceHandler->ServiceCmdByMenuCmd(aCommand)) |
|
621 { |
|
622 /** |
|
623 * @todo Fetching and packing message list is duplicated in |
|
624 * HandleCommandL and in DynInitMenuPaneL. should be extracted |
|
625 * into a separate method. I don't dare to introduce a new |
|
626 * method. Let the mce team care about it |
|
627 */ |
|
628 CMsvEntrySelection* itemIds = iMsgListContainer->CurrentItemSelectionL(); |
|
629 CleanupStack::PushL( itemIds ); |
|
630 |
|
631 CAiwGenericParamList& inList = iAiwServiceHandler->InParamListL(); |
|
632 |
|
633 for ( TInt i( 0 ); i < itemIds->Count(); i++ ) |
|
634 { |
|
635 TMsvId itemId ( (*itemIds)[i] ); |
|
636 TMsvEntry currentEntry; |
|
637 TMsvId serviceId; // not used here but needed by GetEntry function |
|
638 |
|
639 if ( iSession->GetEntry( itemId, serviceId, currentEntry ) == KErrNone ) |
|
640 { |
|
641 // Pack the TMsvEntry into the TAiwVariant and add it to the param list |
|
642 TPckgC<TMsvEntry> packedEntry ( currentEntry ); |
|
643 |
|
644 // does not copy the data |
|
645 TAiwVariant varEntry( packedEntry ); |
|
646 TAiwGenericParam parEntry( EGenericParamUnspecified, varEntry ); |
|
647 |
|
648 // copies the data |
|
649 inList.AppendL( parEntry ); |
|
650 } // if |
|
651 // message reader wise ignore the error |
|
652 // @todo log the error according to the mce team standards |
|
653 } // for |
|
654 |
|
655 CleanupStack::PopAndDestroy( itemIds ); |
|
656 |
|
657 iAiwServiceHandler->ExecuteMenuCmdL( aCommand, inList, |
|
658 iAiwServiceHandler->OutParamListL() ); |
|
659 } |
|
660 // NSS End of handling MessageReader AIW command |
|
661 else |
|
662 { |
|
663 iMceUi->HandleCommandL( aCommand ); |
|
664 } |
|
665 break; |
|
666 } |
|
667 MCELOGGER_LEAVEFN("CMceMessageListView::HandleCommandL()"); |
|
668 } |
|
669 |
|
670 // ---------------------------------------------------- |
|
671 // CMceMessageListView::HandleSessionEventL |
|
672 // ---------------------------------------------------- |
|
673 void CMceMessageListView::HandleSessionEventL( |
|
674 TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
675 { |
|
676 MCELOGGER_WRITE_TIMESTAMP("CMceMessageListView::HandleSessionEventL() start"); |
|
677 switch ( aEvent ) |
|
678 { |
|
679 case EMsvEntriesDeleted: |
|
680 { |
|
681 // check that we don't have deleted folder open |
|
682 CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1; |
|
683 if ( iMceViewActivated && selection->Find( iFolderId ) != KErrNotFound ) |
|
684 { |
|
685 // opened folder is deleted, must change to documents |
|
686 SetFolderL( KMceDocumentsEntryId ); |
|
687 iMceUi->ShowTabsL( KMceDocumentsEntryId ); |
|
688 CAknTitlePane* title=iMceUi->TitlePaneL(); |
|
689 TMsvEntry documentsEntry; |
|
690 TMsvId serviceId; |
|
691 if ( iSession->GetEntry( KMceDocumentsEntryId, serviceId, documentsEntry) |
|
692 == KErrNone ) |
|
693 { |
|
694 title->SetTextL( documentsEntry.iDetails ); |
|
695 } |
|
696 if ( iMsgListContainer ) |
|
697 { |
|
698 iMsgListContainer->SetFolderL( KMceDocumentsEntryId ); |
|
699 iMsgListContainer->ClearSelection(); |
|
700 } |
|
701 } |
|
702 |
|
703 if ( /*!iMceUi->ViewUpdateSuppressionFlag() &&*/ |
|
704 iMsgListContainer && |
|
705 iFolderId == (*(TMsvId*) (aArg2)) ) |
|
706 { |
|
707 iMsgListContainer->HandleMsvSessionEventL( aEvent, *selection, !iMceUi->ViewUpdateSuppressionFlag() ); |
|
708 //HandleEntriesDeletedL(); |
|
709 SetMSKButtonL(); |
|
710 //this has been commented due to toolbar not showing up after opening a message and deleting and come back to main view |
|
711 //UpdateToolbarL(); |
|
712 } |
|
713 |
|
714 } |
|
715 break; |
|
716 case EMsvEntriesCreated: |
|
717 case EMsvEntriesChanged: |
|
718 { |
|
719 const TMsvId parentId = (*(TMsvId*) aArg2); |
|
720 CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1; |
|
721 MessageViewHandleEntriesCreatedOrChangedL( parentId, selection); |
|
722 if ( iMsgListContainer ) |
|
723 { |
|
724 // Set the middle soft key |
|
725 SetMSKButtonL(); |
|
726 |
|
727 if ( iFolderId == (*(TMsvId*) (aArg2)) ) |
|
728 { |
|
729 iMsgListContainer->HandleMsvSessionEventL( aEvent, *selection, !iMceUi->ViewUpdateSuppressionFlag() ); |
|
730 } |
|
731 |
|
732 // Imap: Refresh list |
|
733 if ( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmImap4Uid ) |
|
734 { |
|
735 iMsgListContainer->SetRect( ClientRect() ); |
|
736 iMsgListContainer->DrawDeferred(); |
|
737 } |
|
738 } |
|
739 } |
|
740 |
|
741 break; |
|
742 case EMsvEntriesMoved: |
|
743 { |
|
744 const TMsvId parentId = (*(TMsvId*) aArg2); |
|
745 CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1; |
|
746 if ( iMsgListContainer ) |
|
747 { |
|
748 // Set the middle soft key |
|
749 SetMSKButtonL(); |
|
750 if ( parentId == iFolderId ) |
|
751 { |
|
752 iMsgListContainer->HandleMsvSessionEventL( EMsvEntriesCreated, *selection, !iMceUi->ViewUpdateSuppressionFlag() ); |
|
753 } |
|
754 else if ( (*(TMsvId*) (aArg3)) == iFolderId ) |
|
755 { |
|
756 iMsgListContainer->HandleMsvSessionEventL( EMsvEntriesDeleted, *selection, !iMceUi->ViewUpdateSuppressionFlag() ); |
|
757 } |
|
758 |
|
759 // Folder string update for one row list |
|
760 if (iMsgListContainer->MceListId() == EMceListTypeOneRow ) |
|
761 { |
|
762 TMsvId service; |
|
763 TMsvEntry toFolder; |
|
764 if ( iSession->GetEntry( parentId, service, toFolder ) == KErrNone ) |
|
765 { |
|
766 // Is target folder subfolder for current folder |
|
767 if ( toFolder.Parent() == iFolderId ) |
|
768 { |
|
769 CMsvEntrySelection* targetSelection = new(ELeave) CMsvEntrySelection(); |
|
770 CleanupStack::PushL( targetSelection ); |
|
771 targetSelection->AppendL( parentId ); |
|
772 // Send EMsvEntriesChanged to one row message list container |
|
773 // with move target folder information to get folder string updated |
|
774 iMsgListContainer->HandleMsvSessionEventL( EMsvEntriesChanged, *targetSelection, |
|
775 !iMceUi->ViewUpdateSuppressionFlag() ); |
|
776 CleanupStack::PopAndDestroy( targetSelection ); |
|
777 } |
|
778 } |
|
779 } |
|
780 } |
|
781 } |
|
782 |
|
783 break; |
|
784 |
|
785 case EMsvCloseSession: |
|
786 { |
|
787 if (iMsgListContainer) |
|
788 { |
|
789 //TODO |
|
790 // CMceMessageListItemArray* listArray = iMsgListContainer->ListItems(); |
|
791 // listArray->HandleSessionEventL( aEvent, aArg1, aArg2, aArg3 ); |
|
792 } |
|
793 |
|
794 iSession->RemoveObserver( *this ); |
|
795 } |
|
796 break; |
|
797 |
|
798 case EMsvMediaChanged: |
|
799 { |
|
800 if (iMceUi->MceViewActive(EMceMessageViewActive) ) |
|
801 { |
|
802 |
|
803 // this is because DoDeactivate saves current index and when returning to main view |
|
804 // we want to reset current index |
|
805 iMceUi->SetCustomControl(1); |
|
806 iSelectedIndex = 0; |
|
807 iMainViewListView.SetSelectedFolderId( iFolderId ); |
|
808 iMceUi->ActivateLocalViewL( KMceMainViewListViewId ); |
|
809 iMceUi->RemoveTabs(); |
|
810 } |
|
811 } |
|
812 break; |
|
813 |
|
814 default: |
|
815 break; |
|
816 |
|
817 }; |
|
818 UpdateViewL(); |
|
819 MCELOGGER_WRITE_TIMESTAMP("CMceMessageListView::HandleSessionEventL() end"); |
|
820 } |
|
821 |
|
822 // ---------------------------------------------------- |
|
823 // CMceMessageListView::ProcessCommandL |
|
824 // ---------------------------------------------------- |
|
825 void CMceMessageListView::ProcessCommandL(TInt aCommand) |
|
826 { |
|
827 iMceUi->CancelMailboxTimer(); |
|
828 MCELOGGER_WRITE("CMceMessageListView::ProcessCommandL"); |
|
829 |
|
830 if ( ( !iMessageViewerLauncher || ( iMessageViewerLauncher && !iMessageViewerLauncher->IsActive() ) ) && |
|
831 !iMceUi->IsEditorOpen() ) |
|
832 { |
|
833 if ( aCommand == EAknSoftkeyContextOptions ) |
|
834 { |
|
835 // Handle the context sensitive menu |
|
836 iFetchMenuSelectionKeyPressed = ETrue; |
|
837 iHideExitCommand = ETrue; |
|
838 aCommand = EAknSoftkeyOptions; |
|
839 if(iFolderId == KMsvGlobalOutBoxIndexEntryIdValue) |
|
840 iContextCommand = ETrue; |
|
841 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); |
|
842 } |
|
843 CAknView::ProcessCommandL( aCommand ); |
|
844 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
845 } |
|
846 #ifdef _DEBUG |
|
847 else |
|
848 { |
|
849 MCELOGGER_WRITE("MCE: Editor is open so don't call CAknView::ProcessCommandL"); |
|
850 } |
|
851 #endif |
|
852 } |
|
853 |
|
854 |
|
855 // ---------------------------------------------------- |
|
856 // CMceMessageListView::Id |
|
857 // ---------------------------------------------------- |
|
858 TUid CMceMessageListView::Id() const |
|
859 { |
|
860 return KMceMessageListViewId; |
|
861 } |
|
862 |
|
863 // ---------------------------------------------------- |
|
864 // CMceMessageListView::HandleListBoxEventL |
|
865 // ---------------------------------------------------- |
|
866 void CMceMessageListView::HandleListBoxEventL( |
|
867 CEikListBox* /*aListBox*/, |
|
868 TListBoxEvent aEventType ) |
|
869 { |
|
870 switch(aEventType) |
|
871 { |
|
872 case EEventEnterKeyPressed: |
|
873 case EEventItemSingleClicked: |
|
874 iMceUi->CancelMailboxTimer(); |
|
875 HandleOpenL(); |
|
876 break; |
|
877 default: |
|
878 break; |
|
879 } |
|
880 } |
|
881 |
|
882 // ---------------------------------------------------- |
|
883 // CMceMessageListView::HandleCloseL |
|
884 // ---------------------------------------------------- |
|
885 void CMceMessageListView::HandleCloseL( ) |
|
886 { |
|
887 // this is because DoDeactivate saves current index and when returning to main view |
|
888 // we want to reset current index |
|
889 iSelectedIndex = 0; |
|
890 if ( iMsgListContainer->FolderEntry().iMtm == KUidMsvLocalServiceMtm ) |
|
891 { |
|
892 iMainViewListView.SetSelectedFolderId( iFolderId ); |
|
893 } |
|
894 else |
|
895 { |
|
896 // we are closing service and we should inform main view that |
|
897 // service id, not folder id. |
|
898 iMainViewListView.SetSelectedFolderId( iMsgListContainer->FolderEntry().iServiceId ); |
|
899 } |
|
900 iMceUi->ActivateLocalViewL( KMceMainViewListViewId ); |
|
901 iMceUi->RemoveTabs(); |
|
902 } |
|
903 |
|
904 // ---------------------------------------------------- |
|
905 // CMceMessageListView::ChangeFolderL |
|
906 // ---------------------------------------------------- |
|
907 void CMceMessageListView::ChangeFolderL( TBool aOpenParent ) |
|
908 { |
|
909 if ( aOpenParent && FolderOpenedL() ) |
|
910 { |
|
911 iMceUi->RemoveFolderTabs(); |
|
912 ChangeFolderAndRefreshListboxL( iMsgListContainer->FolderEntry().Parent() ); |
|
913 const TMsvEntry& entry = iMsgListContainer->FolderEntry(); |
|
914 const TMsvId entryId = entry.Id(); |
|
915 if ( entry.Parent() == KMsvRootIndexEntryId || |
|
916 ( entry.iMtm == KSenduiMtmImap4Uid && !IsImapFolderOpenL( ) ) || |
|
917 entryId == KMsvGlobalInBoxIndexEntryId || |
|
918 entryId == KMsvGlobalOutBoxIndexEntryId || |
|
919 entryId == KMsvDraftEntryId || |
|
920 entryId == KMsvSentEntryId || |
|
921 entryId == KMceDocumentsEntryId ) |
|
922 { |
|
923 iMceUi->ShowTabsL( entry.Id() ); |
|
924 } |
|
925 } |
|
926 else if ( !aOpenParent ) |
|
927 { |
|
928 iMceUi->RemoveTabs(); |
|
929 TMsvEntry child; |
|
930 TMsvId serviceId; |
|
931 TInt error = iSession->GetEntry( iMsgListContainer->CurrentItemId(), serviceId, child ); |
|
932 if ( error == KErrNone ) |
|
933 { |
|
934 if ( child.Id() == KMceTemplatesEntryId ) |
|
935 { |
|
936 |
|
937 TInt r = RProperty::Define( KPSUidMuiu, KMceTemplatesDialog, RProperty::EInt ); |
|
938 if ( r != KErrAlreadyExists ) |
|
939 { |
|
940 User::LeaveIfError( r ); |
|
941 } |
|
942 if ( iCurrentListType == EMceListTypeOneRow) |
|
943 { |
|
944 r = RProperty::Set( KPSUidMuiu, KMceTemplatesDialog, MceTemplatesDialogOpen ); |
|
945 } |
|
946 |
|
947 if ( CNotepadApi::ExecTemplatesL() == EAknSoftkeyExit ) |
|
948 { |
|
949 iAvkonViewAppUi->ProcessCommandL( EAknCmdExit ); |
|
950 } |
|
951 |
|
952 if ( iCurrentListType == EMceListTypeOneRow) |
|
953 { |
|
954 r = RProperty::Set( KPSUidMuiu, KMceTemplatesDialog, MceTemplatesDialogClose ); |
|
955 } |
|
956 if ( !(iMceUi->MceViewActive( EMceMainViewActive ))) |
|
957 iMceUi->ShowTabsL( iMsgListContainer->FolderEntry().Id() ); |
|
958 ListContainer()->DrawDeferred(); |
|
959 } |
|
960 else if ( child.iType == KUidMsvFolderEntry || |
|
961 child.iType == KUidMsvServiceEntry ) // this should not be possible |
|
962 { |
|
963 ChangeFolderAndRefreshListboxL( child.Id() ); |
|
964 } |
|
965 } // end if error == KErrNone |
|
966 } // else |
|
967 } |
|
968 |
|
969 // ---------------------------------------------------- |
|
970 // CMceMessageListView::DynInitMenuPaneL |
|
971 // ---------------------------------------------------- |
|
972 |
|
973 void CMceMessageListView::DynInitMenuPaneL( |
|
974 TInt aResourceId, |
|
975 CEikMenuPane* aMenuPane ) |
|
976 { |
|
977 if ( !iMceViewActivated ) |
|
978 { |
|
979 return; |
|
980 } |
|
981 |
|
982 if ( !iAiwServiceHandler ) |
|
983 { |
|
984 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
985 } |
|
986 |
|
987 if ( !iListViewFlags.MceFlag(EMceUiFlagsMainViewAiwCreated) ) |
|
988 { |
|
989 iAiwServiceHandler->AttachMenuL( R_MCE_FOLDER_MENU, R_AIWMCE_INTEREST ); |
|
990 iListViewFlags.SetMceFlag(EMceUiFlagsMainViewAiwCreated); |
|
991 } |
|
992 |
|
993 if (iAiwServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
994 { |
|
995 return; |
|
996 } |
|
997 |
|
998 switch ( aResourceId ) |
|
999 { |
|
1000 case R_MCE_FOLDER_MENU: |
|
1001 aMenuPane->SetItemDimmed( EAknCmdHelp, |
|
1002 !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); |
|
1003 |
|
1004 iMsgListContainer->MarkItemSelectionL(); |
|
1005 if ( !iHideExitCommand && |
|
1006 !iMsgListContainer->DisplayOptionsMenuFromSelectionKey() && |
|
1007 iMsgListContainer->CurrentItemType() == CMceMessageListContainerBase::EMessageListItemMsvItem |
|
1008 ) |
|
1009 { |
|
1010 iMceUi->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
1011 } |
|
1012 // MMS.Content.Upload |
|
1013 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, !FeatureManager::FeatureSupported(KFeatureIdSenduiMmsUpload) ); |
|
1014 if ( !iMceUi->NumUploadServices() ) |
|
1015 { |
|
1016 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1017 } |
|
1018 |
|
1019 FolderMenuL( aMenuPane ); |
|
1020 |
|
1021 //multiselection, handle MMMbox item |
|
1022 iMceUi->AddMultiselectionMTMFunctionsL(*aMenuPane, EAknCmdOpen); |
|
1023 |
|
1024 // NSS Fetch the MessageReader menu |
|
1025 if ( iAiwServiceHandler->IsAiwMenu( aResourceId ) ) |
|
1026 { |
|
1027 /** |
|
1028 * @todo Fetching and packing message list is duplicated in |
|
1029 * HandleCommandL and in DynInitMenuPaneL. should be extracted |
|
1030 * into a separate method. I don't dare to introduce a new |
|
1031 * method. Let the mce team care about it |
|
1032 */ |
|
1033 CMsvEntrySelection* itemIds = iMsgListContainer->CurrentItemSelectionL(); |
|
1034 CleanupStack::PushL( itemIds ); |
|
1035 |
|
1036 CAiwGenericParamList& inList = iAiwServiceHandler->InParamListL(); |
|
1037 |
|
1038 for ( TInt i( 0 ); i < itemIds->Count(); i++ ) |
|
1039 { |
|
1040 TMsvId itemId ( (*itemIds)[i] ); |
|
1041 TMsvEntry currentEntry; |
|
1042 TMsvId serviceId; // not used here but needed by GetEntry function |
|
1043 |
|
1044 if ( iSession->GetEntry( itemId, serviceId, currentEntry ) == KErrNone ) |
|
1045 { |
|
1046 // Pack the TMsvEntry into the TAiwVariant and add it to the param list |
|
1047 TPckgC<TMsvEntry> packedEntry ( currentEntry ); |
|
1048 |
|
1049 // does not copy the data |
|
1050 TAiwVariant varEntry( packedEntry ); |
|
1051 TAiwGenericParam parEntry( EGenericParamUnspecified, varEntry ); |
|
1052 |
|
1053 // copies the data |
|
1054 inList.AppendL( parEntry ); |
|
1055 } // if |
|
1056 // message reader wise ignore the error |
|
1057 // @todo log the error according to the mce team standards |
|
1058 } // for |
|
1059 |
|
1060 CleanupStack::PopAndDestroy( itemIds ); |
|
1061 |
|
1062 iAiwServiceHandler->InitializeMenuPaneL( *aMenuPane, aResourceId, |
|
1063 EMceCmdFirstMessageReaderAiwCommand, |
|
1064 inList ); |
|
1065 HandleContainerOptionsMenuL( aMenuPane ); |
|
1066 } |
|
1067 |
|
1068 break; |
|
1069 case R_MCE_EDIT_MENU: |
|
1070 EditMenuL( aMenuPane ); |
|
1071 break; |
|
1072 case R_MCE_FETCH_MENU: |
|
1073 FetchMenuL( aMenuPane ); |
|
1074 break; |
|
1075 |
|
1076 case R_MCE_SENDVIA_MENU: |
|
1077 aMenuPane->SetItemDimmed( EMceCmdSendViaIr, |
|
1078 !FeatureManager::FeatureSupported( KFeatureIdIrda ) ); |
|
1079 aMenuPane->SetItemDimmed( EMceCmdSendViaBt, |
|
1080 !FeatureManager::FeatureSupported( KFeatureIdBt ) ); |
|
1081 |
|
1082 break; |
|
1083 |
|
1084 case R_MCE_SORT_BY_MENU: |
|
1085 { |
|
1086 if ( ( iFolderId != KMsvSentEntryId ) && |
|
1087 ( iFolderId != KMsvDraftEntryId ) && |
|
1088 ( iFolderId != KMsvGlobalOutBoxIndexEntryId) ) |
|
1089 { |
|
1090 aMenuPane->DeleteMenuItem(EMceCmdSortByRecipient); |
|
1091 aMenuPane->SetItemDimmed( EMceCmdSortBySender, EFalse ); |
|
1092 } |
|
1093 else |
|
1094 { |
|
1095 aMenuPane->DeleteMenuItem(EMceCmdSortBySender); |
|
1096 aMenuPane->SetItemDimmed( EMceCmdSortByRecipient, EFalse ); |
|
1097 } |
|
1098 |
|
1099 if ( IsMSKMailBox() ) |
|
1100 { |
|
1101 // Mail folder, only single message type |
|
1102 aMenuPane->SetItemDimmed( EMceCmdSortByType, ETrue ); |
|
1103 } |
|
1104 else |
|
1105 { |
|
1106 // Inbox etc. |
|
1107 aMenuPane->SetItemDimmed( EMceCmdSortByType, EFalse ); |
|
1108 } |
|
1109 aMenuPane->SetItemButtonState( iSortOrder, EEikMenuItemSymbolOn ); |
|
1110 break; |
|
1111 } |
|
1112 |
|
1113 case R_MCE_NEW_MESSAGE_MENU: |
|
1114 default: |
|
1115 iMceUi->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
1116 iMsgListContainer->SetContainerFlag( EMceOneRowFlagOptionsMenuOpen, ETrue ); |
|
1117 break; |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 // ---------------------------------------------------- |
|
1122 // CMceMessageListView::HandleContainerOptionsMenuL |
|
1123 // ---------------------------------------------------- |
|
1124 void CMceMessageListView::HandleContainerOptionsMenuL( CEikMenuPane* aMenuPane ) |
|
1125 { |
|
1126 TUint validCommands = iMsgListContainer->OptionsCommandSupported(); |
|
1127 |
|
1128 aMenuPane->SetItemDimmed( EMceHCListCmdExpand, !(validCommands & CMceMessageListContainerBase::TMessageListCommandExpand )); |
|
1129 aMenuPane->SetItemDimmed( EMceHCListCmdCollapse1, !(validCommands & CMceMessageListContainerBase::TMessageListCommandCollapse1 )); |
|
1130 aMenuPane->SetItemDimmed( EMceHCListCmdCollapse2, !(validCommands & CMceMessageListContainerBase::TMessageListCommandCollapse2 )); |
|
1131 |
|
1132 } |
|
1133 |
|
1134 // ---------------------------------------------------- |
|
1135 // CMceMessageListView::HandleContainerOptionsCommandL |
|
1136 // ---------------------------------------------------- |
|
1137 void CMceMessageListView::HandleContainerOptionsCommandL( TInt aCommand ) |
|
1138 { |
|
1139 TInt containerCommand = 0; |
|
1140 switch ( aCommand ) |
|
1141 { |
|
1142 case EMceHCListCmdExpand: |
|
1143 containerCommand = CMceMessageListContainerBase::TMessageListCommandExpand; |
|
1144 break; |
|
1145 case EMceHCListCmdCollapse: |
|
1146 case EMceHCListCmdCollapse1: |
|
1147 case EMceHCListCmdCollapse2: |
|
1148 containerCommand = CMceMessageListContainerBase::TMessageListCommandCollapse1; |
|
1149 break; |
|
1150 default: |
|
1151 break; |
|
1152 } |
|
1153 if ( containerCommand > 0 ) |
|
1154 { |
|
1155 iMsgListContainer->HandleOptionsCommandL( containerCommand ); |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 |
|
1160 // ---------------------------------------------------- |
|
1161 // CMceMessageListView::EditEntryL |
|
1162 // ---------------------------------------------------- |
|
1163 void CMceMessageListView::EditEntryL() |
|
1164 { |
|
1165 if ( iMceUi->IsEditorOpen() ) |
|
1166 { |
|
1167 MCELOGGER_WRITE("MCE: EditEntry: do not open because already editing one"); |
|
1168 return; |
|
1169 } |
|
1170 |
|
1171 TMsvId id = iMsgListContainer->CurrentItemId(); |
|
1172 if ( id < KMsvRootIndexEntryId ) |
|
1173 { |
|
1174 return; |
|
1175 } |
|
1176 TMsvEntry currentEntry; |
|
1177 TMsvId serviceId; // not used here but needed by GetEntry function |
|
1178 if ( iSession->GetEntry( id, serviceId, currentEntry ) == KErrNone && |
|
1179 currentEntry.iType == KUidMsvMessageEntry ) |
|
1180 { |
|
1181 if ( (currentEntry.iMtm==KSenduiMtmImap4Uid) || (currentEntry.iMtm==KSenduiMtmPop3Uid) || |
|
1182 (currentEntry.iMtm==KSenduiMtmSyncMLEmailUid)|| |
|
1183 iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, currentEntry.iMtm ) ) |
|
1184 { |
|
1185 // Mailbox entry |
|
1186 if ( currentEntry.Unread() ) |
|
1187 { |
|
1188 // NCN reset, opening the unread entry |
|
1189 |
|
1190 iMceUi->HandleNotif(iMsgListContainer->FolderEntry().iServiceId); |
|
1191 } |
|
1192 } |
|
1193 |
|
1194 // just to make sure... |
|
1195 iMceUi->CancelMailboxTimer(); |
|
1196 iRunningEditFunction = ETrue; |
|
1197 TRAPD( error, iMceUi->EditMTMEntryL( currentEntry ) ); |
|
1198 iRunningEditFunction = EFalse; |
|
1199 User::LeaveIfError( error ); |
|
1200 } |
|
1201 |
|
1202 } |
|
1203 |
|
1204 |
|
1205 // ---------------------------------------------------- |
|
1206 // CMceMessageListView::HandleOpenL |
|
1207 // ---------------------------------------------------- |
|
1208 void CMceMessageListView::HandleOpenL() |
|
1209 { |
|
1210 if ( !iMsgListContainer->DisplayOptionsMenuFromSelectionKey() ) |
|
1211 { |
|
1212 CMsvEntrySelection* selection = iMsgListContainer->CurrentItemSelectionRefreshL(); |
|
1213 CleanupStack::PushL( selection ); |
|
1214 iHideExitCommand = EFalse; |
|
1215 TMsvEntry currentEntry; |
|
1216 TMsvId serviceId; // not used here but needed by GetEntry function |
|
1217 if ( selection->Count() && |
|
1218 iSession->GetEntry( selection->At(0), serviceId, currentEntry ) == KErrNone ) |
|
1219 { |
|
1220 switch ( currentEntry.iType.iUid ) |
|
1221 { |
|
1222 case KUidMsvMessageEntryValue: |
|
1223 if ( currentEntry.Parent() != KMsvGlobalOutBoxIndexEntryId ) |
|
1224 { |
|
1225 EditEntryL(); |
|
1226 } |
|
1227 else // Open context sensitive menu |
|
1228 { |
|
1229 ProcessCommandL( EAknSoftkeyContextOptions ); |
|
1230 } |
|
1231 break; |
|
1232 case KUidMsvFolderEntryValue: |
|
1233 ChangeFolderL(); |
|
1234 break; |
|
1235 default: |
|
1236 break; |
|
1237 } |
|
1238 } |
|
1239 CleanupStack::PopAndDestroy( selection ); |
|
1240 } |
|
1241 else |
|
1242 { |
|
1243 iHideExitCommand = ETrue; |
|
1244 ProcessCommandL( EAknSoftkeyContextOptions ); |
|
1245 } |
|
1246 } |
|
1247 |
|
1248 // ---------------------------------------------------- |
|
1249 // CMceMessageListView::FetchMenuL |
|
1250 // ---------------------------------------------------- |
|
1251 void CMceMessageListView::FetchMenuL( CEikMenuPane* aMenuPane ) const |
|
1252 { |
|
1253 if ( iMsgListContainer->CurrentItemSelectionCount() == 0 ) |
|
1254 { |
|
1255 aMenuPane->SetItemDimmed( EMceCmdFetchSelected, ETrue ); |
|
1256 } |
|
1257 else if ( iFetchMenuSelectionKeyPressed ) |
|
1258 { |
|
1259 aMenuPane->SetItemDimmed( EMceCmdFetchNew, ETrue ); |
|
1260 aMenuPane->SetItemDimmed( EMceCmdFetchAll, ETrue ); |
|
1261 } |
|
1262 } |
|
1263 |
|
1264 // |
|
1265 // ---------------------------------------------------------------------------- |
|
1266 // CMceMessageListView::GetSetRead() |
|
1267 // ---------------------------------------------------------------------------- |
|
1268 // |
|
1269 TInt CMceMessageListView::GetSetRead( const CMsvEntrySelection& aEntries ) |
|
1270 { |
|
1271 TBool allRead = ETrue; |
|
1272 TBool allUnread = ETrue; |
|
1273 TMsvId service; |
|
1274 TMsvEntry tEntry; |
|
1275 |
|
1276 for ( TInt cc=aEntries.Count(); --cc>=0; ) |
|
1277 { |
|
1278 if ( iSession->GetEntry( |
|
1279 aEntries.At( cc ), service, tEntry ) == KErrNone ) |
|
1280 { |
|
1281 if ( tEntry.Unread() ) |
|
1282 { |
|
1283 allRead = EFalse; |
|
1284 } |
|
1285 else |
|
1286 { |
|
1287 allUnread = EFalse; |
|
1288 } |
|
1289 } |
|
1290 } |
|
1291 |
|
1292 if ( allRead && !allUnread ) |
|
1293 { |
|
1294 return MessageFolderAllRead; |
|
1295 } |
|
1296 else if ( !allRead && allUnread ) |
|
1297 { |
|
1298 // all unread |
|
1299 return MessageFolderAllUnread; |
|
1300 } |
|
1301 else if ( !allRead && !allUnread ) |
|
1302 { |
|
1303 // both read and unread |
|
1304 return MessageFolderReadUnread; |
|
1305 } |
|
1306 else |
|
1307 { |
|
1308 /* never */ |
|
1309 return MessageFolderReadUnread; |
|
1310 } |
|
1311 |
|
1312 } |
|
1313 |
|
1314 // ---------------------------------------------------- |
|
1315 // CMceMessageListView::FolderMenuL |
|
1316 // ---------------------------------------------------- |
|
1317 void CMceMessageListView::FolderMenuL( CEikMenuPane* aMenuPane ) |
|
1318 { |
|
1319 if(iFolderId == KMsvGlobalOutBoxIndexEntryIdValue ) |
|
1320 { |
|
1321 if(iContextCommand) |
|
1322 { |
|
1323 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, EFalse ); |
|
1324 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, EFalse ); |
|
1325 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, EFalse ); |
|
1326 aMenuPane->SetItemDimmed( EMceCmdDelete, EFalse ); |
|
1327 iContextCommand = EFalse; |
|
1328 } |
|
1329 else |
|
1330 { |
|
1331 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1332 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1333 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1334 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1335 } |
|
1336 } |
|
1337 const TInt count = iMsgListContainer->CurrentItemSelectionCount(); |
|
1338 TBool remotemailboxOpened = ( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmImap4Uid |
|
1339 || iMsgListContainer->FolderEntry().iMtm == KSenduiMtmPop3Uid ); |
|
1340 |
|
1341 TBool thirdPartEmail = ( !remotemailboxOpened && |
|
1342 iMceUi->CheckTechnologyTypeFromMtm( |
|
1343 KMailTechnologyTypeUid, |
|
1344 iMsgListContainer->FolderEntry().iMtm ) ); |
|
1345 |
|
1346 //Forward is disabled in all folder menus, except is enabled in Sent Items seperately |
|
1347 aMenuPane->SetItemDimmed( EMceCmdForward, ETrue ); |
|
1348 if ( remotemailboxOpened ) |
|
1349 { |
|
1350 aMenuPane->SetItemDimmed( EMceCmdMailboxSettings, IsImapFolderOpenL() ); |
|
1351 if ( !IsImapFolderOpenL() ) |
|
1352 { |
|
1353 aMenuPane->SetItemDimmed( EMceCmdMailboxSettings, iHideExitCommand ); |
|
1354 } |
|
1355 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, iHideExitCommand ); |
|
1356 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, iHideExitCommand ); |
|
1357 aMenuPane->SetItemDimmed( EMceCmdSort, iHideExitCommand ); |
|
1358 aMenuPane->SetItemDimmed( EMceCmdReply, iHideExitCommand ); |
|
1359 TMsvEntry tempEntry; |
|
1360 TMsvId serviceId; |
|
1361 if ( iSession->GetEntry( iMsgListContainer->FolderEntry().iServiceId, serviceId, tempEntry ) |
|
1362 == KErrNone ) |
|
1363 { |
|
1364 if ( tempEntry.Connected() ) |
|
1365 { |
|
1366 aMenuPane->SetItemDimmed( EMceCmdConnect, ETrue ); |
|
1367 aMenuPane->SetItemDimmed( EMceCmdCloseConnection, (iHideExitCommand && count > 0) ); |
|
1368 } |
|
1369 else |
|
1370 { |
|
1371 aMenuPane->SetItemDimmed( EMceCmdCloseConnection, ETrue ); |
|
1372 aMenuPane->SetItemDimmed( EMceCmdConnect, (iHideExitCommand && count > 0) ); |
|
1373 } |
|
1374 } |
|
1375 // MMS.Content.Upload |
|
1376 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1377 // No move and copy commands for mail messages |
|
1378 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1379 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
1380 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1381 } |
|
1382 else |
|
1383 { |
|
1384 aMenuPane->SetItemDimmed( EMceCmdCloseConnection, ETrue ); |
|
1385 aMenuPane->SetItemDimmed( EMceCmdConnect, ETrue ); |
|
1386 aMenuPane->SetItemDimmed( EMceCmdMailboxSettings, ETrue ); |
|
1387 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, !iIsUnread ); |
|
1388 } |
|
1389 |
|
1390 if ( iFolderId != KMceDocumentsEntryId ) |
|
1391 { |
|
1392 // only documents can have create, rename folder menu items |
|
1393 aMenuPane->SetItemDimmed( EMceCmdNewFolder, ETrue ); |
|
1394 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
1395 } |
|
1396 else |
|
1397 { |
|
1398 aMenuPane->SetItemDimmed( EMceCmdNewFolder, iHideExitCommand ); |
|
1399 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, iHideExitCommand ); |
|
1400 } |
|
1401 TInt totalCount = iMsgListContainer->Count(); |
|
1402 TInt subfolderCount = SubfolderCount(); |
|
1403 // TODO: I don't understand this if... |
|
1404 if ( totalCount != subfolderCount && totalCount - subfolderCount == 1) |
|
1405 { |
|
1406 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1407 } |
|
1408 if ( iFolderId == KMsvGlobalOutBoxIndexEntryId ) |
|
1409 { |
|
1410 aMenuPane->SetItemDimmed( EMceCmdEditList, ETrue ); |
|
1411 } |
|
1412 else if ( count > 0 && totalCount == subfolderCount ) |
|
1413 { |
|
1414 // only folders in the list, then "Edit" submenu would be empty so delete it |
|
1415 aMenuPane->SetItemDimmed( EMceCmdEditList, ETrue ); |
|
1416 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1417 } |
|
1418 |
|
1419 aMenuPane->SetItemDimmed( EMceCmdExit, iHideExitCommand ); |
|
1420 aMenuPane->SetItemDimmed( EAknCmdOpen, iHideExitCommand ); |
|
1421 aMenuPane->SetItemDimmed( EMceCmdSort, iHideExitCommand ); |
|
1422 |
|
1423 if ( IsSyncMl() ) |
|
1424 { |
|
1425 if ( iMsgListContainer->FolderEntry().iType == KUidMsvServiceEntry ) |
|
1426 { |
|
1427 // Prepare the menu for the SyncML main folder |
|
1428 FolderMenuSyncMLMain( aMenuPane ); |
|
1429 } |
|
1430 else |
|
1431 { |
|
1432 // Prepare the menu for the message lists |
|
1433 FolderMenuSyncMLFolderL( aMenuPane ); |
|
1434 } |
|
1435 } |
|
1436 else |
|
1437 { |
|
1438 // Show the SyncML command only for the SyncML folder, no other folders |
|
1439 aMenuPane->SetItemDimmed( EMceCmdAiwPlaceholder, ETrue ); |
|
1440 } |
|
1441 |
|
1442 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
1443 { |
|
1444 aMenuPane->SetItemDimmed( EAknCmdHelp, iHideExitCommand ); |
|
1445 } |
|
1446 |
|
1447 TBool hideNewMessageCommand = iHideExitCommand; |
|
1448 if ( iHideExitCommand && iFolderId == KMsvDraftEntryId ) |
|
1449 { |
|
1450 hideNewMessageCommand = count > 0; |
|
1451 } |
|
1452 if ( !IsSyncMl() ) |
|
1453 { |
|
1454 aMenuPane->SetItemDimmed( EMceCmdNewMessage, hideNewMessageCommand ); |
|
1455 } |
|
1456 if ( count == 0 ) // No items in the list |
|
1457 { |
|
1458 // MMS.Content.Upload |
|
1459 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1460 FolderMenuNoItemsL( aMenuPane ); |
|
1461 } |
|
1462 else if ( count == 1 ) // 1 selected from the list |
|
1463 { |
|
1464 FolderMenuOneItemL( aMenuPane, remotemailboxOpened, thirdPartEmail ); |
|
1465 } |
|
1466 else // More than 1 selected from the list |
|
1467 { |
|
1468 // MMS.Content.Upload |
|
1469 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1470 |
|
1471 CMsvEntrySelection* entries = ListContainer()->CurrentItemSelectionL(); |
|
1472 CleanupStack::PushL( entries ); |
|
1473 |
|
1474 TInt setRead = GetSetRead( *entries ); |
|
1475 FolderMenuManyItemsL( aMenuPane, remotemailboxOpened, thirdPartEmail, setRead ); |
|
1476 |
|
1477 if ( remotemailboxOpened || |
|
1478 SyncMlOutboxInbox( KMsvGlobalInBoxIndexEntryId ) || |
|
1479 SyncMlOutboxInbox( KMsvDraftEntryId ) || |
|
1480 SyncMlOutboxInbox( KMsvSentEntryId ) ) |
|
1481 { |
|
1482 switch ( GetDeleteFlagStatusL( entries ) ) |
|
1483 { |
|
1484 case MessageFolderAllDelete: |
|
1485 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
1486 aMenuPane->SetItemDimmed( EMceCmdDelete, EFalse ); |
|
1487 break; |
|
1488 case MessageFolderAllUnDelete: |
|
1489 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1490 aMenuPane->SetItemDimmed( EMceCmdUndelete, EFalse ); |
|
1491 break; |
|
1492 case MessageFolderDeleteUnDelete: |
|
1493 aMenuPane->SetItemDimmed( EMceCmdUndelete, EFalse ); |
|
1494 aMenuPane->SetItemDimmed( EMceCmdDelete, EFalse ); |
|
1495 break; |
|
1496 default: |
|
1497 break; |
|
1498 } |
|
1499 } |
|
1500 |
|
1501 // MMS notifications cannot be moved |
|
1502 CBaseMtmUiData* uiData = NULL; |
|
1503 uiData = iMceUi->GetMtmUiDataL( KUidMsgMMSNotification );// NULL check |
|
1504 TMsvId id; |
|
1505 TMsvId service; |
|
1506 TMsvEntry tEntry; |
|
1507 TInt mmsCount = 0; |
|
1508 TInt mmsNotDeleteCount = 0; |
|
1509 |
|
1510 for ( TInt cc=entries->Count(); --cc>=0; ) |
|
1511 { |
|
1512 id = entries->At(cc); |
|
1513 if ( iSession->GetEntry( id, service, tEntry ) == KErrNone ) |
|
1514 { |
|
1515 if ( tEntry.iMtm == KUidMsgMMSNotification ) |
|
1516 { |
|
1517 mmsCount++; |
|
1518 if ( uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, tEntry ) ) |
|
1519 { |
|
1520 //MMS notification delete this entry not supported |
|
1521 mmsNotDeleteCount ++; |
|
1522 } |
|
1523 } |
|
1524 } |
|
1525 } |
|
1526 if ( mmsCount == count ) |
|
1527 { |
|
1528 //if only mms notifications, then move cannot be done |
|
1529 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1530 if ( mmsCount == mmsNotDeleteCount ) |
|
1531 { |
|
1532 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1533 } |
|
1534 } |
|
1535 |
|
1536 CleanupStack::PopAndDestroy( entries ); |
|
1537 } |
|
1538 |
|
1539 if( iReadUnread ) |
|
1540 { |
|
1541 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, ETrue ); |
|
1542 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, ETrue ); |
|
1543 } |
|
1544 |
|
1545 iFetchMenuSelectionKeyPressed = iHideExitCommand; |
|
1546 iHideExitCommand = EFalse; |
|
1547 } |
|
1548 |
|
1549 // ---------------------------------------------------- |
|
1550 // CMceMessageListView::FolderMenuNoItemsL |
|
1551 // ---------------------------------------------------- |
|
1552 void CMceMessageListView::FolderMenuNoItemsL( CEikMenuPane* aMenuPane ) const |
|
1553 { |
|
1554 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
1555 aMenuPane->SetItemDimmed( EMceCmdEditList, ETrue ); |
|
1556 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1557 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
1558 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1559 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1560 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
1561 |
|
1562 // "Write New Message" enabled for options and context sensitive menu |
|
1563 // in case of empty list in Mail For Exchange mailbox |
|
1564 if ( iMsgListContainer->FolderEntry().iMtm == KMceMtmMailForExchangeUid ) |
|
1565 { |
|
1566 aMenuPane->SetItemDimmed( EMceCmdNewMessage, EFalse ); |
|
1567 } |
|
1568 |
|
1569 if ( !( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmImap4Uid || |
|
1570 iMsgListContainer->FolderEntry().iMtm == KSenduiMtmPop3Uid ) ) |
|
1571 { |
|
1572 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
1573 } |
|
1574 else |
|
1575 { |
|
1576 TMsvEntry tempEntry; |
|
1577 TMsvId serviceId; |
|
1578 if ( iSession->GetEntry( iMsgListContainer->FolderEntry().iServiceId, serviceId, tempEntry ) == KErrNone ) |
|
1579 { |
|
1580 if ( tempEntry.Connected() ) |
|
1581 { |
|
1582 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
1583 } |
|
1584 } |
|
1585 } |
|
1586 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1587 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1588 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
1589 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
1590 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, ETrue ); |
|
1591 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, ETrue ); |
|
1592 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsg, ETrue ); |
|
1593 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsg, ETrue ); |
|
1594 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsgs, ETrue ); |
|
1595 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsgs, ETrue ); |
|
1596 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadEmails, ETrue ); |
|
1597 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadEmails, ETrue ); |
|
1598 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1599 } |
|
1600 |
|
1601 // ---------------------------------------------------- |
|
1602 // CMceMessageListView::FolderMenuOneItemL |
|
1603 // ---------------------------------------------------- |
|
1604 void CMceMessageListView::FolderMenuOneItemL( CEikMenuPane* aMenuPane, |
|
1605 TBool aRemoteMailboxOpened, |
|
1606 TBool aThirdPartEmail ) |
|
1607 { |
|
1608 if ( iMsgListContainer->CurrentItemType() != CMceMessageListContainerBase::EMessageListItemMsvItem ) |
|
1609 { |
|
1610 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
1611 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1612 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
1613 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
1614 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1615 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1616 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1617 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
1618 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
1619 aMenuPane->SetItemDimmed( EMceCmdFetch, !aRemoteMailboxOpened ); |
|
1620 DimReadUnreadOptionsMenu( aMenuPane ); |
|
1621 |
|
1622 if ( iMsgListContainer->CurrentItemType() == CMceMessageListContainerBase::EMessageListItemSubtitle ) |
|
1623 { |
|
1624 CMsvEntrySelection* entriesInNode = iMsgListContainer->CurrentItemSelectionL(); |
|
1625 CleanupStack::PushL( entriesInNode ); |
|
1626 if ( entriesInNode->Count() > 0 ) |
|
1627 { |
|
1628 switch ( GetDeleteFlagStatusL( entriesInNode ) ) |
|
1629 { |
|
1630 case MessageFolderAllUnDelete: |
|
1631 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1632 aMenuPane->SetItemDimmed( EMceCmdUndelete, EFalse ); |
|
1633 break; |
|
1634 case MessageFolderAllDelete: |
|
1635 case MessageFolderDeleteUnDelete: |
|
1636 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
1637 aMenuPane->SetItemDimmed( EMceCmdDelete, EFalse ); |
|
1638 break; |
|
1639 default: |
|
1640 break; |
|
1641 } |
|
1642 |
|
1643 TInt setRead = GetSetRead( *entriesInNode ); |
|
1644 TMsvId currentFolderId = iFolderId; |
|
1645 |
|
1646 // Set Mark as Read/Unread Options menu |
|
1647 if ( ( currentFolderId == KMceDocumentsEntryId || |
|
1648 currentFolderId == KMsvGlobalInBoxIndexEntryId || |
|
1649 iMsgListContainer->FolderEntry().Parent() == KMceDocumentsEntryId ) ) |
|
1650 { |
|
1651 SetReadUnreadOptionsMenu( aMenuPane, !KIsEmail, setRead ); |
|
1652 } |
|
1653 else if( aRemoteMailboxOpened || aThirdPartEmail ) |
|
1654 { |
|
1655 SetReadUnreadOptionsMenu( aMenuPane, KIsEmail, setRead ); |
|
1656 } |
|
1657 } |
|
1658 CleanupStack::PopAndDestroy( entriesInNode ); |
|
1659 } |
|
1660 else |
|
1661 { |
|
1662 aMenuPane->SetItemDimmed( EMceCmdUndelete, !aRemoteMailboxOpened ); |
|
1663 } |
|
1664 |
|
1665 // Disable Mark as read/unread if focus on subtitle |
|
1666 if ( iMsgListContainer->CurrentItemType() != CMceMessageListContainerBase::EMessageListItemSubtitle ) |
|
1667 { |
|
1668 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, !aRemoteMailboxOpened ); |
|
1669 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, !aRemoteMailboxOpened ); |
|
1670 } |
|
1671 TMsvId currentFolderId = iFolderId; |
|
1672 // Drafts does not have sort |
|
1673 if ( currentFolderId == KMsvDraftEntryId ) |
|
1674 { |
|
1675 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1676 } |
|
1677 return; |
|
1678 } |
|
1679 |
|
1680 // CurrentItemSelectionL() collects currently focused item if there is no marked one |
|
1681 // For marked items, check iMsgListContainer->DisplayOptionsMenuFromSelectionKey() |
|
1682 CMsvEntrySelection* selection = iMsgListContainer->CurrentItemSelectionL(); |
|
1683 CleanupStack::PushL( selection ); |
|
1684 TMsvEntry currentEntry; |
|
1685 TMsvId serviceId; |
|
1686 if ( iSession->GetEntry( selection->At(0), serviceId, currentEntry ) |
|
1687 == KErrNone || iMceUi->GetMsgDeletedStatus()) |
|
1688 { |
|
1689 DimReadUnreadOptionsMenu ( aMenuPane ); |
|
1690 if ( currentEntry.iType == KUidMsvFolderEntry ) |
|
1691 { |
|
1692 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1693 |
|
1694 if ( MceUtils::IsEntryFixed( currentEntry.Id() ) ) |
|
1695 { |
|
1696 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
1697 } |
|
1698 if ( aRemoteMailboxOpened ) |
|
1699 { |
|
1700 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
1701 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
1702 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1703 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1704 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
1705 } |
|
1706 // MMS.Content.Upload |
|
1707 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1708 } // end folder |
|
1709 else |
|
1710 { |
|
1711 // not folder so delete "Rename" |
|
1712 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
1713 |
|
1714 // MMS.Content.Upload |
|
1715 if ( currentEntry.iMtm.iUid != KSenduiMtmMmsUidValue ) |
|
1716 { |
|
1717 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1718 } |
|
1719 } |
|
1720 |
|
1721 if ( IsSyncMl() ) |
|
1722 { |
|
1723 if ( iMceUi->CheckCommandAvailableL( EMceCmdUndelete, currentEntry ) ) |
|
1724 { |
|
1725 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
1726 } |
|
1727 else |
|
1728 { |
|
1729 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1730 } |
|
1731 |
|
1732 // Sync: remove New Message, Open, Reply and Sort from menu if item marked |
|
1733 if ( iMsgListContainer->DisplayOptionsMenuFromSelectionKey() ) |
|
1734 { |
|
1735 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
1736 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
1737 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1738 aMenuPane->SetItemDimmed( EMceCmdNewMessage, ETrue ); |
|
1739 } |
|
1740 else |
|
1741 { |
|
1742 if ( SyncMlOutboxInbox( KMsvGlobalInBoxIndexEntryId ) ) |
|
1743 { |
|
1744 aMenuPane->SetItemDimmed( EMceCmdReply, |
|
1745 iMceUi->CheckCommandAvailableL( EMceCmdReply, currentEntry ) ); |
|
1746 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, !currentEntry.Unread() ); |
|
1747 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, currentEntry.Unread() ); |
|
1748 } |
|
1749 } |
|
1750 |
|
1751 CleanupStack::PopAndDestroy( selection ); |
|
1752 return; |
|
1753 } |
|
1754 |
|
1755 TMsvId currentFolderId = iFolderId; |
|
1756 |
|
1757 // Forward is enabled in sent item folder. |
|
1758 if ( currentFolderId == KMsvSentEntryId ) |
|
1759 { |
|
1760 SetForwardMenuL( aMenuPane, currentEntry ); |
|
1761 } |
|
1762 |
|
1763 //reply is enabled in Inbox,Remote mailbox and in Document folder |
|
1764 if ( currentFolderId == KMsvDraftEntryId || |
|
1765 currentFolderId == KMsvGlobalOutBoxIndexEntryId || |
|
1766 currentFolderId == KMsvSentEntryId || |
|
1767 currentFolderId == KMceTemplatesEntryId ) |
|
1768 { |
|
1769 //reply is disabled in drafts, sent, outbox and templates folder |
|
1770 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
1771 |
|
1772 if ( currentEntry.iMtm == KUidMsgMMSNotification ) |
|
1773 { |
|
1774 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1775 } |
|
1776 else if ( currentEntry.iMtm.iUid==KSenduiMtmImap4UidValue || |
|
1777 currentEntry.iMtm.iUid==KSenduiMtmPop3UidValue || |
|
1778 currentEntry.iMtm.iUid==KSenduiMtmSmtpUidValue ) |
|
1779 { |
|
1780 // No copy or move commands for the mail messages |
|
1781 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1782 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
1783 } |
|
1784 } |
|
1785 else |
|
1786 { |
|
1787 if ( iMsgListContainer->IsItemFolder( currentEntry.Id() ) |
|
1788 || iMceUi->IsMailSetToBeDeletedFromServerL( currentEntry.Id() ) |
|
1789 || iMsgListContainer->MarkedItemsCount() > 0 ) |
|
1790 { |
|
1791 // Reply is disabled for folder or |
|
1792 // when mailbox is not connected and the message is set to be deleted from the server |
|
1793 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
1794 } |
|
1795 else |
|
1796 { |
|
1797 aMenuPane->SetItemDimmed( EMceCmdReply, |
|
1798 iMceUi->CheckCommandAvailableL( EMceCmdReply, currentEntry ) ); |
|
1799 } |
|
1800 } |
|
1801 |
|
1802 if ( currentFolderId != KMsvGlobalOutBoxIndexEntryId ) |
|
1803 { |
|
1804 TBool selectionKeyPressed = iMsgListContainer->DisplayOptionsMenuFromSelectionKey(); |
|
1805 |
|
1806 if ( iMceUi->IsMailSetToBeDeletedFromServerL( currentEntry.Id() ) ) |
|
1807 { |
|
1808 // Open, Fetch and Delete is disabled |
|
1809 // when mailbox is not connected and the message is set to be deleted from the server |
|
1810 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
1811 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
1812 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1813 } |
|
1814 else |
|
1815 { |
|
1816 aMenuPane->SetItemDimmed( EAknCmdOpen, selectionKeyPressed ); |
|
1817 } |
|
1818 |
|
1819 if ( ( currentFolderId == KMsvGlobalInBoxIndexEntryId ) && |
|
1820 ( currentEntry.iMtm == KUidMsgMMSNotification ) ) |
|
1821 { |
|
1822 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1823 //check also open |
|
1824 CBaseMtmUiData* uiData = iMceUi->GetMtmUiDataL( KUidMsgMMSNotification ); |
|
1825 aMenuPane->SetItemDimmed( EAknCmdOpen, |
|
1826 uiData->OperationSupportedL( KMtmUiFunctionOpenMessage, currentEntry ) ); |
|
1827 aMenuPane->SetItemDimmed( EMceCmdDelete, |
|
1828 uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, currentEntry ) ); |
|
1829 } |
|
1830 |
|
1831 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1832 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1833 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1834 if ( currentEntry.iMtm != KSenduiMtmIrUid && |
|
1835 currentEntry.iMtm != KSenduiMtmBtUid ) |
|
1836 { |
|
1837 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
1838 } |
|
1839 else |
|
1840 { |
|
1841 if ( selectionKeyPressed ) |
|
1842 { |
|
1843 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
1844 } |
|
1845 else |
|
1846 { |
|
1847 TRAPD( error, HandleSendViaMenuItemL( currentEntry.Id(), aMenuPane ) ); |
|
1848 if ( error != KErrNone ) |
|
1849 { |
|
1850 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
1851 } |
|
1852 } |
|
1853 } |
|
1854 } |
|
1855 else |
|
1856 { |
|
1857 // Outbox, MMS.Content.Upload |
|
1858 if ( currentEntry.iBioType == KUidMsgSubTypeMmsUpload.iUid ) |
|
1859 { |
|
1860 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
1861 } |
|
1862 |
|
1863 // outbox does not have open |
|
1864 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
1865 TBool deleteStart = EFalse; |
|
1866 TBool deleteSuspend = EFalse; |
|
1867 switch ( currentEntry.SendingState() ) |
|
1868 { |
|
1869 case KMsvSendStateResend: |
|
1870 if ( currentEntry.iMtm == KUidMsgMMSNotification ) |
|
1871 { |
|
1872 deleteStart = ETrue; |
|
1873 deleteSuspend = ETrue; |
|
1874 } |
|
1875 //go through |
|
1876 case KMsvSendStateScheduled: |
|
1877 break; |
|
1878 |
|
1879 case KMsvSendStateWaiting: |
|
1880 { |
|
1881 if ( currentEntry.iMtm == KSenduiMtmSmsUid || |
|
1882 currentEntry.iMtm == KSenduiMtmMmsUid ) |
|
1883 { |
|
1884 // disable 'Start' option to waiting SMS and |
|
1885 // waiting MMS |
|
1886 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1887 } |
|
1888 |
|
1889 if ( currentEntry.iMtm == KUidMsgMMSNotification ) |
|
1890 { |
|
1891 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1892 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1893 } |
|
1894 break; |
|
1895 } |
|
1896 |
|
1897 case KMsvSendStateFailed: |
|
1898 if ( currentEntry.iMtm == KUidMsgMMSNotification ) |
|
1899 { |
|
1900 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1901 } |
|
1902 //go through |
|
1903 case KMsvSendStateSuspended: |
|
1904 if ( currentEntry.iMtm == KUidMsgMMSNotification ) |
|
1905 { |
|
1906 deleteStart = ETrue; |
|
1907 } |
|
1908 //go through |
|
1909 case KMsvSendStateUponRequest: |
|
1910 deleteSuspend = ETrue; |
|
1911 break; |
|
1912 |
|
1913 case KMsvSendStateSending: |
|
1914 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1915 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1916 // go through |
|
1917 case KMsvSendStateSent: |
|
1918 deleteStart = ETrue; |
|
1919 break; |
|
1920 case KMsvSendStateUnknown: |
|
1921 case KMsvSendStateNotApplicable: |
|
1922 default: |
|
1923 deleteSuspend = ETrue; |
|
1924 deleteStart = ETrue; |
|
1925 break; |
|
1926 } |
|
1927 |
|
1928 if ( currentEntry.Connected() || |
|
1929 deleteStart ) |
|
1930 { |
|
1931 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
1932 if ( currentEntry.iMtm == KSenduiMtmSmsUid || |
|
1933 currentEntry.iMtm == KSenduiMtmMmsUid || |
|
1934 currentEntry.iMtm == KSenduiMtmIrUid|| |
|
1935 currentEntry.iMtm == KSenduiMtmBtUid|| |
|
1936 currentEntry.iMtm == KUidMsgMMSNotification ) |
|
1937 { |
|
1938 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1939 |
|
1940 //if message has no status, do not disable 'move to drafts' |
|
1941 if ( currentEntry.SendingState() != KMsvSendStateUnknown) |
|
1942 { |
|
1943 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
1944 } |
|
1945 |
|
1946 if ( ( currentEntry.SendingState() != KMsvSendStateSent ) && |
|
1947 ( ( currentEntry.iMtm == KSenduiMtmSmsUid ) || |
|
1948 ( currentEntry.iMtm == KSenduiMtmMmsUid ) ) ) |
|
1949 { |
|
1950 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
1951 } |
|
1952 } |
|
1953 } |
|
1954 if ( deleteSuspend ) |
|
1955 { |
|
1956 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
1957 } |
|
1958 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
1959 if ( iMsgListContainer->Count() > 1 ) |
|
1960 { |
|
1961 aMenuPane->SetItemDimmed( EMceCmdSort, iHideExitCommand ); |
|
1962 } |
|
1963 else |
|
1964 { |
|
1965 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1966 } |
|
1967 } // end outbox handling |
|
1968 |
|
1969 // Drafts and Outbox does not have move |
|
1970 if ( currentFolderId == KMsvDraftEntryId || |
|
1971 currentFolderId == KMsvGlobalOutBoxIndexEntryId || |
|
1972 aRemoteMailboxOpened ) |
|
1973 { |
|
1974 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1975 } |
|
1976 // Drafts does not have sort |
|
1977 if ( currentFolderId == KMsvDraftEntryId ) |
|
1978 { |
|
1979 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
1980 } |
|
1981 if ( !aRemoteMailboxOpened ) |
|
1982 { |
|
1983 if ( iMsgListContainer->FolderEntry().iServiceId == KMsvLocalServiceIndexEntryId ) |
|
1984 { |
|
1985 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
1986 } |
|
1987 else |
|
1988 { |
|
1989 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
1990 } |
|
1991 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
1992 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
1993 |
|
1994 // enable mark as read/unread in Inbox and Document folder |
|
1995 EnableMarkAllReadMsgInInboxAndDocument( currentEntry, currentFolderId, aMenuPane ); |
|
1996 } |
|
1997 if ( aRemoteMailboxOpened || aThirdPartEmail ) |
|
1998 { |
|
1999 if ( iMceUi->CheckCommandAvailableL( EMceCmdUndelete, currentEntry ) ) |
|
2000 { |
|
2001 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
2002 } |
|
2003 else |
|
2004 { |
|
2005 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
2006 } |
|
2007 if ( aRemoteMailboxOpened || aThirdPartEmail ) |
|
2008 { |
|
2009 if ( currentEntry.iType != KUidMsvFolderEntry && |
|
2010 !iMceUi->IsMailSetToBeDeletedFromServerL( currentEntry.Id() ) ) |
|
2011 { // MarkAsUnread and MarkAsRead is disabled when the message is set to be deleted from the server |
|
2012 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, !currentEntry.Unread() ); |
|
2013 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, currentEntry.Unread() ); |
|
2014 } |
|
2015 } |
|
2016 } |
|
2017 |
|
2018 if ( currentEntry.iType == KUidMsvFolderEntry ) |
|
2019 { |
|
2020 if ( MceUtils::IsEntryFixed( currentEntry.Id() ) ) |
|
2021 { |
|
2022 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
2023 } |
|
2024 } // end folder |
|
2025 iMceUi->SetMsgDeletedStatus(EFalse); |
|
2026 } // end if ( iSession->GetEntry == KErrNone ) |
|
2027 CleanupStack::PopAndDestroy( selection ); // selection |
|
2028 } |
|
2029 |
|
2030 // ---------------------------------------------------- |
|
2031 // CMceMessageListView::FolderMenuManyItemsL |
|
2032 // ---------------------------------------------------- |
|
2033 void CMceMessageListView::FolderMenuManyItemsL( |
|
2034 CEikMenuPane* aMenuPane, |
|
2035 TBool aRemoteMailboxOpened, |
|
2036 TBool aThirdPartEmail, |
|
2037 TBool aSetRead ) |
|
2038 { |
|
2039 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
2040 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
2041 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
2042 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
2043 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
2044 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
2045 DimReadUnreadOptionsMenu( aMenuPane ); |
|
2046 |
|
2047 if ( IsSyncMl() ) |
|
2048 { |
|
2049 if( SyncMlOutboxInbox ( KMsvGlobalInBoxIndexEntryId ) ) |
|
2050 { |
|
2051 SetReadUnreadOptionsMenu( aMenuPane, KIsEmail, aSetRead ); |
|
2052 } |
|
2053 |
|
2054 aMenuPane->SetItemDimmed( EMceCmdNewMessage, ETrue ); |
|
2055 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
2056 if ( iHideExitCommand ) |
|
2057 { |
|
2058 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadEmails, iHideExitCommand ); |
|
2059 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadEmails, iHideExitCommand ); |
|
2060 } |
|
2061 // SyncML Sent |
|
2062 if ( SyncMlOutboxInbox( KMsvSentEntryId ) || SyncMlOutboxInbox( KMsvDraftEntryId ) ) |
|
2063 { |
|
2064 aMenuPane->SetItemDimmed( EMceCmdNewMessage, ETrue ); |
|
2065 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
2066 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
2067 } |
|
2068 return; |
|
2069 } |
|
2070 |
|
2071 TMsvId serviceId; |
|
2072 CMsvEntrySelection* selection = iMsgListContainer->CurrentItemSelectionL(); |
|
2073 CleanupStack::PushL( selection ); |
|
2074 TMsvEntry currentEntry; |
|
2075 |
|
2076 TMsvId currentFolderId = iFolderId; |
|
2077 |
|
2078 if ( currentFolderId != KMsvGlobalOutBoxIndexEntryId ) |
|
2079 { |
|
2080 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
2081 } |
|
2082 |
|
2083 if ( currentFolderId == KMsvGlobalOutBoxIndexEntryId ) |
|
2084 { |
|
2085 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
2086 } |
|
2087 if ( currentFolderId == KMsvSentEntryId ) |
|
2088 { |
|
2089 TInt selectionCount = selection->Count(); |
|
2090 TBool mailMessage = EFalse; |
|
2091 TBool otherMessage = EFalse; |
|
2092 |
|
2093 aMenuPane->SetItemDimmed( EMceCmdSort, EFalse ); |
|
2094 |
|
2095 // Check type of message |
|
2096 for ( TInt loop = 0; loop < selectionCount; loop++ ) |
|
2097 { |
|
2098 if ( iSession->GetEntry( selection->At(loop), serviceId, currentEntry ) |
|
2099 == KErrNone || iMceUi->GetMsgDeletedStatus()) |
|
2100 { |
|
2101 if ( currentEntry.iMtm.iUid==KSenduiMtmImap4UidValue || |
|
2102 currentEntry.iMtm.iUid==KSenduiMtmPop3UidValue || |
|
2103 currentEntry.iMtm.iUid==KSenduiMtmSmtpUidValue ) |
|
2104 { |
|
2105 mailMessage = ETrue; |
|
2106 } |
|
2107 else |
|
2108 { |
|
2109 otherMessage = ETrue; |
|
2110 } |
|
2111 iMceUi->SetMsgDeletedStatus(EFalse); |
|
2112 } |
|
2113 } |
|
2114 if ( otherMessage && mailMessage ) |
|
2115 { |
|
2116 aMenuPane->SetItemDimmed( EMceCmdMove, EFalse ); |
|
2117 } |
|
2118 else if ( mailMessage && !otherMessage ) // Only mailmessages |
|
2119 { |
|
2120 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
2121 } |
|
2122 else // Only other messages |
|
2123 { |
|
2124 aMenuPane->SetItemDimmed( EMceCmdMove, EFalse ); |
|
2125 } |
|
2126 } |
|
2127 // Drafts does not have move and sort |
|
2128 if ( currentFolderId == KMsvDraftEntryId) |
|
2129 { |
|
2130 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
2131 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
2132 } |
|
2133 |
|
2134 if (aRemoteMailboxOpened ) |
|
2135 { |
|
2136 // Incase of mailbox, sort should be enabled for all defined folder inside (e.g. inbox. outbox, draft, sent etc) |
|
2137 aMenuPane->SetItemDimmed( EMceCmdSort, iHideExitCommand ); |
|
2138 } |
|
2139 |
|
2140 if ( !aRemoteMailboxOpened ) |
|
2141 { |
|
2142 if ( iMsgListContainer->FolderEntry().iServiceId == KMsvLocalServiceIndexEntryId ) |
|
2143 { |
|
2144 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
2145 } |
|
2146 else |
|
2147 { |
|
2148 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
2149 } |
|
2150 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
2151 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
2152 } |
|
2153 |
|
2154 if ( iMsgListContainer->CurrentItemType() != |
|
2155 CMceMessageListContainerBase::EMessageListItemSubtitle |
|
2156 || selection->Count()>0 ) |
|
2157 { |
|
2158 // Set Mark as Read/Unread Options menu |
|
2159 if ( ( currentFolderId == KMceDocumentsEntryId || |
|
2160 currentFolderId == KMsvGlobalInBoxIndexEntryId || |
|
2161 iMsgListContainer->FolderEntry().Parent() == KMceDocumentsEntryId ) ) |
|
2162 { |
|
2163 SetReadUnreadOptionsMenu( aMenuPane, !KIsEmail, aSetRead ); |
|
2164 } |
|
2165 else if( aRemoteMailboxOpened || aThirdPartEmail ) |
|
2166 { |
|
2167 SetReadUnreadOptionsMenu( aMenuPane, KIsEmail, aSetRead ); |
|
2168 } |
|
2169 } |
|
2170 |
|
2171 CleanupStack::PopAndDestroy( selection ); |
|
2172 } |
|
2173 |
|
2174 |
|
2175 // ---------------------------------------------------- |
|
2176 // CMceMessageListView::FolderMenuSyncMLMain |
|
2177 // ---------------------------------------------------- |
|
2178 void CMceMessageListView::FolderMenuSyncMLMain( CEikMenuPane *aMenuPane ) |
|
2179 { |
|
2180 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
2181 aMenuPane->SetItemDimmed( EMceCmdConnect, ETrue ); |
|
2182 aMenuPane->SetItemDimmed( EMceCmdCloseConnection, ETrue ); |
|
2183 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
2184 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
2185 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
2186 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
2187 aMenuPane->SetItemDimmed( EMceCmdDelete, ETrue ); |
|
2188 aMenuPane->SetItemDimmed( EMceCmdUndelete, ETrue ); |
|
2189 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, ETrue ); |
|
2190 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, ETrue ); |
|
2191 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
2192 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
2193 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
2194 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
2195 aMenuPane->SetItemDimmed( EMceCmdNewFolder, ETrue ); |
|
2196 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
2197 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
2198 aMenuPane->SetItemDimmed( EMceCmdEditList, ETrue ); |
|
2199 aMenuPane->SetItemDimmed( EMceCmdMailboxSettings, ETrue ); |
|
2200 // + MessageDetails |
|
2201 } |
|
2202 |
|
2203 // ---------------------------------------------------- |
|
2204 // CMceMessageListView::FolderMenuSyncMLFolderL |
|
2205 // ---------------------------------------------------- |
|
2206 void CMceMessageListView::FolderMenuSyncMLFolderL( CEikMenuPane *aMenuPane ) |
|
2207 { |
|
2208 CMsvEntrySelection* selection = iMsgListContainer->CurrentItemSelectionL(); |
|
2209 CleanupStack::PushL( selection ); |
|
2210 TMsvEntry currentEntry; |
|
2211 TMsvId serviceId; |
|
2212 |
|
2213 // All SyncML folders: Inbox, Sent items, Drafts, Outbox |
|
2214 aMenuPane->SetItemDimmed( EMceCmdAiwPlaceholder, ETrue ); |
|
2215 aMenuPane->SetItemDimmed( EMceCmdSendVia, ETrue ); |
|
2216 aMenuPane->SetItemDimmed( EMceCmdConnect, ETrue ); |
|
2217 aMenuPane->SetItemDimmed( EMceCmdCloseConnection, ETrue ); |
|
2218 aMenuPane->SetItemDimmed( EMceCommandMMSContentUpload, ETrue ); |
|
2219 aMenuPane->SetItemDimmed( EMceCmdOutboxSuspend, ETrue ); |
|
2220 aMenuPane->SetItemDimmed( EMceCmdMove, ETrue ); |
|
2221 aMenuPane->SetItemDimmed( EMceCmdOutboxStart, ETrue ); |
|
2222 aMenuPane->SetItemDimmed( EMceCmdNewFolder, ETrue ); |
|
2223 aMenuPane->SetItemDimmed( EMceCmdRenameFolder, ETrue ); |
|
2224 aMenuPane->SetItemDimmed( EMceCmdMailboxSettings, ETrue ); |
|
2225 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
2226 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
2227 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, ETrue ); |
|
2228 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, ETrue ); |
|
2229 |
|
2230 TInt numberOfEntries = iMsgListContainer->Count(); |
|
2231 |
|
2232 // All except SyncML Outbox |
|
2233 if ( SyncMlOutboxInbox( KMsvGlobalInBoxIndexEntryId ) ) |
|
2234 { |
|
2235 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
2236 if ( numberOfEntries > 0 && |
|
2237 iSession->GetEntry( selection->At(0), serviceId, currentEntry ) == KErrNone && |
|
2238 selection->Count() == 1 ) |
|
2239 { |
|
2240 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, !currentEntry.Unread() ); |
|
2241 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, currentEntry.Unread() ); |
|
2242 } |
|
2243 } |
|
2244 |
|
2245 // SyncML Drafts |
|
2246 if ( SyncMlOutboxInbox( KMsvDraftEntryId ) ) |
|
2247 { |
|
2248 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
2249 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
2250 } |
|
2251 |
|
2252 // SyncML Sent |
|
2253 if ( SyncMlOutboxInbox( KMsvSentEntryId ) ) |
|
2254 { |
|
2255 aMenuPane->SetItemDimmed( EMceCmdOutboxMoveToDrafts, ETrue ); |
|
2256 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
2257 } |
|
2258 |
|
2259 // SyncML Outbox |
|
2260 if ( SyncMlOutboxInbox( KMsvGlobalOutBoxIndexEntryIdValue ) ) |
|
2261 { |
|
2262 aMenuPane->SetItemDimmed( EMceCmdEditList, ETrue ); |
|
2263 aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); |
|
2264 aMenuPane->SetItemDimmed( EMceCmdFetch, ETrue ); |
|
2265 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, ETrue ); |
|
2266 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, ETrue ); |
|
2267 aMenuPane->SetItemDimmed( EMceCmdSort, ETrue ); |
|
2268 aMenuPane->SetItemDimmed( EMceCmdCopy, ETrue ); |
|
2269 aMenuPane->SetItemDimmed( EMceCmdReply, ETrue ); |
|
2270 aMenuPane->SetItemDimmed( EMceCmdNewMessage, iHideExitCommand ); |
|
2271 } |
|
2272 if ( numberOfEntries == 0 ) |
|
2273 { |
|
2274 aMenuPane->SetItemDimmed( EMceCmdNewMessage, EFalse ); |
|
2275 } |
|
2276 CleanupStack::PopAndDestroy( selection ); |
|
2277 } |
|
2278 |
|
2279 // ---------------------------------------------------- |
|
2280 // CMceMessageListView::EditMenuL |
|
2281 // ---------------------------------------------------- |
|
2282 void CMceMessageListView::EditMenuL( CEikMenuPane* aMenuPane ) const |
|
2283 { |
|
2284 // This function is not called if empty folder because in that case |
|
2285 // EditMenu is hidden |
|
2286 aMenuPane->SetItemDimmed( EAknCmdMarkReadMsgs, ETrue ); |
|
2287 |
|
2288 TInt count = iMsgListContainer->SelectionCount(); |
|
2289 |
|
2290 if ( count == 0 ) |
|
2291 { |
|
2292 //if no selection, disable unmarkall |
|
2293 aMenuPane->SetItemDimmed( EAknUnmarkAll, ETrue ); |
|
2294 TBool remoteMailboxOpened = ( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmImap4Uid || |
|
2295 iMsgListContainer->FolderEntry().iMtm == KSenduiMtmPop3Uid ); |
|
2296 if ( remoteMailboxOpened || // Mailbox |
|
2297 IsSyncMl() || //SyncMailbox |
|
2298 iMsgListContainer->FolderEntry().Id() == KMsvGlobalInBoxIndexEntryId || //Inbox |
|
2299 iMsgListContainer->FolderEntry().Id() == KMceDocumentsEntryId || //Document |
|
2300 iMsgListContainer->FolderEntry().Parent() == KMceDocumentsEntryId ) //Subfolder of Document |
|
2301 { |
|
2302 aMenuPane->SetItemDimmed( EAknCmdMarkReadMsgs, EFalse ); |
|
2303 } |
|
2304 } |
|
2305 |
|
2306 if ( ( count + SubfolderCount() ) == iMsgListContainer->Count() ) |
|
2307 { |
|
2308 //if all selected, disable markall |
|
2309 aMenuPane->SetItemDimmed( EAknMarkAll, ETrue ); |
|
2310 } |
|
2311 |
|
2312 if ( iMsgListContainer->IsItemFolder( iMsgListContainer->CurrentItemId() ) ) |
|
2313 { |
|
2314 aMenuPane->SetItemDimmed( EAknCmdMark, ETrue ); |
|
2315 aMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue ); |
|
2316 } |
|
2317 else |
|
2318 { |
|
2319 if (iMsgListContainer->IsItemSelected( iMsgListContainer->CurrentItemId() ) ) |
|
2320 { |
|
2321 aMenuPane->SetItemDimmed( EAknCmdMark, ETrue ); |
|
2322 } |
|
2323 else |
|
2324 { |
|
2325 aMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue ); |
|
2326 } |
|
2327 } // end else |
|
2328 |
|
2329 // Mark All and Unmark All are always visible |
|
2330 } |
|
2331 |
|
2332 // ---------------------------------------------------- |
|
2333 // CMceMessageListView::FolderOpenedL |
|
2334 // ---------------------------------------------------- |
|
2335 TBool CMceMessageListView::FolderOpenedL() |
|
2336 { |
|
2337 // return EFalse if cd.. returns to main view, ETrue if returns to Parent in folder view. |
|
2338 |
|
2339 TBool folderOpened = ETrue; |
|
2340 |
|
2341 const TMsvEntry& entry = iMsgListContainer->FolderEntry(); |
|
2342 const TMsvId entryId = entry.Id(); |
|
2343 |
|
2344 if ( entry.Parent() == KMsvRootIndexEntryId || |
|
2345 ( entry.iMtm == KSenduiMtmImap4Uid && !IsImapFolderOpenL( ) ) || |
|
2346 entryId == KMsvGlobalInBoxIndexEntryId || |
|
2347 entryId == KMsvGlobalOutBoxIndexEntryId || |
|
2348 entryId == KMsvDraftEntryId || |
|
2349 entryId == KMsvSentEntryId || |
|
2350 entryId == KMceDocumentsEntryId ) |
|
2351 { |
|
2352 folderOpened = EFalse; |
|
2353 } |
|
2354 |
|
2355 return folderOpened; |
|
2356 } |
|
2357 |
|
2358 // ---------------------------------------------------- |
|
2359 // CMceMessageListView::SubfolderCount |
|
2360 // ---------------------------------------------------- |
|
2361 TInt CMceMessageListView::SubfolderCount() const |
|
2362 { |
|
2363 return iMsgListContainer->FolderCount(); |
|
2364 } |
|
2365 |
|
2366 |
|
2367 // ---------------------------------------------------- |
|
2368 // CMceMessageListView::CancelMailboxTimer |
|
2369 // ---------------------------------------------------- |
|
2370 void CMceMessageListView::CancelMailboxTimer() const |
|
2371 { |
|
2372 iMceUi->CancelMailboxTimer(); |
|
2373 } |
|
2374 |
|
2375 // ---------------------------------------------------- |
|
2376 // CMceMessageListView::IsFolderNameUsedL |
|
2377 // ---------------------------------------------------- |
|
2378 TBool CMceMessageListView::IsFolderNameUsedL(const TDesC& aName, TMsvId aId /* = KErrNotFound */) const |
|
2379 // |
|
2380 // Return ETrue if a service of name 'aName' already exists. |
|
2381 // |
|
2382 { |
|
2383 CMsvEntry* entry = CMsvEntry::NewL( |
|
2384 *iSession, |
|
2385 iMsgListContainer->CurrentFolderId(), |
|
2386 TMsvSelectionOrdering( |
|
2387 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
2388 CleanupStack::PushL( entry ); |
|
2389 TBool ret = EFalse; |
|
2390 const TInt total = entry->Count(); |
|
2391 for(TInt cc = 0; cc < total; ++cc) |
|
2392 { |
|
2393 const TMsvEntry& tEntry = (*entry)[cc]; |
|
2394 if( tEntry.iType == KUidMsvFolderEntry && |
|
2395 tEntry.Id() != aId ) |
|
2396 { |
|
2397 // This entry is a service, so ensure the passed name isn't used |
|
2398 if(!aName.CompareF(tEntry.iDetails)) |
|
2399 { |
|
2400 ret = ETrue; |
|
2401 break; |
|
2402 } |
|
2403 } |
|
2404 } |
|
2405 CleanupStack::PopAndDestroy( entry ); |
|
2406 return ret; |
|
2407 } |
|
2408 |
|
2409 // ---------------------------------------------------- |
|
2410 // CMceMessageListView::FindUnreadMessageAndOpenItL |
|
2411 // ---------------------------------------------------- |
|
2412 TBool CMceMessageListView::FindUnreadMessageAndOpenItL( const TMsvId aId ) |
|
2413 { |
|
2414 // TODO: how to simplify this ? |
|
2415 TMsvId firstUnreadMessageId = KErrNotFound; |
|
2416 TBool oneUnreadMessage = EFalse; |
|
2417 if ( aId ) |
|
2418 { |
|
2419 // |
|
2420 oneUnreadMessage = ETrue; |
|
2421 firstUnreadMessageId = aId; |
|
2422 } |
|
2423 else |
|
2424 { |
|
2425 oneUnreadMessage = iMsgListContainer->FindFirstUnreadMessageL( firstUnreadMessageId ); |
|
2426 } |
|
2427 |
|
2428 if ( firstUnreadMessageId > KErrNotFound ) |
|
2429 { |
|
2430 iMsgListContainer->SetCurrentItemIdL( |
|
2431 firstUnreadMessageId ); |
|
2432 } |
|
2433 |
|
2434 if ( !iRunningEditFunction ) |
|
2435 { |
|
2436 iMceUi->CloseEditorApp(); |
|
2437 } |
|
2438 |
|
2439 TMsvEntry firstEntry; |
|
2440 TMsvId serviceId; |
|
2441 if ( oneUnreadMessage && firstUnreadMessageId > KErrNotFound && |
|
2442 iSession->GetEntry( firstUnreadMessageId, serviceId, firstEntry ) == KErrNone ) |
|
2443 { |
|
2444 TUid messageMtm = firstEntry.iMtm; |
|
2445 |
|
2446 if ( (messageMtm!=KSenduiMtmIrUidValue) && |
|
2447 (messageMtm!=KSenduiMtmBtUidValue) && |
|
2448 (messageMtm!=KSenduiMtmSmtpUidValue) && |
|
2449 (messageMtm!=KSenduiMtmImap4UidValue) && |
|
2450 (messageMtm!=KSenduiMtmPop3UidValue) |
|
2451 ) |
|
2452 { |
|
2453 |
|
2454 if ( !iMessageViewerLauncher ) |
|
2455 { |
|
2456 iMessageViewerLauncher = CPeriodic::NewL( CActive::EPriorityIdle ); |
|
2457 } |
|
2458 |
|
2459 if ( !(iMessageViewerLauncher->IsActive()) ) |
|
2460 { |
|
2461 delete iLocalScreenClearer; |
|
2462 iLocalScreenClearer = NULL; |
|
2463 iLocalScreenClearer = CAknLocalScreenClearer::NewL( EFalse ); |
|
2464 MCELOGGER_WRITE("FindUnreadMessageAndOpenItL: start viewer launcher"); |
|
2465 const TTimeIntervalMicroSeconds32 startTimeInterval = KMceLaunchViewerStartTime; |
|
2466 const TTimeIntervalMicroSeconds32 retryTimeInterval = KMceLaunchViewerRetryTime; |
|
2467 iLaunchViewerCounter = 0; |
|
2468 iMessageViewerLauncher->Start( |
|
2469 startTimeInterval, |
|
2470 retryTimeInterval, |
|
2471 TCallBack(LaunchViewer, this ) ); |
|
2472 } |
|
2473 } |
|
2474 return ETrue; |
|
2475 } |
|
2476 return EFalse; |
|
2477 } |
|
2478 |
|
2479 // ---------------------------------------------------- |
|
2480 // CMceMessageListView::FindInboxAndOpenItL |
|
2481 // ---------------------------------------------------- |
|
2482 void CMceMessageListView::FindInboxAndOpenItL() |
|
2483 { |
|
2484 //imapfolders |
|
2485 //first count subscribed folders. If only one ( inbox ) open it |
|
2486 //otherwise show folderlist. |
|
2487 TMsvId inboxId = KErrNotFound; |
|
2488 TMsvEntry child; |
|
2489 TInt cnt = 0; |
|
2490 CMsvEntry* entry = CMsvEntry::NewL( |
|
2491 *iSession, |
|
2492 iMsgListContainer->CurrentFolderId(), |
|
2493 TMsvSelectionOrdering( |
|
2494 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
2495 CleanupStack::PushL( entry ); |
|
2496 |
|
2497 const TInt count = entry->Count(); |
|
2498 |
|
2499 for ( TInt loop = 0; loop < count; loop++ ) |
|
2500 { |
|
2501 child = (*entry)[loop]; |
|
2502 if( child.iType == KUidMsvFolderEntry ) |
|
2503 { |
|
2504 cnt++; |
|
2505 inboxId = child.Id(); |
|
2506 } |
|
2507 } |
|
2508 |
|
2509 //if only one subscribed, it must be inbox, but check it also to be sure |
|
2510 if( cnt == KMceOnlyInboxInImap && child.iDetails.CompareF( iInboxName->Des() ) == 0 ) |
|
2511 { |
|
2512 SetFolderL( inboxId ); |
|
2513 } |
|
2514 CleanupStack::PopAndDestroy( entry ); |
|
2515 } |
|
2516 |
|
2517 // ---------------------------------------------------- |
|
2518 // CMceMessageListView::ChangeFolderAndRefreshListboxL |
|
2519 // ---------------------------------------------------- |
|
2520 void CMceMessageListView::ChangeFolderAndRefreshListboxL( TMsvId aNewFolderId ) |
|
2521 { |
|
2522 MCELOGGER_ENTERFN("CMceMessageListView::ChangeFolderAndRefreshListboxL"); |
|
2523 |
|
2524 TInt oldCount = iMsgListContainer->Count(); // how many items in current folder |
|
2525 TMsvId oldId = iMsgListContainer->FolderEntry().Id(); |
|
2526 TMsvEntry currentEntry; |
|
2527 TMsvId serviceId; // not used here but needed by GetEntry function |
|
2528 if ( iSession->GetEntry( aNewFolderId, serviceId, currentEntry ) |
|
2529 == KErrNone ) |
|
2530 { |
|
2531 iMsgListContainer->ClearSelection(); |
|
2532 SetFolderL( aNewFolderId ); |
|
2533 TUid mtm = iMsgListContainer->FolderEntry().iMtm; |
|
2534 if ( mtm == KSenduiMtmImap4Uid ) |
|
2535 { |
|
2536 FindInboxAndOpenItL(); |
|
2537 } |
|
2538 |
|
2539 // NCN reset, if the mail folder contains unread messages |
|
2540 if ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, mtm ) && |
|
2541 HasUnreadMessagesL() ) |
|
2542 { |
|
2543 |
|
2544 iMceUi->HandleNotif(iMsgListContainer->FolderEntry().iServiceId); |
|
2545 } |
|
2546 |
|
2547 if ( ( mtm == KSenduiMtmImap4Uid || |
|
2548 mtm == KSenduiMtmPop3Uid ) && !iConnectionNote ) |
|
2549 { |
|
2550 iMceUi->ActivateConnectionQueryTimerL( iFolderId ); |
|
2551 } |
|
2552 |
|
2553 SetEmptyTextL(); |
|
2554 |
|
2555 if ( IsImapFolderOpenL( ) ) |
|
2556 { |
|
2557 //show folder tabs |
|
2558 TInt depth = 1; |
|
2559 const TMsvEntry child = iMsgListContainer->FolderEntry(); |
|
2560 TMsvId id = child.Parent(); |
|
2561 TMsvId service = KMsvLocalServiceIndexEntryId; |
|
2562 TMsvEntry entry; |
|
2563 TInt err = iSession->GetEntry( id, service, entry ); |
|
2564 |
|
2565 while ( err == KErrNone && entry.iType == KUidMsvFolderEntry) |
|
2566 { |
|
2567 err = iSession->GetEntry( entry.Parent(), service, entry ); |
|
2568 depth++; |
|
2569 } |
|
2570 iMceUi->ShowFolderTabsL( depth ); |
|
2571 } |
|
2572 } |
|
2573 |
|
2574 const TMsvEntry entry = iMsgListContainer->FolderEntry(); |
|
2575 // Fetch pointer to the default title pane control |
|
2576 CAknTitlePane* title=iMceUi->TitlePaneL(); |
|
2577 TMsvEntry serviceEntry; |
|
2578 if ( ( entry.iMtm == KSenduiMtmImap4Uid || IsSyncMl() ) && |
|
2579 iSession->GetEntry( entry.iServiceId, serviceId, serviceEntry) |
|
2580 == KErrNone ) |
|
2581 { |
|
2582 title->SetTextL( serviceEntry.iDetails ); |
|
2583 } |
|
2584 else |
|
2585 { |
|
2586 title->SetTextL( entry.iDetails ); |
|
2587 } |
|
2588 |
|
2589 TInt sorting = EMceCmdSortByDate; |
|
2590 TBool ordering = EFalse; |
|
2591 TMsvId id = iFolderId; |
|
2592 for( TInt loop = 0; loop < iFolderItemArray->Count() ; loop++ ) |
|
2593 { |
|
2594 TMceFolderItem item = ((*iFolderItemArray)[loop]); |
|
2595 if ( item.iFolderId == id ) |
|
2596 { |
|
2597 sorting = item.iSortOrder; |
|
2598 ordering = item.iOrdering; |
|
2599 } |
|
2600 } |
|
2601 |
|
2602 // MSK |
|
2603 SetMSKButtonL(); |
|
2604 |
|
2605 iSortOrder = sorting; |
|
2606 iOrdering = ordering; |
|
2607 |
|
2608 // Unset flag so one row list container knows that first subtitle is to be opened |
|
2609 iMsgListContainer->SetContainerFlag( EMceOneRowFlagFirstSubtitleOpen, EFalse ); |
|
2610 |
|
2611 iMsgListContainer->SetSortTypeL( iSortOrder, iOrdering ); |
|
2612 |
|
2613 if ( !iMsgListContainer->SetCurrentItemIdL( oldId ) ) |
|
2614 { |
|
2615 iMsgListContainer->ResetCurrentItemL( ); |
|
2616 } |
|
2617 |
|
2618 iMsgListContainer->RefreshSelectionIndexesL( EFalse ); |
|
2619 iMsgListContainer->RefreshListbox(); |
|
2620 |
|
2621 MCELOGGER_LEAVEFN("CMceMessageListView::ChangeFolderAndRefreshListboxL"); |
|
2622 } |
|
2623 |
|
2624 // ---------------------------------------------------- |
|
2625 // CMceMessageListView::SetHideExitCommand |
|
2626 // ---------------------------------------------------- |
|
2627 void CMceMessageListView::SetHideExitCommand( TBool aHideExitCommand ) |
|
2628 { |
|
2629 iHideExitCommand = aHideExitCommand; |
|
2630 } |
|
2631 |
|
2632 // ---------------------------------------------------- |
|
2633 // CMceMessageListView::SetEmptyTextL |
|
2634 // now we need to set correct empty string because in remote mailbox it is |
|
2635 // different than in other folders |
|
2636 // ---------------------------------------------------- |
|
2637 void CMceMessageListView::SetEmptyTextL() const |
|
2638 { |
|
2639 TBool folderIsRemote = iMsgListContainer->IsItemRemote( iMsgListContainer->CurrentFolderId() ); |
|
2640 if ( folderIsRemote && !IsSyncMl() ) |
|
2641 { |
|
2642 iMsgListContainer->SetListEmptyTextL( *iRemoteMailboxEmptyText ); |
|
2643 } |
|
2644 else |
|
2645 { |
|
2646 iMsgListContainer->SetListEmptyTextL( *iEmptyText); |
|
2647 } |
|
2648 } |
|
2649 |
|
2650 // ---------------------------------------------------- |
|
2651 // CMceMessageListView::LaunchViewer |
|
2652 // ---------------------------------------------------- |
|
2653 TInt CMceMessageListView::LaunchViewer( TAny* aSelf ) |
|
2654 { |
|
2655 return REINTERPRET_CAST(CMceMessageListView*,aSelf)->LaunchMceViewer(); |
|
2656 } |
|
2657 |
|
2658 // ---------------------------------------------------- |
|
2659 // CMceMessageListView::LaunchMceViewer |
|
2660 // ---------------------------------------------------- |
|
2661 TInt CMceMessageListView::LaunchMceViewer() |
|
2662 { |
|
2663 if ( iMceUi->IsEditorOpen() ) |
|
2664 // something is embedded in mce, wait for that to be closed |
|
2665 { |
|
2666 if ( iRunningEditFunction ) |
|
2667 { |
|
2668 return KErrNone; |
|
2669 } |
|
2670 iMceUi->CloseEditorApp(); |
|
2671 if ( iLaunchViewerCounter++ < KMceLaunchViewerRetryCounter ) |
|
2672 { |
|
2673 MCELOGGER_WRITE_FORMAT("LaunchMceViewer: wait editor to close...iLaunchViewerCounter = %d", iLaunchViewerCounter); |
|
2674 return KErrNotReady; |
|
2675 } |
|
2676 else |
|
2677 { |
|
2678 MCELOGGER_WRITE("LaunchMceViewer: editor did not close quickly enough, give up waiting..."); |
|
2679 delete iLocalScreenClearer; |
|
2680 iLocalScreenClearer = NULL; |
|
2681 delete iMessageViewerLauncher; |
|
2682 iMessageViewerLauncher = NULL; |
|
2683 return KErrNone; |
|
2684 } |
|
2685 } |
|
2686 |
|
2687 if ( iMceUi->IsEditorOpen() ) |
|
2688 { |
|
2689 MCELOGGER_WRITE("LaunchMceViewer: do not open because already editing one"); |
|
2690 delete iLocalScreenClearer; |
|
2691 iLocalScreenClearer = NULL; |
|
2692 delete iMessageViewerLauncher; |
|
2693 iMessageViewerLauncher = NULL; |
|
2694 return KErrNone; |
|
2695 } |
|
2696 |
|
2697 TMsvId firstUnreadMessageId = KErrNotFound; |
|
2698 TBool oneUnreadMessage = EFalse; |
|
2699 TRAPD( error, oneUnreadMessage = iMsgListContainer->FindFirstUnreadMessageL( firstUnreadMessageId )); |
|
2700 if ( error ) |
|
2701 { |
|
2702 oneUnreadMessage = EFalse; |
|
2703 } |
|
2704 TMsvEntry firstEntry; |
|
2705 TMsvId serviceId; |
|
2706 |
|
2707 if ( oneUnreadMessage && firstUnreadMessageId > KErrNotFound && |
|
2708 iSession->GetEntry( firstUnreadMessageId, serviceId, firstEntry ) == KErrNone ) |
|
2709 { |
|
2710 TUid messageMtm = firstEntry.iMtm; |
|
2711 |
|
2712 if ( (messageMtm!=KSenduiMtmIrUidValue) && |
|
2713 (messageMtm!=KSenduiMtmBtUidValue) && |
|
2714 (messageMtm!=KSenduiMtmSmtpUidValue) && |
|
2715 (messageMtm!=KSenduiMtmImap4UidValue) && |
|
2716 (messageMtm!=KSenduiMtmPop3UidValue) |
|
2717 ) |
|
2718 { |
|
2719 MCELOGGER_WRITE("LaunchMceViewer: launch editor"); |
|
2720 iRunningEditFunction = ETrue; |
|
2721 TRAP_IGNORE( iMceUi->EditMTMEntryL( firstEntry ) ); |
|
2722 iRunningEditFunction = EFalse; |
|
2723 } |
|
2724 } |
|
2725 delete iLocalScreenClearer; |
|
2726 iLocalScreenClearer = NULL; |
|
2727 delete iMessageViewerLauncher; |
|
2728 iMessageViewerLauncher = NULL; |
|
2729 MCELOGGER_WRITE("LaunchMceViewer: done"); |
|
2730 return KErrNone; |
|
2731 } |
|
2732 |
|
2733 // ---------------------------------------------------- |
|
2734 // CMceMessageListView::HandleSendViaMenuItemL |
|
2735 // |
|
2736 // ---------------------------------------------------- |
|
2737 void CMceMessageListView::HandleSendViaMenuItemL( TMsvId aEntryId, CEikMenuPane* aMenuPane ) const |
|
2738 { |
|
2739 TBool dimSendVia = ETrue; |
|
2740 TFileName fileName; |
|
2741 RApaLsSession apaLs; |
|
2742 TBool isProgram = EFalse; |
|
2743 TUid appUid(KNullUid); |
|
2744 |
|
2745 MCELOGGER_WRITE_FORMAT("CMceMessageListView::HandleSendViaMenuItemL: aEntryId: 0x%x", aEntryId ); |
|
2746 TInt fileSize; |
|
2747 RFile fileHandle; |
|
2748 MceUtils::GetIrFilePathL( *iSession, aEntryId, fileName, fileHandle, fileSize ); |
|
2749 CleanupClosePushL( fileHandle ); |
|
2750 |
|
2751 TBuf<KMaxDataTypeLength> mimeType; |
|
2752 mimeType.Zero(); |
|
2753 if (apaLs.Connect() == KErrNone) |
|
2754 { |
|
2755 TDataType datatype; |
|
2756 apaLs.SetAcceptedConfidence( CApaDataRecognizerType::ECertain ); |
|
2757 apaLs.AppForDocument( fileName, appUid, datatype ); |
|
2758 apaLs.IsProgram( fileName, isProgram ); |
|
2759 mimeType = datatype.Des(); |
|
2760 apaLs.Close(); |
|
2761 } |
|
2762 |
|
2763 #ifdef _DEBUG |
|
2764 // make sure buffer does not get too long for logging. |
|
2765 TBuf<KMcePrintableTextLength> debugMimeType = mimeType.Left( KMcePrintableTextLength ); |
|
2766 MCELOGGER_WRITE_FORMAT("mime type: \"%s\"", debugMimeType.PtrZ()); |
|
2767 #endif |
|
2768 if (appUid.iUid == 0 || isProgram) |
|
2769 { |
|
2770 MCELOGGER_WRITE( "application not found" ); |
|
2771 dimSendVia = EFalse; |
|
2772 } |
|
2773 #ifdef _DEBUG |
|
2774 else |
|
2775 { |
|
2776 MCELOGGER_WRITE_FORMAT("application found: uid 0x%x", appUid.iUid ); |
|
2777 MCELOGGER_WRITE_FORMAT("is program: %d", isProgram ); |
|
2778 } |
|
2779 #endif |
|
2780 |
|
2781 CCommonContentPolicy* contentPolicy = CCommonContentPolicy::NewLC(); |
|
2782 TBool banned = ( contentPolicy->IsClosedFileL( fileHandle ) ); |
|
2783 if ( banned ) |
|
2784 { |
|
2785 dimSendVia = banned; |
|
2786 } |
|
2787 CleanupStack::PopAndDestroy(2); // contentPolicy, fileHandle |
|
2788 |
|
2789 MCELOGGER_WRITE_FORMAT("dim EMceCmdSendVia menu: %d", dimSendVia ); |
|
2790 aMenuPane->SetItemDimmed( EMceCmdSendVia, dimSendVia ); |
|
2791 } |
|
2792 |
|
2793 // ---------------------------------------------------- |
|
2794 // CMceMessageListView::MessageViewHandleEntriesCreatedOrChangedL |
|
2795 // |
|
2796 // ---------------------------------------------------- |
|
2797 void CMceMessageListView::MessageViewHandleEntriesCreatedOrChangedL( |
|
2798 TMsvId aParentId, |
|
2799 CMsvEntrySelection* aSelection ) |
|
2800 { |
|
2801 if ( !iMsgListContainer ) |
|
2802 { |
|
2803 return; |
|
2804 } |
|
2805 TMsvEntry entry = iMsgListContainer->FolderEntry(); |
|
2806 MCELOGGER_WRITE_FORMAT("parentId 0x%x", aParentId ); |
|
2807 MCELOGGER_WRITE_FORMAT("currentId 0x%x", entry.Id() ); |
|
2808 if ( aParentId != entry.Id() ) |
|
2809 { |
|
2810 MCELOGGER_WRITE("Not happening in our folder, just skip"); |
|
2811 return; |
|
2812 } |
|
2813 if ( entry.Parent() == KMsvRootIndexEntryId && |
|
2814 entry.iMtm == KSenduiMtmImap4Uid && |
|
2815 entry.iType == KUidMsvServiceEntry && |
|
2816 iMsgListContainer->Count() ) |
|
2817 { |
|
2818 FindInboxAndOpenItL(); |
|
2819 if ( iMsgListContainer ) |
|
2820 { |
|
2821 iMsgListContainer->SetFolderL( iMsgListContainer->FolderEntry().Id() ); |
|
2822 } |
|
2823 } |
|
2824 |
|
2825 if ( aSelection->Count() && iMsgListContainer ) |
|
2826 { |
|
2827 iMsgListContainer->RefreshSelectionIndexesL( EFalse ); |
|
2828 iMsgListContainer->RefreshListbox(); |
|
2829 } |
|
2830 |
|
2831 } |
|
2832 |
|
2833 // ---------------------------------------------------- |
|
2834 // CMceMessageListView::FindAndSelectEntryL |
|
2835 // Sets found item in message list |
|
2836 // ---------------------------------------------------- |
|
2837 void CMceMessageListView::FindAndSelectEntryL( const TDesC& aMatchString ) const |
|
2838 { |
|
2839 TMsvId foundEntry = iMsgListContainer->FindEntry( aMatchString ); |
|
2840 if ( foundEntry > KErrNotFound ) |
|
2841 { |
|
2842 iMsgListContainer->SetCurrentItemIdL( foundEntry ); |
|
2843 iMsgListContainer->RefreshListbox(); |
|
2844 } |
|
2845 } |
|
2846 |
|
2847 // ---------------------------------------------------- |
|
2848 // CMceMessageListView::HandleSortCommandL |
|
2849 // |
|
2850 // ---------------------------------------------------- |
|
2851 void CMceMessageListView::HandleSortCommandL( const TInt aCommand ) |
|
2852 { |
|
2853 // set sort order in folder array |
|
2854 TMsvId id = iFolderId; |
|
2855 TBool folderFound = EFalse; |
|
2856 |
|
2857 if ( aCommand == iSortOrder ) |
|
2858 { |
|
2859 // Toggle |
|
2860 iOrdering = !iOrdering; |
|
2861 } |
|
2862 else |
|
2863 { |
|
2864 iOrdering = EFalse; |
|
2865 } |
|
2866 |
|
2867 for( TInt loop = 0; loop < iFolderItemArray->Count() ; loop++ ) |
|
2868 { |
|
2869 TMceFolderItem item = ((*iFolderItemArray)[loop]); |
|
2870 if ( item.iFolderId == id/*service*/ ) |
|
2871 { |
|
2872 ((*iFolderItemArray)[loop]).iSortOrder = aCommand; |
|
2873 ((*iFolderItemArray)[loop]).iOrdering = iOrdering; |
|
2874 folderFound = ETrue; |
|
2875 } |
|
2876 } |
|
2877 // add folder item to folder array |
|
2878 if (!folderFound) |
|
2879 { |
|
2880 TMceFolderItem item; |
|
2881 item.iFolderId = id/*service*/; |
|
2882 item.iSortOrder = aCommand; |
|
2883 item.iOrdering = iOrdering; |
|
2884 |
|
2885 iFolderItemArray->AppendL( item ); |
|
2886 } |
|
2887 |
|
2888 // Switch the sort ordering if needed |
|
2889 iSortOrder = aCommand; |
|
2890 |
|
2891 // Update the selection in the listbox |
|
2892 TMsvId currentItemId = iMsgListContainer->CurrentItemId(); |
|
2893 |
|
2894 // If no focused item in one row list or focused item is folder |
|
2895 // first subtitle is opened |
|
2896 if ( currentItemId == KErrNotFound || |
|
2897 iMsgListContainer->IsItemFolder( currentItemId ) ) |
|
2898 { |
|
2899 iMsgListContainer->SetContainerFlag( |
|
2900 EMceOneRowFlagFirstSubtitleOpen, EFalse ); |
|
2901 } |
|
2902 |
|
2903 // Sort the items of the listbox |
|
2904 iMsgListContainer->SetSortTypeL( aCommand, iOrdering ); |
|
2905 iMsgListContainer->RefreshSelectionIndexesL( EFalse ); |
|
2906 |
|
2907 // Update the selection in the listbox |
|
2908 iMsgListContainer->SetCurrentItemIdL( currentItemId ); |
|
2909 |
|
2910 } |
|
2911 |
|
2912 // ---------------------------------------------------- |
|
2913 // CMceMessageListView::SyncMlOutboxInbox |
|
2914 // |
|
2915 // ---------------------------------------------------- |
|
2916 TBool CMceMessageListView::SyncMlOutboxInbox( TMsvId aFolder ) const |
|
2917 { |
|
2918 TBool syncMl = EFalse; |
|
2919 if ( IsSyncMl() ) |
|
2920 { |
|
2921 TMsvId id = iMsgListContainer->FolderEntry().Parent(); |
|
2922 TMsvEntry parentEntry; |
|
2923 TMsvId serviceId; |
|
2924 if ( iSession->GetEntry( id, serviceId, parentEntry ) == KErrNone ) |
|
2925 { |
|
2926 if ( aFolder == KMsvGlobalInBoxIndexEntryId ) |
|
2927 { |
|
2928 if ( ( iMsgListContainer->FolderEntry().Id() == parentEntry.iMtmData1 ) || |
|
2929 ( iMsgListContainer->FolderEntry().iRelatedId == KMsvGlobalInBoxIndexEntryId ) ) |
|
2930 { |
|
2931 syncMl = ETrue; |
|
2932 } |
|
2933 } |
|
2934 else if ( aFolder == KMsvGlobalOutBoxIndexEntryId ) |
|
2935 { |
|
2936 if ( ( iMsgListContainer->FolderEntry().Id() == parentEntry.iMtmData2 ) || |
|
2937 ( iMsgListContainer->FolderEntry().iRelatedId == KMsvGlobalOutBoxIndexEntryId ) ) |
|
2938 { |
|
2939 syncMl = ETrue; |
|
2940 } |
|
2941 } |
|
2942 else if ( aFolder == KMsvDraftEntryId ) |
|
2943 { |
|
2944 if ( ( iMsgListContainer->FolderEntry().Id() == parentEntry.iMtmData1 ) || |
|
2945 ( iMsgListContainer->FolderEntry().iRelatedId == KMsvDraftEntryId ) ) |
|
2946 { |
|
2947 syncMl = ETrue; |
|
2948 } |
|
2949 } |
|
2950 else if ( aFolder == KMsvSentEntryId ) |
|
2951 { |
|
2952 if ( ( iMsgListContainer->FolderEntry().Id() == parentEntry.iMtmData1 ) || |
|
2953 ( iMsgListContainer->FolderEntry().iRelatedId == KMsvSentEntryId ) ) |
|
2954 { |
|
2955 syncMl = ETrue; |
|
2956 } |
|
2957 } |
|
2958 } |
|
2959 } |
|
2960 |
|
2961 return syncMl; |
|
2962 } |
|
2963 |
|
2964 // ---------------------------------------------------- |
|
2965 // CMceMessageListView::IsSyncMl |
|
2966 // |
|
2967 // Checks if the folder is a SyncML folder |
|
2968 // ---------------------------------------------------- |
|
2969 TBool CMceMessageListView::IsSyncMl() const |
|
2970 { |
|
2971 return ( iMceUi->IsPresent( KSenduiMtmSyncMLEmailUid ) && |
|
2972 ( iMsgListContainer->FolderEntry().iMtm == KSenduiMtmSyncMLEmailUid ) ); |
|
2973 } |
|
2974 |
|
2975 // ---------------------------------------------------- |
|
2976 // CMceMessageListView::SyncMlFindInboxAndOpenItL |
|
2977 // ---------------------------------------------------- |
|
2978 void CMceMessageListView::SyncMlFindInboxAndOpenItL() |
|
2979 { |
|
2980 TMsvId inboxId = KErrNotFound; |
|
2981 TMsvEntry child; |
|
2982 CMsvEntry* entry = CMsvEntry::NewL( |
|
2983 *iSession, |
|
2984 iMsgListContainer->CurrentFolderId(), |
|
2985 TMsvSelectionOrdering( |
|
2986 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
2987 CleanupStack::PushL( entry ); |
|
2988 const TInt count = entry->Count(); |
|
2989 for (TInt loop = 0; loop < count && inboxId == KErrNotFound; loop++) |
|
2990 { |
|
2991 child = (*entry)[loop]; |
|
2992 if ( child.iType == KUidMsvFolderEntry && |
|
2993 child.iRelatedId == KMsvGlobalInBoxIndexEntryId ) |
|
2994 { |
|
2995 inboxId = child.Id(); |
|
2996 } |
|
2997 } |
|
2998 |
|
2999 if ( inboxId != KErrNotFound ) |
|
3000 { |
|
3001 SetFolderL( inboxId ); |
|
3002 } |
|
3003 CleanupStack::PopAndDestroy( entry ); |
|
3004 } |
|
3005 // ---------------------------------------------------- |
|
3006 // CMceMessageListView::IsImapFolderOpenL |
|
3007 // ---------------------------------------------------- |
|
3008 TBool CMceMessageListView::IsImapFolderOpenL( ) const |
|
3009 { |
|
3010 //imapfolders |
|
3011 //we can't have imap folder if mtm isn't imap |
|
3012 if( iMsgListContainer->FolderEntry().iMtm != KSenduiMtmImap4Uid ) |
|
3013 { |
|
3014 return EFalse; |
|
3015 } |
|
3016 |
|
3017 TMsvEntry child; |
|
3018 TInt cnt = 0; |
|
3019 |
|
3020 CMsvEntry *parent = iSession->GetEntryL( iMsgListContainer->FolderEntry().Parent() ); |
|
3021 CleanupStack::PushL( parent ); |
|
3022 if( parent->Entry().iType != KUidMsvFolderEntry ) |
|
3023 { |
|
3024 const TInt count = parent->Count(); |
|
3025 |
|
3026 for ( TInt loop = 0; loop < count; loop++ ) |
|
3027 { |
|
3028 child = (*parent)[loop]; |
|
3029 if( child.iType == KUidMsvFolderEntry ) |
|
3030 { |
|
3031 cnt++; |
|
3032 //entry = child; |
|
3033 } |
|
3034 } |
|
3035 } |
|
3036 |
|
3037 CleanupStack::PopAndDestroy( parent ); |
|
3038 |
|
3039 //if type is folder, then we must have a folder open. |
|
3040 if( iMsgListContainer->FolderEntry().iType == KUidMsvFolderEntry && cnt != KMceOnlyInboxInImap ) |
|
3041 { |
|
3042 return ETrue; |
|
3043 } |
|
3044 |
|
3045 return EFalse; |
|
3046 } |
|
3047 |
|
3048 // ---------------------------------------------------- |
|
3049 // CMceMessageListView::CheckMMSNotificationOpenL |
|
3050 // ---------------------------------------------------- |
|
3051 TBool CMceMessageListView::CheckMMSNotificationOpenL( ) const |
|
3052 { |
|
3053 TBool skip = EFalse; |
|
3054 TMsvId currentFolderId = iFolderId; |
|
3055 const TInt count = iMsgListContainer->CurrentItemSelectionCount(); |
|
3056 TMsvId currentId = KErrNotFound; |
|
3057 if ( count == 1 ) |
|
3058 { |
|
3059 // one selected |
|
3060 currentId = iMsgListContainer->CurrentItemId(); |
|
3061 } |
|
3062 |
|
3063 if ( ( currentId != KErrNotFound ) |
|
3064 && ( currentFolderId == KMsvGlobalInBoxIndexEntryId ) ) |
|
3065 { |
|
3066 TMsvEntry currentEntry; |
|
3067 TMsvId serviceId; |
|
3068 |
|
3069 if ( iSession->GetEntry( currentId, serviceId, currentEntry ) |
|
3070 == KErrNone ) |
|
3071 { |
|
3072 if ( ( currentEntry.iType == KUidMsvMessageEntry ) && |
|
3073 ( currentEntry.iMtm == KUidMsgMMSNotification ) ) |
|
3074 { |
|
3075 CBaseMtmUiData* uiData = iMceUi->GetMtmUiDataL( KUidMsgMMSNotification ); |
|
3076 skip = uiData->OperationSupportedL( KMtmUiFunctionOpenMessage, currentEntry ); |
|
3077 } |
|
3078 } |
|
3079 } |
|
3080 return skip; |
|
3081 } |
|
3082 |
|
3083 // ---------------------------------------------------- |
|
3084 // CMceMessageListView::OpenMailboxSettingsL() |
|
3085 // |
|
3086 // ---------------------------------------------------- |
|
3087 void CMceMessageListView::OpenMailboxSettingsL() |
|
3088 { |
|
3089 TInt currentIndex = 0; |
|
3090 TMsvId currentId = 0; |
|
3091 TInt currentCount = iMsgListContainer->Count(); |
|
3092 if ( currentCount > 0 ) |
|
3093 { |
|
3094 currentId = iMsgListContainer->CurrentItemId(); |
|
3095 } |
|
3096 |
|
3097 const TMsvEntry& entry = iMsgListContainer->FolderEntry(); |
|
3098 |
|
3099 CAknTitlePane* title = iMceUi->TitlePaneL(); |
|
3100 TMsvEntry tEntry; |
|
3101 TMsvId serviceId; |
|
3102 User::LeaveIfError( iSession->GetEntry( entry.iServiceId, serviceId, tEntry ) ); |
|
3103 |
|
3104 |
|
3105 iMceUi->EditAccountL( tEntry.iRelatedId ); |
|
3106 User::LeaveIfError( iSession->GetEntry( serviceId, serviceId, tEntry ) ); |
|
3107 |
|
3108 //set title even if inbox was opened directly |
|
3109 if ( iMsgListContainer->FolderEntry().Id() == tEntry.Id() || |
|
3110 iMsgListContainer->FolderEntry().Parent() == tEntry.Id() ) |
|
3111 { |
|
3112 title->SetTextL( tEntry.iDetails ); |
|
3113 } |
|
3114 |
|
3115 if ( iMsgListContainer->FolderEntry().Id() == tEntry.Id() ) |
|
3116 { |
|
3117 TInt newCount = iMsgListContainer->Count(); |
|
3118 |
|
3119 if ( newCount > 0 ) |
|
3120 { |
|
3121 if ( currentIndex >= newCount ) |
|
3122 { |
|
3123 currentIndex = newCount - 1; |
|
3124 } |
|
3125 else |
|
3126 { |
|
3127 iMsgListContainer->SetCurrentItemIdL( currentId ); |
|
3128 } |
|
3129 } |
|
3130 } |
|
3131 } |
|
3132 |
|
3133 // ---------------------------------------------------- |
|
3134 // CMceMessageListView::HandleStatusPaneSizeChange() |
|
3135 // |
|
3136 // ---------------------------------------------------- |
|
3137 void CMceMessageListView::HandleStatusPaneSizeChange() |
|
3138 { |
|
3139 if ( iMsgListContainer ) |
|
3140 { |
|
3141 iMsgListContainer->SetRect( ClientRect() ); |
|
3142 } |
|
3143 CAknView::HandleStatusPaneSizeChange(); |
|
3144 } |
|
3145 |
|
3146 //// ---------------------------------------------------- |
|
3147 // CMceMessageListView::LaunchViewerWhenOneUnreadL( TInt &aMsgMtmUid ) |
|
3148 // |
|
3149 // ---------------------------------------------------- |
|
3150 TInt CMceMessageListView::LaunchViewerWhenOneUnreadL( TInt &aMsgMtmUid ) |
|
3151 { |
|
3152 if ( iRunningEditFunction || iMsgListContainer || iMceUi->MailboxCreationOn() || iMceUi->IsEditorOpen() ) |
|
3153 { |
|
3154 return KErrNotFound; |
|
3155 } |
|
3156 |
|
3157 // TODO: change this so that FindFirstUnreadMessageL is not called so many times! |
|
3158 // TODO: this is performance optimisation: we should launch viewer before creating container!! |
|
3159 // so container is not created yet, need to calculate unread message count some other way... |
|
3160 |
|
3161 TInt unreadMessageMtmUid = KErrNotFound; |
|
3162 TInt numberOfUnreadMessages = 0; |
|
3163 TInt firstUnreadMessage = KErrNotFound; |
|
3164 |
|
3165 CMsvEntry* entry = CMsvEntry::NewL( |
|
3166 *iSession, |
|
3167 iFolderId, |
|
3168 TMsvSelectionOrdering( |
|
3169 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
3170 CleanupStack::PushL( entry ); |
|
3171 |
|
3172 const TInt itemCount = entry->Count(); |
|
3173 for ( TInt loop = 0; loop < itemCount; loop++ ) |
|
3174 { |
|
3175 if ( (*entry)[loop].iType == KUidMsvMessageEntry && |
|
3176 (*entry)[loop].Unread() ) |
|
3177 { |
|
3178 if ( firstUnreadMessage == KErrNotFound ) |
|
3179 { |
|
3180 firstUnreadMessage = loop; |
|
3181 unreadMessageMtmUid = (*entry)[firstUnreadMessage].iMtm.iUid; |
|
3182 } |
|
3183 numberOfUnreadMessages++; |
|
3184 if ( numberOfUnreadMessages > 1 ) |
|
3185 { |
|
3186 // we are only interested of first unread message and info that if |
|
3187 // there are more than one unread messages. |
|
3188 // So we can stop if there are more than one. |
|
3189 break; |
|
3190 } |
|
3191 } |
|
3192 } |
|
3193 |
|
3194 if ( (numberOfUnreadMessages==1) && (firstUnreadMessage!=KErrNotFound) && |
|
3195 (unreadMessageMtmUid!=KSenduiMtmIrUidValue) && |
|
3196 (unreadMessageMtmUid!=KSenduiMtmBtUidValue) && |
|
3197 (unreadMessageMtmUid!=KSenduiMtmSmtpUidValue) && |
|
3198 (unreadMessageMtmUid!=KSenduiMtmImap4UidValue) && |
|
3199 (unreadMessageMtmUid!=KSenduiMtmPop3UidValue) |
|
3200 ) |
|
3201 { |
|
3202 MCELOGGER_WRITE("LaunchMceViewer: launch editor"); |
|
3203 iRunningEditFunction = ETrue; |
|
3204 iMceUi->EditMTMEntryL( (*entry)[firstUnreadMessage] ); |
|
3205 iRunningEditFunction = EFalse; |
|
3206 } |
|
3207 aMsgMtmUid = unreadMessageMtmUid ; |
|
3208 CleanupStack::PopAndDestroy( entry ); |
|
3209 return ( numberOfUnreadMessages==1 ? firstUnreadMessage : KErrNotFound ); |
|
3210 } |
|
3211 |
|
3212 // ---------------------------------------------------- |
|
3213 // CMceMessageListView::SetMskObserver |
|
3214 // |
|
3215 // ---------------------------------------------------- |
|
3216 void CMceMessageListView::SetMskObserver( TBool aObserver ) |
|
3217 { |
|
3218 CEikButtonGroupContainer* bgc = Cba(); |
|
3219 if ( bgc ) |
|
3220 { |
|
3221 CEikCba* cba = static_cast< CEikCba* >( bgc->ButtonGroup() ); |
|
3222 if ( aObserver ) |
|
3223 { |
|
3224 cba->SetMSKCommandObserver( iMsgListContainer ); |
|
3225 } |
|
3226 else |
|
3227 { |
|
3228 cba->SetMSKCommandObserver( NULL ); |
|
3229 } |
|
3230 } |
|
3231 } |
|
3232 |
|
3233 // ---------------------------------------------------- |
|
3234 // CMceMessageListView::GetDeleteFlagStatusL |
|
3235 // |
|
3236 // ---------------------------------------------------- |
|
3237 TInt CMceMessageListView::GetDeleteFlagStatusL( const CMsvEntrySelection* aEntries ) |
|
3238 { |
|
3239 TBool allDelete = ETrue; |
|
3240 TBool allUnDelete = ETrue; |
|
3241 |
|
3242 TMsvEntry entry; |
|
3243 TMsvId serviceId; |
|
3244 TMsvId id = (*aEntries)[0]; |
|
3245 TInt rid = 0; |
|
3246 if ( iSession->GetEntry( id, serviceId, entry ) != KErrNone ) |
|
3247 { |
|
3248 return KErrNotSupported; |
|
3249 } |
|
3250 if ( entry.iServiceId != KMsvLocalServiceIndexEntryId ) |
|
3251 { |
|
3252 CBaseMtmUiData* uiData = iMceUi->GetMtmUiDataL( entry.iMtm ); |
|
3253 if ( uiData ) |
|
3254 { |
|
3255 const TInt count = aEntries->Count(); |
|
3256 for ( TInt loop = 0; loop < count; loop++ ) |
|
3257 { |
|
3258 id = (*aEntries)[loop]; |
|
3259 if ( iSession->GetEntry( id, serviceId, entry ) == KErrNone ) |
|
3260 { |
|
3261 if ( uiData->CanDeleteFromEntryL(entry, rid) ) |
|
3262 { |
|
3263 allUnDelete = EFalse; |
|
3264 } |
|
3265 else if ( uiData->CanUnDeleteFromEntryL(entry, rid) ) |
|
3266 { |
|
3267 allDelete = EFalse; |
|
3268 } |
|
3269 } |
|
3270 } |
|
3271 } |
|
3272 } |
|
3273 |
|
3274 if ( allDelete && !allUnDelete ) |
|
3275 { |
|
3276 // all delete |
|
3277 return MessageFolderAllDelete; |
|
3278 } |
|
3279 else if ( !allDelete && allUnDelete ) |
|
3280 { |
|
3281 // all undelete |
|
3282 return MessageFolderAllUnDelete; |
|
3283 } |
|
3284 else if ( !allDelete && !allUnDelete ) |
|
3285 { |
|
3286 // both delete and undelete |
|
3287 return MessageFolderDeleteUnDelete; |
|
3288 } |
|
3289 else |
|
3290 { |
|
3291 // never |
|
3292 return MessageFolderDeleteUnDelete; |
|
3293 } |
|
3294 } |
|
3295 |
|
3296 // ---------------------------------------------------- |
|
3297 // CMceMessageListView::FindAllReadMsgAndMarkL() |
|
3298 // Private |
|
3299 // ---------------------------------------------------- |
|
3300 void CMceMessageListView::FindAllReadMsgAndMarkL() |
|
3301 { |
|
3302 if ( iMsgListContainer ) |
|
3303 { |
|
3304 iMsgListContainer->MarkAllReadMessagesL(); |
|
3305 } |
|
3306 } |
|
3307 |
|
3308 // ---------------------------------------------------- |
|
3309 // CMceMessageListView::IsItemUnread( TMsvId aId ) |
|
3310 // Public |
|
3311 // ---------------------------------------------------- |
|
3312 TBool CMceMessageListView::IsItemUnread(TMsvId aId) |
|
3313 { |
|
3314 TMsvEntry aEntry; |
|
3315 TMsvId serviceId; |
|
3316 if ( iSession->GetEntry( aId, serviceId, aEntry ) == KErrNone ) |
|
3317 { |
|
3318 if ( aEntry.Unread() ) |
|
3319 { |
|
3320 return ETrue; |
|
3321 } |
|
3322 } |
|
3323 return EFalse; |
|
3324 } |
|
3325 // ---------------------------------------------------- |
|
3326 // CMceMessageListView::AnySelectedItemsVisible( CArrayFixFlat<TInt>* msgIndexArray ) |
|
3327 // private |
|
3328 // ---------------------------------------------------- |
|
3329 TBool CMceMessageListView::AnySelectedItemsVisible ( CArrayFixFlat<TInt>* /*msgIndexArray */) |
|
3330 { |
|
3331 return EFalse; |
|
3332 } |
|
3333 |
|
3334 // ---------------------------------------------------- |
|
3335 // CMceMessageListView::EnableMarkAllReadMsgInInboxAndDocument( TMsvEntry currentEntry, |
|
3336 // TMsvId currentFolderId, |
|
3337 // CEikMenuPane* aMenuPane ) |
|
3338 // private |
|
3339 // ---------------------------------------------------- |
|
3340 void CMceMessageListView::EnableMarkAllReadMsgInInboxAndDocument( |
|
3341 TMsvEntry currentEntry, |
|
3342 TMsvId currentFolderId, |
|
3343 CEikMenuPane* aMenuPane ) |
|
3344 { |
|
3345 if ( currentFolderId == KMsvGlobalInBoxIndexEntryId || |
|
3346 currentFolderId == KMceDocumentsEntryId || |
|
3347 iMsgListContainer->FolderEntry().Parent() == KMceDocumentsEntryId ) // subfolder of Document |
|
3348 { |
|
3349 if ( iMsgListContainer->IsItemFolder( currentEntry.Id() ) ) |
|
3350 { |
|
3351 // folder item does not have mark as read/unread |
|
3352 } |
|
3353 else |
|
3354 { |
|
3355 aMenuPane->SetItemDimmed( |
|
3356 EMceCmdMarkAsReadMsg, !currentEntry.Unread() ); |
|
3357 aMenuPane->SetItemDimmed( |
|
3358 EMceCmdMarkAsUnreadMsg, currentEntry.Unread() ); |
|
3359 } |
|
3360 } |
|
3361 } |
|
3362 |
|
3363 // ---------------------------------------------------- |
|
3364 // void CMceMessageListView::HandleSendkeyInMailboxL( TMsvId aEntryId ) |
|
3365 // public |
|
3366 // ---------------------------------------------------- |
|
3367 void CMceMessageListView::HandleSendkeyInMailboxL( TMsvId aEntryId ) |
|
3368 { |
|
3369 TPtrC addressString; // mail address string |
|
3370 TBool tempDoMoreCleanup = EFalse; |
|
3371 |
|
3372 CMsvEntry* entry = iSession->GetEntryL( aEntryId ); |
|
3373 CleanupStack::PushL( entry ); //<<<---------------------------entry |
|
3374 |
|
3375 if ( entry->Entry().iType != KUidMsvMessageEntry ) |
|
3376 { |
|
3377 // do not try to call if entry is not message |
|
3378 CleanupStack::PopAndDestroy( entry ); |
|
3379 return; |
|
3380 } |
|
3381 if ( entry->HasStoreL() ) // only mails that have been retrivaled have stores |
|
3382 { |
|
3383 tempDoMoreCleanup = ETrue; |
|
3384 CMsvStore* store = entry->ReadStoreL(); |
|
3385 if ( store == NULL) // just in case no crash if something wrong with store |
|
3386 { |
|
3387 CleanupStack::PopAndDestroy( entry ); //entry, store, |
|
3388 return; |
|
3389 } |
|
3390 CleanupStack::PushL( store ); //<<<--------------------------- store |
|
3391 CImHeader* iHeader = CImHeader::NewLC(); //<<<-----------------iHeader into stack |
|
3392 iHeader->RestoreL( *store ); |
|
3393 TImMessageField email; |
|
3394 addressString.Set( email.GetValidInternetEmailAddressFromString( iHeader->From() ) ); |
|
3395 } |
|
3396 |
|
3397 else // Only mails that are not retrivaled should use iDetails instead. |
|
3398 { |
|
3399 TImMessageField email; |
|
3400 addressString.Set( email.GetValidInternetEmailAddressFromString( entry->Entry().iDetails ) ); |
|
3401 } |
|
3402 |
|
3403 CMuiuContactService* contactService = CMuiuContactService::NewL( *iEikonEnv ); |
|
3404 CleanupStack::PushL( contactService ); //<<<--------------- contactService |
|
3405 contactService->SetAddress( addressString ); |
|
3406 // This LINE is commented for the new send key behaviour in mailboxes |
|
3407 // there shall be no VOIP calls but only dialer shall be opened |
|
3408 // contactService->CallL(); |
|
3409 |
|
3410 if ( tempDoMoreCleanup ) |
|
3411 { |
|
3412 CleanupStack::PopAndDestroy( 4, entry ); //iHeader store contactService entry |
|
3413 } |
|
3414 else |
|
3415 { |
|
3416 CleanupStack::PopAndDestroy( 2, entry ); // contactService entry |
|
3417 } |
|
3418 } |
|
3419 |
|
3420 |
|
3421 // ---------------------------------------------------- |
|
3422 // CMceMessageListView::HandleClientRectChange |
|
3423 // ---------------------------------------------------- |
|
3424 void CMceMessageListView::HandleClientRectChange() |
|
3425 { |
|
3426 if (iMsgListContainer) |
|
3427 { |
|
3428 iMsgListContainer->SetRect(ClientRect()); |
|
3429 } |
|
3430 } |
|
3431 |
|
3432 // ---------------------------------------------------- |
|
3433 // CMceMessageListView::HandleEntriesCreatedChangedL |
|
3434 // ---------------------------------------------------- |
|
3435 void CMceMessageListView::HandleEntriesCreatedChangedL( const CMsvEntrySelection* aSelection ) |
|
3436 { |
|
3437 iMsgListContainer->ItemCountChangedL( ETrue ); |
|
3438 |
|
3439 if ( IsMSKMailBox() ) // focus setting only for email |
|
3440 { |
|
3441 iMsgListContainer->SetCurrentItemIdL( iCurrentItemId ); |
|
3442 |
|
3443 } |
|
3444 else |
|
3445 { |
|
3446 TMsvEntry currentEntry; |
|
3447 TMsvId serviceId; // not used here but needed by GetEntry function |
|
3448 if ( iSession->GetEntry( aSelection->At(0), serviceId, currentEntry ) == KErrNone && |
|
3449 serviceId == KMsvLocalServiceIndexEntryId ) |
|
3450 { |
|
3451 iMsgListContainer->SetCurrentItemIdL( aSelection->At(0) ); |
|
3452 } |
|
3453 } |
|
3454 |
|
3455 if ( iMceViewActivated ) |
|
3456 { |
|
3457 iMsgListContainer->RefreshListbox(); |
|
3458 } |
|
3459 } |
|
3460 |
|
3461 // ---------------------------------------------------- |
|
3462 // CMceMessageListView::HandleEntriesDeletedL |
|
3463 // ---------------------------------------------------- |
|
3464 void CMceMessageListView::HandleEntriesDeletedL( ) |
|
3465 { |
|
3466 TInt currentItem = KErrNotFound; |
|
3467 TMsvId currentSelectedItemId = 0; |
|
3468 if ( IsMSKMailBox() ) // focus setting only for email |
|
3469 { |
|
3470 if ( iMceUi->IsMailSetToBeDeletedFromServerL( iCurrentItemId ) ) |
|
3471 { |
|
3472 currentSelectedItemId = iMceUi->AnchoredItem(); |
|
3473 } |
|
3474 else |
|
3475 { |
|
3476 currentSelectedItemId = iCurrentItemId; |
|
3477 } |
|
3478 } |
|
3479 else |
|
3480 { |
|
3481 currentSelectedItemId = iMceUi->AnchoredItem(); |
|
3482 } |
|
3483 |
|
3484 iMsgListContainer->ItemCountChangedL( EFalse ); |
|
3485 if ( currentItem != KErrNotFound ) |
|
3486 { |
|
3487 iMsgListContainer->RefreshSelectionIndexesL( ETrue ); |
|
3488 } |
|
3489 iMsgListContainer->SetCurrentItemIdL( currentSelectedItemId ); |
|
3490 SetCurrentItemId(); |
|
3491 if ( iMceViewActivated ) |
|
3492 { |
|
3493 iMsgListContainer->RefreshListbox(); |
|
3494 SetMSKButtonL(); |
|
3495 } |
|
3496 } |
|
3497 |
|
3498 // ---------------------------------------------------- |
|
3499 // CMceMessageListView::HandleEntriesMovedL |
|
3500 // ---------------------------------------------------- |
|
3501 void CMceMessageListView::HandleEntriesMovedL( TMsvId aSourceFolderId, TMsvId aTargetFolderId ) |
|
3502 { |
|
3503 if ( iFolderId == aTargetFolderId ) |
|
3504 { |
|
3505 iMsgListContainer->ItemCountChangedL( ETrue ); |
|
3506 iMsgListContainer->RefreshSelectionIndexesL( EFalse ); |
|
3507 iMsgListContainer->SetCurrentItemIdL( iMceUi->AnchoredItem() ); |
|
3508 if ( iMceViewActivated ) |
|
3509 { |
|
3510 iMsgListContainer->RefreshListbox(); |
|
3511 } |
|
3512 } |
|
3513 else if ( iFolderId == aSourceFolderId ) |
|
3514 { |
|
3515 iMsgListContainer->ItemCountChangedL( EFalse ); |
|
3516 iMsgListContainer->SetCurrentItemIdL( iMceUi->AnchoredItem() ); |
|
3517 iMsgListContainer->RefreshSelectionIndexesL( EFalse ); |
|
3518 if ( iMceViewActivated ) |
|
3519 { |
|
3520 iMsgListContainer->RefreshListbox(); |
|
3521 } |
|
3522 } |
|
3523 } |
|
3524 |
|
3525 // ---------------------------------------------------- |
|
3526 // CMceMessageListView::SetFolderL |
|
3527 // ---------------------------------------------------- |
|
3528 void CMceMessageListView::SetFolderL( TMsvId aFolderId ) |
|
3529 { |
|
3530 if ( iFolderId != aFolderId && iMsgListContainer ) |
|
3531 { |
|
3532 iFolderId = aFolderId; |
|
3533 if ( GetFolderListBoxType() != iMsgListContainer->MceListId() ) |
|
3534 { |
|
3535 ListboxTypeChangedL(); |
|
3536 } |
|
3537 } |
|
3538 |
|
3539 iFolderId = aFolderId; |
|
3540 if ( iMsgListContainer ) |
|
3541 { |
|
3542 iMsgListContainer->SetFolderL( aFolderId ); |
|
3543 } |
|
3544 } |
|
3545 |
|
3546 // ---------------------------------------------------- |
|
3547 // CMceMessageListView::GetFolderListBoxType |
|
3548 // ---------------------------------------------------- |
|
3549 TInt CMceMessageListView::GetFolderListBoxType() |
|
3550 { |
|
3551 TInt listType = EMceListTypeTwoRow; |
|
3552 TMsvEntry serviceEntry; |
|
3553 TMsvId serviceId; |
|
3554 |
|
3555 if ( iSession->GetEntry( iFolderId, serviceId, serviceEntry ) == KErrNone ) |
|
3556 { |
|
3557 const TMsvId entryId = serviceEntry.Id(); |
|
3558 if ( entryId == KMsvGlobalInBoxIndexEntryId |
|
3559 || entryId == KMsvDraftEntryId |
|
3560 || entryId == KMsvSentEntryId |
|
3561 || entryId == KMceDocumentsEntryId |
|
3562 || serviceEntry.Parent() == KMceDocumentsEntryId ) |
|
3563 { |
|
3564 listType = iListboxInboxTypeObserver->ListboxType(); |
|
3565 } |
|
3566 else if ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, serviceEntry.iMtm )) |
|
3567 { |
|
3568 listType = iListboxMailTypeObserver->ListboxType(); |
|
3569 } |
|
3570 } |
|
3571 return listType; |
|
3572 } |
|
3573 |
|
3574 // ---------------------------------------------------- |
|
3575 // CMceMessageListView::ListContainer |
|
3576 // ---------------------------------------------------- |
|
3577 CMceMessageListContainerBase* CMceMessageListView::ListContainer() const |
|
3578 { |
|
3579 return iMsgListContainer; |
|
3580 } |
|
3581 |
|
3582 |
|
3583 // ---------------------------------------------------- |
|
3584 // CMceMessageListView::HandleMsgServerStartupL |
|
3585 // ---------------------------------------------------- |
|
3586 void CMceMessageListView::HandleMsgServerStartupL() |
|
3587 { |
|
3588 iSession->AddObserverL( *this ); |
|
3589 iMsvSessionReady = ETrue; |
|
3590 } |
|
3591 |
|
3592 // ---------------------------------------------------- |
|
3593 // CMceMessageListView::AiwSyncParamListLC() |
|
3594 // |
|
3595 // ---------------------------------------------------- |
|
3596 CAiwGenericParamList* CMceMessageListView::AiwSyncParamListLC(TInt /*aId*/, const TDesC& aText) |
|
3597 { |
|
3598 TAiwVariant variant; |
|
3599 variant.Set(KNullDesC); |
|
3600 TAiwGenericParam param(EGenericParamMessageItemEMail, variant); |
|
3601 |
|
3602 TAiwVariant variant2; |
|
3603 variant2.Set(aText); |
|
3604 TAiwGenericParam param2(EGenericParamMessageItemMbox, variant2); |
|
3605 |
|
3606 CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); |
|
3607 list->AppendL(param); |
|
3608 list->AppendL(param2); |
|
3609 |
|
3610 return list; |
|
3611 } |
|
3612 |
|
3613 // ---------------------------------------------------- |
|
3614 // CMceMessageListView::CheckUnreadMessages |
|
3615 // |
|
3616 // ---------------------------------------------------- |
|
3617 TBool CMceMessageListView::HasUnreadMessagesL() |
|
3618 { |
|
3619 // TODO: to list array or container??? |
|
3620 CMsvEntry* entry = CMsvEntry::NewL( |
|
3621 *iSession, |
|
3622 iMsgListContainer->CurrentFolderId(), |
|
3623 TMsvSelectionOrdering( |
|
3624 KMsvGroupByStandardFolders, EMsvSortByDateReverse) ); |
|
3625 CleanupStack::PushL( entry ); |
|
3626 |
|
3627 const TInt count = entry->Count(); |
|
3628 |
|
3629 for ( TInt i=0; i<count; ++i ) |
|
3630 { |
|
3631 if ( (*entry)[i].Unread() ) |
|
3632 { |
|
3633 CleanupStack::PopAndDestroy( entry ); |
|
3634 // Current folder has unread/new message |
|
3635 return ETrue; |
|
3636 } |
|
3637 } |
|
3638 CleanupStack::PopAndDestroy( entry ); |
|
3639 return EFalse; |
|
3640 } |
|
3641 |
|
3642 // ---------------------------------------------------- |
|
3643 // CMceMessageListView::SetMSKButtonL() |
|
3644 // |
|
3645 // ---------------------------------------------------- |
|
3646 void CMceMessageListView::SetMSKButtonL() |
|
3647 { |
|
3648 |
|
3649 if ( AknLayoutUtils::MSKEnabled() ) |
|
3650 { |
|
3651 TMsvId newFolderId = iFolderId; |
|
3652 TMsvId syncFolderId = 0; |
|
3653 TInt resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3654 TInt numberOfEntries = iMsgListContainer->Count(); |
|
3655 TInt currentItemSelectionCount = iMsgListContainer->SelectionCount(); |
|
3656 |
|
3657 if ( IsMSKSyncMlMailBox() ) |
|
3658 { |
|
3659 syncFolderId = iMsgListContainer->FolderEntry().iRelatedId; |
|
3660 if ( syncFolderId > 0 && newFolderId != syncFolderId ) |
|
3661 { |
|
3662 newFolderId = syncFolderId; |
|
3663 } |
|
3664 } |
|
3665 |
|
3666 if ( IsMSKMailBox() && ( !IsMSKSyncMlMailBox() ) ) |
|
3667 { |
|
3668 TInt rid = 0; // command is available |
|
3669 TMsvId id = iMsgListContainer->CurrentItemId(); |
|
3670 if ( id < 0 ) |
|
3671 { |
|
3672 if ( CMceMessageListContainerBase::EMessageListItemSubtitle |
|
3673 != iMsgListContainer->CurrentItemType()) |
|
3674 { |
|
3675 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3676 } |
|
3677 else |
|
3678 { |
|
3679 resourceId = iMsgListContainer->SetSpecialMskL(); |
|
3680 } |
|
3681 } |
|
3682 else |
|
3683 { |
|
3684 TMsvEntry currentEntry; |
|
3685 TMsvId serviceId; |
|
3686 iSession->GetEntry( id, serviceId, currentEntry ); |
|
3687 |
|
3688 TMsvEntry serviceEntry; |
|
3689 iSession->GetEntry( currentEntry.iServiceId, serviceId, serviceEntry ); |
|
3690 |
|
3691 CBaseMtmUiData* mtmUiData = iMceUi->GetMtmUiDataL( currentEntry.iMtm ); |
|
3692 |
|
3693 if ( !mtmUiData) |
|
3694 { |
|
3695 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3696 } |
|
3697 else if ( mtmUiData->CanUnDeleteFromEntryL( currentEntry, rid ) && |
|
3698 !serviceEntry.Connected() && currentItemSelectionCount == 0 ) |
|
3699 { |
|
3700 // Offline and deleted item in focus |
|
3701 resourceId = R_MCE_MSK_BUTTON_UNDELETE; |
|
3702 } |
|
3703 else |
|
3704 { |
|
3705 if ( currentItemSelectionCount >= 1 || numberOfEntries == 0 ) |
|
3706 { |
|
3707 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3708 } |
|
3709 else |
|
3710 { |
|
3711 if ( CMceMessageListContainerBase::EMessageListItemSubtitle == iMsgListContainer->CurrentItemType()) |
|
3712 { |
|
3713 resourceId = iMsgListContainer->SetSpecialMskL(); |
|
3714 } |
|
3715 else |
|
3716 { |
|
3717 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3718 } |
|
3719 } |
|
3720 } |
|
3721 } |
|
3722 } |
|
3723 else if ( newFolderId == KMceDeliveryReportsId ) |
|
3724 { |
|
3725 // Delivery reports |
|
3726 if ( numberOfEntries > 0 ) |
|
3727 { |
|
3728 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3729 } |
|
3730 else |
|
3731 { |
|
3732 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3733 } |
|
3734 } |
|
3735 else if ( newFolderId == KMsvGlobalOutBoxIndexEntryId ) |
|
3736 { |
|
3737 // Outbox |
|
3738 if ( numberOfEntries > 0 ) |
|
3739 { |
|
3740 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3741 } |
|
3742 else if ( numberOfEntries == 0 ) |
|
3743 { |
|
3744 if ( IsMSKSyncMlMailBox() ) |
|
3745 { |
|
3746 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3747 } |
|
3748 else |
|
3749 { |
|
3750 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3751 } |
|
3752 } |
|
3753 } |
|
3754 else if ( newFolderId == KMceDocumentsEntryId ) |
|
3755 { |
|
3756 // Documents, user's own folder |
|
3757 if ( currentItemSelectionCount >= 1 ) |
|
3758 { |
|
3759 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3760 } |
|
3761 else |
|
3762 { |
|
3763 if ( CMceMessageListContainerBase::EMessageListItemSubtitle == iMsgListContainer->CurrentItemType()) |
|
3764 { |
|
3765 resourceId = iMsgListContainer->SetSpecialMskL(); |
|
3766 } |
|
3767 else |
|
3768 { |
|
3769 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3770 } |
|
3771 } |
|
3772 } |
|
3773 else if ( newFolderId == KMsvGlobalInBoxIndexEntryId || |
|
3774 newFolderId == KMsvSentEntryId || |
|
3775 newFolderId == KMceTemplatesEntryId ) |
|
3776 { |
|
3777 // Inbox, Sent Items, Templates |
|
3778 if ( currentItemSelectionCount >= 1 ) |
|
3779 { |
|
3780 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3781 } |
|
3782 else if ( numberOfEntries == 0 ) |
|
3783 { |
|
3784 if ( IsMSKSyncMlMailBox() ) |
|
3785 { |
|
3786 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3787 } |
|
3788 else |
|
3789 { |
|
3790 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3791 } |
|
3792 } |
|
3793 else |
|
3794 { |
|
3795 // One row list handles expand/collape MSK setting |
|
3796 if ( CMceMessageListContainerBase::EMessageListItemSubtitle != iMsgListContainer->CurrentItemType()) |
|
3797 { |
|
3798 TMsvId id = iMsgListContainer->CurrentItemId(); |
|
3799 TMsvEntry currentEntry; |
|
3800 TMsvId serviceId; |
|
3801 iSession->GetEntry( id, serviceId, currentEntry ); |
|
3802 |
|
3803 CBaseMtmUiData* mtmUiData = iMceUi->GetMtmUiDataL( currentEntry.iMtm ); |
|
3804 if ( currentEntry.iMtm == KUidMsgMMSNotification && |
|
3805 mtmUiData->OperationSupportedL(KMtmUiFunctionOpenMessage, currentEntry ) ) |
|
3806 { |
|
3807 // when MMSNotification is in retrieving status, the hide open for MSK |
|
3808 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3809 } |
|
3810 else |
|
3811 { |
|
3812 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3813 } |
|
3814 } |
|
3815 else |
|
3816 { |
|
3817 if ( CMceMessageListContainerBase::EMessageListItemSubtitle == iMsgListContainer->CurrentItemType()) |
|
3818 { |
|
3819 resourceId = iMsgListContainer->SetSpecialMskL(); |
|
3820 } |
|
3821 else |
|
3822 { |
|
3823 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3824 } |
|
3825 } |
|
3826 } |
|
3827 } |
|
3828 else if ( newFolderId == KMsvDraftEntryId ) |
|
3829 { |
|
3830 // Drafts |
|
3831 if ( currentItemSelectionCount >= 1 ) |
|
3832 { |
|
3833 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3834 } |
|
3835 else if ( numberOfEntries == 0 ) |
|
3836 { |
|
3837 if ( IsMSKSyncMlMailBox() ) |
|
3838 { |
|
3839 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3840 } |
|
3841 else |
|
3842 { |
|
3843 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3844 } |
|
3845 } |
|
3846 else |
|
3847 { |
|
3848 if ( CMceMessageListContainerBase::EMessageListItemSubtitle == iMsgListContainer->CurrentItemType()) |
|
3849 { |
|
3850 resourceId = iMsgListContainer->SetSpecialMskL(); |
|
3851 } |
|
3852 else |
|
3853 { |
|
3854 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3855 } |
|
3856 } |
|
3857 } |
|
3858 else |
|
3859 { |
|
3860 // User's own folders |
|
3861 if ( currentItemSelectionCount >= 1 ) |
|
3862 { |
|
3863 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
3864 } |
|
3865 else if ( numberOfEntries == 0 ) |
|
3866 { |
|
3867 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3868 } |
|
3869 else |
|
3870 { |
|
3871 // One row list handles expand/collape MSK setting |
|
3872 if ( CMceMessageListContainerBase::EMessageListItemSubtitle != iMsgListContainer->CurrentItemType()) |
|
3873 { |
|
3874 TMsvId id = iMsgListContainer->CurrentItemId(); |
|
3875 TMsvEntry currentEntry; |
|
3876 TMsvId serviceId; |
|
3877 iSession->GetEntry( id, serviceId, currentEntry ); |
|
3878 |
|
3879 CBaseMtmUiData* mtmUiData = iMceUi->GetMtmUiDataL( currentEntry.iMtm ); |
|
3880 if ( currentEntry.iMtm == KUidMsgMMSNotification && |
|
3881 mtmUiData->OperationSupportedL(KMtmUiFunctionOpenMessage, currentEntry ) ) |
|
3882 { |
|
3883 // when MMSNotification is in retrieving status, the hide open for MSK |
|
3884 resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
3885 } |
|
3886 else |
|
3887 { |
|
3888 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
3889 } |
|
3890 } |
|
3891 else |
|
3892 { |
|
3893 resourceId = iMsgListContainer->SetSpecialMskL(); |
|
3894 } |
|
3895 } |
|
3896 } |
|
3897 |
|
3898 CEikButtonGroupContainer* cba = Cba(); |
|
3899 cba->SetCommandL( KMSKPosition, resourceId ); |
|
3900 cba->DrawDeferred(); |
|
3901 |
|
3902 } |
|
3903 } |
|
3904 |
|
3905 |
|
3906 // ---------------------------------------------------- |
|
3907 // CMceMessageListView::IsMSKMailBox() |
|
3908 // |
|
3909 // ---------------------------------------------------- |
|
3910 TBool CMceMessageListView::IsMSKMailBox() |
|
3911 { |
|
3912 TBool mailBox = EFalse; |
|
3913 const TMsvEntry& entry = iMsgListContainer->FolderEntry(); |
|
3914 if ( iMceUi->CheckTechnologyTypeFromMtm( KMailTechnologyTypeUid, entry.iMtm ) ) |
|
3915 { |
|
3916 mailBox = ETrue; |
|
3917 } |
|
3918 return mailBox; |
|
3919 } |
|
3920 |
|
3921 // ---------------------------------------------------- |
|
3922 // CMceMessageListView::IsMSKSyncMlMailBox() |
|
3923 // |
|
3924 // ---------------------------------------------------- |
|
3925 TBool CMceMessageListView::IsMSKSyncMlMailBox() |
|
3926 { |
|
3927 TBool syncMailBox = EFalse; |
|
3928 const TMsvEntry& entry = iMsgListContainer->FolderEntry(); |
|
3929 if ( iMceUi->IsPresent( entry.iMtm ) && |
|
3930 iMsgListContainer->FolderEntry().iMtm == KSenduiMtmSyncMLEmailUid ) |
|
3931 { |
|
3932 syncMailBox = ETrue; |
|
3933 } |
|
3934 return syncMailBox; |
|
3935 } |
|
3936 |
|
3937 // ---------------------------------------------------- |
|
3938 // CMceMessageListView::SetCurrentItemId |
|
3939 // ---------------------------------------------------- |
|
3940 void CMceMessageListView::SetCurrentItemId() |
|
3941 { |
|
3942 if ( iMsgListContainer && IsMSKMailBox() ) |
|
3943 { |
|
3944 iCurrentItemId = iMsgListContainer->CurrentItemId(); |
|
3945 } |
|
3946 else |
|
3947 { |
|
3948 iCurrentItemId = KErrNotFound; |
|
3949 } |
|
3950 } |
|
3951 |
|
3952 |
|
3953 // ---------------------------------------------------- |
|
3954 // CMceMessageListView::CreateListboxL |
|
3955 // ---------------------------------------------------- |
|
3956 void CMceMessageListView::CreateListboxL() |
|
3957 { |
|
3958 TInt newListType = EMceListTypeTwoRow; |
|
3959 |
|
3960 newListType = GetFolderListBoxType(); |
|
3961 |
|
3962 if ( !iMsgListContainer ) |
|
3963 { |
|
3964 if ( newListType != EMceListTypeOneRow ) |
|
3965 { |
|
3966 iMsgListContainer = CMceMessageListContainer::NewL( |
|
3967 ClientRect(), |
|
3968 iSession, |
|
3969 iFolderId, |
|
3970 iBitmapResolver, |
|
3971 *this ); |
|
3972 iCurrentListType = EMceListTypeTwoRow; |
|
3973 } |
|
3974 else |
|
3975 { |
|
3976 iMsgListContainer = CMceOneRowMessageListContainer::NewL( |
|
3977 *this, |
|
3978 ClientRect(), |
|
3979 iSession, |
|
3980 *iMceUi ); |
|
3981 iCurrentListType = EMceListTypeOneRow; |
|
3982 } |
|
3983 |
|
3984 iMsgListContainer->SetMopParent( this ); |
|
3985 iMsgListContainer->SetMtmUiDataRegistry( iMceUi ); |
|
3986 } |
|
3987 |
|
3988 iCurrentListboxId = iMsgListContainer->MceListId(); |
|
3989 } |
|
3990 |
|
3991 |
|
3992 // ---------------------------------------------------- |
|
3993 // CMceMessageListView::EnvironmentChanged |
|
3994 // ---------------------------------------------------- |
|
3995 TInt CMceMessageListView::EnvironmentChanged( TAny* aSelf ) |
|
3996 { |
|
3997 TInt err = KErrArgument; |
|
3998 CMceMessageListView* self = static_cast<CMceMessageListView*>(aSelf); |
|
3999 if ( self ) |
|
4000 { |
|
4001 err = self->HandleEnvironmentChanged(); |
|
4002 } |
|
4003 return err; |
|
4004 |
|
4005 } |
|
4006 |
|
4007 // ---------------------------------------------------- |
|
4008 // CMceMessageListView::HandleEnvironmentChanged |
|
4009 // ---------------------------------------------------- |
|
4010 TInt CMceMessageListView::HandleEnvironmentChanged() |
|
4011 { |
|
4012 TInt err = KErrNone; |
|
4013 if ( iMsgListContainer && |
|
4014 iDateTimeNotifier ) |
|
4015 { |
|
4016 TInt change = iDateTimeNotifier->Change(); |
|
4017 if ( change & EChangesMidnightCrossover || |
|
4018 change & EChangesLocale || |
|
4019 change & EChangesSystemTime ) |
|
4020 { |
|
4021 // inform container that date/time format has been changed |
|
4022 TRAP( err, iMsgListContainer->DateTimeFormatChangedL( change ) ); |
|
4023 } |
|
4024 } |
|
4025 return err; |
|
4026 } |
|
4027 |
|
4028 |
|
4029 // ---------------------------------------------------- |
|
4030 // CMceMessageListView::ListboxTypeChangedL |
|
4031 // ---------------------------------------------------- |
|
4032 void CMceMessageListView::ListboxTypeChangedL() |
|
4033 { |
|
4034 if (iMsgListContainer) |
|
4035 { |
|
4036 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
4037 if( eikEnv ) |
|
4038 { |
|
4039 // New listbox will overlap any remaining dialog, |
|
4040 // so we'll close them here. |
|
4041 AknDialogShutter::ShutDialogsL( *eikEnv ); |
|
4042 } |
|
4043 |
|
4044 iMsgListContainer->MakeVisible(EFalse); |
|
4045 AppUi()->RemoveFromStack(iMsgListContainer); |
|
4046 delete iMsgListContainer; |
|
4047 iMsgListContainer = NULL; |
|
4048 iLocalScreenClearer = CAknLocalScreenClearer::NewL( EFalse ); |
|
4049 CreateListboxL(); |
|
4050 iMsgListContainer->SetFolderL( iFolderId ); |
|
4051 iMsgListContainer->ClearSelection(); |
|
4052 iMsgListContainer->SetRect(ClientRect()); |
|
4053 SetMskObserver( ETrue ); |
|
4054 AppUi()->AddToStackL( *this,iMsgListContainer ); |
|
4055 iMsgListContainer->ActivateL(); |
|
4056 iMsgListContainer->MakeVisible(ETrue); |
|
4057 delete iLocalScreenClearer; |
|
4058 iLocalScreenClearer = NULL; |
|
4059 } |
|
4060 } |
|
4061 |
|
4062 // ---------------------------------------------------- |
|
4063 // CMceMessageListView::SetForwardMenuL |
|
4064 // ---------------------------------------------------- |
|
4065 void CMceMessageListView::SetForwardMenuL( CEikMenuPane* aMenuPane, TMsvEntry& aEntry ) |
|
4066 { |
|
4067 TBool canForward = EFalse; |
|
4068 switch( aEntry.iMtm.iUid ) |
|
4069 { |
|
4070 case KSenduiMtmIrUidValue: |
|
4071 case KSenduiMtmBtUidValue: |
|
4072 case KSenduiMtmBioUidValue: |
|
4073 { |
|
4074 canForward = EFalse; |
|
4075 break; |
|
4076 } |
|
4077 case KSenduiMtmSmsUidValue: |
|
4078 { |
|
4079 canForward = !( aEntry.iBioType ) && |
|
4080 iMceUi->CheckCommandAvailableL( EMceCmdForward, aEntry ) ; |
|
4081 break; |
|
4082 } |
|
4083 default: |
|
4084 { |
|
4085 canForward = iMceUi->CheckCommandAvailableL( EMceCmdForward, aEntry ); |
|
4086 } |
|
4087 } |
|
4088 aMenuPane->SetItemDimmed( EMceCmdForward, !canForward ); |
|
4089 } |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 // --------------------------------------------------------- |
|
4095 // CMceMessageListView::DimReadUnreadOptionsMenu |
|
4096 // --------------------------------------------------------- |
|
4097 // |
|
4098 void CMceMessageListView::DimReadUnreadOptionsMenu( CEikMenuPane *aMenuPane ) |
|
4099 { |
|
4100 aMenuPane->SetItemDimmed( EMceCmdMarkAsRead, ETrue ); |
|
4101 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnread, ETrue ); |
|
4102 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsg, ETrue ); |
|
4103 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsg, ETrue ); |
|
4104 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsgs, ETrue ); |
|
4105 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsgs, ETrue ); |
|
4106 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadEmails, ETrue ); |
|
4107 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadEmails, ETrue ); |
|
4108 } |
|
4109 |
|
4110 // --------------------------------------------------------- |
|
4111 // CMceMessageListView::SetReadUnreadOptionsMenu |
|
4112 // --------------------------------------------------------- |
|
4113 // |
|
4114 void CMceMessageListView::SetReadUnreadOptionsMenu( CEikMenuPane *aMenuPane, TBool aIsEmail, TBool aSetRead ) |
|
4115 { |
|
4116 if ( aIsEmail ) |
|
4117 {// emails |
|
4118 switch ( aSetRead ) |
|
4119 { |
|
4120 case MessageFolderAllRead: |
|
4121 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadEmails, ETrue ); |
|
4122 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadEmails, EFalse ); |
|
4123 break; |
|
4124 case MessageFolderAllUnread: |
|
4125 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadEmails, EFalse ); |
|
4126 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadEmails, ETrue ); |
|
4127 break; |
|
4128 case MessageFolderReadUnread: |
|
4129 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadEmails, EFalse ); |
|
4130 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadEmails, EFalse ); |
|
4131 break; |
|
4132 default: |
|
4133 // never |
|
4134 break; |
|
4135 } |
|
4136 } |
|
4137 else |
|
4138 {// messages |
|
4139 switch ( aSetRead ) |
|
4140 { |
|
4141 case MessageFolderAllRead: |
|
4142 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsgs, ETrue ); |
|
4143 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsgs, EFalse ); |
|
4144 break; |
|
4145 case MessageFolderAllUnread: |
|
4146 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsgs, EFalse ); |
|
4147 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsgs, ETrue ); |
|
4148 break; |
|
4149 case MessageFolderReadUnread: |
|
4150 aMenuPane->SetItemDimmed( EMceCmdMarkAsReadMsgs, EFalse ); |
|
4151 aMenuPane->SetItemDimmed( EMceCmdMarkAsUnreadMsgs, EFalse ); |
|
4152 break; |
|
4153 default: |
|
4154 // never |
|
4155 break; |
|
4156 } |
|
4157 } |
|
4158 } |
|
4159 |
|
4160 // ---------------------------------------------------- |
|
4161 // CMceMessageListView::SetMarkReadUnread( TBool aValue ) |
|
4162 // ---------------------------------------------------- |
|
4163 void CMceMessageListView::SetMarkReadUnread( TBool aValue ) |
|
4164 { |
|
4165 iReadUnread = aValue; |
|
4166 } |
|
4167 |
|
4168 // ---------------------------------------------------- |
|
4169 // CMceMessageListView::SetContextCommandFlag( TBool aContextCommandFlag ) |
|
4170 // ---------------------------------------------------- |
|
4171 void CMceMessageListView::SetContextCommandFlag(TBool aContextCommandFlag) |
|
4172 { |
|
4173 iContextCommand = aContextCommandFlag; |
|
4174 } |
|
4175 |
|
4176 // End of File |