menufw/menufwui/mmwidgets/src/mmwidgetcontainer.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 25 137ebc85284b
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *  Version     : %version: MM_71.1.17.1.65 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_71.1.17.1.70 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 #include <e32keys.h>
    19 #include <e32keys.h>
    20 #include <e32math.h>
    20 #include <e32math.h>
    99 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
   100 //
   100 //
   101 CMmWidgetContainer::CMmWidgetContainer()
   101 CMmWidgetContainer::CMmWidgetContainer()
   102     : iMarqueeAdapter( NULL )
   102     : iMarqueeAdapter( NULL )
   103     , iLongTapInProgress( EFalse )
   103     , iLongTapInProgress( EFalse )
       
   104     , iDragOccured( EFalse )
   104     , iBgContext( NULL )
   105     , iBgContext( NULL )
   105     , iIsFaded( EFalse )
   106     , iIsFaded( EFalse )
   106     , iHasFocus( ETrue )
   107     , iHasFocus( ETrue )
   107     , iInForeground( ETrue )
   108     , iInForeground( ETrue )
   108     , iLongTapDetector( NULL )
   109     , iLongTapDetector( NULL )
   139         {
   140         {
   140         iLongTapDetector->EnableLongTapAnimation( aEnable );
   141         iLongTapDetector->EnableLongTapAnimation( aEnable );
   141         // cancel longTap timer, avoid showing popupmenu
   142         // cancel longTap timer, avoid showing popupmenu
   142         if( !aEnable )
   143         if( !aEnable )
   143             {
   144             {
   144             iLongTapDetector->PointerEventL( TPointerEvent() );
   145             TRAP_IGNORE( iLongTapDetector->PointerEventL( TPointerEvent() ) );
   145             }
   146             }
   146         }
   147         }
   147     }
   148     }
   148 
   149 
   149 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   208     {
   209     {
   209     iTapPoint = aPointerEvent.iPosition;
   210     iTapPoint = aPointerEvent.iPosition;
   210     iLastDragPoint = aPointerEvent.iPosition;
   211     iLastDragPoint = aPointerEvent.iPosition;
   211     iLastDragHighlight = GetHighlight();
   212     iLastDragHighlight = GetHighlight();
   212     if( !iWidget->View()->XYPosToItemIndex(
   213     if( !iWidget->View()->XYPosToItemIndex(
   213         aPointerEvent.iPosition, iDraggedIndex ) )
   214             aPointerEvent.iPosition, iDraggedIndex ) )
   214         {
   215         {
   215         iDraggedIndex = KErrNotFound;
   216         iDraggedIndex = KErrNotFound;
   216         }
   217         }
   217     iItemRelativeTapPoint = aPointerEvent.iPosition - iWidget->View()->ItemPos(
   218     iItemRelativeTapPoint = aPointerEvent.iPosition - iWidget->View()->ItemPos(
   218         iDraggedIndex );
   219         iDraggedIndex );
   250     if( !iIsFaded && iDialogOpened)
   251     if( !iIsFaded && iDialogOpened)
   251         {
   252         {
   252         iDialogOpened = EFalse;
   253         iDialogOpened = EFalse;
   253         if(highlightVisibleBefore != iHighlightVisibleBeforeLongTap)
   254         if(highlightVisibleBefore != iHighlightVisibleBeforeLongTap)
   254             {
   255             {
   255             SetHighlightVisibilityL( iHighlightVisibleBeforeLongTap);
   256             TRAP_IGNORE( SetHighlightVisibilityL( iHighlightVisibleBeforeLongTap) );
   256             }
   257             }
   257         highlightVisibleBefore = iHighlightVisibleBeforeLongTap;
   258         highlightVisibleBefore = iHighlightVisibleBeforeLongTap;
   258         }
   259         }
   259 
   260 
   260     CCoeControl::HandleResourceChange( aType );
   261     CCoeControl::HandleResourceChange( aType );
   310 
   311 
   311     if( iLastDragHighlight != highlight )
   312     if( iLastDragHighlight != highlight )
   312         {
   313         {
   313         iDragAndDropObserver->HandleDragOverL( GetHighlight() );
   314         iDragAndDropObserver->HandleDragOverL( GetHighlight() );
   314         }
   315         }
   315 
   316     
       
   317     TPoint centerPoint( aPointerEvent.iPosition );
       
   318     if( WidgetType() == EGridWidget )
       
   319         { // move item's TL corner by half width/height to center item horizontally.
       
   320         centerPoint.iX -= ( iWidget->View()->ItemSize( highlight ).iWidth / 2 );
       
   321         centerPoint.iY -= ( iWidget->View()->ItemSize( highlight ).iHeight / 2 );
       
   322         }
       
   323     else
       
   324         { // move item's T of corner by relative tap point to align left horizontally.
       
   325         centerPoint.iX -= iItemRelativeTapPoint.iX;
       
   326         // move item's L of corner by half height to center item horizontally.
       
   327         centerPoint.iY -= ( iWidget->View()->ItemSize( highlight ).iHeight / 2 );
       
   328         }
       
   329     
   316     if( !tooFast )
   330     if( !tooFast )
   317         {
   331         {
   318         TSize itemSize = iWidget->View()->ItemSize( highlight );
   332         TSize itemSize = iWidget->View()->ItemSize( highlight );
   319     TPoint itemPos = iWidget->View()->ItemPos( highlight );
   333         TPoint itemPos = iWidget->View()->ItemPos( highlight );
   320 
   334 
   321     if ( PointInItemReorderAreaL( highlight, aPointerEvent.iPosition ) )
   335         if ( PointInItemReorderAreaL( highlight, aPointerEvent.iPosition ) )
   322        {
       
   323        CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
       
   324        CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( highlight ));
       
   325        if (iDrawer->GetAnimator()->IsReadyForNewAnimation() && !aAbortAnimation
       
   326            && onItemModel->GetItemType() != EItemTypeParentFolder
       
   327            && iDraggedIndex != highlight)
       
   328            {
   336            {
   329            GetMmModel()->ReorderModelL( iDraggedIndex, highlight );
   337            CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
   330                 AnimateShiftL( highlight );
   338            CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( highlight ));
   331                 iDrawer->SetDraggedIndexL( highlight,
   339            if( iDrawer->GetAnimator()->IsReadyForNewAnimation() && !aAbortAnimation
   332                         aPointerEvent.iPosition - iItemRelativeTapPoint );
   340                    && onItemModel->GetItemType() != EItemTypeParentFolder
   333            iDraggedIndex = highlight;
   341                    && iDraggedIndex != highlight )
   334            iDragAndDropObserver->HandleDraggedIndexUpdatedL( highlight );
   342                {
       
   343                GetMmModel()->ReorderModelL( iDraggedIndex, highlight );
       
   344                AnimateShiftL( highlight );
       
   345                iDrawer->SetDraggedIndexL( highlight, centerPoint );
       
   346                iDraggedIndex = highlight;
       
   347                iDragAndDropObserver->HandleDraggedIndexUpdatedL( highlight );
       
   348                }
   335            }
   349            }
   336        }
   350         }
   337       }
   351 
   338 
   352 
   339     if ( DeltaSquare( iTapPoint, aPointerEvent.iPosition ) > KDragDelta &&
   353 
   340         !iDrawer->IsDraggable() )
   354     if ( DeltaSquare( iTapPoint, aPointerEvent.iPosition ) > KDragDelta
   341     {
   355             && !iDrawer->IsDraggable() )
   342     iDrawer->SetDraggedIndexL( iDraggedIndex, iTapPoint - iItemRelativeTapPoint );
   356         {
       
   357         if( !tooFast )
       
   358             {
       
   359             iDrawer->AnimateDragItemStartL( iDraggedIndex, centerPoint );
       
   360             }
       
   361         iDrawer->SetDraggedIndexL( iDraggedIndex, centerPoint );
   343         iDrawer->SetDraggableL( ETrue );
   362         iDrawer->SetDraggableL( ETrue );
   344         }
   363         }
   345     else if( iDrawer->IsDraggable() )
   364     else if( iDrawer->IsDraggable() )
   346         {
   365         {
   347         iDrawer->SetDraggedPointL( aPointerEvent.iPosition - iItemRelativeTapPoint );
   366         iDrawer->SetDraggedPointL( centerPoint );
   348         }
   367         }
   349 
   368 
   350     DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: iLastDragHighlight = %d ", iLastDragHighlight ));
   369     DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: iLastDragHighlight = %d ", iLastDragHighlight ));
   351     DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: highlight = %d ", highlight ));
   370     DEBUG(("\t_Mm_:CMmWidgetContainer::HandleDragL: highlight = %d ", highlight ));
   352     iLastDragPoint = aPointerEvent.iPosition;
   371     iLastDragPoint = aPointerEvent.iPosition;
   391 
   410 
   392     iDraggedIndex = -1;
   411     iDraggedIndex = -1;
   393     iDrawer->SetDraggedIndexL( iDraggedIndex, TPoint( 0, 0 ) );
   412     iDrawer->SetDraggedIndexL( iDraggedIndex, TPoint( 0, 0 ) );
   394     SetDraggableL( EFalse );
   413     SetDraggableL( EFalse );
   395 
   414 
   396     TInt dragFloatingItem;
   415     TInt dragFloatingItem( KErrNotFound );
       
   416     TInt dragStartFloatingItem( KErrNotFound );
   397     do
   417     do
   398         {
   418         {
   399         dragFloatingItem = iDrawer->GetFloatingItemIndex( EDrag );
   419         dragFloatingItem = iDrawer->GetFloatingItemIndex( EDrag );
   400         iDrawer->RemoveFloatingItem( dragFloatingItem );
   420         iDrawer->RemoveFloatingItem( dragFloatingItem );
   401         }
   421         dragStartFloatingItem = iDrawer->GetFloatingItemIndex( EDragStart );
   402     while( dragFloatingItem != KErrNotFound );
   422         iDrawer->RemoveFloatingItem( dragStartFloatingItem );
       
   423         }
       
   424     while( dragFloatingItem != KErrNotFound || dragStartFloatingItem != KErrNotFound);
   403 
   425 
   404     }
   426     }
   405 
   427 
   406 // -----------------------------------------------------------------------------
   428 // -----------------------------------------------------------------------------
   407 //
   429 //
   433 //
   455 //
   434 
   456 
   435 TBool CMmWidgetContainer::IsNoItemDragged()
   457 TBool CMmWidgetContainer::IsNoItemDragged()
   436     {
   458     {
   437     TBool noItemDragged = EFalse;
   459     TBool noItemDragged = EFalse;
   438   noItemDragged = ( KErrNotFound == iDraggedIndex ) ? ETrue : noItemDragged;
   460     noItemDragged = ( KErrNotFound == iDraggedIndex ) ? ETrue : noItemDragged;
   439     CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
   461     CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
   440     if( !noItemDragged && model )
   462     if( !noItemDragged && model )
   441         {
   463         {
   442     CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( iDraggedIndex ));
   464         CHnItemModel* onItemModel = model->GetItemModel( model->IdByIndex( iDraggedIndex ));
   443         if( onItemModel )
   465         if( onItemModel )
   444             {
   466             {
   445         noItemDragged = ( onItemModel->GetItemType() == EItemTypeParentFolder );
   467             noItemDragged = ( onItemModel->GetItemType() == EItemTypeParentFolder );
   446             }
   468             }
   447         }
   469         }
   448     return noItemDragged;
   470     return noItemDragged;
   449     }
   471     }
   450 
   472 
   551 
   573 
   552 // -----------------------------------------------------------------------------
   574 // -----------------------------------------------------------------------------
   553 //
   575 //
   554 // -----------------------------------------------------------------------------
   576 // -----------------------------------------------------------------------------
   555 //
   577 //
   556 TBool CMmWidgetContainer::IsDeleteLockedL( TInt aItemIndex )
   578 TMmWidgetPosition CMmWidgetContainer::WidgetPositionCache() const
       
   579     {
       
   580     return iWidgetPositionCache;
       
   581     }
       
   582 
       
   583 // -----------------------------------------------------------------------------
       
   584 //
       
   585 // -----------------------------------------------------------------------------
       
   586 //
       
   587 TBool CMmWidgetContainer::IsDeleteLocked( TInt aItemIndex )
   557     {
   588     {
   558     TBool result = ETrue;
   589     TBool result = ETrue;
   559 
   590 
   560     CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
   591     CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
   561     if( model )
   592     if( model )
   593 
   624 
   594     if( !isAnimated )
   625     if( !isAnimated )
   595         {
   626         {
   596         if( GetHighlight() != iDraggedIndex
   627         if( GetHighlight() != iDraggedIndex
   597                 && IsFolderL( GetHighlight() )
   628                 && IsFolderL( GetHighlight() )
   598                 && !IsDeleteLockedL( GetHighlight() )
   629                 && !IsDeleteLocked( GetHighlight() )
   599                 && iDrawer->IsDraggable() )
   630                 && iDrawer->IsDraggable() )
   600             {
   631             {
   601             iDrawer->AnimateItemZoomInL( GetHighlight() );
   632             iDrawer->AnimateItemZoomInL( GetHighlight() );
   602             }
   633             }
   603         }
   634         }
   672         ManageFolderZoomingL( draggedItemOverIcons );
   703         ManageFolderZoomingL( draggedItemOverIcons );
   673 
   704 
   674         HandleDragL( pointerEvent, aAbortAnimations );
   705         HandleDragL( pointerEvent, aAbortAnimations );
   675 
   706 
   676         }
   707         }
   677     else if (aPointerEvent.iType == TPointerEvent::EButton1Up && iDrawer->IsDraggable())
   708     else if( aPointerEvent.iType == TPointerEvent::EButton1Up && iDrawer->IsDraggable() )
   678         {
   709         {
   679         if( !draggedItemOverIcons )
   710         if( !draggedItemOverIcons )
   680             {
   711             {
   681             SetManualHighlightL( iDraggedIndex );
   712             SetManualHighlightL( iDraggedIndex );
   682             }
   713             }
   714             longTapPointerEvent.iType = TPointerEvent::EDrag;
   745             longTapPointerEvent.iType = TPointerEvent::EDrag;
   715             }
   746             }
   716         iLongTapDetector->PointerEventL( longTapPointerEvent );
   747         iLongTapDetector->PointerEventL( longTapPointerEvent );
   717         }
   748         }
   718 
   749 
   719     CCoeControl::HandlePointerEventL( aPointerEvent );
       
   720 
       
   721     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   750     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   722             && itemExists  )
   751             && itemExists  )
   723         {
   752         {
   724         SetHighlightL( index );
   753         SetHighlightL( index );
   725         }
   754         }
   726     else if( aPointerEvent.iType == TPointerEvent::EDrag
   755     else if( aPointerEvent.iType == TPointerEvent::EDrag
   727     // the line below is needed to enable edit mode in the list widget
   756             // the line below is needed to enable edit mode in the list widget
   728             // because behaviour in the grid and list is different
   757             // because behaviour in the grid and list is different
   729           || (aPointerEvent.iType == TPointerEvent::EButtonRepeat && WidgetType() == EGridWidget ))
   758           || (aPointerEvent.iType == TPointerEvent::EButtonRepeat && WidgetType() == EGridWidget ))
   730         {
   759         {
   731         if( itemExists )
   760         if( itemExists )
   732             {
   761             {
   739                     }
   768                     }
   740                 }
   769                 }
   741             }
   770             }
   742         else
   771         else
   743             {
   772             {
       
   773             iDragOccured = ETrue;
   744             SetHighlightVisibilityL( EFalse );
   774             SetHighlightVisibilityL( EFalse );
   745             }
   775             }
   746         }
   776         }
       
   777 
       
   778     CCoeControl::HandlePointerEventL( aPointerEvent );
   747 
   779 
   748     TInt lastTopItemIndex = Widget()->TopItemIndex();
   780     TInt lastTopItemIndex = Widget()->TopItemIndex();
   749 
   781 
   750     TBool abortAnimation = lastTopItemIndex != Widget()->TopItemIndex();
   782     TBool abortAnimation = lastTopItemIndex != Widget()->TopItemIndex();
   751 
   783 
   818 //
   850 //
   819 // -----------------------------------------------------------------------------
   851 // -----------------------------------------------------------------------------
   820 //
   852 //
   821 EXPORT_C void CMmWidgetContainer::SetHighlightVisibilityL( TBool aEnable )
   853 EXPORT_C void CMmWidgetContainer::SetHighlightVisibilityL( TBool aEnable )
   822     {
   854     {
   823     // activate the model
       
   824     CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel();
       
   825 
       
   826     if( suiteModel )
       
   827         {
       
   828         suiteModel->SetActiveL( aEnable );
       
   829         }
       
   830 
       
   831     if( ( !!aEnable != !!iPreviousHighlightVisibility ) // Ex-OR
   855     if( ( !!aEnable != !!iPreviousHighlightVisibility ) // Ex-OR
   832             || ( !!aEnable != !!IsHighlightVisible() ) ) // Ex-OR
   856             || ( !!aEnable != !!IsHighlightVisible() ) ) // Ex-OR
   833         {
   857         {
   834 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   858 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   835         MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal(
   859         MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal(
   850             {
   874             {
   851             iWidget->View()->ItemDrawer()->ClearFlags(
   875             iWidget->View()->ItemDrawer()->ClearFlags(
   852                     CListItemDrawer::ESingleClickDisabledHighlight );
   876                     CListItemDrawer::ESingleClickDisabledHighlight );
   853             }
   877             }
   854 
   878 
   855         if( IsVisible() )
   879         if( IsVisible() && !aEnable )
   856             {
   880             {
   857             TInt highlight = GetHighlight();
   881             TInt highlight = GetHighlight();
   858             CListBoxView* view = Widget()->View();
   882             CListBoxView* view = Widget()->View();
   859             Widget()->DrawNow( TRect( view->ItemPos( highlight ),
   883             Widget()->DrawNow( TRect( view->ItemPos( highlight ),
   860                     view->ItemSize( highlight ) ) );
   884                     view->ItemSize( highlight ) ) );
  1396 //
  1420 //
  1397 void CMmWidgetContainer::CancelDragL()
  1421 void CMmWidgetContainer::CancelDragL()
  1398     {
  1422     {
  1399     if( iIsEditMode && iDrawer )
  1423     if( iIsEditMode && iDrawer )
  1400         {
  1424         {
  1401         if( iDrawer->GetFloatingItemIndex( EDrag ) != KErrNotFound )
  1425         if( iDrawer->GetFloatingItemIndex( EDrag ) != KErrNotFound
       
  1426                 || iDrawer->GetFloatingItemIndex( EDragStart ) != KErrNotFound )
  1402             {
  1427             {
  1403             CancelDragL( EFalse );
  1428             CancelDragL( EFalse );
  1404             }
  1429             }
  1405         }
  1430         }
  1406     }
  1431     }
  1447             - iWidget->TopItemIndex() / ColumnsInCurrentView() ) <= 1 )
  1472             - iWidget->TopItemIndex() / ColumnsInCurrentView() ) <= 1 )
  1448         {
  1473         {
  1449         return;
  1474         return;
  1450         }
  1475         }
  1451 
  1476 
  1452   TBool needToScrollUp =
  1477     TBool needToScrollUp =
  1453     GetHighlight() - iWidget->TopItemIndex() < ColumnsInCurrentView()
  1478             GetHighlight() - iWidget->TopItemIndex() < ColumnsInCurrentView()
  1454     && iWidget->TopItemIndex() != 0;
  1479             && iWidget->TopItemIndex() != 0;
  1455 
  1480 
  1456   TBool needToScrollDown =
  1481     TBool needToScrollDown =
  1457     iWidget->BottomItemIndex() - GetHighlight() < ColumnsInCurrentView()
  1482             iWidget->BottomItemIndex() - GetHighlight() < ColumnsInCurrentView()
  1458     && iWidget->BottomItemIndex() / ColumnsInCurrentView()
  1483             && iWidget->BottomItemIndex() / ColumnsInCurrentView()
  1459       != ( NumberOfItems() - 1 )  / ColumnsInCurrentView();
  1484                 != ( NumberOfItems() - 1 )  / ColumnsInCurrentView();
  1460 
  1485 
  1461     if( WidgetType() == EGridWidget )
  1486     if( WidgetType() == EGridWidget )
  1462         {
  1487         {
  1463         // TODO: temporary - invisible partial items in MCL grid :/
  1488         // TODO: temporary - invisible partial items in MCL grid :/
  1464     needToScrollDown =
  1489         needToScrollDown =
  1465       iWidget->BottomItemIndex() - ColumnsInCurrentView() - GetHighlight() < ColumnsInCurrentView()
  1490                 iWidget->BottomItemIndex() - ColumnsInCurrentView() - GetHighlight() < ColumnsInCurrentView()
  1466         && ( iWidget->BottomItemIndex() / ColumnsInCurrentView() ) - 1
  1491                 && ( iWidget->BottomItemIndex() / ColumnsInCurrentView() ) - 1
  1467         != ( NumberOfItems() - 1 ) / ColumnsInCurrentView()
  1492                     != ( NumberOfItems() - 1 ) / ColumnsInCurrentView()
  1468       && iWidget->BottomItemIndex() - iWidget->TopItemIndex()
  1493                 && iWidget->BottomItemIndex() - iWidget->TopItemIndex()
  1469         > ColumnsInCurrentView() * RowsInCurrentView();
  1494                     > ColumnsInCurrentView() * RowsInCurrentView();
  1470         }
  1495         }
  1471 
  1496 
  1472     if( needToScrollUp )
  1497     if( needToScrollUp )
  1473         {
  1498         {
  1474 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1499 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1475       MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() );
  1500         MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() );
  1476         if( transApi )
  1501         if( transApi )
  1477             {
  1502             {
  1478             transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollUp );
  1503             transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollUp );
  1479             }
  1504             }
  1480 #endif
  1505 #endif
  1481         iDrawer->RemoveFloatingItems();
  1506         iDrawer->RemoveFloatingItems();
  1482     iWidget->View()->VScrollTo(
  1507         iWidget->View()->VScrollTo(
  1483         iWidget->TopItemIndex() - ColumnsInCurrentView() );
  1508                 iWidget->TopItemIndex() - ColumnsInCurrentView() );
  1484 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1509 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1485         if( transApi )
  1510         if( transApi )
  1486             {
  1511             {
  1487             transApi->Draw( Rect() );
  1512             transApi->Draw( Rect() );
  1488             }
  1513             }
  1491         }
  1516         }
  1492     else if( needToScrollDown )
  1517     else if( needToScrollDown )
  1493         {
  1518         {
  1494 
  1519 
  1495 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1520 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1496       MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() );
  1521         MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iDrawer->Gc() );
  1497         if( transApi )
  1522         if( transApi )
  1498             {
  1523             {
  1499             transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown );
  1524             transApi->SetMoveType( MAknListBoxTfxInternal::EListScrollDown );
  1500             }
  1525             }
  1501 #endif
  1526 #endif
  1502         iDrawer->RemoveFloatingItems();
  1527         iDrawer->RemoveFloatingItems();
  1503     iWidget->View()->VScrollTo(
  1528         iWidget->View()->VScrollTo(
  1504         iWidget->TopItemIndex() + ColumnsInCurrentView() );
  1529                 iWidget->TopItemIndex() + ColumnsInCurrentView() );
  1505 
  1530 
  1506 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1531 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1507         if( transApi )
  1532         if( transApi )
  1508             {
  1533             {
  1509             transApi->Draw( Rect() );
  1534             transApi->Draw( Rect() );
  1558             && iDraggedIndex != Widget()->CurrentItemIndex()
  1583             && iDraggedIndex != Widget()->CurrentItemIndex()
  1559             && iDraggedIndex < NumberOfItems() )
  1584             && iDraggedIndex < NumberOfItems() )
  1560         {
  1585         {
  1561         TBool isFolder( EFalse );
  1586         TBool isFolder( EFalse );
  1562         CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
  1587         CHnSuiteModel* model = GetMmModel()->GetSuiteModel();
  1563     CHnItemModel* onItemModel = model->GetItemModel(
  1588         CHnItemModel* onItemModel = model->GetItemModel(
  1564         model->IdByIndex( Widget()->CurrentItemIndex() ));
  1589         model->IdByIndex( Widget()->CurrentItemIndex() ));
  1565         if( onItemModel )
  1590         if( onItemModel )
  1566             {
  1591             {
  1567             isFolder = onItemModel->GetItemType() == EItemTypeParentFolder
  1592             isFolder = onItemModel->GetItemType() == EItemTypeParentFolder
  1568                     || onItemModel->GetItemType() == EItemTypeFolder;
  1593                     || onItemModel->GetItemType() == EItemTypeFolder;
  1978     {
  2003     {
  1979     //    handle same behaviour in edit mode and normal mode
  2004     //    handle same behaviour in edit mode and normal mode
  1980     switch( aEventType )
  2005     switch( aEventType )
  1981         {
  2006         {
  1982         case MEikListBoxObserver::EEventPenDownOnItem:
  2007         case MEikListBoxObserver::EEventPenDownOnItem:
  1983         case MEikListBoxObserver::EEventItemSingleClicked:
       
  1984             {
  2008             {
  1985             iDragOccured = EFalse;
  2009             iDragOccured = EFalse;
  1986             break;
  2010             break;
  1987             }
  2011             }
       
  2012         case MEikListBoxObserver::EEventItemSingleClicked:
       
  2013             break;
  1988         case MEikListBoxObserver::EEventItemDraggingActioned:
  2014         case MEikListBoxObserver::EEventItemDraggingActioned:
  1989             {
  2015             {
  1990             iDragOccured = ETrue;
  2016             iDragOccured = ETrue;
  1991             break;
  2017             break;
  1992             }
  2018             }
  1998         switch( aEventType )
  2024         switch( aEventType )
  1999             {
  2025             {
  2000             case MEikListBoxObserver::EEventFlickStarted:
  2026             case MEikListBoxObserver::EEventFlickStarted:
  2001             case MEikListBoxObserver::EEventPanningStarted:
  2027             case MEikListBoxObserver::EEventPanningStarted:
  2002                 {
  2028                 {
  2003         static_cast<CMmListBoxItemDrawer*>(
  2029                 static_cast<CMmListBoxItemDrawer*>(
  2004             Widget()->View()->ItemDrawer() )->
  2030                         Widget()->View()->ItemDrawer() )->
  2005             EnableCachedDataUse( ETrue );
  2031                             EnableCachedDataUse( ETrue );
  2006         break;
  2032                 break;
  2007         }
  2033                 }
  2008       case MEikListBoxObserver::EEventFlickStopped:
  2034             case MEikListBoxObserver::EEventFlickStopped:
  2009         {
  2035                 {
  2010         static_cast<CMmListBoxItemDrawer*>(
  2036                 static_cast<CMmListBoxItemDrawer*>(
  2011             Widget()->View()->ItemDrawer() )->
  2037                         Widget()->View()->ItemDrawer() )->
  2012             EnableCachedDataUse( EFalse );
  2038                             EnableCachedDataUse( EFalse );
  2013         DrawView();
  2039                 DrawView();
  2014         break;
  2040                 break;
  2015         }
  2041                 }
  2016       case MEikListBoxObserver::EEventPanningStopped:
  2042             case MEikListBoxObserver::EEventPanningStopped:
  2017         {
  2043                 {
  2018         static_cast<CMmListBoxItemDrawer*>(
  2044                 static_cast<CMmListBoxItemDrawer*>(
  2019             Widget()->View()->ItemDrawer() )->
  2045                         Widget()->View()->ItemDrawer() )->
  2020             EnableCachedDataUse( EFalse );
  2046                             EnableCachedDataUse( EFalse );
  2021         break;
  2047                 break;
  2022                 }
  2048                 }
  2023             }
  2049             }
  2024         }
  2050         }
  2025     else
  2051     else
  2026         {
  2052         {
  2034                 break;
  2060                 break;
  2035                 }
  2061                 }
  2036             }
  2062             }
  2037         }
  2063         }
  2038 
  2064 
  2039     if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked &&
  2065     if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked
  2040         iListBoxObserver && !iLongTapInProgress && !iDrawer->IsDraggable() )
  2066             && iListBoxObserver && !iLongTapInProgress && !iDrawer->IsDraggable()
       
  2067             && !iDragOccured )
  2041         {
  2068         {
  2042         iListBoxObserver->HandleListBoxEventL( aListBox, aEventType );
  2069         iListBoxObserver->HandleListBoxEventL( aListBox, aEventType );
  2043         }
  2070         }
  2044     }
  2071     }
  2045 //End of file
  2072 //End of file