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