equal
deleted
inserted
replaced
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.59 % << Don't touch! Updated by Synergy at check-out. |
15 * Version : %version: MM_71.1.17.1.64 % << 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> |
103 , iLongTapInProgress( EFalse ) |
103 , iLongTapInProgress( EFalse ) |
104 , iBgContext( NULL ) |
104 , iBgContext( NULL ) |
105 , iIsFaded( EFalse ) |
105 , iIsFaded( EFalse ) |
106 , iHasFocus( ETrue ) |
106 , iHasFocus( ETrue ) |
107 , iInForeground( ETrue ) |
107 , iInForeground( ETrue ) |
|
108 , iLongTapDetector( NULL ) |
108 , iAllowMove( EFalse ) |
109 , iAllowMove( EFalse ) |
109 , iRecipientId( KErrNotFound ) |
110 , iRecipientId( KErrNotFound ) |
110 , iEventParameters( NULL ) |
111 , iEventParameters( NULL ) |
|
112 , iDialogOpened( EFalse ) |
|
113 , iHighlightVisibleBeforeLongTap( EFalse ) |
111 { |
114 { |
112 iWidgetPositionCache.iValid = EFalse; |
115 iWidgetPositionCache.iValid = EFalse; |
113 } |
116 } |
114 |
117 |
115 // ----------------------------------------------------------------------------- |
118 // ----------------------------------------------------------------------------- |
133 EXPORT_C void CMmWidgetContainer::EnableLongTapAnimation( TBool aEnable ) |
136 EXPORT_C void CMmWidgetContainer::EnableLongTapAnimation( TBool aEnable ) |
134 { |
137 { |
135 if( iLongTapDetector ) |
138 if( iLongTapDetector ) |
136 { |
139 { |
137 iLongTapDetector->EnableLongTapAnimation( aEnable ); |
140 iLongTapDetector->EnableLongTapAnimation( aEnable ); |
|
141 // cancel longTap timer, avoid showing popupmenu |
|
142 if( !aEnable ) |
|
143 { |
|
144 iLongTapDetector->PointerEventL( TPointerEvent() ); |
|
145 } |
138 } |
146 } |
139 } |
147 } |
140 |
148 |
141 // ----------------------------------------------------------------------------- |
149 // ----------------------------------------------------------------------------- |
142 // |
150 // |
234 static_cast<CMmListBoxItemDrawer*>( iDrawer )->TemplateLibrary(); |
242 static_cast<CMmListBoxItemDrawer*>( iDrawer )->TemplateLibrary(); |
235 templateLibrary->CleanAndClearCache(); |
243 templateLibrary->CleanAndClearCache(); |
236 } |
244 } |
237 |
245 |
238 TBool highlightVisibleBefore = iWidget->IsVisible() && IsHighlightVisible(); |
246 TBool highlightVisibleBefore = iWidget->IsVisible() && IsHighlightVisible(); |
|
247 |
|
248 // fix ou1cimx1#344006 error; when we close dialog - if highlight had been |
|
249 // visible/invisible before dialog has been opened, we restore highlight visibility flag. |
|
250 if( !iIsFaded && iDialogOpened) |
|
251 { |
|
252 iDialogOpened = EFalse; |
|
253 if(highlightVisibleBefore != iHighlightVisibleBeforeLongTap) |
|
254 { |
|
255 SetHighlightVisibilityL( iHighlightVisibleBeforeLongTap); |
|
256 } |
|
257 highlightVisibleBefore = iHighlightVisibleBeforeLongTap; |
|
258 } |
|
259 |
239 CCoeControl::HandleResourceChange( aType ); |
260 CCoeControl::HandleResourceChange( aType ); |
240 if( highlightVisibleBefore ) |
261 if( highlightVisibleBefore ) |
241 { |
262 { |
242 TRAP_IGNORE( SetHighlightVisibilityL( ETrue ) ); |
263 TRAP_IGNORE( SetHighlightVisibilityL( ETrue ) ); |
243 } |
264 } |
521 |
542 |
522 // ----------------------------------------------------------------------------- |
543 // ----------------------------------------------------------------------------- |
523 // |
544 // |
524 // ----------------------------------------------------------------------------- |
545 // ----------------------------------------------------------------------------- |
525 // |
546 // |
|
547 EXPORT_C void CMmWidgetContainer::SetExDialogOpened( TBool aOpened ) |
|
548 { |
|
549 iDialogOpened = aOpened; |
|
550 } |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 // ----------------------------------------------------------------------------- |
|
555 // |
526 TBool CMmWidgetContainer::IsDeleteLockedL( TInt aItemIndex ) |
556 TBool CMmWidgetContainer::IsDeleteLockedL( TInt aItemIndex ) |
527 { |
557 { |
528 TBool result = ETrue; |
558 TBool result = ETrue; |
529 |
559 |
530 CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); |
560 CHnSuiteModel* model = GetMmModel()->GetSuiteModel(); |
954 else if( aItemIndex >= 0 && aItemIndex < GetMmModel()->NumberOfItems() ) |
984 else if( aItemIndex >= 0 && aItemIndex < GetMmModel()->NumberOfItems() ) |
955 { |
985 { |
956 iPreviousHighlight = iCurrentHighlight; |
986 iPreviousHighlight = iCurrentHighlight; |
957 iCurrentHighlight = aItemIndex; |
987 iCurrentHighlight = aItemIndex; |
958 |
988 |
959 if( iPreviousHighlight != iCurrentHighlight ) |
989 if( IsHighlightVisible() && iPreviousHighlight != iCurrentHighlight ) |
960 { |
990 { |
961 HideOptionsMenuIfDisplayed(); |
991 HideOptionsMenuIfDisplayed(); |
962 } |
992 } |
963 |
993 |
964 CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); |
994 CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); |
1581 CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); |
1611 CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); |
1582 if( suiteModel && highlightedItemIndex != KErrNotFound |
1612 if( suiteModel && highlightedItemIndex != KErrNotFound |
1583 && suiteModel->GetSuiteHighlight() == highlightedItemIndex |
1613 && suiteModel->GetSuiteHighlight() == highlightedItemIndex |
1584 && ItemIsVisible( highlightedItemIndex ) ) |
1614 && ItemIsVisible( highlightedItemIndex ) ) |
1585 { |
1615 { |
1586 iWidgetPositionCache.iHighlightedItemId = |
1616 iWidgetPositionCache.iHighlightedItemId = |
1587 suiteModel->IdByIndex( highlightedItemIndex ); |
1617 suiteModel->IdByIndex( highlightedItemIndex ); |
1588 } |
1618 } |
1589 |
1619 |
1590 iWidgetPositionCache.iValid = ETrue; |
1620 iWidgetPositionCache.iValid = ETrue; |
1591 } |
1621 } |
1610 // This corrects the position cached during the upper boundary |
1640 // This corrects the position cached during the upper boundary |
1611 // effect. AlignBottomOfViewL will take care of lower boundary |
1641 // effect. AlignBottomOfViewL will take care of lower boundary |
1612 // effect. |
1642 // effect. |
1613 } |
1643 } |
1614 |
1644 |
1615 Widget()->View()->SetTopItemIndex(iWidgetPositionCache.iTopItemIndex); |
1645 Widget()->View()->SetTopItemIndex(iWidgetPositionCache.iTopItemIndex); |
1616 SetVerticalItemOffset( iWidgetPositionCache.iVerticalItemOffset ); |
1646 SetVerticalItemOffset( iWidgetPositionCache.iVerticalItemOffset ); |
1617 TRAP_IGNORE( AlignBottomOfViewL() ); |
1647 TRAP_IGNORE( AlignBottomOfViewL() ); |
1618 |
1648 |
1619 // Important: If an item that was previously highlighted and visible is |
1649 // Important: If an item that was previously highlighted and visible is |
1620 // still highlighted and yet somehow is not visible after the position |
1650 // still highlighted and yet somehow is not visible after the position |
1622 // item is visible again: |
1652 // item is visible again: |
1623 CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); |
1653 CHnSuiteModel* suiteModel = GetMmModel()->GetSuiteModel(); |
1624 if( suiteModel && IsHighlightVisible() ) |
1654 if( suiteModel && IsHighlightVisible() ) |
1625 { |
1655 { |
1626 TInt highlightedItemIndex = suiteModel->GetSuiteHighlight(); |
1656 TInt highlightedItemIndex = suiteModel->GetSuiteHighlight(); |
1627 TInt highlightedItemId = highlightedItemIndex != KErrNotFound ? |
1657 TInt highlightedItemId = highlightedItemIndex != KErrNotFound ? |
1628 suiteModel->IdByIndex( highlightedItemIndex ) : KErrNotFound; |
1658 suiteModel->IdByIndex( highlightedItemIndex ) : KErrNotFound; |
1629 if ( highlightedItemId != KErrNotFound |
1659 if ( highlightedItemId != KErrNotFound |
1630 && highlightedItemId == iWidgetPositionCache.iHighlightedItemId |
1660 && highlightedItemId == iWidgetPositionCache.iHighlightedItemId |
1631 && !ItemIsVisible( highlightedItemIndex ) ) |
1661 && !ItemIsVisible( highlightedItemIndex ) ) |
1632 { |
1662 { |
1633 TRAP_IGNORE( ScrollToItemL( highlightedItemIndex ) ); |
1663 TRAP_IGNORE( ScrollToItemL( highlightedItemIndex ) ); |
1634 } |
1664 } |
1635 } |
1665 } |
1636 } |
1666 } |
1821 { |
1851 { |
1822 TInt scrollConsumed( EFalse ); |
1852 TInt scrollConsumed( EFalse ); |
1823 if( aIndex >= 0 && aIndex <= NumberOfItems() ) |
1853 if( aIndex >= 0 && aIndex <= NumberOfItems() ) |
1824 { |
1854 { |
1825 scrollConsumed = AlignBottomOfViewL(); |
1855 scrollConsumed = AlignBottomOfViewL(); |
1826 if ( !scrollConsumed && Widget()->View()->ItemIsPartiallyVisible(aIndex)) |
1856 if ( !scrollConsumed && Widget()->View()->ItemIsPartiallyVisible(aIndex)) |
1827 { |
1857 { |
1828 // the case when the item is partially visible at top or |
1858 // the case when the item is partially visible at top or |
1829 // bottom of screen. Th e view is scrolled the offset to |
1859 // bottom of screen. The view is scrolled the offset to |
1830 // make the item entirely visible. |
1860 // make the item entirely visible. |
1831 TInt offsetBottom = Widget()->View()->ItemPos( aIndex ).iY |
1861 TInt offsetBottom = Widget()->View()->ItemPos( aIndex ).iY |
1832 + Widget()->ItemHeight() |
1862 + Widget()->ItemHeight() |
1833 - Widget()->View()->ViewRect().Height(); |
1863 - Widget()->View()->ViewRect().Height(); |
1834 TInt offsetTop = Widget()->View()->ItemPos( aIndex ).iY; |
1864 TInt offsetTop = Widget()->View()->ItemPos( aIndex ).iY; |
1899 const TPoint& aPenEventScreenLocation ) |
1929 const TPoint& aPenEventScreenLocation ) |
1900 { |
1930 { |
1901 TInt index( KErrNotFound ); |
1931 TInt index( KErrNotFound ); |
1902 if( iWidget->View()->XYPosToItemIndex( aPenEventLocation, index ) ) |
1932 if( iWidget->View()->XYPosToItemIndex( aPenEventLocation, index ) ) |
1903 { |
1933 { |
|
1934 iHighlightVisibleBeforeLongTap = iPreviousHighlightVisibility; |
1904 SetHighlightVisibilityL( ETrue ); |
1935 SetHighlightVisibilityL( ETrue ); |
1905 iLongTapInProgress = ETrue; |
1936 iLongTapInProgress = ETrue; |
1906 if( iLongTapObserver ) |
1937 if( iLongTapObserver ) |
1907 { |
1938 { |
1908 iLongTapObserver->HandleLongTapEventL( aPenEventScreenLocation ); |
1939 iLongTapObserver->HandleLongTapEventL( aPenEventScreenLocation ); |
1926 EXPORT_C void CMmWidgetContainer::EndLongTapL( TBool aStopTimer ) |
1957 EXPORT_C void CMmWidgetContainer::EndLongTapL( TBool aStopTimer ) |
1927 { |
1958 { |
1928 if( iLongTapInProgress ) |
1959 if( iLongTapInProgress ) |
1929 { |
1960 { |
1930 iLongTapInProgress = EFalse; |
1961 iLongTapInProgress = EFalse; |
1931 if( aStopTimer ) |
1962 if( aStopTimer && !iIsFaded ) |
1932 { |
1963 { |
1933 SetHighlightVisibilityL( EFalse ); |
1964 SetHighlightVisibilityL( EFalse ); |
1934 } |
1965 } |
1935 } |
1966 } |
1936 } |
1967 } |