2101 const MVPbkContactBookmarkCollection& aSelectedItems ) |
2101 const MVPbkContactBookmarkCollection& aSelectedItems ) |
2102 { |
2102 { |
2103 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
2103 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
2104 ("CPbk2NamesListReadyState::RestoreMarkedItemsL: %d items"), |
2104 ("CPbk2NamesListReadyState::RestoreMarkedItemsL: %d items"), |
2105 aSelectedItems.Count() ); |
2105 aSelectedItems.Count() ); |
2106 |
2106 |
2107 DisableRedrawEnablePushL(); |
|
2108 iListBox.ClearSelection(); |
|
2109 const TInt count = aSelectedItems.Count(); |
2107 const TInt count = aSelectedItems.Count(); |
2110 for ( TInt i = 0; i < count; ++i ) |
2108 if ( count > 0 ) |
2111 { |
2109 { |
2112 TInt index = iViewStack.IndexOfBookmarkL( aSelectedItems.At( i ) ) + CommandItemCount(); |
2110 CListBoxView::CSelectionIndexArray* updateSelections = |
2113 if ( index >= 0 ) |
2111 new(ELeave) CArrayFixFlat<TInt>( count ); |
2114 { |
2112 CleanupStack::PushL( updateSelections ); |
2115 iListBox.View()->SelectItemL( index ); |
2113 |
2116 } |
2114 // Get the index of each selected item. If one of items could not be found, break. |
2117 } |
2115 for ( TInt i = 0; i < count; ++i ) |
2118 CleanupStack::PopAndDestroy(); // DisableRedrawEnablePushL |
2116 { |
|
2117 TInt index = iViewStack.IndexOfBookmarkL( aSelectedItems.At( i ) ) + CommandItemCount(); |
|
2118 if ( index >= 0 ) |
|
2119 { |
|
2120 updateSelections->AppendL( index ); |
|
2121 } |
|
2122 else |
|
2123 { |
|
2124 break; |
|
2125 } |
|
2126 } |
|
2127 |
|
2128 // If all the selected items can be found in iViewStack, update the list box. |
|
2129 // The list box will change nothing if some of selected items are not found in iViewStack. |
|
2130 if ( updateSelections->Count() == count ) |
|
2131 { |
|
2132 DisableRedrawEnablePushL(); |
|
2133 iListBox.ClearSelection(); |
|
2134 iListBox.SetSelectionIndexesL( updateSelections ); |
|
2135 CleanupStack::PopAndDestroy(); // DisableRedrawEnablePushL |
|
2136 } |
|
2137 |
|
2138 CleanupStack::PopAndDestroy( updateSelections ); // Destroy updateSelections |
|
2139 } |
2119 } |
2140 } |
2120 |
2141 |
2121 // -------------------------------------------------------------------------- |
2142 // -------------------------------------------------------------------------- |
2122 // CPbk2NamesListReadyState::DisableRedrawEnablePushL |
2143 // CPbk2NamesListReadyState::DisableRedrawEnablePushL |
2123 // -------------------------------------------------------------------------- |
2144 // -------------------------------------------------------------------------- |