|
1 /* |
|
2 * Copyright (c) 2007 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 * Container for main view. |
|
16 * Derived from CMceOneRowMessageListContainer. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "mceui.h" |
|
24 #include <aknlists.h> |
|
25 #include <aknsinglecolumnstyletreelist.h> |
|
26 #include <AknsBasicBackgroundControlContext.h> |
|
27 #include <akntreelist.h> // CAknTreeList::ESaveFocus |
|
28 |
|
29 |
|
30 #include <AknIconUtils.h> |
|
31 #include <avkon.mbg> // bitmap enums |
|
32 #include <muiu.mbg> // bitmap enums |
|
33 #include <data_caging_path_literals.hrh> |
|
34 |
|
35 #include "MceOneRowMessageListBitmapResolver.h" |
|
36 #include "MceOneRowMessageListContainer.h" |
|
37 #include "MceOneRowMessageListArray.h" |
|
38 #include "MceOneRowMessageListArrayLoader.h" // For CMceOneRowListItemArrayLoader::EHListItemSubtitle |
|
39 |
|
40 #include "MceMessageListView.h" |
|
41 |
|
42 #include <msvids.h> |
|
43 #include <msvuids.h> |
|
44 #include <SenduiMtmUids.h> // mtm uids |
|
45 #include "MceIds.h" // KMceApplicationUid |
|
46 #include "MceLogText.h" |
|
47 |
|
48 #include <StringLoader.h> // stringloader |
|
49 #include "MceCommands.hrh" |
|
50 #include <bldvariant.hrh> |
|
51 |
|
52 #include <csxhelp/mce.hlp.hrh> |
|
53 #include <csxhelp/mbxs.hlp.hrh> |
|
54 |
|
55 #include <PtiEngine.h> |
|
56 #include <featmgr.h> |
|
57 #include <commonphoneparser.h> |
|
58 |
|
59 #include <muiumsvuiserviceutilitiesinternal.h> |
|
60 |
|
61 #include <mce.rsg> |
|
62 #include <mtudreg.h> |
|
63 // CONSTANTS |
|
64 |
|
65 const TInt KMceListContainerGranuality = 4; |
|
66 const TInt KMceTextBufferLength = 10; // text buffer length |
|
67 const TInt KMceFocusOffsetTopView = 0; // Set focused item top of view |
|
68 const TInt KMceTextItemSize = 75; // Subtitle text buffer size |
|
69 |
|
70 const TInt KMceColumn1 = 1; |
|
71 const TInt KMceColumn2 = 2; |
|
72 const TInt KMceColumn3 = 3; |
|
73 const TInt KMceFirstItemIndex = 0; |
|
74 |
|
75 |
|
76 // The position of the middle soft key |
|
77 const TInt KMSKPosition = 3; |
|
78 const TInt KMSKLabel = 20; |
|
79 |
|
80 //cmail update |
|
81 #define KUidMsgTypeCmailMtmVal 0x2001F406 |
|
82 const TUid KMailTechnologyTypeUid = { 0x10001671 }; |
|
83 // ================= MEMBER FUNCTIONS ======================= |
|
84 |
|
85 // ---------------------------------------------------- |
|
86 // Constructor |
|
87 // ---------------------------------------------------- |
|
88 // |
|
89 CMceOneRowMessageListContainer::CMceOneRowMessageListContainer( CMceMessageListView& aParentView ) : |
|
90 CMceMessageListContainerBase( aParentView ), |
|
91 iEmailFramework(EFalse), |
|
92 iDeletedMessges(0) |
|
93 { |
|
94 iSelectedSubTitles.Reset(); |
|
95 } |
|
96 |
|
97 |
|
98 // ---------------------------------------------------- |
|
99 // Destructor |
|
100 // ---------------------------------------------------- |
|
101 // |
|
102 CMceOneRowMessageListContainer::~CMceOneRowMessageListContainer() |
|
103 { |
|
104 delete iT9Interface; |
|
105 delete iT9Timer; |
|
106 delete iListItems; |
|
107 delete iBitmapResolver; |
|
108 delete iBgContext; |
|
109 delete iSelectedEntries; |
|
110 delete iTreeListBox; |
|
111 delete iUiRegistry; |
|
112 iSelectedSubTitles.Close(); |
|
113 } |
|
114 |
|
115 |
|
116 // ---------------------------------------------------- |
|
117 // CMceOneRowMessageListContainer::NewL |
|
118 // ---------------------------------------------------- |
|
119 // |
|
120 CMceOneRowMessageListContainer* CMceOneRowMessageListContainer::NewL( |
|
121 CMceMessageListView& aParentView, |
|
122 const TRect& aRect, |
|
123 CMsvSessionPtr aSession, |
|
124 MMtmUiDataRegistryObserver& aRegObserver ) |
|
125 { |
|
126 CMceOneRowMessageListContainer* self = new (ELeave) |
|
127 CMceOneRowMessageListContainer( aParentView ); |
|
128 CleanupStack::PushL(self); |
|
129 self->ConstructL( aRect, aSession, aRegObserver ); |
|
130 CleanupStack::Pop(); // self |
|
131 return self; |
|
132 } |
|
133 |
|
134 |
|
135 // ---------------------------------------------------- |
|
136 // CMceOneRowMessageListContainer::AddDefaultIconsL |
|
137 // ---------------------------------------------------- |
|
138 // |
|
139 void CMceOneRowMessageListContainer::AddDefaultIconsL() |
|
140 { |
|
141 CFbsBitmap* bitmap = NULL; |
|
142 CFbsBitmap* bitmapMask = NULL; |
|
143 TInt treeIconIndex = KErrNotFound; |
|
144 |
|
145 for ( TInt i = EMceBitmapIndexUnknown; i < EMceBitmapIndexLastIconIndex; i++ ) |
|
146 { |
|
147 if ( iBitmapResolver->GetBitmapL( (TMceBitmapArrayIndexes)i, bitmap, bitmapMask ) < 0 ) |
|
148 { |
|
149 treeIconIndex = iTreeListBox->AddIconL( |
|
150 bitmap, |
|
151 bitmapMask, |
|
152 EFalse, |
|
153 EAspectRatioPreserved ); |
|
154 iBitmapResolver->SetTreeIconId( (TMceBitmapArrayIndexes)i, treeIconIndex ); |
|
155 } |
|
156 } |
|
157 } |
|
158 |
|
159 |
|
160 // ---------------------------------------------------- |
|
161 // CMceOneRowMessageListContainer::ConstructL |
|
162 // ---------------------------------------------------- |
|
163 // |
|
164 void CMceOneRowMessageListContainer::ConstructL( |
|
165 const TRect& aRect, |
|
166 CMsvSessionPtr aSession, |
|
167 MMtmUiDataRegistryObserver& aRegObserver ) |
|
168 { |
|
169 FeatureManager::InitializeLibL(); |
|
170 if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) ) |
|
171 { |
|
172 iEmailFramework = ETrue; |
|
173 } |
|
174 FeatureManager::UnInitializeLib(); |
|
175 |
|
176 CreateWindowL(); |
|
177 |
|
178 InitComponentArrayL(); |
|
179 Components().SetControlsOwnedExternally( ETrue ); |
|
180 |
|
181 // Construct list. |
|
182 CAknSingleColumnStyleTreeList* list = |
|
183 CAknSingleColumnStyleTreeList::NewL( *this ); |
|
184 |
|
185 iSelectedEntries = new (ELeave) CMsvEntrySelection; |
|
186 |
|
187 iContainerFlags.ClearMceFlag( EMceOneRowFlagOptionsMenuOpen ); |
|
188 |
|
189 iContainerFlags.ClearMceFlag( EMceOneRowFlagFirstSubtitleOpen ); |
|
190 |
|
191 // Use list as a component control of the view. |
|
192 Components().AppendLC( list, KCoeNoControlId ); |
|
193 CleanupStack::Pop( list ); |
|
194 iTreeListBox = list; |
|
195 iTreeListBox->EnableTabModeFunctionIndicatorsL( ETrue ); |
|
196 iTreeListBox->SetFlags( iTreeListBox->Flags() ^ KAknTreeListLooping ^ KAknTreeListMarkable ); |
|
197 iTreeListBox->AddObserverL( this ); |
|
198 |
|
199 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
200 KAknsIIDQsnBgAreaMain, iAvkonAppUi->ApplicationRect(), EFalse ); |
|
201 |
|
202 iBitmapResolver = CMceOneRowBitmapResolver::NewL( aSession, aRegObserver ); |
|
203 AddDefaultIconsL(); |
|
204 iListItems = CMceOneRowListItemArray::NewL( aSession, 0x1000 ); |
|
205 iListItems->SetListItemArrayObserver( this ); |
|
206 |
|
207 iTreeListBox->Sort( iListItems, EFalse ); |
|
208 |
|
209 SetRect( aRect ); |
|
210 |
|
211 TLocale locale; |
|
212 iStartOfWeek = locale.StartOfWeek(); |
|
213 iDialerEvent = EFalse ; |
|
214 iUiRegistry = CMtmUiDataRegistry::NewL(*aSession); |
|
215 } |
|
216 |
|
217 |
|
218 // ---------------------------------------------------- |
|
219 // CMceMessageListContainer::MceListId |
|
220 // ---------------------------------------------------- |
|
221 TInt CMceOneRowMessageListContainer::MceListId() const |
|
222 { |
|
223 return EMceListTypeOneRow; |
|
224 } |
|
225 |
|
226 |
|
227 // ---------------------------------------------------- |
|
228 // CMceOneRowMessageListContainer::CountComponentControls |
|
229 // ---------------------------------------------------- |
|
230 // |
|
231 TInt CMceOneRowMessageListContainer::CountComponentControls() const |
|
232 { |
|
233 return 1; // always only listbox |
|
234 } |
|
235 |
|
236 |
|
237 // ---------------------------------------------------- |
|
238 // CMceOneRowMessageListContainer::ComponentControl |
|
239 // ---------------------------------------------------- |
|
240 // |
|
241 CCoeControl* CMceOneRowMessageListContainer::ComponentControl(TInt /*aIndex*/) const |
|
242 { |
|
243 return iTreeListBox; |
|
244 } |
|
245 |
|
246 |
|
247 // ---------------------------------------------------- |
|
248 // CMceOneRowMessageListContainer::SetFolderL |
|
249 // ---------------------------------------------------- |
|
250 // |
|
251 void CMceOneRowMessageListContainer::SetFolderL( TMsvId aFolderId ) |
|
252 { |
|
253 if ( iListItems ) |
|
254 { |
|
255 ResetListbox(); |
|
256 iContainerFlags.ClearMceFlag( EMceOneRowFlagFirstSubtitleOpen ); |
|
257 iListItems->SetFolderL( aFolderId ); |
|
258 } |
|
259 } |
|
260 |
|
261 |
|
262 // ---------------------------------------------------- |
|
263 // CMceOneRowMessageListContainer::SizeChanged |
|
264 // ---------------------------------------------------- |
|
265 // |
|
266 void CMceOneRowMessageListContainer::SizeChanged() |
|
267 { |
|
268 TRect rect = Rect(); |
|
269 if (iTreeListBox) |
|
270 { |
|
271 iTreeListBox->SetRect( rect ); |
|
272 } |
|
273 if ( iBgContext ) |
|
274 { |
|
275 iBgContext->SetRect( rect ); |
|
276 } |
|
277 } |
|
278 |
|
279 |
|
280 // ---------------------------------------------------- |
|
281 // CMceOneRowMessageListContainer::HandleResourceChange |
|
282 // ---------------------------------------------------- |
|
283 // |
|
284 void CMceOneRowMessageListContainer::HandleResourceChange( TInt aType ) |
|
285 { |
|
286 CCoeControl::HandleResourceChange( aType ); |
|
287 if( aType == KAknsMessageSkinChange ) |
|
288 { |
|
289 // change skin bitmap |
|
290 TRAP_IGNORE( iBitmapResolver->SkinChangedL( iTreeListBox ) ); |
|
291 ResetListbox(); |
|
292 TRAP_IGNORE( iListItems->RefreshArrayL() ); |
|
293 } |
|
294 |
|
295 } |
|
296 |
|
297 |
|
298 // ---------------------------------------------------- |
|
299 // CMceOneRowMessageListContainer::HandleTreeListEvent |
|
300 // ---------------------------------------------------- |
|
301 // |
|
302 TBool CMceOneRowMessageListContainer::HandleTreeListEvent( CAknTreeList& aList, |
|
303 TAknTreeItemID /* aItem */, TEvent aEvent ) |
|
304 { |
|
305 if ( &aList != iTreeListBox ) |
|
306 { |
|
307 return KErrNone; |
|
308 } |
|
309 |
|
310 switch ( aEvent ) |
|
311 { |
|
312 // One of the nodes in the list is being expanded. |
|
313 case ENodeExpanded: |
|
314 // TRAP_IGNORE( AddChildrenL( aItem ) ); |
|
315 ChangeMskCommand( R_MCE_QTN_MSK_COLLAPSE ); |
|
316 break; |
|
317 // One of the nodes in the list is being collapsed. |
|
318 case ENodeCollapsed: |
|
319 // RemoveChildren( aItem ); |
|
320 ChangeMskCommand( R_MCE_QTN_MSK_EXPAND ); |
|
321 break; |
|
322 // Simple data row or core data row is selected. |
|
323 case EItemSelected: |
|
324 TRAP_IGNORE( iOwningView.HandleCommandL(EAknCmdOpen) ); |
|
325 break; |
|
326 |
|
327 // Focused item changes |
|
328 case EItemFocused: |
|
329 if ( !iMarkingModeEnabled |
|
330 && !iContainerFlags.MceFlag( EMceOneRowFlagOptionsMenuOpen ) ) |
|
331 { |
|
332 TRAP_IGNORE( iOwningView.SetMSKButtonL() ); |
|
333 } |
|
334 else if ( iContainerFlags.MceFlag( EMceOneRowFlagOptionsMenuOpen ) ) |
|
335 { |
|
336 iContainerFlags.ClearMceFlag( EMceOneRowFlagOptionsMenuOpen ); |
|
337 } |
|
338 break; |
|
339 // Item is being removed from the list. |
|
340 case EItemRemoved: |
|
341 break; |
|
342 // Hierarchical list has entered in marking mode |
|
343 case EMarkingModeEnabled: |
|
344 iMarkingModeEnabled = ETrue; |
|
345 break; |
|
346 // hierarchical list exits the marking mode |
|
347 case EMarkingModeDisabled: |
|
348 iMarkingModeEnabled = EFalse; |
|
349 break; |
|
350 case EItemUnmarked: |
|
351 case EItemMarked: |
|
352 if ( !iMarkingModeEnabled ) |
|
353 { |
|
354 TRAP_IGNORE( iOwningView.SetMSKButtonL() ); |
|
355 } |
|
356 break; |
|
357 default: |
|
358 break; |
|
359 } |
|
360 |
|
361 return KErrNone; |
|
362 } |
|
363 |
|
364 |
|
365 // ---------------------------------------------------- |
|
366 // CMceOneRowMessageListContainer::ResetListbox |
|
367 // ---------------------------------------------------- |
|
368 // |
|
369 void CMceOneRowMessageListContainer::ResetListbox() |
|
370 { |
|
371 iTreeListBox->RemoveItem( KAknTreeIIDRoot, EFalse ); |
|
372 } |
|
373 |
|
374 |
|
375 // ---------------------------------------------------- |
|
376 // CMceOneRowMessageListContainer::MceListItemArrayChangedL |
|
377 // ---------------------------------------------------- |
|
378 // |
|
379 void CMceOneRowMessageListContainer::MceListItemArrayChangedL( |
|
380 CArrayFixFlat<TInt>& aChangedItems ) |
|
381 { |
|
382 const TInt count = aChangedItems.Count(); |
|
383 for ( TInt i = 0 ; i < count; i++ ) |
|
384 { |
|
385 TInt itemIndex = aChangedItems[i]; |
|
386 if ( iListItems->HCItemType(itemIndex) == CMceOneRowListItemArrayLoader::EHListItemSubtitle ) |
|
387 { |
|
388 TBuf<KMceTextItemSize> subTitle; |
|
389 TInt itemType = iListItems->GetSubtitleTextL( itemIndex, subTitle ); |
|
390 if ( itemType > EHCListTypeNone ) |
|
391 { |
|
392 TUint32 flags = CAknSingleColumnStyleTreeList::EPersistent; |
|
393 if ( !iContainerFlags.MceFlag( EMceOneRowFlagFirstSubtitleOpen ) ) |
|
394 { |
|
395 flags |= CAknSingleColumnStyleTreeList::EExpanded; |
|
396 iContainerFlags.SetMceFlag( EMceOneRowFlagFirstSubtitleOpen ); |
|
397 } |
|
398 else |
|
399 { |
|
400 flags &= CAknSingleColumnStyleTreeList::EExpanded; |
|
401 } |
|
402 iNodeId = iTreeListBox->AddSubtitleRowL( KAknTreeIIDRoot, |
|
403 subTitle, flags, EFalse ); |
|
404 iListItems->SetTreeItemId( itemIndex, iNodeId ); |
|
405 iTreeListBox->SetNonEmpty( iNodeId, ETrue, EFalse ); |
|
406 UpdateSubtitleIconL( iNodeId, EFalse ); |
|
407 } |
|
408 } |
|
409 else |
|
410 { |
|
411 AddEntryL( itemIndex ); |
|
412 } |
|
413 } |
|
414 |
|
415 // current item id haven't been set due list is not ready yet |
|
416 if ( iSelectedItemWaitingIndex ) |
|
417 { |
|
418 SetCurrentItemIdL( iSelectedItemWaitingIndex ); |
|
419 } |
|
420 //progressive draw for every 200 entries. |
|
421 iTreeListBox->DrawNow(); |
|
422 } |
|
423 |
|
424 |
|
425 // ---------------------------------------------------- |
|
426 // CMceOneRowMessageListContainer::GetSubtitleIcon |
|
427 // ---------------------------------------------------- |
|
428 // |
|
429 TInt CMceOneRowMessageListContainer::GetSubtitleIcon ( TBool setUnread ) |
|
430 { |
|
431 TMceBitmapArrayIndexes treeIconId = EMceBitmapIndexUnknown; |
|
432 TMsvSelectionOrdering sortType = iListItems->SortType(); |
|
433 |
|
434 switch ( sortType.Sorting() ) |
|
435 { |
|
436 case EMsvSortByDate: |
|
437 case EMsvSortByDateReverse: |
|
438 if ( setUnread ) |
|
439 { |
|
440 treeIconId = EMceBitmapIndexSubTimeUnread; |
|
441 } |
|
442 else |
|
443 { |
|
444 treeIconId = EMceBitmapIndexSubTime; |
|
445 } |
|
446 break; |
|
447 case EMsvSortByDetails: |
|
448 case EMsvSortByDetailsReverse: |
|
449 if ( setUnread ) |
|
450 { |
|
451 treeIconId = EMceBitmapIndexSubSenderUnread; |
|
452 } |
|
453 else |
|
454 { |
|
455 treeIconId = EMceBitmapIndexSubSender; |
|
456 } |
|
457 break; |
|
458 case EMsvSortByDescription: |
|
459 case EMsvSortByDescriptionReverse: |
|
460 if ( setUnread ) |
|
461 { |
|
462 treeIconId = EMceBitmapIndexSubSubjectUnread; |
|
463 } |
|
464 else |
|
465 { |
|
466 treeIconId = EMceBitmapIndexSubSubject; |
|
467 } |
|
468 break; |
|
469 default: |
|
470 treeIconId = EMceBitmapIndexSubTime; |
|
471 break; |
|
472 } |
|
473 return iBitmapResolver->TreeIconId( treeIconId ); |
|
474 } |
|
475 |
|
476 |
|
477 // ---------------------------------------------------- |
|
478 // CMceOneRowMessageListContainer::AddChildrenL |
|
479 // ---------------------------------------------------- |
|
480 // |
|
481 void CMceOneRowMessageListContainer::AddChildrenL( TAknTreeItemID aParentId ) |
|
482 { |
|
483 TInt index = iListItems->ItemIndexTreeId( aParentId ); |
|
484 const TInt count = iListItems->GetSubfolderItemCount( aParentId ); |
|
485 |
|
486 for ( TInt i = index ; i <= index + count ; i++ ) |
|
487 { |
|
488 TBuf<KMceTextItemSize> subTitle; |
|
489 TInt itemType = iListItems->GetSubtitleTextL( i, subTitle ); |
|
490 if ( iListItems->ParentItemId( i ) == aParentId && |
|
491 itemType == 0 ) |
|
492 { |
|
493 AddEntryL( i ); |
|
494 } |
|
495 } |
|
496 } |
|
497 |
|
498 |
|
499 // ---------------------------------------------------- |
|
500 // CMceOneRowMessageListContainer::AddEntryL |
|
501 // ---------------------------------------------------- |
|
502 // |
|
503 void CMceOneRowMessageListContainer::AddEntryL( TInt aEntryIndex ) |
|
504 { |
|
505 TMsvEntry entry; |
|
506 User::LeaveIfError( iListItems->GetEntry( aEntryIndex, entry ) ); |
|
507 TInt foundIcon = KErrNotFound; |
|
508 TUint32 flags; |
|
509 |
|
510 CFbsBitmap* bitmap = NULL; |
|
511 CFbsBitmap* bitmapMask = NULL; |
|
512 foundIcon = iBitmapResolver->GetBitmapL( entry, bitmap, bitmapMask ); |
|
513 if ( foundIcon < 0 ) |
|
514 { |
|
515 foundIcon = iTreeListBox->AddIconL( |
|
516 bitmap, |
|
517 bitmapMask, |
|
518 EFalse, |
|
519 EAspectRatioPreserved ); |
|
520 iBitmapResolver->AddTreeIconIdL( bitmap, foundIcon, entry.iMtm ); |
|
521 } |
|
522 |
|
523 TAknTreeItemID parentId = iListItems->ParentItemId( aEntryIndex ); |
|
524 |
|
525 TBuf<KMceTextItemSize> bufferC1; |
|
526 TBuf<KMceTextItemSize> bufferC2; |
|
527 TBuf<KMceTextItemSize> bufferC3; |
|
528 iListItems->GetColumnTextL( aEntryIndex, KMceColumn1, bufferC1 ); |
|
529 iListItems->GetColumnTextL( aEntryIndex, KMceColumn2, bufferC2 ); |
|
530 iListItems->GetColumnTextL( aEntryIndex, KMceColumn3, bufferC3 ); |
|
531 |
|
532 TAknTreeItemID itemId = 0; |
|
533 |
|
534 if ( IsItemFolder( entry.Id() )) |
|
535 { |
|
536 // Set folders not markable |
|
537 flags = CAknSingleColumnStyleTreeList::EPersistent |
|
538 | CAknSingleColumnStyleTreeList::EMarkingDisabled; |
|
539 |
|
540 // Add two column core data row for folders |
|
541 itemId = iTreeListBox->AddCoreDataRowL( |
|
542 parentId, |
|
543 bufferC1, |
|
544 bufferC3, |
|
545 flags, |
|
546 EFalse ); |
|
547 } |
|
548 else |
|
549 { |
|
550 flags = CAknSingleColumnStyleTreeList::EPersistent; |
|
551 |
|
552 // Add three column core data row for entries |
|
553 itemId = iTreeListBox->AddCoreDataRowL( |
|
554 parentId, |
|
555 bufferC1, |
|
556 bufferC2, |
|
557 bufferC3, //subTitle, |
|
558 flags, |
|
559 EFalse ); |
|
560 |
|
561 if ( iListItems->GetItemMarkStatusL( entry.Id()) ) |
|
562 { |
|
563 iTreeListBox->SetMarked( itemId, ETrue, ETrue ); |
|
564 } |
|
565 iTreeListBox->EnableThirdColumn( itemId, bufferC3.Length(), EFalse ); |
|
566 } |
|
567 |
|
568 iListItems->SetTreeItemId( aEntryIndex, itemId ); |
|
569 if ( foundIcon >= 0 ) |
|
570 { |
|
571 iTreeListBox->SetIcon( |
|
572 itemId, |
|
573 CAknSingleColumnStyleTreeList::ELeaf, |
|
574 foundIcon, |
|
575 EFalse ); |
|
576 |
|
577 TBool attachmentIcon = EFalse; |
|
578 |
|
579 if ( entry.Attachment() && entry.iMtm != KSenduiMtmMmsUid |
|
580 && IsMailMtmTechnology(entry.iMtm )) |
|
581 { |
|
582 iTreeListBox->SetIcon( |
|
583 itemId, |
|
584 CAknSingleColumnStyleTreeList::EOptionalIcon1, |
|
585 iBitmapResolver->TreeIconId( EMceBitmapIndexAttachment ), |
|
586 EFalse ); |
|
587 iTreeListBox->SetIcon( |
|
588 itemId, |
|
589 CAknSingleColumnStyleTreeList::EHighlightedOptionalIcon1, |
|
590 iBitmapResolver->TreeIconId( EMceBitmapIndexAttachmentFocus ), |
|
591 EFalse ); |
|
592 attachmentIcon = ETrue; |
|
593 } |
|
594 |
|
595 if ( entry.iType == KUidMsvMessageEntry ) |
|
596 { |
|
597 TMsvPriority entryPrio = entry.Priority(); |
|
598 if ( entryPrio != EMsvMediumPriority ) |
|
599 { |
|
600 TInt prioIcon = 0; |
|
601 TInt prioIconFocus = 0; |
|
602 if ( entryPrio == EMsvHighPriority ) |
|
603 { |
|
604 prioIcon = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityHigh ); |
|
605 prioIconFocus = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityHighFocus ); |
|
606 } |
|
607 else |
|
608 { |
|
609 prioIcon = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityLow ); |
|
610 prioIconFocus = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityLowFocus ); |
|
611 } |
|
612 |
|
613 if ( attachmentIcon ) |
|
614 { |
|
615 iTreeListBox->SetIcon( |
|
616 itemId, |
|
617 CAknSingleColumnStyleTreeList::EOptionalIcon2, |
|
618 prioIcon, |
|
619 EFalse ); |
|
620 iTreeListBox->SetIcon( |
|
621 itemId, |
|
622 CAknSingleColumnStyleTreeList::EHighlightedOptionalIcon2, |
|
623 prioIconFocus, |
|
624 EFalse ); |
|
625 } |
|
626 else |
|
627 { |
|
628 iTreeListBox->SetIcon( |
|
629 itemId, |
|
630 CAknSingleColumnStyleTreeList::EOptionalIcon1, |
|
631 prioIcon, |
|
632 EFalse ); |
|
633 iTreeListBox->SetIcon( |
|
634 itemId, |
|
635 CAknSingleColumnStyleTreeList::EHighlightedOptionalIcon1, |
|
636 prioIconFocus, |
|
637 EFalse ); |
|
638 } |
|
639 } |
|
640 } |
|
641 } |
|
642 |
|
643 // If unread message update subtitle icon |
|
644 if ( iTreeListBox->Parent( itemId ) > KAknTreeIIDRoot && entry.Unread() ) |
|
645 { |
|
646 UpdateSubtitleIconL( parentId, ETrue ); |
|
647 } |
|
648 iTreeListBox->SetEmphasis( itemId, entry.Unread(), EFalse ); |
|
649 } |
|
650 |
|
651 |
|
652 // ---------------------------------------------------- |
|
653 // CMceOneRowMessageListContainer::RemoveChildren |
|
654 // ---------------------------------------------------- |
|
655 // |
|
656 void CMceOneRowMessageListContainer::RemoveChildren( TAknTreeItemID aParentId ) |
|
657 { |
|
658 const TInt count = iTreeListBox->ChildCount( aParentId ); |
|
659 |
|
660 for ( TInt i = 0; i < count; i++ ) |
|
661 { |
|
662 TAknTreeItemID removedItem = iTreeListBox->Child( aParentId, 0); |
|
663 iTreeListBox->RemoveItem( removedItem, EFalse ); |
|
664 } |
|
665 } |
|
666 |
|
667 |
|
668 // ---------------------------------------------------- |
|
669 // CMceOneRowMessageListContainer::MopSupplyObject |
|
670 // ---------------------------------------------------- |
|
671 // |
|
672 TTypeUid::Ptr CMceOneRowMessageListContainer::MopSupplyObject( TTypeUid aId ) |
|
673 { |
|
674 if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) |
|
675 { |
|
676 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
677 } |
|
678 return CCoeControl::MopSupplyObject( aId ); |
|
679 } |
|
680 |
|
681 |
|
682 // ---------------------------------------------------- |
|
683 // CMceMainViewListContainer::ItemIndex |
|
684 // ---------------------------------------------------- |
|
685 TInt CMceOneRowMessageListContainer::ItemIndex( TMsvId aId ) const |
|
686 { |
|
687 return iListItems->ItemIndex( aId ); |
|
688 } |
|
689 |
|
690 |
|
691 // ---------------------------------------------------- |
|
692 // CMceOneRowMessageListContainer::Draw |
|
693 // ---------------------------------------------------- |
|
694 // |
|
695 void CMceOneRowMessageListContainer::Draw( const TRect& /*aRect*/ ) const |
|
696 { |
|
697 // Get the standard graphics context. |
|
698 CWindowGc& gc = SystemGc(); |
|
699 |
|
700 // Gets the control's extent. |
|
701 TRect rect = Rect(); |
|
702 |
|
703 // Clears the screen. |
|
704 gc.Clear( rect ); |
|
705 } |
|
706 |
|
707 |
|
708 // ---------------------------------------------------- |
|
709 // CMceOneRowMessageListContainer::Count |
|
710 // ---------------------------------------------------- |
|
711 // |
|
712 TInt CMceOneRowMessageListContainer::Count() const |
|
713 { |
|
714 return iListItems->MdcaCount(); |
|
715 } |
|
716 |
|
717 |
|
718 // ---------------------------------------------------- |
|
719 // CMceOneRowMessageListContainer::MessageCount |
|
720 // ---------------------------------------------------- |
|
721 // |
|
722 TInt CMceOneRowMessageListContainer::MessageCount() const |
|
723 { |
|
724 return iListItems->MessageCount(); |
|
725 } |
|
726 |
|
727 |
|
728 // ---------------------------------------------------- |
|
729 // CMceOneRowMessageListContainer::FolderCount |
|
730 // ---------------------------------------------------- |
|
731 // |
|
732 TInt CMceOneRowMessageListContainer::FolderCount() const |
|
733 { |
|
734 return iListItems->FolderCount(); |
|
735 } |
|
736 |
|
737 |
|
738 // ---------------------------------------------------- |
|
739 // CMceOneRowMessageListContainer::CurrentFolderId |
|
740 // ---------------------------------------------------- |
|
741 // |
|
742 TMsvId CMceOneRowMessageListContainer::CurrentFolderId() const |
|
743 { |
|
744 TMsvId folderId = 0; |
|
745 if ( iListItems ) |
|
746 { |
|
747 folderId = iListItems->FolderId(); |
|
748 } |
|
749 return folderId; |
|
750 } |
|
751 |
|
752 |
|
753 // ---------------------------------------------------- |
|
754 // CMceOneRowMessageListContainer::SetCurrentItemIdL |
|
755 // ---------------------------------------------------- |
|
756 TBool CMceOneRowMessageListContainer::SetCurrentItemIdL( TMsvId aEntryId ) |
|
757 { |
|
758 const TInt selectedIndex = ItemIndex( aEntryId ); |
|
759 |
|
760 if ( selectedIndex != KErrNotFound ) |
|
761 { |
|
762 TAknTreeItemID selectedTreeID = iListItems->TreeItemId( selectedIndex ); |
|
763 if ( selectedTreeID ) |
|
764 { |
|
765 TAknTreeItemID parentId = iListItems->ParentItemId( selectedIndex ); |
|
766 if ( !iTreeListBox->IsExpanded( parentId ) ) |
|
767 { |
|
768 iTreeListBox->ExpandNode( parentId, ETrue ); |
|
769 } |
|
770 iTreeListBox->SetFocusedItem( selectedTreeID ); |
|
771 } |
|
772 iSelectedItemWaitingIndex = NULL; |
|
773 } |
|
774 // Current entry not yet added to the list |
|
775 else if ( selectedIndex == KErrNotFound && aEntryId > 0 ) |
|
776 { |
|
777 iSelectedItemWaitingIndex = aEntryId; |
|
778 } |
|
779 |
|
780 return (selectedIndex != KErrNotFound); |
|
781 } |
|
782 |
|
783 |
|
784 // ---------------------------------------------------- |
|
785 // CMceOneRowMessageListContainer::RefreshListbox |
|
786 // ---------------------------------------------------- |
|
787 // |
|
788 void CMceOneRowMessageListContainer::RefreshListbox() |
|
789 { |
|
790 iTreeListBox->DrawDeferred(); |
|
791 } |
|
792 |
|
793 |
|
794 // ---------------------------------------------------- |
|
795 // CMceOneRowMessageListContainer::ItemCountChangedL |
|
796 // ---------------------------------------------------- |
|
797 // |
|
798 void CMceOneRowMessageListContainer::ItemCountChangedL( TBool /* aItemsAdded */ ) |
|
799 { |
|
800 ResetListbox(); |
|
801 } |
|
802 |
|
803 |
|
804 // ---------------------------------------------------- |
|
805 // CMceOneRowMessageListContainer::FolderEntry |
|
806 // ---------------------------------------------------- |
|
807 // |
|
808 const TMsvEntry& CMceOneRowMessageListContainer::FolderEntry() const |
|
809 { |
|
810 return iListItems->FolderEntry(); |
|
811 } |
|
812 |
|
813 |
|
814 // ---------------------------------------------------- |
|
815 // CMceOneRowMessageListContainer::CurrentItemId |
|
816 // ---------------------------------------------------- |
|
817 // |
|
818 TMsvId CMceOneRowMessageListContainer::CurrentItemId() const |
|
819 { |
|
820 return iListItems->MsvItemId( iTreeListBox->FocusedItem() ); |
|
821 } |
|
822 |
|
823 |
|
824 // ---------------------------------------------------- |
|
825 // CMceOneRowMessageListContainer::CurrentItemSelectionL |
|
826 // ---------------------------------------------------- |
|
827 // |
|
828 CMsvEntrySelection* CMceOneRowMessageListContainer::CurrentItemSelectionL() |
|
829 { |
|
830 return iSelectedEntries->CopyL(); |
|
831 } |
|
832 |
|
833 |
|
834 // ---------------------------------------------------- |
|
835 // CMceOneRowMessageListContainer::CurrentItemSelectionRefreshL |
|
836 // ---------------------------------------------------- |
|
837 // |
|
838 CMsvEntrySelection* CMceOneRowMessageListContainer::CurrentItemSelectionRefreshL() |
|
839 { |
|
840 MarkItemSelectionL(); |
|
841 return CurrentItemSelectionL(); |
|
842 } |
|
843 |
|
844 |
|
845 // ---------------------------------------------------- |
|
846 // CMceOneRowMessageListContainer::CurrentItemSelectionCount |
|
847 // ---------------------------------------------------- |
|
848 // |
|
849 TInt CMceOneRowMessageListContainer::CurrentItemSelectionCount() const |
|
850 { |
|
851 if ( iListItems->MdcaCount() == 0 ) |
|
852 { |
|
853 return 0; |
|
854 } |
|
855 TInt markedCount = 0; |
|
856 TRAP_IGNORE( markedCount = GetMarkedItemsCountL() ); |
|
857 return Max( 1, markedCount ); |
|
858 } |
|
859 |
|
860 |
|
861 // ---------------------------------------------------- |
|
862 // CMceOneRowMessageListContainer::SelectionCount |
|
863 // ---------------------------------------------------- |
|
864 // |
|
865 TInt CMceOneRowMessageListContainer::SelectionCount() const |
|
866 { |
|
867 TInt markedCount = 0; |
|
868 TRAP_IGNORE( markedCount = GetMarkedItemsCountL() ); |
|
869 return markedCount; |
|
870 } |
|
871 |
|
872 |
|
873 // ---------------------------------------------------- |
|
874 // CMceOneRowMessageListContainer::ClearSelection |
|
875 // ---------------------------------------------------- |
|
876 // |
|
877 void CMceOneRowMessageListContainer::ClearSelection() |
|
878 { |
|
879 if ( iTreeListBox ) |
|
880 { |
|
881 iTreeListBox->SetMarked( KAknTreeIIDRoot, EFalse, ETrue ); |
|
882 iListItems->SetItemMarked( KAknTreeIIDRoot, EFalse); |
|
883 } |
|
884 } |
|
885 |
|
886 |
|
887 // ---------------------------------------------------- |
|
888 // CMceOneRowMessageListContainer::MarkItemSelectionL |
|
889 // ---------------------------------------------------- |
|
890 // |
|
891 void CMceOneRowMessageListContainer::MarkItemSelectionL() |
|
892 { |
|
893 RArray<TAknTreeItemID> selection; |
|
894 CleanupClosePushL( selection ); |
|
895 iTreeListBox->GetMarkedItemsL( selection ); |
|
896 |
|
897 TInt count( selection.Count() ); |
|
898 iSelectedEntries->Reset(); |
|
899 // If subtitle is only marked item and focused item is different then add focused item to selection |
|
900 if ( count == 0 || ( count == 1 && iTreeListBox->IsNode( selection[0] ) ) ) |
|
901 |
|
902 { |
|
903 TMsvId id = CurrentItemId(); |
|
904 TAknTreeItemID focused = iTreeListBox->FocusedItem(); |
|
905 if ( id != KErrNotFound ) |
|
906 { |
|
907 // nothing in selection so add item under "cursor" |
|
908 iSelectedEntries->AppendL( id ); |
|
909 } |
|
910 else if ( focused > KAknTreeIIDNone && iTreeListBox->IsNode( focused ) ) // Focused item is subtitle |
|
911 { |
|
912 TInt index = iListItems->ItemIndexTreeId( focused ); |
|
913 const TInt childCount = iListItems->GetSubfolderItemCount( focused ); |
|
914 // Add all items under subtitle |
|
915 for (TInt loop = index + 1 ; loop <= childCount + index ; loop++ ) |
|
916 { |
|
917 id = iListItems->MsvItemId( iListItems->TreeItemId( loop ) ); |
|
918 if ( id != KErrNotFound ) |
|
919 { |
|
920 iSelectedEntries->AppendL( id ); |
|
921 } |
|
922 } |
|
923 } |
|
924 } |
|
925 else if ( count != 0 ) |
|
926 { |
|
927 for (TInt loop=0; loop < count; loop++ ) |
|
928 { |
|
929 TMsvId id = iListItems->MsvItemId( selection[ loop ] ); |
|
930 if ( id != KErrNotFound ) |
|
931 { |
|
932 iSelectedEntries->AppendL( id ); |
|
933 } |
|
934 } |
|
935 } |
|
936 |
|
937 CleanupStack::PopAndDestroy( &selection ); |
|
938 } |
|
939 |
|
940 |
|
941 // ---------------------------------------------------- |
|
942 // CMceOneRowMessageListContainer::SaveMarkingL |
|
943 // ---------------------------------------------------- |
|
944 // |
|
945 void CMceOneRowMessageListContainer::SaveMarkingL() |
|
946 { |
|
947 RArray<TAknTreeItemID> selection; |
|
948 CleanupClosePushL( selection ); |
|
949 iTreeListBox->GetMarkedItemsL( selection ); |
|
950 TInt count( selection.Count() ); |
|
951 |
|
952 if ( count > 0 ) |
|
953 { |
|
954 iListItems->SaveMarkingL( selection ); |
|
955 } |
|
956 CleanupStack::PopAndDestroy( &selection ); |
|
957 } |
|
958 |
|
959 |
|
960 // ---------------------------------------------------- |
|
961 // CMceOneRowMessageListContainer::ResetCurrentItemL |
|
962 // ---------------------------------------------------- |
|
963 // |
|
964 void CMceOneRowMessageListContainer::ResetCurrentItemL() |
|
965 { |
|
966 iSelectedItemWaitingIndex = NULL; |
|
967 } |
|
968 |
|
969 |
|
970 // ---------------------------------------------------- |
|
971 // CMceOneRowMessageListContainer::FindEntry |
|
972 // ---------------------------------------------------- |
|
973 // |
|
974 TMsvId CMceOneRowMessageListContainer::FindEntry( const TDesC& aMatchString ) const |
|
975 { |
|
976 |
|
977 TMsvId foundEntry = KErrNotFound; |
|
978 TInt index = iListItems->FindEntryIndex( aMatchString ); |
|
979 if ( index >= 0 ) |
|
980 { |
|
981 foundEntry = iListItems->ItemId( index ); |
|
982 } |
|
983 return foundEntry; |
|
984 } |
|
985 |
|
986 |
|
987 // ---------------------------------------------------- |
|
988 // CMceOneRowMessageListContainer::FindFirstUnreadMessageL |
|
989 // ---------------------------------------------------- |
|
990 // |
|
991 TBool CMceOneRowMessageListContainer::FindFirstUnreadMessageL( TMsvId& aEntryId ) const |
|
992 { |
|
993 return iListItems->FindFirstUnreadMessageL( aEntryId ); |
|
994 } |
|
995 |
|
996 |
|
997 // ---------------------------------------------------- |
|
998 // CMceOneRowMessageListContainer::AddCurrentItemToSelectionL |
|
999 // ---------------------------------------------------- |
|
1000 // |
|
1001 void CMceOneRowMessageListContainer::AddCurrentItemToSelectionL() |
|
1002 { |
|
1003 TAknTreeItemID focused = iTreeListBox->FocusedItem(); |
|
1004 |
|
1005 if ( iTreeListBox && focused != KAknTreeIIDNone ) |
|
1006 { |
|
1007 iTreeListBox->SetMarked( focused, ETrue, ETrue ); |
|
1008 iListItems->SetItemMarked( focused, ETrue); |
|
1009 } |
|
1010 } |
|
1011 |
|
1012 |
|
1013 // ---------------------------------------------------- |
|
1014 // CMceOneRowMessageListContainer::RemoveCurrentItemFromSelection |
|
1015 // ---------------------------------------------------- |
|
1016 // |
|
1017 void CMceOneRowMessageListContainer::RemoveCurrentItemFromSelection() |
|
1018 { |
|
1019 TAknTreeItemID focused = iTreeListBox->FocusedItem(); |
|
1020 if ( iTreeListBox && focused != KAknTreeIIDNone ) |
|
1021 { |
|
1022 iTreeListBox->SetMarked( iTreeListBox->FocusedItem(), |
|
1023 EFalse, ETrue ); |
|
1024 iListItems->SetItemMarked( focused, EFalse ); |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 |
|
1029 // ---------------------------------------------------- |
|
1030 // CMceOneRowMessageListContainer::RefreshSelectionIndexesL |
|
1031 // ---------------------------------------------------- |
|
1032 // |
|
1033 void CMceOneRowMessageListContainer::RefreshSelectionIndexesL( TBool aForceUpdate ) |
|
1034 { |
|
1035 RArray<TInt> selection; |
|
1036 CleanupClosePushL( selection ); |
|
1037 iTreeListBox->GetMarkedItemsL( selection ); |
|
1038 TInt count( selection.Count() ); |
|
1039 if ( count > 0 || aForceUpdate ) |
|
1040 { |
|
1041 CArrayFixFlat<TInt>* newSelection = new ( ELeave ) |
|
1042 CArrayFixFlat<TInt>( KMceListContainerGranuality ); |
|
1043 CleanupStack::PushL( newSelection ); |
|
1044 const TInt count = iSelectedEntries->Count(); |
|
1045 for ( TInt loop = count; loop >0; loop--) |
|
1046 { |
|
1047 TInt index = ItemIndex( (*iSelectedEntries)[loop-1] ); |
|
1048 if ( index > KErrNotFound ) |
|
1049 { |
|
1050 newSelection->AppendL( index ); |
|
1051 } |
|
1052 else |
|
1053 { |
|
1054 iSelectedEntries->Delete( loop-1 ); |
|
1055 } |
|
1056 } |
|
1057 CleanupStack::PopAndDestroy( newSelection ); |
|
1058 } |
|
1059 CleanupStack::PopAndDestroy( &selection ); |
|
1060 } |
|
1061 |
|
1062 |
|
1063 // ---------------------------------------------------- |
|
1064 // CMceOneRowMessageListContainer::AddAllToSelectionL |
|
1065 // ---------------------------------------------------- |
|
1066 // |
|
1067 void CMceOneRowMessageListContainer::AddAllToSelectionL() |
|
1068 { |
|
1069 if ( iTreeListBox ) |
|
1070 { |
|
1071 // The marking can be removed from every list item by specifying |
|
1072 // the tree root as the unmarked item. |
|
1073 iTreeListBox->SetMarked( KAknTreeIIDRoot, ETrue, ETrue ); |
|
1074 } |
|
1075 } |
|
1076 |
|
1077 |
|
1078 // ---------------------------------------------------- |
|
1079 // CMceOneRowMessageListContainer::MarkAllReadMessagesL |
|
1080 // ---------------------------------------------------- |
|
1081 // |
|
1082 void CMceOneRowMessageListContainer::MarkAllReadMessagesL() |
|
1083 { |
|
1084 if ( iTreeListBox ) |
|
1085 { |
|
1086 // do not mark folders. |
|
1087 const TInt count = iListItems->MdcaCount(); |
|
1088 for (TInt i=0; i<count;i++) |
|
1089 { |
|
1090 TMsvEntry entry; |
|
1091 if ( iListItems->GetEntry( i, entry ) == KErrNone && |
|
1092 entry.iType == KUidMsvMessageEntry && |
|
1093 !entry.Unread() ) |
|
1094 { |
|
1095 TAknTreeItemID treeItemId = iListItems->TreeItemId( i ); |
|
1096 iTreeListBox->SetMarked( treeItemId, ETrue, EFalse ); |
|
1097 } |
|
1098 } |
|
1099 iTreeListBox->DrawNow(); |
|
1100 } |
|
1101 } |
|
1102 |
|
1103 |
|
1104 // ---------------------------------------------------- |
|
1105 // CMceOneRowMessageListContainer::IsItemSelected |
|
1106 // ---------------------------------------------------- |
|
1107 // |
|
1108 TBool CMceOneRowMessageListContainer::IsItemSelected( TMsvId aItemId ) |
|
1109 { |
|
1110 if ( aItemId > 0 ) |
|
1111 { |
|
1112 TInt itemIndex = ItemIndex( aItemId ); |
|
1113 TAknTreeItemID treeIndex = iListItems->TreeItemId( itemIndex ); |
|
1114 return ( iTreeListBox->IsMarked( treeIndex ) ); |
|
1115 } |
|
1116 else // Node selected |
|
1117 { |
|
1118 TAknTreeItemID treeIndex = iTreeListBox->FocusedItem(); |
|
1119 return ( iTreeListBox->IsMarked( treeIndex ) ); |
|
1120 } |
|
1121 } |
|
1122 |
|
1123 |
|
1124 // ---------------------------------------------------- |
|
1125 // CMceMessageListContainer::SetAnchorItemIdL |
|
1126 // ---------------------------------------------------- |
|
1127 // |
|
1128 void CMceOneRowMessageListContainer::SetAnchorItemIdL( |
|
1129 TMessageListOperationType aOperationType ) |
|
1130 { |
|
1131 if ( iListItems->MdcaCount() == 0 ) |
|
1132 { |
|
1133 iAnchorItemId = KErrNotFound; |
|
1134 iAnchorItemIndex = KErrNotFound; |
|
1135 if ( aOperationType != EMessageListOperationCompleted ) |
|
1136 { |
|
1137 iLastOperationType = aOperationType; |
|
1138 } |
|
1139 return; |
|
1140 } |
|
1141 |
|
1142 switch ( aOperationType ) |
|
1143 { |
|
1144 case EMessageListOperationGeneral: |
|
1145 iAnchorItemIndex = iListItems->ItemIndexTreeId(iTreeListBox->FocusedItem()); |
|
1146 iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1147 break; |
|
1148 case EMessageListOperationConnect: |
|
1149 iAnchorItemIndex = iListItems->ItemIndexTreeId(iTreeListBox->FocusedItem()); |
|
1150 iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1151 break; |
|
1152 case EMessageListOperationFetchSelected: |
|
1153 |
|
1154 // find first from the marked messages list...? What if that is deleted when connected??? |
|
1155 if ( iSelectedEntries->Count() ) |
|
1156 { |
|
1157 // pick first one |
|
1158 iAnchorItemId = ( *iSelectedEntries )[0]; |
|
1159 iAnchorItemIndex = ItemIndex( iAnchorItemId ); |
|
1160 } |
|
1161 else |
|
1162 { |
|
1163 iAnchorItemIndex = iListItems->ItemIndexTreeId(iTreeListBox->FocusedItem()); |
|
1164 iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1165 } |
|
1166 break; |
|
1167 case EMessageListOperationFetchNew: |
|
1168 iAnchorItemIndex = iListItems->ItemIndexTreeId(iTreeListBox->FocusedItem()); |
|
1169 iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1170 break; |
|
1171 case EMessageListOperationDelete: |
|
1172 iAnchorItemIndex = iListItems->ItemIndexTreeId(iTreeListBox->FocusedItem()); |
|
1173 iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1174 break; |
|
1175 case EMessageListOperationCompleted: |
|
1176 HandleOperationCompletedL(); |
|
1177 break; |
|
1178 default: |
|
1179 break; |
|
1180 } |
|
1181 |
|
1182 #ifdef _DEBUG |
|
1183 RDebug::Print(_L("CMceMessageListContainer1: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex); |
|
1184 #endif |
|
1185 if ( aOperationType != EMessageListOperationCompleted ) |
|
1186 { |
|
1187 iLastOperationType = aOperationType; |
|
1188 } |
|
1189 } |
|
1190 |
|
1191 |
|
1192 // ---------------------------------------------------- |
|
1193 // CMceMessageListContainer::HandleMsvSessionEventL |
|
1194 // ---------------------------------------------------- |
|
1195 // |
|
1196 void CMceOneRowMessageListContainer::HandleMsvSessionEventL( |
|
1197 MMsvSessionObserver::TMsvSessionEvent aEvent, |
|
1198 CMsvEntrySelection& aSelection, |
|
1199 TBool aDraw ) |
|
1200 { |
|
1201 switch ( aEvent ) |
|
1202 { |
|
1203 case MMsvSessionObserver::EMsvEntriesDeleted: |
|
1204 { |
|
1205 EntryDeletedL( aSelection, aDraw ); |
|
1206 } |
|
1207 |
|
1208 break; |
|
1209 case MMsvSessionObserver::EMsvEntriesCreated: |
|
1210 { |
|
1211 EntryCreatedL( aSelection, aDraw ); |
|
1212 } |
|
1213 break; |
|
1214 |
|
1215 case MMsvSessionObserver::EMsvEntriesChanged: |
|
1216 { |
|
1217 TInt count = aSelection.Count(); |
|
1218 for (TInt i=0; i<count; i++) |
|
1219 { |
|
1220 UpdateEntryL( aSelection[i] ); |
|
1221 } |
|
1222 } |
|
1223 break; |
|
1224 default: |
|
1225 break; |
|
1226 }; |
|
1227 } |
|
1228 |
|
1229 |
|
1230 // ---------------------------------------------------- |
|
1231 // CMceOneRowMessageListContainer::FocusChanged |
|
1232 // ---------------------------------------------------- |
|
1233 // |
|
1234 void CMceOneRowMessageListContainer::FocusChanged(TDrawNow /*aDrawNow*/) |
|
1235 { |
|
1236 if ( iTreeListBox ) |
|
1237 { |
|
1238 iTreeListBox->SetFocus( IsFocused() ); |
|
1239 } |
|
1240 } |
|
1241 |
|
1242 |
|
1243 // ---------------------------------------------------- |
|
1244 // CMceOneRowMessageListContainer::MarkedItemsCount |
|
1245 // ---------------------------------------------------- |
|
1246 // |
|
1247 TInt CMceOneRowMessageListContainer::MarkedItemsCount() |
|
1248 { |
|
1249 TInt count = 0; |
|
1250 TRAP_IGNORE( count = GetMarkedItemsCountL() ); |
|
1251 return count; |
|
1252 } |
|
1253 |
|
1254 |
|
1255 // ---------------------------------------------------- |
|
1256 // CMceOneRowMessageListContainer::GetMarkedItemsCountL |
|
1257 // ---------------------------------------------------- |
|
1258 // |
|
1259 TInt CMceOneRowMessageListContainer::GetMarkedItemsCountL() const |
|
1260 { |
|
1261 RArray<TInt> selection; |
|
1262 CleanupClosePushL( selection ); |
|
1263 iTreeListBox->GetMarkedItemsL( selection ); |
|
1264 TInt count( selection.Count() ); |
|
1265 CleanupStack::PopAndDestroy( &selection ); |
|
1266 return count; |
|
1267 } |
|
1268 |
|
1269 |
|
1270 // ---------------------------------------------------- |
|
1271 // CMceOneRowMessageListContainer::OfferKeyEventL |
|
1272 // ---------------------------------------------------- |
|
1273 // |
|
1274 TKeyResponse CMceOneRowMessageListContainer::OfferKeyEventL( |
|
1275 const TKeyEvent& aKeyEvent, TEventCode aType) |
|
1276 { |
|
1277 if ( !iT9Interface ) |
|
1278 { |
|
1279 iT9Interface = CPtiEngine::NewL(); |
|
1280 if ( iInputMethodQwerty ) |
|
1281 { |
|
1282 iT9Interface->SetInputMode( EPtiEngineQwerty ); |
|
1283 iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineQwerty ); |
|
1284 } |
|
1285 else |
|
1286 { |
|
1287 iT9Interface->SetInputMode( EPtiEngineMultitapping ); |
|
1288 iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineMultitapping ); |
|
1289 } |
|
1290 iPreviousInputMethod = iInputMethodQwerty; |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 if ( iInputMethodQwerty != iPreviousInputMethod ) |
|
1295 { |
|
1296 if ( iInputMethodQwerty ) |
|
1297 { |
|
1298 iT9Interface->SetInputMode( EPtiEngineQwerty ); |
|
1299 iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineQwerty ); |
|
1300 } |
|
1301 else |
|
1302 { |
|
1303 iT9Interface->SetInputMode( EPtiEngineMultitapping ); |
|
1304 iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineMultitapping ); |
|
1305 } |
|
1306 iPreviousInputMethod = iInputMethodQwerty; |
|
1307 } |
|
1308 } |
|
1309 |
|
1310 if ( !iT9Timer ) |
|
1311 { |
|
1312 iT9Timer = CMceMessageListContainerKeyTimer::NewL( *iT9Interface ); |
|
1313 } |
|
1314 |
|
1315 if ( iTreeListBox ) |
|
1316 { |
|
1317 if ( aType == EEventKeyUp) |
|
1318 { |
|
1319 iDialerEvent = EFalse ; |
|
1320 } |
|
1321 if ( aType == EEventKeyDown && iDialerEvent ) |
|
1322 { |
|
1323 iDialerEvent = EFalse ; |
|
1324 } |
|
1325 if ( aType == EEventKey ) |
|
1326 { |
|
1327 |
|
1328 iOwningView.CancelMailboxTimer(); |
|
1329 |
|
1330 if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow ) |
|
1331 { |
|
1332 return EKeyWasNotConsumed; |
|
1333 } |
|
1334 |
|
1335 if ( iOwningView.MenuBar()->ItemSpecificCommandsEnabled() && aKeyEvent.iCode == EKeyBackspace ) |
|
1336 { |
|
1337 MarkItemSelectionL(); |
|
1338 SetAnchorItemIdL( |
|
1339 CMceMessageListContainerBase::EMessageListOperationGeneral ); |
|
1340 |
|
1341 TMsvId currentId = CurrentItemId(); |
|
1342 const TInt itemCount = CurrentItemSelectionCount(); |
|
1343 if ( itemCount != 0 && |
|
1344 ( itemCount != 1 || |
|
1345 currentId != KMceTemplatesEntryIdValue ) |
|
1346 ) |
|
1347 { |
|
1348 if ( currentId == KErrNotFound || // subtitle is selected, allow delete |
|
1349 !iListItems->DeleteDiscard( currentId ) ) |
|
1350 { |
|
1351 //if outbox and mms/sms connected, not delete |
|
1352 iOwningView.HandleCommandL( EMceCmdDelete ); |
|
1353 } |
|
1354 } |
|
1355 return EKeyWasConsumed; |
|
1356 } |
|
1357 else if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) |
|
1358 { |
|
1359 if ( aKeyEvent.iModifiers & EModifierShift || |
|
1360 aKeyEvent.iModifiers & EModifierCtrl ) |
|
1361 { |
|
1362 if ( iListItems->FolderId() != KMsvGlobalOutBoxIndexEntryIdValue && |
|
1363 IsCurrentItemFolder() ) |
|
1364 { |
|
1365 return EKeyWasNotConsumed; |
|
1366 } |
|
1367 } |
|
1368 else |
|
1369 { |
|
1370 iOwningView.SetHideExitCommand( ETrue ); |
|
1371 if ( iListItems->FolderId() == KMsvGlobalOutBoxIndexEntryIdValue || |
|
1372 iOwningView.SyncMlOutboxInbox( KMsvGlobalOutBoxIndexEntryId ) || |
|
1373 CurrentItemSelectionCount() == 0 || |
|
1374 iOwningView.CheckMMSNotificationOpenL() ) |
|
1375 { |
|
1376 // list is empty, open options menu |
|
1377 iOwningView.ProcessCommandL( EAknSoftkeyOptions ); |
|
1378 return EKeyWasConsumed; |
|
1379 } |
|
1380 } |
|
1381 } |
|
1382 |
|
1383 else if ( aKeyEvent.iCode == EKeyYes ) |
|
1384 { |
|
1385 if (!iDialerEvent && aKeyEvent.iRepeats == 0) |
|
1386 { |
|
1387 |
|
1388 // send key has been pressed in Inbox or in Documents folder |
|
1389 TMsvId folderId = iListItems->FolderId(); |
|
1390 if ( folderId != KMsvDraftEntryId && |
|
1391 folderId != KMsvGlobalOutBoxIndexEntryId && |
|
1392 folderId != KMsvSentEntryId && |
|
1393 folderId != KMceTemplatesEntryId |
|
1394 && ( CurrentItemSelectionCount() == 1 ) ) |
|
1395 { |
|
1396 if ( !( iListItems->IsFolderRemote() ) ) |
|
1397 { |
|
1398 TMsvId id = CurrentItemId(); |
|
1399 TBool validNumber = EFalse; |
|
1400 TPhCltTelephoneNumber number; |
|
1401 TBuf<KMceVisibleTextLength> recipientstring; |
|
1402 CMceUi* mceUi = static_cast<CMceUi*>( CCoeEnv::Static()->AppUi() ); |
|
1403 if (id != -1) |
|
1404 { |
|
1405 validNumber = MceUtils::ValidPhoneNumberL( id, mceUi->Session(), number, &recipientstring ); |
|
1406 } |
|
1407 if (KErrNotFound != number.Match( recipientstring )) |
|
1408 { |
|
1409 recipientstring = KNullDesC; |
|
1410 } |
|
1411 |
|
1412 // |
|
1413 // Callback number is supported in CDMA mode. If there isn't a phone |
|
1414 // book match for the sender, it gets confusing to display the sender's |
|
1415 // number (contained in recipientstring) and the callback number |
|
1416 // (contained in the number field) via CallToSenderQueryL. |
|
1417 // Therefore, if the recipientstring differs from the phone number |
|
1418 // to be used to call the sender and recipientstring is also a phone |
|
1419 // number, we won't display recipientstring when running in CDMA mode. |
|
1420 // |
|
1421 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
|
1422 { |
|
1423 if ( CommonPhoneParser::IsValidPhoneNumber( recipientstring, CommonPhoneParser::ESMSNumber ) ) |
|
1424 { |
|
1425 recipientstring = KNullDesC; |
|
1426 } |
|
1427 } |
|
1428 |
|
1429 if ( validNumber ) |
|
1430 { |
|
1431 iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong ); |
|
1432 MsvUiServiceUtilitiesInternal::CallToSenderQueryL( number, recipientstring, EFalse ); |
|
1433 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
1434 } |
|
1435 } |
|
1436 else // Enable Sendkey in Mail List |
|
1437 { |
|
1438 iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong ); |
|
1439 TMsvId id = CurrentItemId(); |
|
1440 |
|
1441 if ( id != -1) |
|
1442 { |
|
1443 iOwningView.HandleSendkeyInMailboxL( id ); |
|
1444 } |
|
1445 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
1446 } |
|
1447 } |
|
1448 SetAnchorItemIdL( |
|
1449 CMceMessageListContainerBase::EMessageListOperationGeneral ); |
|
1450 } |
|
1451 return EKeyWasConsumed; |
|
1452 } |
|
1453 |
|
1454 else if ( IsValidSearchKey( aKeyEvent ) ) |
|
1455 { |
|
1456 if ( !( FeatureManager::FeatureSupported(KFeatureIdJapanese) || |
|
1457 FeatureManager::FeatureSupported(KFeatureIdChinese) ) ) |
|
1458 { |
|
1459 HandleShortcutForSearchL( aKeyEvent ); |
|
1460 } |
|
1461 } |
|
1462 else if ( aKeyEvent.iCode == (TUint)EPtiKeyStar ) |
|
1463 { |
|
1464 if ( HasHandleStarKeyDoneL() ) // * key |
|
1465 { |
|
1466 return EKeyWasConsumed; |
|
1467 } |
|
1468 } |
|
1469 if ( iOwningView.IsMSKMailBox() || |
|
1470 iOwningView.IsMSKSyncMlMailBox() || |
|
1471 iListItems->FolderId() == KMsvGlobalInBoxIndexEntryId ) |
|
1472 { |
|
1473 } |
|
1474 } |
|
1475 |
|
1476 if ( iListItems->MdcaCount() > 0 && SelectionCount() == 0 ) |
|
1477 { |
|
1478 iOwningView.SetHideExitCommand( EFalse ); |
|
1479 } |
|
1480 TKeyResponse ret = iTreeListBox->OfferKeyEventL(aKeyEvent, aType); |
|
1481 iOwningView.SetCurrentItemId(); |
|
1482 SetAnchorItemIdL( |
|
1483 CMceMessageListContainerBase::EMessageListOperationGeneral ); |
|
1484 |
|
1485 if ( iOwningView.IsMSKMailBox() && |
|
1486 ( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow ) ) |
|
1487 { |
|
1488 iOwningView.SetMSKButtonL(); |
|
1489 } |
|
1490 return ret; |
|
1491 } |
|
1492 else |
|
1493 { |
|
1494 return EKeyWasNotConsumed; |
|
1495 } |
|
1496 } |
|
1497 |
|
1498 |
|
1499 //------------------------------------------------------------------------------- |
|
1500 //CMceMessageListContainer::IsValidSearchKey(const TKeyEvent& aKeyEvent) |
|
1501 //------------------------------------------------------------------------------- |
|
1502 // |
|
1503 TBool CMceOneRowMessageListContainer::IsValidSearchKey( const TKeyEvent& aKeyEvent ) |
|
1504 { |
|
1505 TBool response = EFalse; |
|
1506 if ( iInputMethodQwerty ) |
|
1507 { |
|
1508 response = ETrue; |
|
1509 } |
|
1510 if ((( aKeyEvent.iCode >= (TUint)EPtiKey0 && |
|
1511 aKeyEvent.iCode <= (TUint)EPtiKey9 ) ) |
|
1512 && !aKeyEvent.iRepeats ) |
|
1513 { |
|
1514 response = ETrue; |
|
1515 } |
|
1516 if ( aKeyEvent.iCode == EKeyUpArrow || |
|
1517 aKeyEvent.iCode == EKeyDownArrow ) |
|
1518 { |
|
1519 response = EFalse; |
|
1520 } |
|
1521 return response; |
|
1522 } |
|
1523 |
|
1524 |
|
1525 // ---------------------------------------------------- |
|
1526 // CMceMessageListContainer::StateCanBeChangedByStarKeyL() const |
|
1527 // Exam if it is the situation that * key can change message state |
|
1528 // Returns ETrue if it can |
|
1529 // Public |
|
1530 // ---------------------------------------------------- |
|
1531 // |
|
1532 TBool CMceOneRowMessageListContainer::StateCanBeChangedByStarKeyL() const |
|
1533 { |
|
1534 TMsvId folderId = iListItems->FolderId(); |
|
1535 TBool isRemoteFolder = iListItems->IsFolderRemote(); |
|
1536 |
|
1537 if ( ( iListItems->MessageCount() > 0 |
|
1538 && SelectionCount() == 0 |
|
1539 && !IsCurrentItemFolder() ) |
|
1540 && ( folderId == KMsvGlobalInBoxIndexEntryId //Inbox |
|
1541 || folderId == KMceDocumentsEntryId //Documents |
|
1542 || iListItems->GetParentFolderId() == KMceDocumentsEntryId //Subfolder of Documents |
|
1543 || isRemoteFolder ) ) // Mailbox & SyncMl |
|
1544 { |
|
1545 if ( iOwningView.IsSyncMl() ) |
|
1546 { |
|
1547 return( iOwningView.ListContainer()->FolderEntry().iRelatedId == KMsvGlobalInBoxIndexEntryId );//Inbox of SyncMail |
|
1548 } |
|
1549 return ETrue; |
|
1550 } |
|
1551 else |
|
1552 { |
|
1553 return EFalse; |
|
1554 } |
|
1555 } |
|
1556 |
|
1557 |
|
1558 // ---------------------------------------------------- |
|
1559 // CMceOneRowMessageListContainer::IsCurrentItemFolder |
|
1560 // ---------------------------------------------------- |
|
1561 // |
|
1562 TBool CMceOneRowMessageListContainer::IsCurrentItemFolder() const |
|
1563 { |
|
1564 TBool isCurrentFolder = EFalse; |
|
1565 const TMsvId id = CurrentItemId(); |
|
1566 if ( id != KErrNotFound ) |
|
1567 { |
|
1568 isCurrentFolder = IsItemFolder( id ); |
|
1569 } |
|
1570 return isCurrentFolder; |
|
1571 } |
|
1572 |
|
1573 |
|
1574 // ---------------------------------------------------- |
|
1575 // CMceOneRowMessageListContainer::IsItemFolder |
|
1576 // ---------------------------------------------------- |
|
1577 // |
|
1578 TBool CMceOneRowMessageListContainer::IsItemFolder( TMsvId aItemId ) const |
|
1579 { |
|
1580 return iListItems->IsItemFolder( aItemId ); |
|
1581 } |
|
1582 |
|
1583 |
|
1584 // ---------------------------------------------------- |
|
1585 // CMceOneRowMessageListContainer::IsItemFolder |
|
1586 // ---------------------------------------------------- |
|
1587 // |
|
1588 TBool CMceOneRowMessageListContainer::IsItemFolder( TInt aIndex ) const |
|
1589 { |
|
1590 TBool isCurrentFolder = EFalse; |
|
1591 const TMsvId id = iListItems->MsvItemId( aIndex ); |
|
1592 if ( id != KErrNotFound ) |
|
1593 { |
|
1594 isCurrentFolder = iListItems->IsItemFolder( id ); |
|
1595 } |
|
1596 return isCurrentFolder; |
|
1597 } |
|
1598 |
|
1599 |
|
1600 // ---------------------------------------------------- |
|
1601 // CMceOneRowMessageListContainer::IsItemRemote |
|
1602 // ---------------------------------------------------- |
|
1603 // |
|
1604 TBool CMceOneRowMessageListContainer::IsItemRemote( TMsvId aItemId ) const |
|
1605 { |
|
1606 return iListItems->IsItemRemote( aItemId ); |
|
1607 } |
|
1608 |
|
1609 |
|
1610 // ---------------------------------------------------- |
|
1611 // CMceOneRowMessageListContainer::IsOpenedFolder |
|
1612 // ---------------------------------------------------- |
|
1613 // |
|
1614 TBool CMceOneRowMessageListContainer::IsOpenedFolder( TMsvId aFolderId ) const |
|
1615 { |
|
1616 return ( iListItems->FolderId() == aFolderId ); |
|
1617 } |
|
1618 |
|
1619 |
|
1620 // ---------------------------------------------------- |
|
1621 // CMceMessageListContainer::DisplayOptionsMenuFromSelectionKey |
|
1622 // ---------------------------------------------------- |
|
1623 // |
|
1624 TBool CMceOneRowMessageListContainer::DisplayOptionsMenuFromSelectionKey() const |
|
1625 { |
|
1626 TInt itemCount = 0; |
|
1627 TRAP_IGNORE( itemCount = GetMarkedItemsCountL() ); |
|
1628 return ( (iListItems->MessageCount() + iListItems->FolderCount()) == 0 || itemCount ); |
|
1629 } |
|
1630 |
|
1631 |
|
1632 // ---------------------------------------------------- |
|
1633 // CMceMessageListContainer::GetHelpContext |
|
1634 // returns helpcontext as aContext |
|
1635 // ---------------------------------------------------- |
|
1636 // |
|
1637 void CMceOneRowMessageListContainer::GetHelpContext |
|
1638 (TCoeHelpContext& aContext) const |
|
1639 { |
|
1640 TMsvId folderId = iListItems->FolderId(); |
|
1641 aContext.iMajor = KMceApplicationUid; |
|
1642 |
|
1643 TBool isRemoteFolder = iListItems->IsFolderRemote(); |
|
1644 |
|
1645 /*if ( iOwningView.SyncMlOutboxInbox( KMsvGlobalInBoxIndexEntryId ) ) |
|
1646 { |
|
1647 aContext.iContext = KMCE_HLP_MESS_SYNCI; |
|
1648 } |
|
1649 else if ( iOwningView.SyncMlOutboxInbox( KMsvGlobalOutBoxIndexEntryId ) ) |
|
1650 { |
|
1651 aContext.iContext = KMCE_HLP_MESS_SYNCO; |
|
1652 } |
|
1653 |
|
1654 else if ( iOwningView.IsSyncMl() ) |
|
1655 { |
|
1656 aContext.iContext = KMCE_HLP_MESS_SYNC; |
|
1657 } |
|
1658 |
|
1659 else*/ |
|
1660 if ( folderId == KMsvDraftEntryId ) |
|
1661 { |
|
1662 aContext.iContext = KMCE_HLP_DRAFTS; |
|
1663 } |
|
1664 else if ( folderId == KMsvGlobalOutBoxIndexEntryId ) |
|
1665 { |
|
1666 aContext.iContext = KMCE_HLP_OUTBOX; |
|
1667 } |
|
1668 else if ( folderId == KMsvGlobalInBoxIndexEntryId ) |
|
1669 { |
|
1670 aContext.iContext = KMCE_HLP_INBOX; |
|
1671 } |
|
1672 else if ( folderId == KMsvSentEntryId ) |
|
1673 { |
|
1674 aContext.iContext = KMCE_HLP_SENT_ITEMS; |
|
1675 } |
|
1676 else if ( folderId == KMceDocumentsEntryId ) |
|
1677 { |
|
1678 aContext.iContext = KMCE_HLP_DOCUMENTS; |
|
1679 } |
|
1680 else if ( folderId == KMceTemplatesEntryId ) |
|
1681 { |
|
1682 aContext.iContext = KMCE_HLP_TEMPLATES; |
|
1683 } |
|
1684 else if ( !isRemoteFolder ) |
|
1685 { |
|
1686 // own folder |
|
1687 aContext.iContext = KMCE_HLP_FOLDER; |
|
1688 } |
|
1689 else |
|
1690 { |
|
1691 // remote account |
|
1692 TBool isConnected = iListItems->IsConnected(); |
|
1693 if ( isConnected ) |
|
1694 { |
|
1695 aContext.iContext = KMCE_HLP_MAILBOX_ONLINE; |
|
1696 } |
|
1697 else |
|
1698 { |
|
1699 aContext.iContext = KMCE_HLP_MAILBOX_OFFLINE; |
|
1700 } |
|
1701 } |
|
1702 } |
|
1703 |
|
1704 |
|
1705 // ---------------------------------------------------- |
|
1706 // CMceOneRowMessageListContainer::SetSortTypeL |
|
1707 // ---------------------------------------------------- |
|
1708 // |
|
1709 void CMceOneRowMessageListContainer::SetSortTypeL( TInt aSortType, TBool aOrdering ) |
|
1710 { |
|
1711 SaveMarkingL(); |
|
1712 ResetListbox(); |
|
1713 iListItems->SetOrderingL( aSortType, aOrdering ); |
|
1714 } |
|
1715 |
|
1716 |
|
1717 // ---------------------------------------------------- |
|
1718 // CMceOneRowMessageListContainer::SetMtmUiDataRegistry |
|
1719 // ---------------------------------------------------- |
|
1720 // |
|
1721 void CMceOneRowMessageListContainer::SetMtmUiDataRegistry( MMtmUiDataRegistryObserver* aRegistryObserver ) |
|
1722 { |
|
1723 iListItems->SetRegistryObserver( aRegistryObserver ); |
|
1724 } |
|
1725 |
|
1726 |
|
1727 // ---------------------------------------------------- |
|
1728 // CMceOneRowMessageListContainer::TMessageListItemType |
|
1729 // ---------------------------------------------------- |
|
1730 // |
|
1731 CMceMessageListContainerBase::TMessageListItemType CMceOneRowMessageListContainer::CurrentItemType() const |
|
1732 { |
|
1733 if ( iTreeListBox && |
|
1734 ( iListItems->MessageCount() || iListItems->FolderCount() ) |
|
1735 ) |
|
1736 { |
|
1737 TAknTreeItemID focusedItem = iTreeListBox->FocusedItem(); |
|
1738 if ( iListItems->MsvItemId( focusedItem ) > KErrNotFound ) |
|
1739 { |
|
1740 return CMceMessageListContainerBase::EMessageListItemMsvItem; |
|
1741 } |
|
1742 else if ( focusedItem == KAknTreeIIDNone ) |
|
1743 { |
|
1744 return CMceMessageListContainerBase::EMessageListItemUnknown; |
|
1745 } |
|
1746 else |
|
1747 { |
|
1748 return CMceMessageListContainerBase::EMessageListItemSubtitle; |
|
1749 } |
|
1750 } |
|
1751 return CMceMessageListContainerBase::EMessageListItemUnknown; |
|
1752 } |
|
1753 |
|
1754 |
|
1755 // ---------------------------------------------------- |
|
1756 // CMceOneRowMessageListContainer::ProcessCommandL |
|
1757 // ---------------------------------------------------- |
|
1758 // |
|
1759 void CMceOneRowMessageListContainer::ProcessCommandL(TInt /*aCommand*/) |
|
1760 { |
|
1761 } |
|
1762 |
|
1763 |
|
1764 // ---------------------------------------------------- |
|
1765 // CMceOneRowMessageListContainer::SetListEmptyTextL |
|
1766 // ---------------------------------------------------- |
|
1767 // |
|
1768 void CMceOneRowMessageListContainer::SetListEmptyTextL(const TDesC& aText ) |
|
1769 { |
|
1770 iTreeListBox->SetEmptyTextL( aText ); |
|
1771 } |
|
1772 |
|
1773 |
|
1774 // --------------------------------------------------------------------------- |
|
1775 // CMceOneRowMessageListContainer::ChangeMskCommand |
|
1776 // --------------------------------------------------------------------------- |
|
1777 // |
|
1778 void CMceOneRowMessageListContainer::ChangeMskCommand( TInt aLabelResourceId ) |
|
1779 { |
|
1780 // The MSK commands should not be changed when controlled by the list. |
|
1781 __ASSERT_DEBUG( !iMarkingModeEnabled, User::Invariant() ); |
|
1782 |
|
1783 // Get cba and set MSK command |
|
1784 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
1785 if ( cba ) |
|
1786 { |
|
1787 TBuf<KMSKLabel> label; |
|
1788 TRAP_IGNORE( cba->SetCommandL( KMSKPosition, aLabelResourceId ) ); |
|
1789 cba->DrawDeferred(); |
|
1790 } |
|
1791 } |
|
1792 |
|
1793 |
|
1794 // ---------------------------------------------------- |
|
1795 // CMceOneRowMessageListContainer::OptionsCommandSupported |
|
1796 // ---------------------------------------------------- |
|
1797 TUint CMceOneRowMessageListContainer::OptionsCommandSupported() const |
|
1798 { |
|
1799 TUint listCommand = TMessageListCommandNone; |
|
1800 |
|
1801 if ( iTreeListBox ) |
|
1802 { |
|
1803 TAknTreeItemID focused = iTreeListBox->FocusedItem(); |
|
1804 if ( focused ) |
|
1805 { |
|
1806 if ( focused != KAknTreeIIDNone ) |
|
1807 { |
|
1808 TAknTreeItemID parent = iTreeListBox->Parent( focused ); |
|
1809 // Focused item is a node and it is collapsed |
|
1810 if ( iTreeListBox->IsNode( focused ) |
|
1811 && !( iTreeListBox->IsExpanded( focused ) ) ) |
|
1812 { |
|
1813 listCommand = TMessageListCommandExpand; |
|
1814 } |
|
1815 |
|
1816 // Focused item is expanded node or data row of the expanded node |
|
1817 if ( ( iTreeListBox->IsNode( focused ) && iTreeListBox->IsExpanded( focused ) ) ) |
|
1818 { |
|
1819 listCommand = TMessageListCommandCollapse1; |
|
1820 } |
|
1821 else if ( iTreeListBox->IsLeaf( focused ) && parent != KAknTreeIIDRoot ) |
|
1822 { |
|
1823 listCommand = TMessageListCommandCollapse2; |
|
1824 } |
|
1825 } |
|
1826 } |
|
1827 else |
|
1828 { |
|
1829 // No item is focused |
|
1830 } |
|
1831 } |
|
1832 return listCommand; |
|
1833 } |
|
1834 |
|
1835 |
|
1836 // ---------------------------------------------------- |
|
1837 // CMceOneRowMessageListContainer::HandleOptionsCommandL |
|
1838 // ---------------------------------------------------- |
|
1839 void CMceOneRowMessageListContainer::HandleOptionsCommandL( TInt aCommand ) |
|
1840 { |
|
1841 // Handle list specific options command |
|
1842 iContainerFlags.ClearMceFlag( EMceOneRowFlagOptionsMenuOpen ); |
|
1843 switch( aCommand) |
|
1844 { |
|
1845 case TMessageListCommandCollapse1: |
|
1846 case TMessageListCommandCollapse2: |
|
1847 CollapseFocusedNode(); |
|
1848 break; |
|
1849 |
|
1850 case TMessageListCommandExpand: |
|
1851 ExpandFocusedNode(); |
|
1852 break; |
|
1853 default: |
|
1854 break; |
|
1855 } |
|
1856 } |
|
1857 |
|
1858 |
|
1859 // --------------------------------------------------------------------------- |
|
1860 // CMceOneRowMessageListContainer::ExpandFocusedNode |
|
1861 // --------------------------------------------------------------------------- |
|
1862 // |
|
1863 void CMceOneRowMessageListContainer::ExpandFocusedNode() |
|
1864 { |
|
1865 if ( iTreeListBox ) |
|
1866 { |
|
1867 // Get focused item ID. |
|
1868 TAknTreeItemID focused = iTreeListBox->FocusedItem(); |
|
1869 |
|
1870 // Check that focused item is a node and then expand it. |
|
1871 if ( focused != KAknTreeIIDNone && iTreeListBox->IsNode( focused ) ) |
|
1872 { |
|
1873 iTreeListBox->ExpandNode( focused, ETrue ); |
|
1874 } |
|
1875 } |
|
1876 } |
|
1877 |
|
1878 |
|
1879 // --------------------------------------------------------------------------- |
|
1880 // CMceOneRowMessageListContainer::CollapseFocusedNode |
|
1881 // --------------------------------------------------------------------------- |
|
1882 // |
|
1883 void CMceOneRowMessageListContainer::CollapseFocusedNode() |
|
1884 { |
|
1885 if ( iTreeListBox ) |
|
1886 { |
|
1887 // Get focused item ID. |
|
1888 TAknTreeItemID focused = iTreeListBox->FocusedItem(); |
|
1889 |
|
1890 // Check that focused item is a node or a leaf |
|
1891 if ( focused != KAknTreeIIDNone && iTreeListBox->IsNode( focused ) ) |
|
1892 { |
|
1893 iTreeListBox->CollapseNode( focused, ETrue ); |
|
1894 } |
|
1895 if ( iTreeListBox->IsLeaf( focused ) ) |
|
1896 { |
|
1897 iTreeListBox->CollapseNode( iTreeListBox->Parent( focused ), ETrue ); |
|
1898 } |
|
1899 } |
|
1900 } |
|
1901 |
|
1902 |
|
1903 // --------------------------------------------------------------------------- |
|
1904 // CMceOneRowMessageListContainer::DateTimeFormatChangedL |
|
1905 // --------------------------------------------------------------------------- |
|
1906 // |
|
1907 void CMceOneRowMessageListContainer::DateTimeFormatChangedL( TInt aChangeFlag ) |
|
1908 { |
|
1909 TInt change = aChangeFlag; |
|
1910 if ( ( change & EChangesMidnightCrossover )) |
|
1911 { |
|
1912 ResetListbox(); |
|
1913 iListItems->RefreshArrayL(); |
|
1914 } |
|
1915 else if ( ( change & EChangesLocale )) |
|
1916 { |
|
1917 TLocale locale; |
|
1918 TDay startOfWeek = locale.StartOfWeek(); |
|
1919 if ( startOfWeek != iStartOfWeek ) |
|
1920 { |
|
1921 iStartOfWeek = startOfWeek; |
|
1922 ResetListbox(); |
|
1923 iListItems->RefreshArrayL(); |
|
1924 return; |
|
1925 } |
|
1926 |
|
1927 TMsvSelectionOrdering listType = iListItems->SortType(); |
|
1928 TInt timeColumn = KMceColumn2; |
|
1929 if ( listType.Sorting() == EMsvSortByDate || |
|
1930 listType.Sorting() == EMsvSortByDateReverse ) |
|
1931 { |
|
1932 timeColumn = KMceColumn3; |
|
1933 } |
|
1934 |
|
1935 TInt count = iListItems->MdcaCount(); |
|
1936 for (TInt i=0; i<count; i++) |
|
1937 { |
|
1938 TAknTreeItemID treeItemId = iListItems->TreeItemId( i ); |
|
1939 TMsvId itemId = iListItems->MsvItemId( treeItemId ); |
|
1940 if ( itemId > KErrNotFound && treeItemId > KAknTreeIIDNone ) |
|
1941 { |
|
1942 // this is message, update time/date |
|
1943 TBuf<KMceTextItemSize> buffer; |
|
1944 iListItems->GetColumnTextL( i, timeColumn, buffer ); |
|
1945 iTreeListBox->SetTextL( |
|
1946 treeItemId, |
|
1947 buffer, |
|
1948 timeColumn-1, |
|
1949 EFalse ); |
|
1950 } |
|
1951 } |
|
1952 } |
|
1953 } |
|
1954 |
|
1955 |
|
1956 // --------------------------------------------------------------------------- |
|
1957 // CMceOneRowMessageListContainer::SetSpecialMskL |
|
1958 // --------------------------------------------------------------------------- |
|
1959 // |
|
1960 TInt CMceOneRowMessageListContainer::SetSpecialMskL() |
|
1961 { |
|
1962 TInt resourceId = R_MCE_MSK_BUTTON_EMPTY; |
|
1963 TAknTreeItemID focusedItem = iTreeListBox->FocusedItem(); |
|
1964 |
|
1965 if ( GetMarkedItemsCountL() == 0 ) |
|
1966 { |
|
1967 // Determine the MSK command depending on the focused item type and state. |
|
1968 if ( focusedItem == KAknTreeIIDNone ) |
|
1969 { |
|
1970 // No item focused. |
|
1971 } |
|
1972 else if ( iTreeListBox->IsNode( focusedItem ) ) |
|
1973 { |
|
1974 if ( iTreeListBox->IsExpanded( focusedItem ) ) |
|
1975 { |
|
1976 resourceId = R_MCE_QTN_MSK_COLLAPSE; |
|
1977 } |
|
1978 else |
|
1979 { |
|
1980 resourceId = R_MCE_QTN_MSK_EXPAND; |
|
1981 } |
|
1982 } |
|
1983 else if ( iTreeListBox->IsLeaf( focusedItem ) ) |
|
1984 { |
|
1985 resourceId = R_MCE_MSK_BUTTON_OPEN; |
|
1986 } |
|
1987 } |
|
1988 else |
|
1989 { |
|
1990 resourceId = R_MCE_MSK_BUTTON_CONTEXT_OPTIONS; |
|
1991 } |
|
1992 return resourceId; |
|
1993 } |
|
1994 |
|
1995 |
|
1996 // --------------------------------------------------------------------------- |
|
1997 // CMceOneRowMessageListContainer::UpdateEntryL |
|
1998 // --------------------------------------------------------------------------- |
|
1999 // |
|
2000 void CMceOneRowMessageListContainer::UpdateEntryL( TMsvId aEntryId ) |
|
2001 { |
|
2002 MCELOGGER_ENTERFN("CMceOneRowMessageListContainer::UpdateEntryL"); |
|
2003 TInt itemIndex = iListItems->ItemIndex( aEntryId ); |
|
2004 MCELOGGER_WRITE_FORMAT("aEntryId: 0x%x", aEntryId ); |
|
2005 MCELOGGER_WRITE_FORMAT("itemIndex : %d", itemIndex ); |
|
2006 if ( itemIndex < 0 ) |
|
2007 { |
|
2008 TMsvEntry entry; |
|
2009 if ( iListItems->GetEntry( aEntryId, entry ) == KErrNone ) |
|
2010 { |
|
2011 MCELOGGER_WRITE("entry found, try to add it"); |
|
2012 CMsvEntrySelection* selection = new(ELeave) CMsvEntrySelection(); |
|
2013 CleanupStack::PushL( selection ); |
|
2014 selection->AppendL( aEntryId ); |
|
2015 EntryCreatedL( *selection, ETrue ); |
|
2016 CleanupStack::PopAndDestroy( selection ); |
|
2017 } |
|
2018 |
|
2019 MCELOGGER_LEAVEFN("CMceOneRowMessageListContainer::UpdateEntryL1"); |
|
2020 return; |
|
2021 } |
|
2022 |
|
2023 TAknTreeItemID treeItemId = iListItems->TreeItemId( itemIndex ); |
|
2024 |
|
2025 TMsvEntry entry; |
|
2026 User::LeaveIfError( iListItems->GetEntry( aEntryId, entry ) ); |
|
2027 TInt foundIcon = KErrNotFound; |
|
2028 |
|
2029 CFbsBitmap* bitmap = NULL; |
|
2030 CFbsBitmap* bitmapMask = NULL; |
|
2031 foundIcon = iBitmapResolver->GetBitmapL( entry, bitmap, bitmapMask ); |
|
2032 if ( foundIcon < 0 ) |
|
2033 { |
|
2034 foundIcon = iTreeListBox->AddIconL( |
|
2035 bitmap, |
|
2036 bitmapMask, |
|
2037 EFalse, |
|
2038 EAspectRatioPreserved ); |
|
2039 iBitmapResolver->AddTreeIconIdL( bitmap, foundIcon, entry.iMtm ); |
|
2040 } |
|
2041 |
|
2042 |
|
2043 TBuf<KMceTextItemSize> bufferC1; |
|
2044 TBuf<KMceTextItemSize> bufferC2; |
|
2045 TBuf<KMceTextItemSize> bufferC3; |
|
2046 iListItems->GetColumnTextL( itemIndex, KMceColumn1, bufferC1 ); |
|
2047 iListItems->GetColumnTextL( itemIndex, KMceColumn2, bufferC2 ); |
|
2048 iListItems->GetColumnTextL( itemIndex, KMceColumn3, bufferC3 ); |
|
2049 |
|
2050 iTreeListBox->SetTextL( |
|
2051 treeItemId, |
|
2052 bufferC1, |
|
2053 0, |
|
2054 EFalse ); |
|
2055 |
|
2056 if ( IsItemFolder( entry.Id() )) |
|
2057 { |
|
2058 iTreeListBox->SetTextL( |
|
2059 treeItemId, |
|
2060 bufferC3, |
|
2061 1, |
|
2062 EFalse ); |
|
2063 } |
|
2064 else |
|
2065 { |
|
2066 iTreeListBox->SetTextL( |
|
2067 treeItemId, |
|
2068 bufferC2, |
|
2069 1, |
|
2070 EFalse ); |
|
2071 iTreeListBox->SetTextL( |
|
2072 treeItemId, |
|
2073 bufferC3, |
|
2074 2, |
|
2075 EFalse ); |
|
2076 } |
|
2077 |
|
2078 if ( foundIcon >= 0 ) |
|
2079 { |
|
2080 iTreeListBox->SetIcon( |
|
2081 treeItemId, |
|
2082 CAknSingleColumnStyleTreeList::ELeaf, |
|
2083 foundIcon, |
|
2084 EFalse ); |
|
2085 TBool attachmentIcon = EFalse; |
|
2086 |
|
2087 if ( entry.Attachment() && entry.iMtm != KSenduiMtmMmsUid |
|
2088 && IsMailMtmTechnology(entry.iMtm )) |
|
2089 { |
|
2090 iTreeListBox->SetIcon( |
|
2091 treeItemId, |
|
2092 CAknSingleColumnStyleTreeList::EOptionalIcon1, |
|
2093 iBitmapResolver->TreeIconId( EMceBitmapIndexAttachment ), |
|
2094 EFalse ); |
|
2095 iTreeListBox->SetIcon( |
|
2096 treeItemId, |
|
2097 CAknSingleColumnStyleTreeList::EHighlightedOptionalIcon1, |
|
2098 iBitmapResolver->TreeIconId( EMceBitmapIndexAttachmentFocus ), |
|
2099 EFalse ); |
|
2100 attachmentIcon = ETrue; |
|
2101 } |
|
2102 if ( entry.iType == KUidMsvMessageEntry ) |
|
2103 { |
|
2104 TMsvPriority entryPrio = entry.Priority(); |
|
2105 if ( entryPrio != EMsvMediumPriority ) |
|
2106 { |
|
2107 TInt prioIcon = 0; |
|
2108 TInt prioIconFocus = 0; |
|
2109 if ( entryPrio == EMsvHighPriority ) |
|
2110 { |
|
2111 prioIcon = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityHigh ); |
|
2112 prioIconFocus = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityHighFocus ); |
|
2113 } |
|
2114 else |
|
2115 { |
|
2116 prioIcon = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityLow ); |
|
2117 prioIconFocus = iBitmapResolver->TreeIconId( EMceBitmapIndexPriorityLowFocus ); |
|
2118 } |
|
2119 |
|
2120 if ( attachmentIcon ) |
|
2121 { |
|
2122 iTreeListBox->SetIcon( |
|
2123 treeItemId, |
|
2124 CAknSingleColumnStyleTreeList::EOptionalIcon2, |
|
2125 prioIcon, |
|
2126 EFalse ); |
|
2127 iTreeListBox->SetIcon( |
|
2128 treeItemId, |
|
2129 CAknSingleColumnStyleTreeList::EHighlightedOptionalIcon2, |
|
2130 prioIconFocus, |
|
2131 EFalse ); |
|
2132 } |
|
2133 else |
|
2134 { |
|
2135 iTreeListBox->SetIcon( |
|
2136 treeItemId, |
|
2137 CAknSingleColumnStyleTreeList::EOptionalIcon1, |
|
2138 prioIcon, |
|
2139 EFalse ); |
|
2140 iTreeListBox->SetIcon( |
|
2141 treeItemId, |
|
2142 CAknSingleColumnStyleTreeList::EHighlightedOptionalIcon1, |
|
2143 prioIconFocus, |
|
2144 EFalse ); |
|
2145 } |
|
2146 } |
|
2147 } |
|
2148 } |
|
2149 iTreeListBox->EnableThirdColumn( treeItemId, !IsItemFolder( entry.Id() ), EFalse ); |
|
2150 iTreeListBox->SetEmphasis( treeItemId, entry.Unread(), EFalse ); |
|
2151 TAknTreeItemID parentId = iTreeListBox->Parent( treeItemId ); |
|
2152 if ( parentId > KAknTreeIIDRoot ) |
|
2153 { |
|
2154 UpdateSubtitleIconL( parentId, EFalse ); |
|
2155 } |
|
2156 MCELOGGER_LEAVEFN("CMceOneRowMessageListContainer::UpdateEntryL2"); |
|
2157 } |
|
2158 |
|
2159 |
|
2160 // --------------------------------------------------------------------------- |
|
2161 // CMceOneRowMessageListContainer::EntryCreatedL |
|
2162 // --------------------------------------------------------------------------- |
|
2163 // |
|
2164 void CMceOneRowMessageListContainer::EntryCreatedL( |
|
2165 CMsvEntrySelection& aSelection, |
|
2166 TBool aDraw ) |
|
2167 { |
|
2168 MCELOGGER_ENTERFN("CMceOneRowMessageListContainer::EntryCreatedL"); |
|
2169 TBool tFocus = false; |
|
2170 for ( TInt i = 0; i < aSelection.Count(); i++ ) |
|
2171 { |
|
2172 TMsvId itemId = aSelection[i]; |
|
2173 TMsvEntry tentry; |
|
2174 iListItems->GetEntry( itemId, tentry); |
|
2175 if ( iEmailFramework && |
|
2176 ( tentry.iMtm == KSenduiMtmImap4Uid || |
|
2177 tentry.iMtm == KSenduiMtmPop3Uid || |
|
2178 tentry.iMtm == KSenduiMtmSmtpUid || |
|
2179 tentry.iMtm.iUid == KUidMsgTypeCmailMtmVal ) ) |
|
2180 { |
|
2181 continue; |
|
2182 } |
|
2183 MCELOGGER_WRITE_FORMAT("itemId: 0x%x", itemId ); |
|
2184 TInt itemsAdded = iListItems->EntryCreatedL( itemId ); |
|
2185 MCELOGGER_WRITE_FORMAT("itemsAdded: %d", itemsAdded ); |
|
2186 if ( itemsAdded < 1 ) |
|
2187 { |
|
2188 // item is hidden or otherwise we cound not find it, just ignore. |
|
2189 break; |
|
2190 } |
|
2191 |
|
2192 TInt itemIndex = iListItems->ItemIndex( itemId ); |
|
2193 MCELOGGER_WRITE_FORMAT("itemIndex: %d", itemIndex ); |
|
2194 TAknTreeItemID parentId = iListItems->ParentItemId( itemIndex ); |
|
2195 |
|
2196 if ( itemsAdded == 2 && parentId == KAknTreeIIDNone ) |
|
2197 { |
|
2198 TInt parentIndex = iListItems->ParentItemIndex( itemIndex ); |
|
2199 TBuf<KMceTextItemSize> subTitle; |
|
2200 TInt itemType = iListItems->GetSubtitleTextL( parentIndex, subTitle ); |
|
2201 if ( itemType > EHCListTypeNone ) |
|
2202 { |
|
2203 TUint32 flags = CAknSingleColumnStyleTreeList::EPersistent |
|
2204 | CAknSingleColumnStyleTreeList::EExpanded; |
|
2205 iNodeId = iTreeListBox->AddSubtitleRowL( KAknTreeIIDRoot, |
|
2206 subTitle, flags, EFalse ); |
|
2207 iListItems->SetTreeItemId( parentIndex, iNodeId ); |
|
2208 UpdateSubtitleIconL( iNodeId, EFalse ); |
|
2209 MCELOGGER_WRITE_FORMAT("Added subtitle row : 0x%x", iNodeId ); |
|
2210 iTreeListBox->SetNonEmpty( iNodeId, ETrue, EFalse ); |
|
2211 } |
|
2212 itemsAdded--; |
|
2213 } |
|
2214 |
|
2215 if ( itemsAdded == 1 ) |
|
2216 { |
|
2217 AddEntryL( itemIndex ); |
|
2218 |
|
2219 TMsvEntry entry; |
|
2220 if ( iListItems->GetEntry( itemId, entry ) == KErrNone ) |
|
2221 { |
|
2222 if (entry.Unread()) |
|
2223 { |
|
2224 iAnchorItemId = itemId; |
|
2225 tFocus = true; |
|
2226 } |
|
2227 else |
|
2228 { |
|
2229 tFocus = false; |
|
2230 } |
|
2231 } |
|
2232 MCELOGGER_WRITE_FORMAT("Added entry itemIndex: %d", itemIndex ); |
|
2233 } |
|
2234 |
|
2235 |
|
2236 } |
|
2237 |
|
2238 iTreeListBox->Sort( iListItems, CAknTreeList::ESaveFocus, ETrue ); |
|
2239 if (tFocus == true) |
|
2240 { |
|
2241 SetCurrentItemIdL( iAnchorItemId ); |
|
2242 } |
|
2243 |
|
2244 if ( aDraw ) |
|
2245 { |
|
2246 RefreshListbox(); |
|
2247 } |
|
2248 |
|
2249 MCELOGGER_LEAVEFN("CMceOneRowMessageListContainer::EntryCreatedL"); |
|
2250 } |
|
2251 |
|
2252 |
|
2253 // --------------------------------------------------------------------------- |
|
2254 // CMceOneRowMessageListContainer::EntryDeletedL |
|
2255 // --------------------------------------------------------------------------- |
|
2256 // |
|
2257 void CMceOneRowMessageListContainer::EntryDeletedL( |
|
2258 CMsvEntrySelection& aSelection, |
|
2259 TBool aDraw ) |
|
2260 { |
|
2261 TInt count = aSelection.Count(); |
|
2262 for (TInt i=0; i<count; i++) |
|
2263 { |
|
2264 TAknTreeItemID treeItemId = KAknTreeIIDNone; |
|
2265 TAknTreeItemID parentTreeItemId = KAknTreeIIDNone; |
|
2266 TBool deleteParent = iListItems->EntryDeletedL( aSelection[i], treeItemId, parentTreeItemId ); |
|
2267 if ( deleteParent ) |
|
2268 { |
|
2269 // this removes node and child |
|
2270 iTreeListBox->RemoveItem( parentTreeItemId, EFalse ); |
|
2271 TInt deleteSubtitle = iSelectedSubTitles.Find( parentTreeItemId ); |
|
2272 if ( deleteSubtitle != KErrNotFound ) |
|
2273 { |
|
2274 iSelectedSubTitles.Remove( deleteSubtitle ); |
|
2275 } |
|
2276 } |
|
2277 else if ( treeItemId > KAknTreeIIDRoot ) |
|
2278 { |
|
2279 // delete only one child, there are other children left so leave node untouched |
|
2280 iTreeListBox->RemoveItem( treeItemId, EFalse ); |
|
2281 if ( parentTreeItemId > KAknTreeIIDRoot && |
|
2282 iSelectedSubTitles.Find( parentTreeItemId ) == KErrNotFound ) |
|
2283 { |
|
2284 iSelectedSubTitles.AppendL( parentTreeItemId ) ; |
|
2285 } |
|
2286 } |
|
2287 } |
|
2288 |
|
2289 iDeletedMessges += count; |
|
2290 if ( iSelectedEntries->Count() == iDeletedMessges ) |
|
2291 { |
|
2292 TInt subTitleCount = iSelectedSubTitles.Count(); |
|
2293 for ( TInt i = 0; i < subTitleCount; i++ ) |
|
2294 { |
|
2295 UpdateSubtitleIconL( iSelectedSubTitles[i], EFalse ); |
|
2296 } |
|
2297 iDeletedMessges = 0; |
|
2298 iSelectedSubTitles.Reset(); |
|
2299 } |
|
2300 } |
|
2301 |
|
2302 |
|
2303 // --------------------------------------------------------------------------- |
|
2304 // CMceOneRowMessageListContainer::UpdateSubtitleIconL |
|
2305 // --------------------------------------------------------------------------- |
|
2306 // |
|
2307 void CMceOneRowMessageListContainer::UpdateSubtitleIconL( TAknTreeItemID aSubtitleID, TBool aReadStatusKnown ) |
|
2308 { |
|
2309 TBool hasUnread = EFalse; |
|
2310 if ( aReadStatusKnown ) |
|
2311 { |
|
2312 hasUnread = aReadStatusKnown; |
|
2313 } |
|
2314 else |
|
2315 { |
|
2316 hasUnread = iListItems->FindUnreadMessageUnderSubtitleL( aSubtitleID ); |
|
2317 } |
|
2318 |
|
2319 TInt iconID = GetSubtitleIcon( hasUnread ); |
|
2320 |
|
2321 iTreeListBox->SetIcon( |
|
2322 aSubtitleID, |
|
2323 CAknSingleColumnStyleTreeList::EExpandedNode, |
|
2324 iconID, |
|
2325 EFalse ); |
|
2326 |
|
2327 iTreeListBox->SetIcon( |
|
2328 aSubtitleID, |
|
2329 CAknSingleColumnStyleTreeList::ECollapsedNode, |
|
2330 iconID, |
|
2331 EFalse ); |
|
2332 } |
|
2333 |
|
2334 |
|
2335 //------------------------------------------------------------------------------- |
|
2336 //CMceOneRowMessageListContainer::HandleShortcutForSearchL( const TKeyEvent& aKeyEvent ) |
|
2337 //------------------------------------------------------------------------------- |
|
2338 // |
|
2339 void CMceOneRowMessageListContainer::HandleShortcutForSearchL( const TKeyEvent& aKeyEvent ) |
|
2340 { |
|
2341 // in remote mailbox key has been pressed, find item if sorted |
|
2342 // by subject or sender |
|
2343 TBuf<KMceTextBufferLength> text; |
|
2344 text.Zero(); |
|
2345 if ( iT9Interface->LastEnteredKey() != ( TInt ) aKeyEvent.iScanCode ) |
|
2346 { |
|
2347 iT9Interface->ClearCurrentWord(); |
|
2348 } |
|
2349 iT9Interface->AppendKeyPress( (TPtiKey)aKeyEvent.iScanCode ); |
|
2350 text = iT9Interface->CurrentWord(); |
|
2351 |
|
2352 iOwningView.FindAndSelectEntryL( text ); |
|
2353 iT9Timer->Start(); |
|
2354 } |
|
2355 |
|
2356 |
|
2357 //------------------------------------------------------------------------------- |
|
2358 //CMceOneRowMessageListContainer::HasHandleStarKeyDoneL() |
|
2359 //------------------------------------------------------------------------------- |
|
2360 // |
|
2361 TBool CMceOneRowMessageListContainer::HasHandleStarKeyDoneL() |
|
2362 { |
|
2363 TBool starkeyIsHandled = EFalse; |
|
2364 if ( StateCanBeChangedByStarKeyL() ) |
|
2365 { |
|
2366 if ( IsSortByDate() ) |
|
2367 { |
|
2368 MarkReadUnreadWithStarKeyL(); |
|
2369 } |
|
2370 else |
|
2371 { |
|
2372 // if sort by anything else other than by Date, handle focus change |
|
2373 TAknTreeItemID subtitle = iTreeListBox->Parent( |
|
2374 iTreeListBox->FocusedItem() ); |
|
2375 if ( subtitle > KAknTreeIIDRoot ) |
|
2376 { |
|
2377 TInt itemIndex = iTreeListBox->VisibleItemIndex( subtitle ); |
|
2378 if ( itemIndex < 0 ) |
|
2379 { |
|
2380 iTreeListBox->SetFocusedItem( subtitle, |
|
2381 KMceFocusOffsetTopView, ETrue ); |
|
2382 } |
|
2383 else |
|
2384 { |
|
2385 iTreeListBox->SetFocusedItem( subtitle, itemIndex , ETrue ); |
|
2386 } |
|
2387 } |
|
2388 else if ( subtitle == KAknTreeIIDRoot ) |
|
2389 { |
|
2390 TAknTreeItemID firstItem = iTreeListBox->Child( |
|
2391 KAknTreeIIDRoot, KMceFirstItemIndex ); |
|
2392 iTreeListBox->SetFocusedItem( firstItem, |
|
2393 KMceFocusOffsetTopView, ETrue ); |
|
2394 } |
|
2395 } |
|
2396 starkeyIsHandled = ETrue; |
|
2397 } |
|
2398 return starkeyIsHandled; |
|
2399 } |
|
2400 |
|
2401 |
|
2402 //------------------------------------------------------------------------------- |
|
2403 //CMceOneRowMessageListContainer::MarkReadUnreadWithStarKeyL() |
|
2404 //------------------------------------------------------------------------------- |
|
2405 // |
|
2406 void CMceOneRowMessageListContainer::MarkReadUnreadWithStarKeyL() |
|
2407 { |
|
2408 if ( CurrentItemType() == EMessageListItemMsvItem ) |
|
2409 { |
|
2410 MarkItemSelectionL(); |
|
2411 if( iOwningView.IsItemUnread( CurrentItemId() ) ) |
|
2412 { |
|
2413 iOwningView.HandleCommandL( EMceCmdMarkAsRead ); |
|
2414 } |
|
2415 else |
|
2416 { |
|
2417 iOwningView.HandleCommandL( EMceCmdMarkAsUnread ); |
|
2418 } |
|
2419 } |
|
2420 } |
|
2421 |
|
2422 |
|
2423 //------------------------------------------------------------------------------- |
|
2424 //CMceOneRowMessageListContainer::IsSortByDate() |
|
2425 //------------------------------------------------------------------------------- |
|
2426 // |
|
2427 TBool CMceOneRowMessageListContainer::IsSortByDate() |
|
2428 { |
|
2429 TMsvSelectionOrdering ordering = iListItems->SortType(); |
|
2430 return ( ( ordering.Sorting() == EMsvSortByDateReverse) || ( ordering.Sorting() == EMsvSortByDate ) ); |
|
2431 } |
|
2432 |
|
2433 |
|
2434 //------------------------------------------------------------------------------- |
|
2435 // CMceOneRowMessageListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
2436 //------------------------------------------------------------------------------- |
|
2437 void CMceOneRowMessageListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
2438 { |
|
2439 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
2440 { |
|
2441 iOwningView.SetMSKButtonL(); |
|
2442 iOwningView.SetCurrentItemId(); |
|
2443 if ( ( iOwningView.IsMSKMailBox() || |
|
2444 iListItems->FolderId() == KMsvDraftEntryId ) && |
|
2445 iTreeListBox->ChildCount( KAknTreeIIDRoot ) == 0 ) |
|
2446 { |
|
2447 iOwningView.ProcessCommandL( EAknSoftkeyContextOptions ); |
|
2448 } |
|
2449 } |
|
2450 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
2451 { |
|
2452 if ( iOwningView.IsMSKMailBox() ) |
|
2453 { |
|
2454 iOwningView.CancelMailboxTimer(); |
|
2455 } |
|
2456 } |
|
2457 iTreeListBox->HandlePointerEventL( aPointerEvent ); |
|
2458 } |
|
2459 |
|
2460 |
|
2461 // --------------------------------------------------------------------------- |
|
2462 // CMceOneRowMessageListContainer::SetContainerFlag |
|
2463 // --------------------------------------------------------------------------- |
|
2464 // |
|
2465 void CMceOneRowMessageListContainer::SetContainerFlag( TMceContainerFlags aFlag, TBool aState ) |
|
2466 { |
|
2467 switch ( aFlag ) |
|
2468 { |
|
2469 case EMceOneRowFlagOptionsMenuOpen: |
|
2470 if ( !aState ) |
|
2471 { |
|
2472 iContainerFlags.ClearMceFlag( EMceOneRowFlagOptionsMenuOpen ); |
|
2473 } |
|
2474 else |
|
2475 { |
|
2476 iContainerFlags.SetMceFlag( EMceOneRowFlagOptionsMenuOpen ); |
|
2477 } |
|
2478 break; |
|
2479 |
|
2480 case EMceOneRowFlagFirstSubtitleOpen: |
|
2481 if ( !aState ) |
|
2482 { |
|
2483 iContainerFlags.ClearMceFlag( EMceOneRowFlagFirstSubtitleOpen ); |
|
2484 } |
|
2485 else |
|
2486 { |
|
2487 iContainerFlags.SetMceFlag( EMceOneRowFlagFirstSubtitleOpen ); |
|
2488 } |
|
2489 break; |
|
2490 |
|
2491 default: |
|
2492 break; |
|
2493 } |
|
2494 } |
|
2495 |
|
2496 |
|
2497 // --------------------------------------------------------------------------- |
|
2498 // CMceOneRowMessageListContainer::UpdateIconArrayL |
|
2499 // --------------------------------------------------------------------------- |
|
2500 // |
|
2501 void CMceOneRowMessageListContainer::UpdateIconArrayL( ) |
|
2502 { |
|
2503 MCELOGGER_ENTERFN("CMceOneRowMessageListContainer::UpdateIconsInListL"); |
|
2504 |
|
2505 iBitmapResolver->UpdateIconArrayL( iTreeListBox ); |
|
2506 |
|
2507 const TInt count = iListItems->MdcaCount(); |
|
2508 |
|
2509 for ( TInt i = 0; i < count; i++ ) |
|
2510 { |
|
2511 TMsvId entryId = iListItems->ItemId(i); |
|
2512 if ( entryId > KErrNotFound ) // If KErrNotFound, then this is subtitle? |
|
2513 { |
|
2514 TAknTreeItemID treeItemId = iListItems->TreeItemId( i ); |
|
2515 |
|
2516 TMsvEntry entry; |
|
2517 // TODO: do not leave here |
|
2518 User::LeaveIfError( iListItems->GetEntry( entryId, entry ) ); |
|
2519 TInt foundIcon = KErrNotFound; |
|
2520 |
|
2521 CFbsBitmap* bitmap = NULL; |
|
2522 CFbsBitmap* bitmapMask = NULL; |
|
2523 foundIcon = iBitmapResolver->GetBitmapL( entry, bitmap, bitmapMask ); |
|
2524 if ( foundIcon < 0 ) |
|
2525 { |
|
2526 foundIcon = iTreeListBox->AddIconL( |
|
2527 bitmap, |
|
2528 bitmapMask, |
|
2529 EFalse, |
|
2530 EAspectRatioPreserved ); |
|
2531 iBitmapResolver->AddTreeIconIdL( bitmap, foundIcon, entry.iMtm ); |
|
2532 } |
|
2533 |
|
2534 if ( foundIcon >= 0 ) |
|
2535 { |
|
2536 iTreeListBox->SetIcon( |
|
2537 treeItemId, |
|
2538 CAknSingleColumnStyleTreeList::ELeaf, |
|
2539 foundIcon, |
|
2540 EFalse ); |
|
2541 } |
|
2542 } |
|
2543 } |
|
2544 MCELOGGER_LEAVEFN("CMceOneRowMessageListContainer::UpdateIconsInListL"); |
|
2545 } |
|
2546 // ---------------------------------------------------- |
|
2547 // CMceOneRowMessageListContainer::HandleOperationCompletedL |
|
2548 // ---------------------------------------------------- |
|
2549 void CMceOneRowMessageListContainer::HandleOperationCompletedL() |
|
2550 { |
|
2551 |
|
2552 if(iLastOperationType == EMessageListOperationConnect ) |
|
2553 { |
|
2554 iAnchorItemIndex=1; |
|
2555 iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
2556 SetCurrentItemIdL( iAnchorItemId ); |
|
2557 } |
|
2558 } |
|
2559 |
|
2560 // ---------------------------------------------------- |
|
2561 // CMceOneRowMessageListContainer::IsMailMtmTechnology |
|
2562 // ---------------------------------------------------- |
|
2563 TBool CMceOneRowMessageListContainer::IsMailMtmTechnology( TUid aMtm )const |
|
2564 { |
|
2565 TBool isMailMtm = EFalse; |
|
2566 if ( aMtm.iUid != 0 && aMtm != KUidMsvLocalServiceMtm && |
|
2567 iUiRegistry->IsPresent( aMtm) ) |
|
2568 { |
|
2569 // get MTM technology type |
|
2570 TUid technologyType = iUiRegistry->TechnologyTypeUid( aMtm); |
|
2571 isMailMtm = ( KMailTechnologyTypeUid == technologyType ); |
|
2572 } |
|
2573 return isMailMtm; |
|
2574 } |
|
2575 // End of File |