1239 { |
1239 { |
1240 break; |
1240 break; |
1241 } |
1241 } |
1242 } |
1242 } |
1243 _AKNTRACE_FUNC_EXIT; |
1243 _AKNTRACE_FUNC_EXIT; |
1244 } |
1244 } |
|
1245 |
|
1246 static CAknButton* GetButtonHelper( RPointerArray<CAknButton> &aButtonArray, TInt aIndex ) |
|
1247 { |
|
1248 return ( aIndex < aButtonArray.Count() && aIndex >= 0 ) ? aButtonArray[aIndex] : NULL; |
|
1249 } |
1245 |
1250 |
1246 // ----------------------------------------------------------------------------- |
1251 // ----------------------------------------------------------------------------- |
1247 // CAknAdaptiveSearchGrid::UpdateVisibleButtonsL() |
1252 // CAknAdaptiveSearchGrid::UpdateVisibleButtonsL() |
1248 // ----------------------------------------------------------------------------- |
1253 // ----------------------------------------------------------------------------- |
1249 // |
1254 // |
1272 |
1277 |
1273 // Hide all the buttons at the beginning for now. |
1278 // Hide all the buttons at the beginning for now. |
1274 CAknButton* tmpButton = NULL; |
1279 CAknButton* tmpButton = NULL; |
1275 for( TInt i = 0; i < iButtonArray.Count(); i++ ) |
1280 for( TInt i = 0; i < iButtonArray.Count(); i++ ) |
1276 { |
1281 { |
1277 tmpButton = static_cast<CAknButton*>( iButtonArray[i] ); |
1282 tmpButton = GetButtonHelper( iButtonArray, i ); |
1278 tmpButton->MakeVisible( EFalse ); |
1283 if ( NULL != tmpButton ) |
|
1284 { |
|
1285 tmpButton->MakeVisible( EFalse ); |
|
1286 } |
1279 } |
1287 } |
1280 |
1288 |
1281 TInt tempTotalGridButtons = iTotalGridButtons - KCloseAndClearButtonCount; |
1289 TInt tempTotalGridButtons = iTotalGridButtons - KCloseAndClearButtonCount; |
1282 if( iNumOfPages == 1 ) |
1290 if( iNumOfPages == 1 ) |
1283 { |
1291 { |
1284 for ( TInt i = 0; i < tempTotalGridButtons; i++ ) |
1292 for ( TInt i = 0; i < tempTotalGridButtons; i++ ) |
1285 { |
1293 { |
1286 button = static_cast<CAknButton*>( iButtonArray[tempTotalGridButtons-i-1] ); |
1294 button = GetButtonHelper( iButtonArray, tempTotalGridButtons-i-1 ); |
|
1295 if ( NULL == button ) |
|
1296 { |
|
1297 continue; |
|
1298 } |
|
1299 |
1287 TInt charPosition = numOfChars-i-1-shift_Ind; |
1300 TInt charPosition = numOfChars-i-1-shift_Ind; |
1288 if ( charPosition >= 0 ) |
1301 if ( charPosition >= 0 ) |
1289 { |
1302 { |
1290 bState = button->State(); |
1303 bState = button->State(); |
1291 if ( ptr.Mid(charPosition, 1) == KSpaceCharacter ) |
1304 if ( ptr.Mid(charPosition, 1) == KSpaceCharacter ) |
1354 // last page |
1367 // last page |
1355 TInt charsOnLastPage = numOfChars - numOfCharsInPrevPages; |
1368 TInt charsOnLastPage = numOfChars - numOfCharsInPrevPages; |
1356 TInt offset = tempTotalGridButtons - charsOnLastPage; |
1369 TInt offset = tempTotalGridButtons - charsOnLastPage; |
1357 |
1370 |
1358 for ( TInt i = tempTotalGridButtons-1 ; i >= 0 ; --i ) |
1371 for ( TInt i = tempTotalGridButtons-1 ; i >= 0 ; --i ) |
1359 { |
1372 { |
1360 button = static_cast<CAknButton*>(iButtonArray[i+shift_Ind]); |
1373 button = GetButtonHelper( iButtonArray, i+shift_Ind ); |
|
1374 if ( NULL == button ) |
|
1375 { |
|
1376 continue; |
|
1377 } |
|
1378 |
1361 if( i < offset ) |
1379 if( i < offset ) |
1362 { |
1380 { |
1363 button->MakeVisible( EFalse ); |
1381 button->MakeVisible( EFalse ); |
1364 } |
1382 } |
1365 else |
1383 else |
1412 shift_Ind = 0; |
1430 shift_Ind = 0; |
1413 |
1431 |
1414 for ( TInt i = 0; i < numOfChars; i++ ) |
1432 for ( TInt i = 0; i < numOfChars; i++ ) |
1415 { |
1433 { |
1416 if ( ( i >= start) && (i < end) ) |
1434 if ( ( i >= start) && (i < end) ) |
1417 { |
1435 { |
1418 button = static_cast<CAknButton*>(iButtonArray[i-start-shift_Ind]); |
1436 button = GetButtonHelper( iButtonArray, i-start-shift_Ind ); |
|
1437 if ( NULL == button ) |
|
1438 { |
|
1439 continue; |
|
1440 } |
|
1441 |
1419 bState = button->State(); |
1442 bState = button->State(); |
1420 if( ptr.Mid(i, 1) == KSpaceCharacter ) |
1443 if( ptr.Mid(i, 1) == KSpaceCharacter ) |
1421 { |
1444 { |
1422 // Create icon for space button |
1445 // Create icon for space button |
1423 icon = GetColorIconL( 4 ); |
1446 icon = GetColorIconL( 4 ); |
1466 { |
1489 { |
1467 tempTotalGridButtons = iTotalGridButtons; |
1490 tempTotalGridButtons = iTotalGridButtons; |
1468 } |
1491 } |
1469 for ( TInt i = tempTotalGridButtons; i < tempTotalGridButtons+iNumOfCols; i++ ) |
1492 for ( TInt i = tempTotalGridButtons; i < tempTotalGridButtons+iNumOfCols; i++ ) |
1470 { |
1493 { |
1471 button = static_cast<CAknButton*>(iButtonArray[i]); |
1494 button = GetButtonHelper( iButtonArray, i ); |
1472 button->MakeVisible( EFalse ); |
1495 if ( NULL != button ) |
|
1496 { |
|
1497 button->MakeVisible( EFalse ); |
|
1498 } |
|
1499 |
1473 } |
1500 } |
1474 } |
1501 } |
1475 } |
1502 } |
1476 button_rect = iDeleteButton->Rect(); |
1503 button_rect = iDeleteButton->Rect(); |
1477 _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |
1504 _AKNTRACE( "[%s][%s] rect of delete button is %d %d %d %d ", "CAknAdaptiveSearchGrid", __FUNCTION__, |