author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:08:45 +0300 | |
branch | RCL_3 |
changeset 71 | 17302fa075e1 |
parent 60 | 7fdbb852d323 |
child 77 | da6ac9d688df |
permissions | -rw-r--r-- |
60 | 1 |
/* |
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* List container user by message view. |
|
16 |
* Derived from CMceMessageListContainer. |
|
17 |
* |
|
18 |
*/ |
|
19 |
||
20 |
||
21 |
||
22 |
// INCLUDE FILES |
|
23 |
||
24 |
#include "mceui.h" |
|
25 |
#include "MceMessageListContainer.h" |
|
26 |
#include "MceMessageListbox.h" |
|
27 |
#include "MceMessageListView.h" |
|
28 |
#include "MceMessageListItemArray.h" |
|
29 |
#include "MceBitmapResolver.h" |
|
30 |
#include "MceCommands.hrh" |
|
31 |
#include "MceIds.hrh" |
|
32 |
#include <mce.rsg> |
|
33 |
#include "McePropertySubscriber.h" |
|
34 |
#include <PtiEngine.h> |
|
35 |
#include <AvkonInternalCRKeys.h> // KCRUidAvkon |
|
36 |
||
37 |
#include <msvids.h> |
|
38 |
#include <msvuids.h> // KUidMsvMessageEntry |
|
39 |
||
40 |
#include <bldvariant.hrh> |
|
41 |
||
42 |
#include <csxhelp/mce.hlp.hrh> |
|
43 |
#include <csxhelp/mbxs.hlp.hrh> |
|
44 |
#include "MceIds.h" |
|
45 |
#include <MuiuMsvUiServiceUtilities.h> |
|
46 |
||
47 |
#include <commonphoneparser.h> |
|
48 |
#include <featmgr.h> |
|
49 |
||
50 |
// For Muiu split |
|
51 |
#include <muiumsvuiserviceutilitiesinternal.h> |
|
52 |
||
53 |
// CONSTANTS |
|
54 |
||
55 |
const TInt KMceTextBufferLength = 10; // text buffer length |
|
56 |
const TInt KMceListContainerGranuality = 4; |
|
57 |
// ================= MEMBER FUNCTIONS ======================= |
|
58 |
||
59 |
// ---------------------------------------------------- |
|
60 |
// Constructor |
|
61 |
// ---------------------------------------------------- |
|
62 |
CMceMessageListContainer::CMceMessageListContainer( |
|
63 |
CMceMessageListView& aParentView ) |
|
64 |
: |
|
65 |
CMceMessageListContainerBase( aParentView ) |
|
66 |
{ |
|
67 |
} |
|
68 |
||
69 |
// ---------------------------------------------------- |
|
70 |
// Destructor |
|
71 |
// ---------------------------------------------------- |
|
72 |
CMceMessageListContainer::~CMceMessageListContainer() |
|
73 |
{ |
|
74 |
delete iT9Interface; |
|
75 |
delete iT9Timer; |
|
76 |
||
77 |
if (iQwertyModeStatusSubscriber) |
|
78 |
{ |
|
79 |
iQwertyModeStatusSubscriber->StopSubscribe(); |
|
80 |
} |
|
81 |
iQwertyModeStatusProperty.Close(); |
|
82 |
delete iQwertyModeStatusSubscriber; |
|
83 |
||
84 |
if ( iListBox ) |
|
85 |
{ |
|
86 |
// icon array is deleted by CMceUi class |
|
87 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( NULL ); |
|
88 |
} |
|
89 |
||
90 |
delete iListBox; |
|
91 |
delete iListItems; |
|
92 |
delete iSelectedEntries; |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
93 |
delete iAddedMsvIds; |
60 | 94 |
} |
95 |
||
96 |
// ---------------------------------------------------- |
|
97 |
// CMceMessageListContainer::NewL |
|
98 |
// ---------------------------------------------------- |
|
99 |
CMceMessageListContainer* CMceMessageListContainer::NewL( |
|
100 |
const TRect& aRect, |
|
101 |
CMsvSessionPtr aSession, |
|
102 |
TMsvId aFolderId, |
|
103 |
CMceBitmapResolver& aBitmapResolver, |
|
104 |
CMceMessageListView& aParentView ) |
|
105 |
{ |
|
106 |
CMceMessageListContainer* self = new (ELeave) CMceMessageListContainer( |
|
107 |
aParentView ); |
|
108 |
CleanupStack::PushL(self); |
|
109 |
self->ConstructL( aRect, aSession, aBitmapResolver, aFolderId ); |
|
110 |
CleanupStack::Pop(); // self |
|
111 |
return self; |
|
112 |
} |
|
113 |
||
114 |
// ---------------------------------------------------- |
|
115 |
// CMceMessageListContainer::ConstructL |
|
116 |
// ---------------------------------------------------- |
|
117 |
void CMceMessageListContainer::ConstructL( |
|
118 |
const TRect& aRect, |
|
119 |
CMsvSessionPtr aSession, |
|
120 |
CMceBitmapResolver& aBitmapResolver, |
|
121 |
TMsvId aFolderId ) |
|
122 |
{ |
|
123 |
CreateWindowL(); |
|
124 |
SetRect( aRect ); |
|
125 |
||
126 |
iListBox = new (ELeave) CMceMessageListBox( *this ); |
|
127 |
if(aFolderId == KMsvGlobalOutBoxIndexEntryIdValue) |
|
128 |
iListBox->ConstructL( this, EAknListBoxStylusMarkableList|EAknListBoxItemSpecificMenuDisabled ); |
|
129 |
else |
|
130 |
iListBox->ConstructL( this, EAknListBoxStylusMarkableList ); |
|
131 |
||
132 |
iListBox->ItemDrawer()->SetItemMarkReverse( ETrue ); |
|
133 |
iListBox->EnableMSKObserver( EFalse ); |
|
134 |
||
135 |
iListItems = CMceMessageListItemArray::NewL( |
|
136 |
aSession, aFolderId, EMceListTypeMessage, aBitmapResolver ); |
|
137 |
||
138 |
iListBox->Model()->SetItemTextArray( iListItems ); |
|
139 |
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
140 |
||
141 |
iListBox->SetListBoxObserver( &iOwningView ); |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
142 |
iListBox->SetMarkingModeObserver( this ); |
60 | 143 |
iSelectedEntries = new (ELeave) CMsvEntrySelection; |
144 |
||
145 |
iListBox->CreateScrollBarFrameL( ETrue ); |
|
146 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
147 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
148 |
||
149 |
iListBox->ItemDrawer()->FormattedCellData() |
|
150 |
->SetIconArray( aBitmapResolver.IconArray() ); |
|
151 |
||
152 |
iPreviousInputMethod = EFalse; |
|
153 |
||
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
154 |
iAddedMsvIds = new (ELeave) CMsvEntrySelection; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
155 |
|
60 | 156 |
User::LeaveIfError( iQwertyModeStatusProperty.Attach( |
157 |
KCRUidAvkon, KAknQwertyInputModeActive )); |
|
158 |
||
159 |
HandleQwertyModeChangeNotification(); |
|
160 |
iQwertyModeStatusSubscriber = CMcePropertySubscriber::NewL( |
|
161 |
TCallBack( QwertyModeChangeNotification, this ), iQwertyModeStatusProperty ); |
|
162 |
||
163 |
iQwertyModeStatusSubscriber->SubscribeL(); |
|
164 |
iDialerEvent = EFalse ; |
|
165 |
||
166 |
} |
|
167 |
||
168 |
// ---------------------------------------------------- |
|
169 |
// CMceMessageListContainer::MceListId |
|
170 |
// ---------------------------------------------------- |
|
171 |
TInt CMceMessageListContainer::MceListId() const |
|
172 |
{ |
|
173 |
return EMceListTypeTwoRow; |
|
174 |
} |
|
175 |
||
176 |
||
177 |
// ---------------------------------------------------- |
|
178 |
// CMceMessageListContainer::CountComponentControls |
|
179 |
// ---------------------------------------------------- |
|
180 |
TInt CMceMessageListContainer::CountComponentControls() const |
|
181 |
{ |
|
182 |
return 1; // always only listbox |
|
183 |
} |
|
184 |
||
185 |
// ---------------------------------------------------- |
|
186 |
// CMceMessageListContainer::ComponentControl |
|
187 |
// ---------------------------------------------------- |
|
188 |
CCoeControl* CMceMessageListContainer::ComponentControl(TInt /*aIndex*/) const |
|
189 |
{ |
|
190 |
return iListBox; |
|
191 |
} |
|
192 |
||
193 |
// ---------------------------------------------------- |
|
194 |
// CMceMessageListContainer::SetFolderL |
|
195 |
// ---------------------------------------------------- |
|
196 |
void CMceMessageListContainer::SetFolderL( TMsvId aFolderId ) |
|
197 |
{ |
|
198 |
if ( iListItems ) |
|
199 |
{ |
|
200 |
iListItems->SetFolderL( aFolderId ); |
|
201 |
} |
|
202 |
} |
|
203 |
||
204 |
// ---------------------------------------------------- |
|
205 |
// CMceMessageListContainer::Count |
|
206 |
// ---------------------------------------------------- |
|
207 |
TInt CMceMessageListContainer::Count() const |
|
208 |
{ |
|
209 |
return iListItems->MdcaCount(); |
|
210 |
} |
|
211 |
||
212 |
// ---------------------------------------------------- |
|
213 |
// CMceMessageListContainer::MessageCount |
|
214 |
// ---------------------------------------------------- |
|
215 |
TInt CMceMessageListContainer::MessageCount() const |
|
216 |
{ |
|
217 |
return iListItems->MessageCount(); |
|
218 |
} |
|
219 |
||
220 |
// ---------------------------------------------------- |
|
221 |
// CMceMessageListContainer::FolderCount |
|
222 |
// ---------------------------------------------------- |
|
223 |
TInt CMceMessageListContainer::FolderCount() const |
|
224 |
{ |
|
225 |
return iListItems->FolderCount(); |
|
226 |
} |
|
227 |
||
228 |
// ---------------------------------------------------- |
|
229 |
// CMceMessageListContainer::CurrentFolderId |
|
230 |
// ---------------------------------------------------- |
|
231 |
TMsvId CMceMessageListContainer::CurrentFolderId() const |
|
232 |
{ |
|
233 |
TMsvId folderId = 0; |
|
234 |
if ( iListItems ) |
|
235 |
{ |
|
236 |
folderId = iListItems->FolderId(); |
|
237 |
} |
|
238 |
return folderId; |
|
239 |
} |
|
240 |
||
241 |
// ---------------------------------------------------- |
|
242 |
// CMceMessageListContainer::SetCurrentItemIdL |
|
243 |
// ---------------------------------------------------- |
|
244 |
TBool CMceMessageListContainer::SetCurrentItemIdL( TMsvId aEntryId ) |
|
245 |
{ |
|
246 |
const TInt selectedIndex = ItemIndex( aEntryId ); |
|
247 |
if ( selectedIndex != KErrNotFound ) |
|
248 |
{ |
|
249 |
iAnchorItemIndex = selectedIndex; |
|
250 |
iAnchorItemId = aEntryId; |
|
251 |
||
252 |
//calulate the top item index |
|
253 |
TInt topIndex = iListBox->View()->CalcNewTopItemIndexSoItemIsVisible( selectedIndex ); |
|
254 |
iListBox->SetTopItemIndex( topIndex ); |
|
255 |
iListBox->SetCurrentItemIndex( selectedIndex ); |
|
256 |
iListBox->UpdateScrollBarsL(); |
|
257 |
iListBox->DrawDeferred(); |
|
258 |
// iListBox->SetCurrentItemIndex( selectedIndex ); |
|
259 |
} |
|
260 |
return (selectedIndex != KErrNotFound); |
|
261 |
||
262 |
} |
|
263 |
||
264 |
// ---------------------------------------------------- |
|
265 |
// CMceMessageListContainer::RefreshListbox |
|
266 |
// ---------------------------------------------------- |
|
267 |
void CMceMessageListContainer::RefreshListbox() |
|
268 |
{ |
|
269 |
iListBox->DrawDeferred(); |
|
270 |
} |
|
271 |
||
272 |
// ---------------------------------------------------- |
|
273 |
// CMceMessageListContainer::ItemCountChangedL |
|
274 |
// ---------------------------------------------------- |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
275 |
void CMceMessageListContainer::ItemCountChangedL( TBool aItemsAdded, |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
276 |
CArrayFix<TInt>* aAddedIndexes ) |
60 | 277 |
{ |
278 |
if ( aItemsAdded ) |
|
279 |
{ |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
280 |
if( aAddedIndexes ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
281 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
282 |
iListBox->HandleItemAdditionL( *aAddedIndexes ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
283 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
284 |
else |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
285 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
286 |
iListBox->HandleItemAdditionL(); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
287 |
} |
60 | 288 |
} |
289 |
else |
|
290 |
{ |
|
291 |
iListBox->HandleItemRemovalL(); |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
292 |
if( iOwningView.MarkingMode() && iListItems->MessageCount() <= 0 ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
293 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
294 |
SetMarkingModeOff(); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
295 |
} |
60 | 296 |
} |
297 |
} |
|
298 |
||
299 |
||
300 |
// ---------------------------------------------------- |
|
301 |
// CMceMessageListContainer::FolderEntry |
|
302 |
// ---------------------------------------------------- |
|
303 |
const TMsvEntry& CMceMessageListContainer::FolderEntry() const |
|
304 |
{ |
|
305 |
return iListItems->FolderEntry(); |
|
306 |
} |
|
307 |
||
308 |
// ---------------------------------------------------- |
|
309 |
// CMceMessageListContainer::CurrentItemIndex |
|
310 |
// ---------------------------------------------------- |
|
311 |
TInt CMceMessageListContainer::CurrentItemIndex() const |
|
312 |
{ |
|
313 |
return iListBox->CurrentItemIndex(); |
|
314 |
} |
|
315 |
||
316 |
// ---------------------------------------------------- |
|
317 |
// CMceMessageListContainer::CurrentItemId |
|
318 |
// ---------------------------------------------------- |
|
319 |
TMsvId CMceMessageListContainer::CurrentItemId() const |
|
320 |
{ |
|
321 |
return iListItems->ItemId( CurrentItemIndex() ); |
|
322 |
} |
|
323 |
||
324 |
// ---------------------------------------------------- |
|
325 |
// CMceMessageListContainer::CurrentItemListItem |
|
326 |
// ---------------------------------------------------- |
|
327 |
TMceListItem CMceMessageListContainer::CurrentItemListItem() const |
|
328 |
{ |
|
329 |
return iListItems->Item( CurrentItemIndex() ); |
|
330 |
} |
|
331 |
||
332 |
||
333 |
// ---------------------------------------------------- |
|
334 |
// CMceMessageListContainer::CurrentItemSelectionL |
|
335 |
// ---------------------------------------------------- |
|
336 |
CMsvEntrySelection* CMceMessageListContainer::CurrentItemSelectionL() |
|
337 |
{ |
|
338 |
return iSelectedEntries->CopyL(); |
|
339 |
} |
|
340 |
||
341 |
// ---------------------------------------------------- |
|
342 |
// CMceMessageListContainer::CurrentItemSelectionRefreshL |
|
343 |
// ---------------------------------------------------- |
|
344 |
CMsvEntrySelection* CMceMessageListContainer::CurrentItemSelectionRefreshL() |
|
345 |
{ |
|
346 |
MarkItemSelectionL(); |
|
347 |
return CurrentItemSelectionL(); |
|
348 |
} |
|
349 |
||
350 |
// ---------------------------------------------------- |
|
351 |
// CMceMessageListContainer::CurrentItemSelectionCount |
|
352 |
// ---------------------------------------------------- |
|
353 |
TInt CMceMessageListContainer::CurrentItemSelectionCount() const |
|
354 |
{ |
|
355 |
if ( iListItems->MdcaCount() == 0 ) |
|
356 |
{ |
|
357 |
return 0; |
|
358 |
} |
|
359 |
return Max( 1, iListBox->View()->SelectionIndexes()->Count() ); |
|
360 |
} |
|
361 |
||
362 |
||
363 |
// ---------------------------------------------------- |
|
364 |
// CMceOneRowMessageListContainer::SelectionCount |
|
365 |
// ---------------------------------------------------- |
|
366 |
TInt CMceMessageListContainer::SelectionCount() const |
|
367 |
{ |
|
368 |
return iListBox->View()->SelectionIndexes()->Count(); |
|
369 |
} |
|
370 |
||
371 |
// ---------------------------------------------------- |
|
372 |
// CMceMessageListContainer::ClearSelection |
|
373 |
// ---------------------------------------------------- |
|
374 |
void CMceMessageListContainer::ClearSelection() |
|
375 |
{ |
|
376 |
iSelectedEntries->Reset(); |
|
377 |
iListBox->View()->ClearSelection(); |
|
378 |
} |
|
379 |
||
380 |
// ---------------------------------------------------- |
|
381 |
// CMceMessageListContainer::ItemIndex |
|
382 |
// ---------------------------------------------------- |
|
383 |
TInt CMceMessageListContainer::ItemIndex( TMsvId aId ) const |
|
384 |
{ |
|
385 |
return iListItems->ItemIndex( aId ); |
|
386 |
} |
|
387 |
||
388 |
||
389 |
// ---------------------------------------------------- |
|
390 |
// CMceMessageListContainer::MarkItemSelectionL |
|
391 |
// ---------------------------------------------------- |
|
392 |
void CMceMessageListContainer::MarkItemSelectionL() |
|
393 |
{ |
|
394 |
const CListBoxView::CSelectionIndexArray* selection = |
|
395 |
iListBox->View()->SelectionIndexes(); |
|
396 |
TInt count = selection->Count(); |
|
397 |
iSelectedEntries->Reset(); |
|
398 |
if ( count != 0 ) |
|
399 |
{ |
|
400 |
for (TInt loop=0; loop < count; loop++ ) |
|
401 |
{ |
|
402 |
TMsvId id = iListItems->ItemId( (*selection)[loop] ); |
|
403 |
if ( id != KErrNotFound ) |
|
404 |
{ |
|
405 |
iSelectedEntries->AppendL( id ); |
|
406 |
} |
|
407 |
} |
|
408 |
} |
|
409 |
else |
|
410 |
{ |
|
411 |
TMsvId id = CurrentItemId(); |
|
412 |
if ( id != KErrNotFound ) |
|
413 |
{ |
|
414 |
// nothing in selection so add item under "cursor" |
|
415 |
iSelectedEntries->AppendL( id ); |
|
416 |
} |
|
417 |
} |
|
418 |
} |
|
419 |
||
420 |
// ---------------------------------------------------- |
|
421 |
// CMceMessageListContainer::AddItemToSelectionL |
|
422 |
// ---------------------------------------------------- |
|
423 |
void CMceMessageListContainer::AddItemToSelectionL( TMsvId aEntryId ) |
|
424 |
{ |
|
425 |
if ( aEntryId > KMsvRootIndexEntryId ) |
|
426 |
{ |
|
427 |
iSelectedEntries->AppendL( aEntryId ); |
|
428 |
} |
|
429 |
} |
|
430 |
// ---------------------------------------------------- |
|
431 |
// CMceMessageListContainer::AddCurrentItemToSelectionL |
|
432 |
// ---------------------------------------------------- |
|
433 |
void CMceMessageListContainer::AddCurrentItemToSelectionL() |
|
434 |
{ |
|
435 |
iListBox->View()->SelectItemL( CurrentItemIndex() ); |
|
436 |
AddItemToSelectionL( CurrentItemId() ); |
|
437 |
} |
|
438 |
||
439 |
// ---------------------------------------------------- |
|
440 |
// CMceMessageListContainer::RemoveItemFromSelection |
|
441 |
// ---------------------------------------------------- |
|
442 |
void CMceMessageListContainer::RemoveItemFromSelection( TMsvId aEntryId ) |
|
443 |
{ |
|
444 |
TInt index = iSelectedEntries->Find( aEntryId ); |
|
445 |
if ( index >= 0 ) |
|
446 |
{ |
|
447 |
iSelectedEntries->Delete( index ); |
|
448 |
} |
|
449 |
} |
|
450 |
||
451 |
// ---------------------------------------------------- |
|
452 |
// CMceMessageListContainer::RemoveCurrentItemFromSelection |
|
453 |
// ---------------------------------------------------- |
|
454 |
void CMceMessageListContainer::RemoveCurrentItemFromSelection() |
|
455 |
{ |
|
456 |
iListBox->View()->DeselectItem( CurrentItemIndex() ); |
|
457 |
RemoveItemFromSelection( CurrentItemId() ); |
|
458 |
} |
|
459 |
||
460 |
// ---------------------------------------------------- |
|
461 |
// CMceMessageListContainer::RefreshSelectionIndexesL |
|
462 |
// ---------------------------------------------------- |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
463 |
void CMceMessageListContainer::RefreshSelectionIndexesL( TBool /*aForceUpdate*/ ) |
60 | 464 |
{ |
465 |
||
466 |
||
467 |
} |
|
468 |
||
469 |
// ---------------------------------------------------- |
|
470 |
// CMceMessageListContainer::AddAllToSelectionL |
|
471 |
// ---------------------------------------------------- |
|
472 |
void CMceMessageListContainer::AddAllToSelectionL() |
|
473 |
{ |
|
474 |
CArrayFixFlat<TInt>* indexArray = new( ELeave ) CArrayFixFlat<TInt>( |
|
475 |
KMceListContainerGranuality ); |
|
476 |
CleanupStack::PushL( indexArray ); |
|
477 |
iSelectedEntries->Reset(); |
|
478 |
const TInt count = iListItems->MdcaCount(); |
|
479 |
for ( TInt loop = 0; loop < count; loop++ ) |
|
480 |
{ |
|
481 |
TMsvId id = iListItems->ItemId( loop ); |
|
482 |
if ( !iListItems->IsItemFolder( id ) ) |
|
483 |
{ |
|
484 |
indexArray->AppendL( loop ); |
|
485 |
iSelectedEntries->AppendL( id ); |
|
486 |
} |
|
487 |
} |
|
488 |
iListBox->SetSelectionIndexesL( indexArray ); |
|
489 |
CleanupStack::PopAndDestroy( indexArray ); |
|
490 |
} |
|
491 |
||
492 |
||
493 |
// ---------------------------------------------------- |
|
494 |
// CMceMessageListContainer::MarkAllReadMessagesL |
|
495 |
// ---------------------------------------------------- |
|
496 |
void CMceMessageListContainer::MarkAllReadMessagesL() |
|
497 |
{ |
|
498 |
CArrayFixFlat<TInt>* msgIndexArray = new( ELeave ) CArrayFixFlat<TInt>( 4 ); |
|
499 |
CleanupStack::PushL( msgIndexArray ); |
|
500 |
iSelectedEntries->Reset(); |
|
501 |
iListBox->View()->ClearSelection(); |
|
502 |
||
503 |
const TInt count = iListItems->MdcaCount(); |
|
504 |
for ( TInt loop = 0; loop < count; loop++ ) |
|
505 |
{ |
|
506 |
TMsvEntry entry; |
|
507 |
TMsvId entryId = iListItems->ItemId( loop ); |
|
508 |
if ( iListItems->GetEntry( entryId, entry ) == KErrNone ) |
|
509 |
{ |
|
510 |
if ( entry.iType == KUidMsvMessageEntry && |
|
511 |
!entry.Unread() ) |
|
512 |
{ |
|
513 |
msgIndexArray->AppendL( loop ); |
|
514 |
} |
|
515 |
} |
|
516 |
} |
|
517 |
||
518 |
if ( msgIndexArray->Count() > 0 ) |
|
519 |
{ |
|
520 |
iListBox->SetSelectionIndexesL( msgIndexArray ); |
|
521 |
iListBox->DrawDeferred(); |
|
522 |
} |
|
523 |
CleanupStack::PopAndDestroy( msgIndexArray ); |
|
524 |
} |
|
525 |
||
526 |
||
527 |
// ---------------------------------------------------- |
|
528 |
// CMceMessageListContainer::IsItemSelected |
|
529 |
// ---------------------------------------------------- |
|
530 |
TBool CMceMessageListContainer::IsItemSelected( TMsvId aItemId ) |
|
531 |
{ |
|
532 |
// Find selected items |
|
533 |
const CListBoxView::CSelectionIndexArray* items = |
|
534 |
iListBox->SelectionIndexes(); |
|
535 |
TInt itemIndex = iListItems->ItemIndex( aItemId ); |
|
536 |
TKeyArrayFix key(0, ECmpTInt); |
|
537 |
TInt pos; |
|
538 |
||
539 |
// Is item in selection array |
|
540 |
if ( items->Find(itemIndex, key, pos) != KErrNone ) |
|
541 |
{ |
|
542 |
return EFalse; |
|
543 |
} |
|
544 |
else |
|
545 |
{ |
|
546 |
return ETrue; |
|
547 |
} |
|
548 |
} |
|
549 |
||
550 |
||
551 |
// ---------------------------------------------------- |
|
552 |
// CMceMessageListContainer::SetMskL |
|
553 |
// ---------------------------------------------------- |
|
554 |
void CMceMessageListContainer::SetMskL() |
|
555 |
{ |
|
556 |
TInt currentItem = CurrentItemIndex(); |
|
557 |
TInt resourceId = currentItem == 0 ? |
|
558 |
R_MCE_MSK_BUTTON_SELECT:R_MCE_MSK_BUTTON_OPEN; |
|
559 |
||
560 |
if ( resourceId != iCurrMskResource ) |
|
561 |
{ |
|
562 |
iCurrMskResource = resourceId; |
|
563 |
CEikButtonGroupContainer* cba; |
|
564 |
cba = CEikButtonGroupContainer::Current(); |
|
565 |
const TInt KMSKPosition = 3; |
|
566 |
cba->SetCommandL( KMSKPosition, iCurrMskResource ); |
|
567 |
cba->DrawDeferred(); |
|
568 |
} |
|
569 |
} |
|
570 |
||
571 |
||
572 |
// ---------------------------------------------------- |
|
573 |
// CMceMessageListContainer::FocusChanged |
|
574 |
// ---------------------------------------------------- |
|
575 |
void CMceMessageListContainer::FocusChanged(TDrawNow /*aDrawNow*/) |
|
576 |
{ |
|
577 |
if (iListBox) |
|
578 |
{ |
|
579 |
iListBox->SetFocus(IsFocused()); |
|
580 |
} |
|
581 |
} |
|
582 |
||
583 |
||
584 |
// ---------------------------------------------------- |
|
585 |
// CMceMessageListContainer::MarkedItemsCount() |
|
586 |
// ---------------------------------------------------- |
|
587 |
TInt CMceMessageListContainer::MarkedItemsCount() |
|
588 |
{ |
|
589 |
return iListBox->View()->SelectionIndexes()->Count(); |
|
590 |
} |
|
591 |
||
592 |
||
593 |
// ---------------------------------------------------- |
|
594 |
// CMceMessageListContainer::OfferKeyEventL |
|
595 |
// ---------------------------------------------------- |
|
596 |
TKeyResponse CMceMessageListContainer::OfferKeyEventL( |
|
597 |
const TKeyEvent& aKeyEvent, |
|
598 |
TEventCode aType ) |
|
599 |
{ |
|
600 |
||
601 |
if ( !iT9Interface ) |
|
602 |
{ |
|
603 |
iT9Interface = CPtiEngine::NewL(); |
|
604 |
if ( iInputMethodQwerty ) |
|
605 |
{ |
|
606 |
iT9Interface->SetInputMode( EPtiEngineQwerty ); |
|
607 |
iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineQwerty ); |
|
608 |
} |
|
609 |
else |
|
610 |
{ |
|
611 |
iT9Interface->SetInputMode( EPtiEngineMultitapping ); |
|
612 |
iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineMultitapping ); |
|
613 |
} |
|
614 |
iPreviousInputMethod = iInputMethodQwerty; |
|
615 |
} |
|
616 |
else |
|
617 |
{ |
|
618 |
if ( iInputMethodQwerty != iPreviousInputMethod ) |
|
619 |
{ |
|
620 |
if ( iInputMethodQwerty ) |
|
621 |
{ |
|
622 |
iT9Interface->SetInputMode( EPtiEngineQwerty ); |
|
623 |
iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineQwerty ); |
|
624 |
} |
|
625 |
else |
|
626 |
{ |
|
627 |
iT9Interface->SetInputMode( EPtiEngineMultitapping ); |
|
628 |
iT9Interface->ActivateLanguageL( User::Language(), EPtiEngineMultitapping ); |
|
629 |
} |
|
630 |
iPreviousInputMethod = iInputMethodQwerty; |
|
631 |
} |
|
632 |
} |
|
633 |
||
634 |
if ( !iT9Timer ) |
|
635 |
{ |
|
636 |
iT9Timer = CMceMessageListContainerKeyTimer::NewL( *iT9Interface ); |
|
637 |
} |
|
638 |
||
639 |
if ( iListBox ) |
|
640 |
{ |
|
641 |
||
642 |
if ( aType == EEventKeyUp ) |
|
643 |
{ |
|
644 |
iOwningView.SetMSKButtonL(); |
|
645 |
iDialerEvent = EFalse ; |
|
646 |
} |
|
647 |
||
648 |
if ( aType == EEventKeyDown && iDialerEvent ) |
|
649 |
{ |
|
650 |
iDialerEvent = EFalse ; |
|
651 |
} |
|
652 |
if ( aType == EEventKey ) |
|
653 |
{ |
|
654 |
||
655 |
iOwningView.CancelMailboxTimer(); |
|
656 |
||
657 |
if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow ) |
|
658 |
{ |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
659 |
if( iOwningView.MarkingMode() ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
660 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
661 |
return EKeyWasConsumed; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
662 |
} |
60 | 663 |
return EKeyWasNotConsumed; |
664 |
} |
|
665 |
||
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
666 |
|
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
667 |
if ( ( iOwningView.MenuBar()->ItemSpecificCommandsEnabled() || SelectionCount() ) && aKeyEvent.iCode == EKeyBackspace ) |
60 | 668 |
{ |
669 |
MarkItemSelectionL(); |
|
670 |
SetAnchorItemIdL( |
|
671 |
CMceMessageListContainerBase::EMessageListOperationGeneral ); |
|
672 |
const TInt itemCount = CurrentItemSelectionCount(); |
|
673 |
if ( itemCount != 0 && |
|
674 |
( itemCount != 1 || |
|
675 |
CurrentItemId() != KMceTemplatesEntryIdValue ) |
|
676 |
) |
|
677 |
{ |
|
678 |
if ( !iListItems->DeleteDiscard( CurrentItemId() ) ) |
|
679 |
{ |
|
680 |
//if outbox and mms/sms connected, not delete |
|
681 |
iOwningView.HandleCommandL( EMceCmdDelete ); |
|
682 |
} |
|
683 |
} |
|
684 |
return EKeyWasConsumed; |
|
685 |
} |
|
686 |
else if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) |
|
687 |
{ |
|
688 |
if ( aKeyEvent.iModifiers & EModifierShift || |
|
689 |
aKeyEvent.iModifiers & EModifierCtrl ) |
|
690 |
{ |
|
691 |
if ( iListItems->FolderId() != KMsvGlobalOutBoxIndexEntryIdValue && |
|
692 |
IsCurrentItemFolder() ) |
|
693 |
{ |
|
694 |
return EKeyWasNotConsumed; |
|
695 |
} |
|
696 |
} |
|
697 |
else |
|
698 |
{ |
|
699 |
iOwningView.SetHideExitCommand( ETrue ); |
|
700 |
if ( iListItems->FolderId() == KMsvGlobalOutBoxIndexEntryIdValue || |
|
701 |
iOwningView.SyncMlOutboxInbox( KMsvGlobalOutBoxIndexEntryId ) || |
|
702 |
CurrentItemSelectionCount() == 0 || |
|
703 |
iOwningView.CheckMMSNotificationOpenL() ) |
|
704 |
{ |
|
705 |
if(iListItems->FolderId() == KMsvGlobalOutBoxIndexEntryIdValue) |
|
706 |
{ |
|
707 |
iOwningView.SetContextCommandFlag(ETrue); |
|
708 |
} |
|
709 |
// list is empty, open options menu |
|
710 |
iOwningView.ProcessCommandL( EAknSoftkeyOptions ); |
|
711 |
return EKeyWasConsumed; |
|
712 |
} |
|
713 |
} |
|
714 |
} |
|
715 |
||
716 |
else if ( aKeyEvent.iCode == EKeyYes ) |
|
717 |
{ |
|
718 |
if (!iDialerEvent && aKeyEvent.iRepeats == 0) |
|
719 |
{ |
|
720 |
// send key has been pressed in Inbox or in Documents folder |
|
721 |
TMsvId folderId = iListItems->FolderId(); |
|
722 |
if ( folderId != KMsvDraftEntryId && |
|
723 |
folderId != KMsvGlobalOutBoxIndexEntryId && |
|
724 |
folderId != KMsvSentEntryId && |
|
725 |
folderId != KMceTemplatesEntryId |
|
726 |
&& ( CurrentItemSelectionCount() == 1 ) ) |
|
727 |
{ |
|
728 |
if ( !( iListItems->IsFolderRemote() ) ) |
|
729 |
{ |
|
730 |
TMsvId id = CurrentItemId(); |
|
731 |
TBool validNumber = EFalse; |
|
732 |
TBuf<KMceVisibleTextLength> recipientstring; |
|
733 |
TPhCltTelephoneNumber number; |
|
734 |
CMceUi* mceUi = static_cast<CMceUi*>( iEikonEnv->AppUi() ); |
|
735 |
validNumber = MceUtils::ValidPhoneNumberL( id, mceUi->Session(), number, &recipientstring ); |
|
736 |
if (KErrNotFound != number.Match( recipientstring )) |
|
737 |
{ |
|
738 |
recipientstring = KNullDesC; |
|
739 |
} |
|
740 |
||
741 |
// |
|
742 |
// Callback number is supported in CDMA mode. If there isn't a phone |
|
743 |
// book match for the sender, it gets confusing to display the sender's |
|
744 |
// number (contained in recipientstring) and the callback number |
|
745 |
// (contained in the number field) via CallToSenderQueryL. |
|
746 |
// Therefore, if the recipientstring differs from the phone number |
|
747 |
// to be used to call the sender and recipientstring is also a phone |
|
748 |
// number, we won't display recipientstring when running in CDMA mode. |
|
749 |
// |
|
750 |
if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
|
751 |
{ |
|
752 |
if ( CommonPhoneParser::IsValidPhoneNumber( recipientstring, CommonPhoneParser::ESMSNumber ) ) |
|
753 |
{ |
|
754 |
recipientstring = KNullDesC; |
|
755 |
} |
|
756 |
} |
|
757 |
||
758 |
if ( validNumber ) |
|
759 |
{ |
|
760 |
iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong ); |
|
761 |
MsvUiServiceUtilitiesInternal::CallToSenderQueryL( number, recipientstring, EFalse ); |
|
762 |
iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
763 |
} |
|
764 |
} |
|
765 |
else //(iiListItems->IsFolderRemote()) Enable Sendkey in Mail List |
|
766 |
{ |
|
767 |
iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong ); |
|
768 |
iOwningView.HandleSendkeyInMailboxL( CurrentItemId() ); |
|
769 |
iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
770 |
} |
|
771 |
} |
|
772 |
SetAnchorItemIdL( |
|
773 |
CMceMessageListContainerBase::EMessageListOperationGeneral ); |
|
774 |
} |
|
775 |
return EKeyWasConsumed; |
|
776 |
} |
|
777 |
||
778 |
else if ( IsValidSearchKey( aKeyEvent ) ) |
|
779 |
{ |
|
780 |
if ( !( FeatureManager::FeatureSupported(KFeatureIdJapanese) || |
|
781 |
FeatureManager::FeatureSupported(KFeatureIdChinese) ) ) |
|
782 |
{ |
|
783 |
HandleShortcutForSearchL( aKeyEvent ); |
|
784 |
} |
|
785 |
} |
|
786 |
else if ( aKeyEvent.iCode == (TUint)EPtiKeyStar ) |
|
787 |
{ |
|
788 |
if ( HasHandleStarKeyDoneL() ) // * key |
|
789 |
{ |
|
790 |
return EKeyWasConsumed; |
|
791 |
} |
|
792 |
} |
|
793 |
} |
|
794 |
||
795 |
if ( iListItems->MdcaCount() > 0 && iListBox->View()->SelectionIndexes()->Count() == 0 ) |
|
796 |
{ |
|
797 |
iOwningView.SetHideExitCommand( EFalse ); |
|
798 |
} |
|
799 |
TKeyResponse ret = iListBox->OfferKeyEventL(aKeyEvent, aType); |
|
800 |
iOwningView.SetCurrentItemId(); |
|
801 |
SetAnchorItemIdL( |
|
802 |
CMceMessageListContainerBase::EMessageListOperationGeneral ); |
|
803 |
if ( ( aKeyEvent.iModifiers & EModifierShift || |
|
804 |
aKeyEvent.iModifiers & EModifierCtrl ) && |
|
805 |
( aKeyEvent.iCode == EKeyOK || |
|
806 |
aKeyEvent.iCode == EKeyEnter || |
|
807 |
aKeyEvent.iCode == EKeyUpArrow || |
|
808 |
aKeyEvent.iCode == EKeyDownArrow ) ) |
|
809 |
{ |
|
810 |
MarkItemSelectionL(); |
|
811 |
iOwningView.SetMSKButtonL(); |
|
812 |
} |
|
813 |
else if ( iOwningView.IsMSKMailBox() && |
|
814 |
( aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow ) ) |
|
815 |
{ |
|
816 |
iOwningView.SetMSKButtonL(); |
|
817 |
} |
|
818 |
return ret; |
|
819 |
} |
|
820 |
else |
|
821 |
{ |
|
822 |
return EKeyWasNotConsumed; |
|
823 |
} |
|
824 |
||
825 |
} |
|
826 |
||
827 |
// ---------------------------------------------------- |
|
828 |
// CMceMessageListContainer::IsCurrentItemFolder |
|
829 |
// ---------------------------------------------------- |
|
830 |
TBool CMceMessageListContainer::IsCurrentItemFolder() const |
|
831 |
{ |
|
832 |
TBool isCurrentFolder = EFalse; |
|
833 |
const TMsvId id = CurrentItemId(); |
|
834 |
if ( id != KErrNotFound ) |
|
835 |
{ |
|
836 |
isCurrentFolder = iListItems->IsItemFolder( id ); |
|
837 |
} |
|
838 |
return isCurrentFolder; |
|
839 |
} |
|
840 |
||
841 |
||
842 |
// ---------------------------------------------------- |
|
843 |
// CMceMessageListContainer::IsCurrentItemFolder |
|
844 |
// ---------------------------------------------------- |
|
845 |
TBool CMceMessageListContainer::IsItemFolder( TMsvId aItemId ) const |
|
846 |
{ |
|
847 |
return iListItems->IsItemFolder( aItemId ); |
|
848 |
} |
|
849 |
||
850 |
||
851 |
// ---------------------------------------------------- |
|
852 |
// CMceMessageListContainer::IsItemFolder |
|
853 |
// ---------------------------------------------------- |
|
854 |
TBool CMceMessageListContainer::IsItemFolder(TInt aIndex) const |
|
855 |
{ |
|
856 |
TBool isCurrentFolder = EFalse; |
|
857 |
const TMsvId id = iListItems->ItemId( aIndex ); |
|
858 |
if ( id != KErrNotFound ) |
|
859 |
{ |
|
860 |
isCurrentFolder = iListItems->IsItemFolder( id ); |
|
861 |
} |
|
862 |
return isCurrentFolder; |
|
863 |
} |
|
864 |
||
865 |
||
866 |
// ---------------------------------------------------- |
|
867 |
// CMceOneRowMessageListContainer::IsItemRemote |
|
868 |
// ---------------------------------------------------- |
|
869 |
TBool CMceMessageListContainer::IsItemRemote( TMsvId aItemId ) const |
|
870 |
{ |
|
871 |
return iListItems->IsItemRemote( aItemId ); |
|
872 |
} |
|
873 |
||
874 |
||
875 |
// ---------------------------------------------------- |
|
876 |
// CMceMessageListContainer::IsOutboxOpened |
|
877 |
// ---------------------------------------------------- |
|
878 |
TBool CMceMessageListContainer::IsOutboxOpened() const |
|
879 |
{ |
|
880 |
return IsOpenedFolder( KMsvGlobalOutBoxIndexEntryIdValue ); |
|
881 |
} |
|
882 |
||
883 |
||
884 |
// ---------------------------------------------------- |
|
885 |
// CMceMessageListContainer:: |
|
886 |
// ---------------------------------------------------- |
|
887 |
TBool CMceMessageListContainer::IsOpenedFolder( TMsvId aFolderId ) const |
|
888 |
{ |
|
889 |
return ( iListItems->FolderId() == aFolderId ); |
|
890 |
} |
|
891 |
||
892 |
||
893 |
// ---------------------------------------------------- |
|
894 |
// CMceMessageListContainer::DisplayOptionsMenuFromSelectionKey |
|
895 |
// ---------------------------------------------------- |
|
896 |
TBool CMceMessageListContainer::DisplayOptionsMenuFromSelectionKey() const |
|
897 |
{ |
|
898 |
return ( iListItems->MdcaCount() == 0 || iListBox->View()->SelectionIndexes()->Count() ); |
|
899 |
} |
|
900 |
||
901 |
||
902 |
// ---------------------------------------------------- |
|
903 |
// CMceMessageListContainer::GetHelpContext |
|
904 |
// returns helpcontext as aContext |
|
905 |
// ---------------------------------------------------- |
|
906 |
void CMceMessageListContainer::GetHelpContext |
|
907 |
(TCoeHelpContext& aContext) const |
|
908 |
{ |
|
909 |
TMsvId folderId = iListItems->FolderId(); |
|
910 |
aContext.iMajor = KMceApplicationUid; |
|
911 |
||
912 |
TBool isRemoteFolder = iListItems->IsFolderRemote(); |
|
913 |
||
914 |
/*if ( iOwningView.SyncMlOutboxInbox( KMsvGlobalInBoxIndexEntryId ) ) |
|
915 |
{ |
|
916 |
aContext.iContext = KMCE_HLP_MESS_SYNCI; |
|
917 |
} |
|
918 |
else if ( iOwningView.SyncMlOutboxInbox( KMsvGlobalOutBoxIndexEntryId ) ) |
|
919 |
{ |
|
920 |
aContext.iContext = KMCE_HLP_MESS_SYNCO; |
|
921 |
} |
|
922 |
||
923 |
else if ( iOwningView.IsSyncMl() ) |
|
924 |
{ |
|
925 |
aContext.iContext = KMCE_HLP_MESS_SYNC; |
|
926 |
} |
|
927 |
||
928 |
else*/ |
|
929 |
if ( folderId == KMsvDraftEntryId ) |
|
930 |
{ |
|
931 |
aContext.iContext = KMCE_HLP_DRAFTS; |
|
932 |
} |
|
933 |
else if ( folderId == KMsvGlobalOutBoxIndexEntryId ) |
|
934 |
{ |
|
935 |
aContext.iContext = KMCE_HLP_OUTBOX; |
|
936 |
} |
|
937 |
else if ( folderId == KMsvGlobalInBoxIndexEntryId ) |
|
938 |
{ |
|
939 |
aContext.iContext = KMCE_HLP_INBOX; |
|
940 |
} |
|
941 |
else if ( folderId == KMsvSentEntryId ) |
|
942 |
{ |
|
943 |
aContext.iContext = KMCE_HLP_SENT_ITEMS; |
|
944 |
} |
|
945 |
else if ( folderId == KMceDocumentsEntryId ) |
|
946 |
{ |
|
947 |
aContext.iContext = KMCE_HLP_DOCUMENTS; |
|
948 |
} |
|
949 |
else if ( folderId == KMceTemplatesEntryId ) |
|
950 |
{ |
|
951 |
aContext.iContext = KMCE_HLP_TEMPLATES; |
|
952 |
} |
|
953 |
else if ( !isRemoteFolder ) |
|
954 |
{ |
|
955 |
// own folder |
|
956 |
aContext.iContext = KMCE_HLP_FOLDER; |
|
957 |
} |
|
958 |
else |
|
959 |
{ |
|
960 |
// remote account |
|
961 |
TBool isConnected = iListItems->IsConnected(); |
|
962 |
if ( isConnected ) |
|
963 |
{ |
|
964 |
aContext.iContext = KMCE_HLP_MAILBOX_ONLINE; |
|
965 |
} |
|
966 |
else |
|
967 |
{ |
|
968 |
aContext.iContext = KMCE_HLP_MAILBOX_OFFLINE; |
|
969 |
} |
|
970 |
} |
|
971 |
||
972 |
} |
|
973 |
||
974 |
// ---------------------------------------------------- |
|
975 |
// CMceMessageListContainer::SyncMlOutboxOpened |
|
976 |
// ---------------------------------------------------- |
|
977 |
TBool CMceMessageListContainer::SyncMlOutboxOpened() const |
|
978 |
{ |
|
979 |
return ( iOwningView.SyncMlOutboxInbox( KMsvGlobalOutBoxIndexEntryId ) ); |
|
980 |
} |
|
981 |
||
982 |
||
983 |
||
984 |
// ---------------------------------------------------- |
|
985 |
// CMceMessageListContainer::HandleResourceChange |
|
986 |
// ---------------------------------------------------- |
|
987 |
void CMceMessageListContainer::HandleResourceChange( TInt aType ) |
|
988 |
{ |
|
989 |
CCoeControl::HandleResourceChange( aType ); |
|
990 |
if ( iListBox && aType == KEikDynamicLayoutVariantSwitch ) |
|
991 |
{ |
|
992 |
||
993 |
iListBox->ItemDrawer()->SetItemMarkReverse( ETrue ); |
|
994 |
SetRect( iOwningView.ClientRect() ); |
|
995 |
} |
|
996 |
} |
|
997 |
||
998 |
||
999 |
// ---------------------------------------------------- |
|
1000 |
// CMceMessageListContainer::SizeChanged |
|
1001 |
// ---------------------------------------------------- |
|
1002 |
void CMceMessageListContainer::SizeChanged() |
|
1003 |
{ |
|
1004 |
if (iListBox) |
|
1005 |
{ |
|
1006 |
iListBox->SetRect( Rect() ); |
|
1007 |
iListBox->ItemDrawer()->SetItemMarkReverse( ETrue ); |
|
1008 |
} |
|
1009 |
} |
|
1010 |
||
1011 |
// ---------------------------------------------------- |
|
1012 |
// CMceMessageListContainer::ProcessCommandL |
|
1013 |
// ---------------------------------------------------- |
|
1014 |
void CMceMessageListContainer::ProcessCommandL(TInt aCommand) |
|
1015 |
{ |
|
1016 |
if ( aCommand == EAknSoftkeyShiftMSK ) |
|
1017 |
{ |
|
1018 |
// Pass the MSK marking command as a key event to controls |
|
1019 |
const CListBoxView::CSelectionIndexArray* items = |
|
1020 |
iListBox->SelectionIndexes(); |
|
1021 |
||
1022 |
// check what state item under "cursor" is |
|
1023 |
TKeyArrayFix key(0, ECmpTInt); |
|
1024 |
TInt pos; |
|
1025 |
if ( !items->Find(CurrentItemIndex(), key, pos)) |
|
1026 |
{ |
|
1027 |
RemoveCurrentItemFromSelection(); |
|
1028 |
} |
|
1029 |
else |
|
1030 |
{ |
|
1031 |
AddCurrentItemToSelectionL(); |
|
1032 |
} |
|
1033 |
iOwningView.SetMSKButtonL(); |
|
1034 |
} |
|
1035 |
} |
|
1036 |
||
1037 |
||
1038 |
// ---------------------------------------------------- |
|
1039 |
// CMceMessageListContainer::StateCanBeChangedByStarKeyL() const |
|
1040 |
// Exam if it is the situation that * key can change message state |
|
1041 |
// Returns ETrue if it can |
|
1042 |
// Public |
|
1043 |
// ---------------------------------------------------- |
|
1044 |
TBool CMceMessageListContainer::StateCanBeChangedByStarKeyL() const |
|
1045 |
{ |
|
1046 |
TMsvId folderId = iListItems->FolderId(); |
|
1047 |
TBool isRemoteFolder = iListItems->IsFolderRemote(); |
|
1048 |
||
1049 |
if ( ( iListItems->MdcaCount() > 0 && |
|
1050 |
iListBox->View()->SelectionIndexes()->Count() == 0 && |
|
1051 |
!IsCurrentItemFolder() ) && |
|
1052 |
( folderId == KMsvGlobalInBoxIndexEntryId || //Inbox |
|
1053 |
folderId == KMceDocumentsEntryId || //Documents |
|
1054 |
iListItems->GetParentFolderId() == KMceDocumentsEntryId || //Subfolder of Documents |
|
1055 |
isRemoteFolder ) ) // Mailbox & SyncMl |
|
1056 |
{ |
|
1057 |
if ( iOwningView.IsSyncMl() ) |
|
1058 |
{ |
|
1059 |
return( iOwningView.ListContainer()->FolderEntry().iRelatedId == KMsvGlobalInBoxIndexEntryId );//Inbox of SyncMail |
|
1060 |
} |
|
1061 |
return ETrue; |
|
1062 |
} |
|
1063 |
else |
|
1064 |
{ |
|
1065 |
return EFalse; |
|
1066 |
} |
|
1067 |
} |
|
1068 |
||
1069 |
// TODO: maybe worth of adding new function for these listbox->ItemDrawer()->SetItemMarkXXX function? |
|
1070 |
// MarkItemSelectionL(); does selection but not mark |
|
1071 |
// AddCurrentItemToSelectionL(); selects and marks |
|
1072 |
||
1073 |
||
1074 |
//------------------------------------------------------------------------------- |
|
1075 |
// CMceMessageListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
1076 |
//------------------------------------------------------------------------------- |
|
1077 |
void CMceMessageListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
1078 |
{ |
|
1079 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
1080 |
{ |
|
1081 |
iOwningView.SetMSKButtonL(); |
|
1082 |
iOwningView.SetCurrentItemId(); |
|
1083 |
if ( ( iOwningView.IsMSKMailBox() || |
|
1084 |
iListItems->FolderId() == KMsvDraftEntryId ) && |
|
1085 |
iListBox->CurrentItemIndex() < 0 ) |
|
1086 |
{ |
|
1087 |
iOwningView.ProcessCommandL( EAknSoftkeyContextOptions ); |
|
1088 |
} |
|
1089 |
} |
|
1090 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
1091 |
{ |
|
1092 |
if ( iOwningView.IsMSKMailBox() ) |
|
1093 |
{ |
|
1094 |
iOwningView.CancelMailboxTimer(); |
|
1095 |
} |
|
1096 |
} |
|
1097 |
iListBox->HandlePointerEventL( aPointerEvent ); |
|
1098 |
} |
|
1099 |
||
1100 |
||
1101 |
//------------------------------------------------------------------------------- |
|
1102 |
//CMceMessageListContainer::IsValidSearchKey(const TKeyEvent& aKeyEvent) |
|
1103 |
//------------------------------------------------------------------------------- |
|
1104 |
TBool CMceMessageListContainer::IsValidSearchKey( const TKeyEvent& aKeyEvent ) |
|
1105 |
{ |
|
1106 |
TBool response = EFalse; |
|
1107 |
if ( iInputMethodQwerty ) |
|
1108 |
{ |
|
1109 |
response = ETrue; |
|
1110 |
} |
|
1111 |
if ((( aKeyEvent.iCode >= (TUint)EPtiKey0 && |
|
1112 |
aKeyEvent.iCode <= (TUint)EPtiKey9 ) ) |
|
1113 |
&& !aKeyEvent.iRepeats ) |
|
1114 |
{ |
|
1115 |
response = ETrue; |
|
1116 |
} |
|
1117 |
if ( aKeyEvent.iCode == EKeyUpArrow || |
|
1118 |
aKeyEvent.iCode == EKeyDownArrow ) |
|
1119 |
{ |
|
1120 |
response = EFalse; |
|
1121 |
} |
|
1122 |
return response; |
|
1123 |
} |
|
1124 |
||
1125 |
||
1126 |
//------------------------------------------------------------------------------- |
|
1127 |
//CMceMessageListContainer::HandleQwertyModeChangeNotification() |
|
1128 |
//------------------------------------------------------------------------------- |
|
1129 |
TInt CMceMessageListContainer::HandleQwertyModeChangeNotification() |
|
1130 |
{ |
|
1131 |
TInt err = iQwertyModeStatusProperty.Get( iInputMethodQwerty ); |
|
1132 |
if ( err ) |
|
1133 |
{ |
|
1134 |
// Set defaut inputmethod. 0 = No Qwerty -> EPtiEngineMultitapping |
|
1135 |
iInputMethodQwerty = 0; |
|
1136 |
} |
|
1137 |
return err; |
|
1138 |
} |
|
1139 |
||
1140 |
||
1141 |
//------------------------------------------------------------------------------- |
|
1142 |
//CMceMessageListContainer::QwertyModeChangeNotification(TAny* aObj) |
|
1143 |
//------------------------------------------------------------------------------- |
|
1144 |
TInt CMceMessageListContainer::QwertyModeChangeNotification( TAny* aObj ) |
|
1145 |
{ |
|
1146 |
TInt err = KErrArgument; |
|
1147 |
if ( aObj != NULL ) |
|
1148 |
{ |
|
1149 |
err = static_cast<CMceMessageListContainer*>(aObj)->HandleQwertyModeChangeNotification(); |
|
1150 |
} |
|
1151 |
return err; |
|
1152 |
} |
|
1153 |
||
1154 |
// ---------------------------------------------------- |
|
1155 |
// CMceMessageListContainer:: |
|
1156 |
// ---------------------------------------------------- |
|
1157 |
void CMceMessageListContainer::SetSortTypeL( TInt aSortType, TBool aOrdering ) |
|
1158 |
{ |
|
1159 |
iListItems->SetOrderingL( aSortType, aOrdering ); |
|
1160 |
} |
|
1161 |
||
1162 |
// ---------------------------------------------------- |
|
1163 |
// CMceMessageListContainer:: |
|
1164 |
// ---------------------------------------------------- |
|
1165 |
void CMceMessageListContainer::SetMtmUiDataRegistry( MMtmUiDataRegistryObserver* aRegistryObserver ) |
|
1166 |
{ |
|
1167 |
iListItems->SetRegistryObserver( aRegistryObserver ); |
|
1168 |
} |
|
1169 |
||
1170 |
// ---------------------------------------------------- |
|
1171 |
// CMceMessageListContainer:: |
|
1172 |
// ---------------------------------------------------- |
|
1173 |
TMsvId CMceMessageListContainer::FindEntry( const TDesC& aMatchString ) const |
|
1174 |
{ |
|
1175 |
TMsvId foundEntry = KErrNotFound; |
|
1176 |
TInt index = iListItems->FindEntryIndex( aMatchString ); |
|
1177 |
if ( index >= 0 ) |
|
1178 |
{ |
|
1179 |
foundEntry = iListItems->ItemId( index ); |
|
1180 |
} |
|
1181 |
return foundEntry; |
|
1182 |
||
1183 |
} |
|
1184 |
||
1185 |
// ---------------------------------------------------- |
|
1186 |
// CMceMessageListContainer:: |
|
1187 |
// ---------------------------------------------------- |
|
1188 |
TBool CMceMessageListContainer::FindFirstUnreadMessageL( TMsvId& aEntryId ) const |
|
1189 |
{ |
|
1190 |
return iListItems->FindFirstUnreadMessageL( aEntryId ); |
|
1191 |
} |
|
1192 |
||
1193 |
// ---------------------------------------------------- |
|
1194 |
// CMceMessageListContainer:: |
|
1195 |
// ---------------------------------------------------- |
|
1196 |
void CMceMessageListContainer::ResetCurrentItemL() |
|
1197 |
{ |
|
1198 |
if ( iListItems->MdcaCount() ) |
|
1199 |
{ |
|
1200 |
//calulate the top item index |
|
1201 |
TInt topIndex = iListBox->View()->CalcNewTopItemIndexSoItemIsVisible( 0 ); |
|
1202 |
iListBox->SetTopItemIndex( topIndex ); |
|
1203 |
iListBox->SetCurrentItemIndex( 0 ); |
|
1204 |
} |
|
1205 |
iListBox->UpdateScrollBarsL(); |
|
1206 |
} |
|
1207 |
||
1208 |
// ---------------------------------------------------- |
|
1209 |
// CMceMessageListContainer:: |
|
1210 |
// ---------------------------------------------------- |
|
1211 |
CMceMessageListContainerBase::TMessageListItemType CMceMessageListContainer::CurrentItemType() const |
|
1212 |
{ |
|
1213 |
if ( iListItems->MdcaCount() ) |
|
1214 |
{ |
|
1215 |
return CMceMessageListContainerBase::EMessageListItemMsvItem; |
|
1216 |
} |
|
1217 |
return CMceMessageListContainerBase::EMessageListItemUnknown; |
|
1218 |
} |
|
1219 |
||
1220 |
// ---------------------------------------------------- |
|
1221 |
// CMceMessageListContainer:: |
|
1222 |
// ---------------------------------------------------- |
|
1223 |
void CMceMessageListContainer::SetListEmptyTextL(const TDesC& aText) |
|
1224 |
{ |
|
1225 |
iListBox->View()->SetListEmptyTextL( aText ); |
|
1226 |
} |
|
1227 |
||
1228 |
// ---------------------------------------------------- |
|
1229 |
// CMceMessageListContainer:: |
|
1230 |
// ---------------------------------------------------- |
|
1231 |
void CMceMessageListContainer::SetAnchorItemIdL( |
|
1232 |
TMessageListOperationType aOperationType ) |
|
1233 |
{ |
|
1234 |
if ( iListItems->MdcaCount() == 0 ) |
|
1235 |
{ |
|
1236 |
iAnchorItemId = KErrNotFound; |
|
1237 |
iAnchorItemIndex = KErrNotFound; |
|
1238 |
iLastOperationType = aOperationType; |
|
1239 |
return; |
|
1240 |
} |
|
1241 |
||
1242 |
switch ( aOperationType ) |
|
1243 |
{ |
|
1244 |
case EMessageListOperationGeneral: |
|
1245 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1246 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1247 |
break; |
|
1248 |
case EMessageListOperationConnect: |
|
1249 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1250 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1251 |
break; |
|
1252 |
case EMessageListOperationFetchSelected: |
|
1253 |
// find first from the marked messages list...? What if that is deleted when connected??? |
|
1254 |
if ( iSelectedEntries->Count() ) |
|
1255 |
{ |
|
1256 |
// pick first one |
|
1257 |
iAnchorItemId = (*iSelectedEntries)[0]; |
|
1258 |
iAnchorItemIndex = iListItems->ItemIndex( iAnchorItemId ); |
|
1259 |
} |
|
1260 |
else |
|
1261 |
{ |
|
1262 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1263 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1264 |
} |
|
1265 |
break; |
|
1266 |
case EMessageListOperationFetchNew: |
|
1267 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1268 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1269 |
break; |
|
1270 |
case EMessageListOperationDelete: |
|
1271 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1272 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1273 |
break; |
|
1274 |
case EMessageListOperationCompleted: |
|
1275 |
HandleOperationCompletedL(); |
|
1276 |
break; |
|
1277 |
default: |
|
1278 |
// assert debug ? |
|
1279 |
break; |
|
1280 |
} |
|
1281 |
||
1282 |
#ifdef _DEBUG |
|
1283 |
RDebug::Print(_L("CMceMessageListContainer1: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex); |
|
1284 |
#endif |
|
1285 |
if ( aOperationType != EMessageListOperationCompleted ) |
|
1286 |
{ |
|
1287 |
iLastOperationType = aOperationType; |
|
1288 |
} |
|
1289 |
} |
|
1290 |
||
1291 |
// ---------------------------------------------------- |
|
1292 |
// CMceMessageListContainer:: |
|
1293 |
// ---------------------------------------------------- |
|
1294 |
void CMceMessageListContainer::HandleOperationCompletedL() |
|
1295 |
{ |
|
1296 |
if ( /*iLastOperationType == EMessageListOperationConnect &&*/ |
|
1297 |
iAnchorItemIndex == KErrNotFound ) |
|
1298 |
{ |
|
1299 |
// set focus to first one... |
|
1300 |
if ( iListItems->MdcaCount() ) |
|
1301 |
{ |
|
1302 |
iListBox->SetCurrentItemIndex( 0 ); |
|
1303 |
iAnchorItemIndex = 0; |
|
1304 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1305 |
} |
|
1306 |
RefreshListbox(); |
|
1307 |
} |
|
1308 |
SetAnchorItemIdL( EMessageListOperationGeneral ); |
|
1309 |
} |
|
1310 |
||
1311 |
// ---------------------------------------------------- |
|
1312 |
// CMceMessageListContainer:: |
|
1313 |
// ---------------------------------------------------- |
|
1314 |
void CMceMessageListContainer::HandleMsvSessionEventL( |
|
1315 |
MMsvSessionObserver::TMsvSessionEvent aEvent, |
|
1316 |
CMsvEntrySelection& aSelection, |
|
1317 |
TBool aDraw ) |
|
1318 |
{ |
|
1319 |
#ifdef _DEBUG |
|
1320 |
RDebug::Print(_L("CMceMessageListContainer2: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex); |
|
1321 |
#endif |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1322 |
// listitem addition handling when all the new item indexes can be resolved |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1323 |
if( iOwningView.MarkingMode() && iAddedMsvIds->Count() > 0 ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1324 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1325 |
TBool allItemsInTheList( ETrue ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1326 |
CArrayFix<TInt>* addedIndexes = new( ELeave ) CArrayFixFlat<TInt> ( |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1327 |
KMceListContainerGranuality ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1328 |
CleanupStack::PushL( addedIndexes ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1329 |
for( TInt i( 0 ); i < iAddedMsvIds->Count(); i++ ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1330 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1331 |
TMsvId msvId = (*iAddedMsvIds)[i]; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1332 |
TInt index = iListItems->ItemIndex( msvId ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1333 |
if ( index > KErrNotFound ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1334 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1335 |
addedIndexes->AppendL( index ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1336 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1337 |
else |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1338 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1339 |
allItemsInTheList = EFalse; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1340 |
break; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1341 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1342 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1343 |
if( allItemsInTheList ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1344 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1345 |
ItemCountChangedL( ETrue, addedIndexes ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1346 |
iAddedMsvIds->Reset(); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1347 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1348 |
CleanupStack::PopAndDestroy( addedIndexes ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1349 |
addedIndexes = NULL; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1350 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1351 |
else if( iAddedMsvIds->Count() > 0 ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1352 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1353 |
iAddedMsvIds->Reset(); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1354 |
} |
60 | 1355 |
switch ( aEvent ) |
1356 |
{ |
|
1357 |
case MMsvSessionObserver::EMsvEntriesDeleted: |
|
1358 |
{ |
|
1359 |
/* if ( iOwningView.IsMSKMailBox() ) // focus setting only for email |
|
1360 |
{ |
|
1361 |
} |
|
1362 |
else*/ |
|
1363 |
{ |
|
1364 |
ItemCountChangedL( EFalse ); |
|
1365 |
TInt selectedIndex = ItemIndex( iAnchorItemId ); |
|
1366 |
if ( selectedIndex == KErrNotFound ) |
|
1367 |
{ |
|
1368 |
// we could not find anchor item, lets try to set new focus using index |
|
1369 |
||
1370 |
if ( iAnchorItemIndex > iListItems->MdcaCount() - 1 ) |
|
1371 |
{ |
|
1372 |
iAnchorItemIndex = iListItems->MdcaCount() - 1; |
|
1373 |
} |
|
1374 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1375 |
} |
|
1376 |
if ( aDraw ) |
|
1377 |
{ |
|
1378 |
SetCurrentItemIdL( iAnchorItemId ); |
|
1379 |
} |
|
1380 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1381 |
} |
|
1382 |
if ( aDraw ) |
|
1383 |
{ |
|
1384 |
RefreshListbox(); |
|
1385 |
} |
|
1386 |
} |
|
1387 |
break; |
|
1388 |
case MMsvSessionObserver::EMsvEntriesCreated: |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1389 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1390 |
if( iOwningView.MarkingMode() ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1391 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1392 |
// list item count not updated fast enough in hw so let's |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1393 |
// collect added ids for future handling |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1394 |
for( TInt i( 0 ); i < aSelection.Count(); i++ ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1395 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1396 |
TMsvId msvId = (aSelection)[ i ]; |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1397 |
if( iAddedMsvIds->Find( msvId ) == KErrNotFound ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1398 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1399 |
iAddedMsvIds->AppendL( msvId ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1400 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1401 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1402 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1403 |
else |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1404 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1405 |
ItemCountChangedL( ETrue ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1406 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1407 |
} |
60 | 1408 |
case MMsvSessionObserver::EMsvEntriesChanged: |
1409 |
{ |
|
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1410 |
if( aEvent == MMsvSessionObserver::EMsvEntriesChanged ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1411 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1412 |
ItemCountChangedL( ETrue ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1413 |
} |
60 | 1414 |
if ( iLastOperationType != EMessageListOperationConnect && |
1415 |
iAnchorItemId != KErrNotFound ) |
|
1416 |
{ |
|
1417 |
if ( iOwningView.IsMSKMailBox() ) // focus setting only for email |
|
1418 |
{ |
|
1419 |
TInt selectedIndex = ItemIndex( iAnchorItemId ); |
|
1420 |
if ( selectedIndex == KErrNotFound ) |
|
1421 |
{ |
|
1422 |
// we could not find anchor item, lets try to set new focus using index |
|
1423 |
if ( iAnchorItemIndex > iListItems->MdcaCount() - 1 ) |
|
1424 |
{ |
|
1425 |
iAnchorItemIndex = iListItems->MdcaCount() - 1; |
|
1426 |
} |
|
1427 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1428 |
} |
|
1429 |
if (selectedIndex != iListBox->CurrentItemIndex() && |
|
1430 |
aEvent == MMsvSessionObserver::EMsvEntriesChanged ) |
|
1431 |
{ |
|
1432 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1433 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1434 |
} |
|
1435 |
if(aEvent==MMsvSessionObserver::EMsvEntriesCreated) |
|
1436 |
{ |
|
1437 |
iAnchorItemIndex=0; |
|
1438 |
iAnchorItemId = iListItems->ItemId( iAnchorItemIndex ); |
|
1439 |
} |
|
1440 |
if ( aDraw ) |
|
1441 |
{ |
|
1442 |
SetCurrentItemIdL( iAnchorItemId ); |
|
1443 |
} |
|
1444 |
iAnchorItemIndex = iListBox->CurrentItemIndex(); |
|
1445 |
#ifdef _DEBUG |
|
1446 |
RDebug::Print(_L("CMceMessageListContainer3: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex); |
|
1447 |
#endif |
|
1448 |
//SetCurrentItemIdL( iAnchorItemId ); |
|
1449 |
} |
|
1450 |
else |
|
1451 |
{ |
|
1452 |
if ( aSelection.Count() ) |
|
1453 |
{ |
|
1454 |
// is this enough? |
|
1455 |
SetCurrentItemIdL( aSelection.At(0) ); |
|
1456 |
} |
|
1457 |
} |
|
1458 |
} |
|
1459 |
} |
|
1460 |
||
1461 |
||
1462 |
break; |
|
1463 |
case MMsvSessionObserver::EMsvEntriesMoved: |
|
1464 |
break; |
|
1465 |
default: |
|
1466 |
break; |
|
1467 |
}; |
|
1468 |
} |
|
1469 |
||
1470 |
// ---------------------------------------------------- |
|
1471 |
// CMceMessageListContainer::OptionsCommandSupported |
|
1472 |
// ---------------------------------------------------- |
|
1473 |
TUint CMceMessageListContainer::OptionsCommandSupported() const |
|
1474 |
{ |
|
1475 |
return TMessageListCommandNone; |
|
1476 |
} |
|
1477 |
||
1478 |
// ---------------------------------------------------- |
|
1479 |
// CMceMessageListContainer::HandleOptionsCommandL |
|
1480 |
// ---------------------------------------------------- |
|
1481 |
void CMceMessageListContainer::HandleOptionsCommandL( TInt /*aCommand*/ ) |
|
1482 |
{ |
|
1483 |
// Should we use assert debug here? |
|
1484 |
} |
|
1485 |
||
1486 |
// ---------------------------------------------------- |
|
1487 |
// CMceMessageListContainer::DateTimeFormatChangedL |
|
1488 |
// ---------------------------------------------------- |
|
1489 |
void CMceMessageListContainer::DateTimeFormatChangedL( TInt /*aChangeFlag*/ ) |
|
1490 |
{ |
|
1491 |
RefreshListbox(); |
|
1492 |
} |
|
1493 |
||
1494 |
// --------------------------------------------------------------------------- |
|
1495 |
// CMceMessageListContainer::SetMskL |
|
1496 |
// --------------------------------------------------------------------------- |
|
1497 |
// |
|
1498 |
TInt CMceMessageListContainer::SetSpecialMskL() |
|
1499 |
{ |
|
1500 |
return NULL; |
|
1501 |
} |
|
1502 |
||
1503 |
//------------------------------------------------------------------------------- |
|
1504 |
//CMceMessageListContainer::HandleShortcutForSearch( const TKeyEvent& aKeyEvent ) |
|
1505 |
//------------------------------------------------------------------------------- |
|
1506 |
void CMceMessageListContainer::HandleShortcutForSearchL( const TKeyEvent& aKeyEvent ) |
|
1507 |
{ |
|
1508 |
// in remote mailbox key has been pressed, find item if sorted |
|
1509 |
// by subject or sender |
|
1510 |
TInt Len = 0; |
|
1511 |
TBuf<KMceTextBufferLength> text; |
|
1512 |
text.Zero(); |
|
1513 |
if ( iT9Interface->LastEnteredKey() != ( TInt ) aKeyEvent.iScanCode ) |
|
1514 |
{ |
|
1515 |
iT9Interface->ClearCurrentWord(); |
|
1516 |
} |
|
1517 |
iT9Interface->AppendKeyPress( (TPtiKey)aKeyEvent.iScanCode ); |
|
1518 |
Len = iT9Interface->CurrentWord().Length(); |
|
1519 |
if ( Len < KMceTextBufferLength ) |
|
1520 |
{ |
|
1521 |
text = iT9Interface->CurrentWord(); |
|
1522 |
} |
|
1523 |
else |
|
1524 |
{ |
|
1525 |
text = iT9Interface->CurrentWord().Left(KMceTextBufferLength); |
|
1526 |
} |
|
1527 |
||
1528 |
iOwningView.FindAndSelectEntryL( text ); |
|
1529 |
iT9Timer->Start(); |
|
1530 |
} |
|
1531 |
||
1532 |
//------------------------------------------------------------------------------- |
|
1533 |
//CMceMessageListContainer::HasHandleStarKeyDoneL() |
|
1534 |
//------------------------------------------------------------------------------- |
|
1535 |
TBool CMceMessageListContainer::HasHandleStarKeyDoneL() |
|
1536 |
{ |
|
1537 |
TBool starkeyIsHandled = EFalse; |
|
1538 |
if ( StateCanBeChangedByStarKeyL() ) |
|
1539 |
{ |
|
1540 |
if ( IsSortByDate() ) |
|
1541 |
{ |
|
1542 |
MarkReadUnreadWithStarKeyL(); |
|
1543 |
} |
|
1544 |
else |
|
1545 |
{ |
|
1546 |
// if sort by anything else other than by Date, handle focus change |
|
1547 |
iListBox->SetCurrentItemIndex( 0 ); |
|
1548 |
iListBox->DrawDeferred(); |
|
1549 |
} |
|
1550 |
starkeyIsHandled = ETrue; |
|
1551 |
} |
|
1552 |
return starkeyIsHandled; |
|
1553 |
} |
|
1554 |
||
1555 |
//------------------------------------------------------------------------------- |
|
1556 |
//CMceMessageListContainer::MarkReadUnreadWithStarKeyL() |
|
1557 |
//------------------------------------------------------------------------------- |
|
1558 |
void CMceMessageListContainer::MarkReadUnreadWithStarKeyL() |
|
1559 |
{ |
|
1560 |
MarkItemSelectionL(); |
|
1561 |
if( iOwningView.IsItemUnread( CurrentItemId() ) ) |
|
1562 |
{ |
|
1563 |
iOwningView.HandleCommandL( EMceCmdMarkAsRead ); |
|
1564 |
} |
|
1565 |
else |
|
1566 |
{ |
|
1567 |
iOwningView.HandleCommandL( EMceCmdMarkAsUnread ); |
|
1568 |
} |
|
1569 |
} |
|
1570 |
||
1571 |
//------------------------------------------------------------------------------- |
|
1572 |
//CMceMessageListContainer::IsSortByDate() |
|
1573 |
//------------------------------------------------------------------------------- |
|
1574 |
TBool CMceMessageListContainer::IsSortByDate() |
|
1575 |
{ |
|
1576 |
TMsvSelectionOrdering ordering = iListItems->SortType(); |
|
1577 |
return ( ( ordering.Sorting() == EMsvSortByDateReverse) || ( ordering.Sorting() == EMsvSortByDate ) ); |
|
1578 |
} |
|
1579 |
||
1580 |
// --------------------------------------------------------------------------- |
|
1581 |
// CMceMessageListContainer::SetContainerFlag |
|
1582 |
// --------------------------------------------------------------------------- |
|
1583 |
void CMceMessageListContainer::SetContainerFlag( TMceContainerFlags /*aFlag*/, TBool /*aState*/ ) |
|
1584 |
{ |
|
1585 |
} |
|
1586 |
||
1587 |
void CMceMessageListContainer::UpdateIconArrayL() |
|
1588 |
{ |
|
1589 |
// do nothing for two row list. |
|
1590 |
} |
|
1591 |
||
71
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1592 |
void CMceMessageListContainer::SetMarkingModeOff() |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1593 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1594 |
if( iListBox ) |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1595 |
{ |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1596 |
iListBox->SetMarkingMode( EFalse ); |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1597 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1598 |
} |
17302fa075e1
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
1599 |
|
60 | 1600 |
// End of File |