137 |
136 |
138 iListBox->Model()->SetItemTextArray( iListItems ); |
137 iListBox->Model()->SetItemTextArray( iListItems ); |
139 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
138 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
140 |
139 |
141 iListBox->SetListBoxObserver( &iOwningView ); |
140 iListBox->SetListBoxObserver( &iOwningView ); |
142 iListBox->SetMarkingModeObserver( this ); |
141 |
143 iSelectedEntries = new (ELeave) CMsvEntrySelection; |
142 iSelectedEntries = new (ELeave) CMsvEntrySelection; |
144 |
143 |
145 iListBox->CreateScrollBarFrameL( ETrue ); |
144 iListBox->CreateScrollBarFrameL( ETrue ); |
146 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
145 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
147 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
146 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
148 |
147 |
149 iListBox->ItemDrawer()->FormattedCellData() |
148 iListBox->ItemDrawer()->FormattedCellData() |
150 ->SetIconArray( aBitmapResolver.IconArray() ); |
149 ->SetIconArray( aBitmapResolver.IconArray() ); |
151 |
150 |
152 iPreviousInputMethod = EFalse; |
151 iPreviousInputMethod = EFalse; |
153 |
|
154 iAddedMsvIds = new (ELeave) CMsvEntrySelection; |
|
155 |
152 |
156 User::LeaveIfError( iQwertyModeStatusProperty.Attach( |
153 User::LeaveIfError( iQwertyModeStatusProperty.Attach( |
157 KCRUidAvkon, KAknQwertyInputModeActive )); |
154 KCRUidAvkon, KAknQwertyInputModeActive )); |
158 |
155 |
159 HandleQwertyModeChangeNotification(); |
156 HandleQwertyModeChangeNotification(); |
270 } |
267 } |
271 |
268 |
272 // ---------------------------------------------------- |
269 // ---------------------------------------------------- |
273 // CMceMessageListContainer::ItemCountChangedL |
270 // CMceMessageListContainer::ItemCountChangedL |
274 // ---------------------------------------------------- |
271 // ---------------------------------------------------- |
275 void CMceMessageListContainer::ItemCountChangedL( TBool aItemsAdded, |
272 void CMceMessageListContainer::ItemCountChangedL( TBool aItemsAdded ) |
276 CArrayFix<TInt>* aAddedIndexes ) |
|
277 { |
273 { |
278 if ( aItemsAdded ) |
274 if ( aItemsAdded ) |
279 { |
275 { |
280 if( aAddedIndexes ) |
276 iListBox->HandleItemAdditionL(); |
281 { |
|
282 iListBox->HandleItemAdditionL( *aAddedIndexes ); |
|
283 } |
|
284 else |
|
285 { |
|
286 iListBox->HandleItemAdditionL(); |
|
287 } |
|
288 } |
277 } |
289 else |
278 else |
290 { |
279 { |
291 iListBox->HandleItemRemovalL(); |
280 iListBox->HandleItemRemovalL(); |
292 if( iOwningView.MarkingMode() && iListItems->MessageCount() <= 0 ) |
|
293 { |
|
294 SetMarkingModeOff(); |
|
295 } |
|
296 } |
281 } |
297 } |
282 } |
298 |
283 |
299 |
284 |
300 // ---------------------------------------------------- |
285 // ---------------------------------------------------- |
458 } |
443 } |
459 |
444 |
460 // ---------------------------------------------------- |
445 // ---------------------------------------------------- |
461 // CMceMessageListContainer::RefreshSelectionIndexesL |
446 // CMceMessageListContainer::RefreshSelectionIndexesL |
462 // ---------------------------------------------------- |
447 // ---------------------------------------------------- |
463 void CMceMessageListContainer::RefreshSelectionIndexesL( TBool /*aForceUpdate*/ ) |
448 void CMceMessageListContainer::RefreshSelectionIndexesL( TBool aForceUpdate ) |
464 { |
449 { |
465 |
450 const CListBoxView::CSelectionIndexArray* selection = |
|
451 iListBox->View()->SelectionIndexes(); |
|
452 |
|
453 if ( selection->Count() > 0 || aForceUpdate ) |
|
454 { |
|
455 CArrayFixFlat<TInt>* newSelection = new ( ELeave ) |
|
456 CArrayFixFlat<TInt>( KMceListContainerGranuality ); |
|
457 CleanupStack::PushL( newSelection ); |
|
458 const TInt count = iSelectedEntries->Count(); |
|
459 for ( TInt loop = count; loop >0; loop--) |
|
460 { |
|
461 TInt index = iListItems->ItemIndex( (*iSelectedEntries)[loop-1] ); |
|
462 if ( index > KErrNotFound ) |
|
463 { |
|
464 newSelection->AppendL( index ); |
|
465 } |
|
466 else |
|
467 { |
|
468 iSelectedEntries->Delete( loop-1 ); |
|
469 } |
|
470 } |
|
471 iListBox->SetSelectionIndexesL( newSelection ); |
|
472 CleanupStack::PopAndDestroy( newSelection ); |
|
473 } |
466 |
474 |
467 } |
475 } |
468 |
476 |
469 // ---------------------------------------------------- |
477 // ---------------------------------------------------- |
470 // CMceMessageListContainer::AddAllToSelectionL |
478 // CMceMessageListContainer::AddAllToSelectionL |
654 |
662 |
655 iOwningView.CancelMailboxTimer(); |
663 iOwningView.CancelMailboxTimer(); |
656 |
664 |
657 if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow ) |
665 if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow ) |
658 { |
666 { |
659 if( iOwningView.MarkingMode() ) |
|
660 { |
|
661 return EKeyWasConsumed; |
|
662 } |
|
663 return EKeyWasNotConsumed; |
667 return EKeyWasNotConsumed; |
664 } |
668 } |
665 |
669 |
666 |
670 |
667 if ( ( iOwningView.MenuBar()->ItemSpecificCommandsEnabled() || SelectionCount() ) && aKeyEvent.iCode == EKeyBackspace ) |
671 if ( ( iOwningView.MenuBar()->ItemSpecificCommandsEnabled() || SelectionCount() ) && aKeyEvent.iCode == EKeyBackspace ) |
1317 TBool aDraw ) |
1321 TBool aDraw ) |
1318 { |
1322 { |
1319 #ifdef _DEBUG |
1323 #ifdef _DEBUG |
1320 RDebug::Print(_L("CMceMessageListContainer2: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex); |
1324 RDebug::Print(_L("CMceMessageListContainer2: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex); |
1321 #endif |
1325 #endif |
1322 // listitem addition handling when all the new item indexes can be resolved |
|
1323 if( iOwningView.MarkingMode() && iAddedMsvIds->Count() > 0 ) |
|
1324 { |
|
1325 TBool allItemsInTheList( ETrue ); |
|
1326 CArrayFix<TInt>* addedIndexes = new( ELeave ) CArrayFixFlat<TInt> ( |
|
1327 KMceListContainerGranuality ); |
|
1328 CleanupStack::PushL( addedIndexes ); |
|
1329 for( TInt i( 0 ); i < iAddedMsvIds->Count(); i++ ) |
|
1330 { |
|
1331 TMsvId msvId = (*iAddedMsvIds)[i]; |
|
1332 TInt index = iListItems->ItemIndex( msvId ); |
|
1333 if ( index > KErrNotFound ) |
|
1334 { |
|
1335 addedIndexes->AppendL( index ); |
|
1336 } |
|
1337 else |
|
1338 { |
|
1339 allItemsInTheList = EFalse; |
|
1340 break; |
|
1341 } |
|
1342 } |
|
1343 if( allItemsInTheList ) |
|
1344 { |
|
1345 ItemCountChangedL( ETrue, addedIndexes ); |
|
1346 iAddedMsvIds->Reset(); |
|
1347 } |
|
1348 CleanupStack::PopAndDestroy( addedIndexes ); |
|
1349 addedIndexes = NULL; |
|
1350 } |
|
1351 else if( iAddedMsvIds->Count() > 0 ) |
|
1352 { |
|
1353 iAddedMsvIds->Reset(); |
|
1354 } |
|
1355 switch ( aEvent ) |
1326 switch ( aEvent ) |
1356 { |
1327 { |
1357 case MMsvSessionObserver::EMsvEntriesDeleted: |
1328 case MMsvSessionObserver::EMsvEntriesDeleted: |
1358 { |
1329 { |
1359 /* if ( iOwningView.IsMSKMailBox() ) // focus setting only for email |
1330 /* if ( iOwningView.IsMSKMailBox() ) // focus setting only for email |
1384 RefreshListbox(); |
1355 RefreshListbox(); |
1385 } |
1356 } |
1386 } |
1357 } |
1387 break; |
1358 break; |
1388 case MMsvSessionObserver::EMsvEntriesCreated: |
1359 case MMsvSessionObserver::EMsvEntriesCreated: |
1389 { |
|
1390 if( iOwningView.MarkingMode() ) |
|
1391 { |
|
1392 // list item count not updated fast enough in hw so let's |
|
1393 // collect added ids for future handling |
|
1394 for( TInt i( 0 ); i < aSelection.Count(); i++ ) |
|
1395 { |
|
1396 TMsvId msvId = (aSelection)[ i ]; |
|
1397 if( iAddedMsvIds->Find( msvId ) == KErrNotFound ) |
|
1398 { |
|
1399 iAddedMsvIds->AppendL( msvId ); |
|
1400 } |
|
1401 } |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 ItemCountChangedL( ETrue ); |
|
1406 } |
|
1407 } |
|
1408 case MMsvSessionObserver::EMsvEntriesChanged: |
1360 case MMsvSessionObserver::EMsvEntriesChanged: |
1409 { |
1361 { |
1410 if( aEvent == MMsvSessionObserver::EMsvEntriesChanged ) |
1362 |
1411 { |
1363 ItemCountChangedL( ETrue ); |
1412 ItemCountChangedL( ETrue ); |
1364 |
1413 } |
|
1414 if ( iLastOperationType != EMessageListOperationConnect && |
1365 if ( iLastOperationType != EMessageListOperationConnect && |
1415 iAnchorItemId != KErrNotFound ) |
1366 iAnchorItemId != KErrNotFound ) |
1416 { |
1367 { |
1417 if ( iOwningView.IsMSKMailBox() ) // focus setting only for email |
1368 if ( iOwningView.IsMSKMailBox() ) // focus setting only for email |
1418 { |
1369 { |