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