127 // |
127 // |
128 void CMmListBoxItemDrawer::InvalidateCache() |
128 void CMmListBoxItemDrawer::InvalidateCache() |
129 { |
129 { |
130 iItemsDataCache->Invalidate(); |
130 iItemsDataCache->Invalidate(); |
131 // this is needed to get iColors initialized on first use: |
131 // this is needed to get iColors initialized on first use: |
|
132 iLastDrawnItemWasFloating = ETrue; |
132 } |
133 } |
133 |
134 |
134 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
135 // |
136 // |
136 // ----------------------------------------------------------------------------- |
137 // ----------------------------------------------------------------------------- |
798 if ( !iUseCache || !cache || !cache->IsValid() ) |
799 if ( !iUseCache || !cache || !cache->IsValid() ) |
799 { |
800 { |
800 const TDesC8& mm_template = iMmModel->GetAttributeAsText (aItemIndex, |
801 const TDesC8& mm_template = iMmModel->GetAttributeAsText (aItemIndex, |
801 KMmTemplate8); |
802 KMmTemplate8); |
802 TRect viewRect = iWidget->View()->ViewRect(); |
803 TRect viewRect = iWidget->View()->ViewRect(); |
803 |
804 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
804 TBool landscapeOrientation = viewRect.Width() > viewRect.Height(); |
|
805 // Layout_Meta_Data::IsLandscapeOrientation cannot be used here because it |
|
806 // might happen that GetSize (this method) gets called immediately after |
|
807 // layout change but before AppUi calls SetRect on the container of iWidget |
|
808 // (Layout_Meta_Data::IsLandscapeOrientation always reflects the current state, |
|
809 // whereas ViewRect might sometimes be out of date). |
|
810 // In such situation iTemplateLibrary->GetSize (called just below) would |
|
811 // cause the template library to fill the internal cache for landscape mode |
|
812 // with parameters calculated according to the outdated ViewRect. |
|
813 |
|
814 |
805 |
815 if ( iTemplateLibrary->GetSize( size, iWidgetType, mm_template, |
806 if ( iTemplateLibrary->GetSize( size, iWidgetType, mm_template, |
816 landscapeOrientation, aItemIsCurrent, viewRect ) |
807 landscapeOrientation, aItemIsCurrent, viewRect ) |
817 != KErrNone ) |
808 != KErrNone ) |
818 { |
809 { |
1338 // |
1329 // |
1339 void CMmListBoxItemDrawer::SetupSubCellsL( TBool aItemIsCurrent, |
1330 void CMmListBoxItemDrawer::SetupSubCellsL( TBool aItemIsCurrent, |
1340 TInt aItemIndex ) const |
1331 TInt aItemIndex ) const |
1341 { |
1332 { |
1342 CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); |
1333 CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); |
1343 cache->SetValidL( EFalse ); |
1334 cache->MarkAsInvalid(); |
1344 |
1335 |
1345 const TDesC8& mmTemplate = iMmModel->GetAttributeAsText( aItemIndex, KMmTemplate8 ); |
1336 const TDesC8& mmTemplate = iMmModel->GetAttributeAsText( aItemIndex, KMmTemplate8 ); |
1346 if ( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) ) |
1337 if ( !mmTemplate.Compare( KNullDesC8 ) || !mmTemplate.Compare( KEmpty8 ) ) |
1347 { |
1338 { |
1348 User::Leave( KErrNotFound ); |
1339 User::Leave( KErrNotFound ); |
1418 CleanupStack::PopAndDestroy( &templateChildArray ); |
1409 CleanupStack::PopAndDestroy( &templateChildArray ); |
1419 |
1410 |
1420 cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); |
1411 cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); |
1421 // the line below is here only to make the cached information complete |
1412 // the line below is here only to make the cached information complete |
1422 GetItemSize( aItemIndex, aItemIsCurrent ); |
1413 GetItemSize( aItemIndex, aItemIsCurrent ); |
1423 cache->SetValidL( ETrue ); |
1414 cache->MarkAsValidL(); |
1424 } |
1415 } |
1425 |
1416 |
1426 // ----------------------------------------------------------------------------- |
1417 // ----------------------------------------------------------------------------- |
1427 // |
1418 // |
1428 // ----------------------------------------------------------------------------- |
1419 // ----------------------------------------------------------------------------- |