diff -r fcdfafb36fe7 -r aecbbf00d063 uifw/AvKon/src/AknIndicatorContainer.cpp --- a/uifw/AvKon/src/AknIndicatorContainer.cpp Thu Aug 19 10:11:06 2010 +0300 +++ b/uifw/AvKon/src/AknIndicatorContainer.cpp Tue Aug 31 15:28:30 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -112,8 +112,7 @@ TInt iFlags; TBool iIncallBubbleDisabled; TBool iIsForeground; - CEikStatusPaneBase* iStatusPane; - MTouchFeedback* iFeedback; + TBool iIsActiveIdle; }; @@ -141,29 +140,6 @@ } TRAP_IGNORE( CCoeEnv::Static()->AddMessageMonitorObserverL( *this ) ); - - iFeedback = MTouchFeedback::Instance(); - if ( iFeedback && - iIndicatorContainer->iIndicatorContext == - CAknIndicatorContainer::EUniversalIndicators ) - { - // Tactile feedback is only used for universal indicator pane. - CFeedbackSpec* fbSpec = CFeedbackSpec::New(); - if ( fbSpec ) - { - fbSpec->AddFeedback( ETouchEventStylusDown, - ETouchFeedbackSensitiveButton ); - fbSpec->AddFeedback( ETouchEventStylusUp, - ETouchFeedbackSensitiveButton, - ETouchFeedbackVibra ); - - iFeedback->SetFeedbackArea( iIndicatorContainer, - 0, - iIndicatorContainer->Rect(), - fbSpec ); - delete fbSpec; - } - } } @@ -174,7 +150,7 @@ iSmallStatusPaneLayout = AknStatuspaneUtils::SmallLayoutActive(); iIncallBubbleAllowedInUsual = ETrue; iIsForeground = static_cast( CEikonEnv::Static()->EikAppUi() )->IsForeground(); - iStatusPane = CEikStatusPaneBase::Current(); + iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle(); } @@ -184,12 +160,6 @@ delete iDataObserver; CCoeEnv::Static()->RemoveMessageMonitorObserver( *this ); - - MTouchFeedback* feedback = MTouchFeedback::Instance(); - if ( feedback ) - { - feedback->RemoveFeedbackForControl( iIndicatorContainer ); - } } @@ -307,6 +277,9 @@ iIndicators = new (ELeave) CAknIndicatorQueue( KAknIndicatorQueueGranularity ); } + + + iTicker = CPeriodic::NewL( CActive::EPriorityLow ); } @@ -636,13 +609,6 @@ AknStatuspaneUtils::ExtendedStaconPaneActive() || ( AknStatuspaneUtils::StaconPaneActive() && !AknStatuspaneUtils::IdleLayoutActive() ) ); - - if ( iExtension && iExtension->iFeedback ) - { - iExtension->iFeedback->ChangeFeedbackArea( this, - 0, - Rect() ); - } } AknsUtils::RegisterControlPosition( this ); @@ -832,29 +798,26 @@ EXPORT_C TInt CAknIndicatorContainer::CountComponentControls() const { - return iIndicators->Count(); - } - -TInt CAknIndicatorContainer::CountShownIndicator() const - { - TInt count = iIndicators->Count(); - TInt indicatorShown = 0; - for ( TInt i = 0; i< count; i++ ) - { - if( iIndicators->At(i)->IndicatorState() && iIndicators->At( i )->Priority() != KIndicatorNotShown ) - { - indicatorShown++; - } - } - return indicatorShown; + return (iIndicatorsShown); } EXPORT_C CCoeControl* CAknIndicatorContainer::ComponentControl(TInt aIndex) const { - if ( aIndex >= 0 && aIndex < iIndicators->Count() ) + TInt count = iIndicators->Count(); + + TInt ii = 0; + for (ii = 0; (ii < count) && (aIndex >= 0); ii++) { - return iIndicators->At( aIndex ); + if ( iIndicators->At(ii)->IndicatorState() && (iIndicators->At(ii)->Priority() != KIndicatorNotShown)) + { + aIndex--; + } + } + + if ( ii > 0 ) + { + return iIndicators->At(--ii); } else { @@ -863,18 +826,10 @@ } -EXPORT_C void CAknIndicatorContainer::Draw( const TRect& aRect ) const +EXPORT_C void CAknIndicatorContainer::Draw( const TRect& /*aRect*/ ) const { - if ( iExtension->iStatusPane && - iExtension->iStatusPane->IsTransparent() && - ( iIndicatorContext != EQueryEditorIndicators ) ) + if ( iExtension->iIsActiveIdle ) { - CWindowGc& gc = SystemGc(); - TRgb rgb(TRgb::Color16MA(0)); - gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); - gc.SetBrushStyle(CGraphicsContext::ESolidBrush); - gc.SetBrushColor(rgb); - gc.Clear(aRect); return; } @@ -1080,8 +1035,7 @@ { CAknControl::HandlePointerEventL( aPointerEvent ); - // Pointer events are only handled in the universal indicator container. - if ( iExtension && iIndicatorContext == EUniversalIndicators ) + if ( AknLayoutUtils::PenEnabled() && iExtension ) { TRect rect( Rect() ); @@ -1097,23 +1051,32 @@ // set flag that down was inside indicator iExtension->iFlags |= EAknIndicatorsButton1DownInIndicatorPaneRect; + + if ( iIndicatorContext == EUniversalIndicators && + iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect + ) + { + MTouchFeedback* feedback = MTouchFeedback::Instance(); + + if ( feedback ) + { + feedback->InstantFeedback( this, ETouchFeedbackSensitiveButton ); + } + } } break; } case TPointerEvent::EButton1Up: { - // Currently the small digital clock pane, universal - // indicator pane and battery pane (in status pane layouts - // where it's adjacent to universal indicator or digital - // clock pane) are regarded as one touch responsive - // area from which the universal indicator popup should - // open on tap, so upon pointer up event it must be checked - // here if the down event happened inside this control, - // but the up event inside digital clock or battery pane area. + // Currently the small digital clock pane and universal + // indicator pane are regarded as one touch responsive area from + // which the universal indicator popup should open on tap, + // so upon pointer up event it must be checked here if + // the down event happened inside this control, but the up event + // inside digital clock pane area. CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); - TBool pointerUpInClockArea( EFalse ); - TBool pointerUpInBatteryArea( EFalse ); + TRect clockRect( 0, 0, 0, 0 ); if ( sp ) { @@ -1121,60 +1084,29 @@ TUid::Uid( EEikStatusPaneUidDigitalClock ) ); if ( clockPane ) { - TRect clockRect( clockPane->PositionRelativeToScreen(), - clockPane->Size() ); - pointerUpInClockArea = - clockRect.Contains( aPointerEvent.iParentPosition ); - } - - if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() ) - { - CCoeControl* batteryPane = sp->ContainerControlL( - TUid::Uid( EEikStatusPaneUidBattery ) ); - if ( batteryPane ) - { - TRect batteryRect( - batteryPane->PositionRelativeToScreen(), - batteryPane->Size() ); - pointerUpInBatteryArea = - batteryRect.Contains( aPointerEvent.iParentPosition ); - } + clockRect = TRect( clockPane->PositionRelativeToScreen(), + clockPane->Size() ); } } // if indicator's rect contains pointer up position - if ( ( iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect && + if ( iIndicatorContext == EUniversalIndicators && + ( ( iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect && rect.Contains( aPointerEvent.iPosition ) ) || - pointerUpInClockArea || - pointerUpInBatteryArea ) + clockRect.Contains( aPointerEvent.iParentPosition ) ) ) { - if ( iExtension->iFeedback && - ( pointerUpInClockArea || pointerUpInBatteryArea ) ) - { - // The pointer down was received in another control, - // so the tactile feedback must be given directly. - iExtension->iFeedback->InstantFeedback( - this, - ETouchFeedbackSensitiveButton, - ETouchFeedbackVibra, - aPointerEvent ); - } - - CAknSmallIndicator* indicatorNotifier = CAknSmallIndicator::NewLC( TUid::Uid( 0 ) ); - indicatorNotifier->HandleIndicatorTapL(); - //for indicator popup event MTouchFeedback* feedback = MTouchFeedback::Instance(); if ( feedback ) { - feedback->InstantFeedback( - this, - ETouchFeedbackPopUp, - ETouchFeedbackVibra, - aPointerEvent ); + feedback->InstantFeedback( this, + ETouchFeedbackSensitiveButton, + ETouchFeedbackVibra, + aPointerEvent ); } + CAknSmallIndicator* indicatorNotifier = CAknSmallIndicator::NewLC( TUid::Uid( 0 ) ); + indicatorNotifier->HandleIndicatorTapL(); CleanupStack::PopAndDestroy( indicatorNotifier ); } - // Up happened, reset button down flag iExtension->iFlags &= ( ~EAknIndicatorsButton1DownInIndicatorPaneRect ); @@ -1208,29 +1140,30 @@ return; } - // Bubble sorted - for (TInt i = 0; i < ( count - 1 ); i++) + CAknIndicator* temp; + for(TInt ii = 1; ii < count; ii++) { - TBool swaped = EFalse; - for (TInt j = count - 1; j > i; j--) + temp = iIndicators->At(ii); + TInt tempPriority = temp->Priority(); + if (tempPriority >= 0) { - if ( iIndicators->At( j )->Priority() - < iIndicators->At( j - 1 )->Priority() ) + for(TInt jj = 0; jj <= ii; jj++) { - CAknIndicator* temp = iIndicators->At( j ); - iIndicators->Delete( j ); - CleanupStack::PushL( temp ); - iIndicators->InsertL( j - 1, temp ); - CleanupStack::Pop( temp ); - swaped = ETrue; + if (tempPriority < iIndicators->At(jj)->Priority()) + { + iIndicators->Delete( ii ); + CleanupStack::PushL( temp ); + iIndicators->InsertL( jj, temp ); + CleanupStack::Pop( temp ); + break; + } + else if ( jj == (ii-1) ) + { + break; + } } } - if( !swaped ) - { - break; - } } - } @@ -1976,16 +1909,15 @@ TInt uid = indicator->Uid().iUid; - if ( uid == EAknNaviPaneEditorIndicatorGprs || - uid == EAknNaviPaneEditorIndicatorWlanAvailable || - uid == EAknNaviPaneEditorIndicatorWlanActive || - uid == EAknNaviPaneEditorIndicatorWlanActiveSecure || - (!isLandscape && - (uid == EAknNaviPaneEditorIndicatorProgressBar || - uid == EAknNaviPaneEditorIndicatorFileSize || - uid == EAknNaviPaneEditorIndicatorWaitBar || - uid == EAknNaviPaneEditorIndicatorSecuredConnection || - uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe))) + if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection || + uid == EAknNaviPaneEditorIndicatorProgressBar || + uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe || + uid == EAknNaviPaneEditorIndicatorGprs || + uid == EAknNaviPaneEditorIndicatorFileSize || + uid == EAknNaviPaneEditorIndicatorWaitBar || + uid == EAknNaviPaneEditorIndicatorWlanAvailable || + uid == EAknNaviPaneEditorIndicatorWlanActive || + uid == EAknNaviPaneEditorIndicatorWlanActiveSecure ) { // These indicators are not shown in this statuspane layout. indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) ); @@ -1996,16 +1928,6 @@ if ( iLayoutOrientation == EVertical ) { - if (uid == EAknNaviPaneEditorIndicatorProgressBar || uid - == EAknNaviPaneEditorIndicatorFileSize || uid - == EAknNaviPaneEditorIndicatorWaitBar || uid - == EAknNaviPaneEditorIndicatorSecuredConnection || uid - == EAknNaviPaneEditorIndicatorWmlWaitGlobe) - { - indicator->SetExtent(TPoint(0, 0), TSize(0, 0)); - iIndicatorsShown++; - continue; - } // Highest priority indicator is put topmost. if ( height < indicator->IconSize().iHeight ) { @@ -2047,112 +1969,6 @@ TInt textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels; - //////////////////////////////////////////////////////////////////////////// - //small status pane - TRect smallStatusPaneRect; - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, - smallStatusPaneRect); - - // small statuspane, secure state indicator - TAknWindowLineLayout - smallStatusSecureStateLayout = - AknLayout::Small_status_pane_descendants_and_elements_Line_5(); - TAknLayoutRect smallStatusSecureStateLayoutRect; - smallStatusSecureStateLayoutRect.LayoutRect(smallStatusPaneRect, - smallStatusSecureStateLayout); - TRect smallStatusSecureStateRect( - smallStatusSecureStateLayoutRect.Rect()); - - // small statuspane, wait pane - TAknWindowComponentLayout smallStatusWaitPaneLayout = - AknLayoutScalable_Avkon::status_small_wait_pane(3); - TAknLayoutRect smallStatusWaitPaneLayoutRect; - smallStatusWaitPaneLayoutRect.LayoutRect(smallStatusPaneRect, - smallStatusWaitPaneLayout); - TRect smallStatusWaitPaneRect( - smallStatusWaitPaneLayoutRect.Rect()); - - // small statuspane, globe - TAknWindowComponentLayout smallStatusWmlGlobeLayout = - AknLayoutScalable_Avkon::status_small_pane_g4(0); - TAknLayoutRect smallStatusWmlGlobeLayoutRect; - smallStatusWmlGlobeLayoutRect.LayoutRect(smallStatusPaneRect, - smallStatusWmlGlobeLayout); - TRect smallStatusWmlGlobeRect( - smallStatusWmlGlobeLayoutRect.Rect()); - - TInt waitBarIndicatorLeftOffset = smallStatusWaitPaneRect.iTl.iX; - TInt progressBarIndicatorLeftOffset = 0; - TInt wmlWaitGlobeLeftOffset = smallStatusWmlGlobeRect.iTl.iX; - - TRect rectForMiddleIndicators(wmlWaitGlobeLeftOffset, - containerRect.iTl.iY, wmlWaitGlobeLeftOffset, - containerRect.iBr.iY); - - if (AknLayoutUtils::LayoutMirrored()) - { - wmlWaitGlobeLeftOffset = smallStatusPaneRect.iBr.iX - - smallStatusWmlGlobeRect.iBr.iX; - waitBarIndicatorLeftOffset = smallStatusPaneRect.iBr.iX - - smallStatusWaitPaneRect.iBr.iX; - } - - if (uid == EAknNaviPaneEditorIndicatorProgressBar) - { - indicatorWidth = smallStatusWaitPaneRect.Width(); - indicatorHeight = smallStatusWaitPaneRect.Height(); - verticalOffset = (containerRect.Height() - indicatorHeight)/ 2; - leftOffset = progressBarIndicatorLeftOffset; - - textIndicatorOffsetNeeded = ETrue; - } - else if (uid == EAknNaviPaneEditorIndicatorFileSize) - { - verticalOffset = verticalOffsetForTextIndicator; - - // need left offset in western, right offset in A&H layout. - if (AknLayoutUtils::LayoutMirrored()) - { - rightOffset = textIndicatorLeftOffset; - } - else - { - leftOffset = KMinSpaceBetweenIconsInPixels; - } - } - else if (uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe) - { - verticalOffset = (containerRect.Height() - - indicator->IconSize().iHeight) / 2; - indicatorWidth = smallStatusWmlGlobeRect.Width(); - } - else if (uid == EAknNaviPaneEditorIndicatorWaitBar) - { - indicatorWidth = smallStatusWaitPaneRect.Width(); - indicatorHeight = smallStatusWaitPaneRect.Height(); - verticalOffset = (containerRect.Height() - indicatorHeight)/ 2; - leftOffset = waitBarIndicatorLeftOffset; - textIndicatorOffsetNeeded = ETrue; - } - else if (uid == EAknNaviPaneEditorIndicatorSecuredConnection) - { - verticalOffset = (containerRect.Height() - - smallStatusSecureStateRect.Height()) / 2; - - // because icon bitmap does not contain enough space, increase offset as - // the layout spec states. - if (AknLayoutUtils::LayoutMirrored()) - { - leftOffset = KMinSpaceBetweenIconsInPixels; - } - else - { - rightOffset = KMinSpaceBetweenIconsInPixels; - } - textIndicatorOffsetNeeded = EFalse; - progressBarIndicatorLeftOffset = 0; - } - //////////////////////////////////////////////////////////////////////// if ( uid == EAknNaviPaneEditorIndicatorMessageInfo || uid == EAknNaviPaneEditorIndicatorWmlWindowsText || uid == EAknNaviPaneEditorIndicatorMessageLength ) @@ -2321,30 +2137,9 @@ // Place indicators to the middle if any. if ( indicatorPosition == EMiddle ) { - TRect requiredRect( rectForMiddleIndicators.iTl.iX, - rectForMiddleIndicators.iTl.iY, - rectForMiddleIndicators.iTl.iX + leftOffset - + indicatorWidth + rightOffset, - rectForMiddleIndicators.iBr.iY ); - - // check if indicator fits - if (( requiredRect.Intersects( rectForRightSideIndicators ) - || requiredRect.Intersects(rectForLeftSideIndicators )) - || ( rectForMiddleIndicators.Width() != 0 )) - { - indicator->SetExtent(TPoint(0, 0), TSize(0, 0)); - iIndicatorsShown++; - continue; - } - else - { - indicator->SetExtent( TPoint( - rectForMiddleIndicators.iTl.iX + leftOffset, - verticalOffset ), TSize( indicatorWidth, - indicatorHeight )); - rectForMiddleIndicators.iTl.iX += rightOffset; - rectForMiddleIndicators.iTl.iX += indicatorWidth; - } + // Not supported for now, always set size to zero. + indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) ); + iIndicatorsShown++; } } @@ -3078,87 +2873,67 @@ iIndicatorsShown++; TBool showIndicator( ETrue ); - switch ( iIndicatorsShown ) { case 1: { - if ( extendedFlatLayout ) - { - indicatorLayout = - AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g1( 0 ); - } - else - { - indicatorLayout = - AknLayoutScalable_Avkon::uni_indicator_pane_g1( 1 ); - } + indicatorLayout = + AknLayoutScalable_Avkon::uni_indicator_pane_g1( 1 ); break; } case 2: { - if ( extendedFlatLayout ) - { - indicatorLayout = - AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g2( 0 ); - } - else - { - indicatorLayout = - AknLayoutScalable_Avkon::uni_indicator_pane_g2( 1 ); - } + indicatorLayout = + AknLayoutScalable_Avkon::uni_indicator_pane_g2( 1 ); break; } case 3: { - if ( extendedFlatLayout ) + indicatorLayout = + AknLayoutScalable_Avkon::uni_indicator_pane_g3( 1 ); + break; + } + + // TODO: Add support (remove the extendedFlatLayout checks + // below) for six indicators also in the extended flat layout + // once the layout data is fixed. + + case 4: + { + if ( !extendedFlatLayout ) { indicatorLayout = - AknLayoutScalable_Avkon::indicator_nsta_pane_cp_g3( 0 ); + AknLayoutScalable_Avkon::uni_indicator_pane_g4( 1 ); } else { - indicatorLayout = - AknLayoutScalable_Avkon::uni_indicator_pane_g3( 1 ); - } - break; - } - case 4: - { - if ( extendedFlatLayout ) - { showIndicator = EFalse; } - else - { - indicatorLayout = - AknLayoutScalable_Avkon::uni_indicator_pane_g4( 1 ); - } break; } case 5: { - if ( extendedFlatLayout ) + if ( !extendedFlatLayout ) { - showIndicator = EFalse; + indicatorLayout = + AknLayoutScalable_Avkon::uni_indicator_pane_g5( 1 ); } else { - indicatorLayout = - AknLayoutScalable_Avkon::uni_indicator_pane_g5( 1 ); + showIndicator = EFalse; } break; } case 6: { - if ( extendedFlatLayout ) + if ( !extendedFlatLayout ) { - showIndicator = EFalse; + indicatorLayout = + AknLayoutScalable_Avkon::uni_indicator_pane_g6( 1 ); } else { - indicatorLayout = - AknLayoutScalable_Avkon::uni_indicator_pane_g6( 1 ); + showIndicator = EFalse; } break; } @@ -4072,8 +3847,8 @@ } } - if (indicator && (indicator->IndicatorState() || - indicator->Priority()!= KIndicatorNotShown)) + if ( indicator && + ( indicator->IndicatorState() || indicator->Priority() != KIndicatorNotShown ) ) { SizeChanged(); DrawDeferred(); @@ -4285,37 +4060,24 @@ if ( !iExtension->iIsForeground || R_AVKON_STATUS_PANE_LAYOUT_EMPTY == curId ) { - if ( iTicker ) + if ( iTicker->IsActive() ) { iTicker->Cancel(); - delete iTicker; - iTicker = NULL; } - return; } - if ( iAnimatedIndicatorsShown > 0 ) + if ( !iTicker->IsActive() && iAnimatedIndicatorsShown > 0 ) { - if ( !iTicker ) - { - TRAP_IGNORE( iTicker = CPeriodic::NewL( CActive::EPriorityLow ) ); - } - - if ( iTicker && !iTicker->IsActive() ) - { - iTicker->Start( KAknIndicatorAnimationShortDelay, - KAknIndicatorAnimationInterval, - TCallBack( TickerCallback, this ) ); - } + iTicker->Start( KAknIndicatorAnimationShortDelay, + KAknIndicatorAnimationInterval, + TCallBack( TickerCallback, this ) ); } - else if ( iTicker && iAnimatedIndicatorsShown == 0 ) + else if ( iTicker->IsActive() && iAnimatedIndicatorsShown == 0 ) { // Cancel animation timer if animated indicators // are not visible anymore. iTicker->Cancel(); - delete iTicker; - iTicker = NULL; iSynchronizingValue = 0; } }