--- a/messagingappbase/mce/src/MceMessageListContainer.cpp Wed Sep 15 12:08:45 2010 +0300
+++ b/messagingappbase/mce/src/MceMessageListContainer.cpp Wed Oct 13 14:27:34 2010 +0300
@@ -90,7 +90,6 @@
delete iListBox;
delete iListItems;
delete iSelectedEntries;
- delete iAddedMsvIds;
}
// ----------------------------------------------------
@@ -139,7 +138,7 @@
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
iListBox->SetListBoxObserver( &iOwningView );
- iListBox->SetMarkingModeObserver( this );
+
iSelectedEntries = new (ELeave) CMsvEntrySelection;
iListBox->CreateScrollBarFrameL( ETrue );
@@ -151,8 +150,6 @@
iPreviousInputMethod = EFalse;
- iAddedMsvIds = new (ELeave) CMsvEntrySelection;
-
User::LeaveIfError( iQwertyModeStatusProperty.Attach(
KCRUidAvkon, KAknQwertyInputModeActive ));
@@ -272,27 +269,15 @@
// ----------------------------------------------------
// CMceMessageListContainer::ItemCountChangedL
// ----------------------------------------------------
-void CMceMessageListContainer::ItemCountChangedL( TBool aItemsAdded,
- CArrayFix<TInt>* aAddedIndexes )
+void CMceMessageListContainer::ItemCountChangedL( TBool aItemsAdded )
{
if ( aItemsAdded )
{
- if( aAddedIndexes )
- {
- iListBox->HandleItemAdditionL( *aAddedIndexes );
- }
- else
- {
- iListBox->HandleItemAdditionL();
- }
+ iListBox->HandleItemAdditionL();
}
else
{
iListBox->HandleItemRemovalL();
- if( iOwningView.MarkingMode() && iListItems->MessageCount() <= 0 )
- {
- SetMarkingModeOff();
- }
}
}
@@ -460,9 +445,32 @@
// ----------------------------------------------------
// CMceMessageListContainer::RefreshSelectionIndexesL
// ----------------------------------------------------
-void CMceMessageListContainer::RefreshSelectionIndexesL( TBool /*aForceUpdate*/ )
+void CMceMessageListContainer::RefreshSelectionIndexesL( TBool aForceUpdate )
{
+ const CListBoxView::CSelectionIndexArray* selection =
+ iListBox->View()->SelectionIndexes();
+ if ( selection->Count() > 0 || aForceUpdate )
+ {
+ CArrayFixFlat<TInt>* newSelection = new ( ELeave )
+ CArrayFixFlat<TInt>( KMceListContainerGranuality );
+ CleanupStack::PushL( newSelection );
+ const TInt count = iSelectedEntries->Count();
+ for ( TInt loop = count; loop >0; loop--)
+ {
+ TInt index = iListItems->ItemIndex( (*iSelectedEntries)[loop-1] );
+ if ( index > KErrNotFound )
+ {
+ newSelection->AppendL( index );
+ }
+ else
+ {
+ iSelectedEntries->Delete( loop-1 );
+ }
+ }
+ iListBox->SetSelectionIndexesL( newSelection );
+ CleanupStack::PopAndDestroy( newSelection );
+ }
}
@@ -656,10 +664,6 @@
if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow )
{
- if( iOwningView.MarkingMode() )
- {
- return EKeyWasConsumed;
- }
return EKeyWasNotConsumed;
}
@@ -1319,39 +1323,6 @@
#ifdef _DEBUG
RDebug::Print(_L("CMceMessageListContainer2: iAnchorItemId 0x%x, iAnchorItemIndex %d"), iAnchorItemId, iAnchorItemIndex);
#endif
- // listitem addition handling when all the new item indexes can be resolved
- if( iOwningView.MarkingMode() && iAddedMsvIds->Count() > 0 )
- {
- TBool allItemsInTheList( ETrue );
- CArrayFix<TInt>* addedIndexes = new( ELeave ) CArrayFixFlat<TInt> (
- KMceListContainerGranuality );
- CleanupStack::PushL( addedIndexes );
- for( TInt i( 0 ); i < iAddedMsvIds->Count(); i++ )
- {
- TMsvId msvId = (*iAddedMsvIds)[i];
- TInt index = iListItems->ItemIndex( msvId );
- if ( index > KErrNotFound )
- {
- addedIndexes->AppendL( index );
- }
- else
- {
- allItemsInTheList = EFalse;
- break;
- }
- }
- if( allItemsInTheList )
- {
- ItemCountChangedL( ETrue, addedIndexes );
- iAddedMsvIds->Reset();
- }
- CleanupStack::PopAndDestroy( addedIndexes );
- addedIndexes = NULL;
- }
- else if( iAddedMsvIds->Count() > 0 )
- {
- iAddedMsvIds->Reset();
- }
switch ( aEvent )
{
case MMsvSessionObserver::EMsvEntriesDeleted:
@@ -1386,31 +1357,11 @@
}
break;
case MMsvSessionObserver::EMsvEntriesCreated:
- {
- if( iOwningView.MarkingMode() )
- {
- // list item count not updated fast enough in hw so let's
- // collect added ids for future handling
- for( TInt i( 0 ); i < aSelection.Count(); i++ )
- {
- TMsvId msvId = (aSelection)[ i ];
- if( iAddedMsvIds->Find( msvId ) == KErrNotFound )
- {
- iAddedMsvIds->AppendL( msvId );
- }
- }
- }
- else
- {
- ItemCountChangedL( ETrue );
- }
- }
case MMsvSessionObserver::EMsvEntriesChanged:
{
- if( aEvent == MMsvSessionObserver::EMsvEntriesChanged )
- {
- ItemCountChangedL( ETrue );
- }
+
+ ItemCountChangedL( ETrue );
+
if ( iLastOperationType != EMessageListOperationConnect &&
iAnchorItemId != KErrNotFound )
{
@@ -1589,12 +1540,4 @@
// do nothing for two row list.
}
-void CMceMessageListContainer::SetMarkingModeOff()
- {
- if( iListBox )
- {
- iListBox->SetMarkingMode( EFalse );
- }
- }
-
// End of File