# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274782082 -10800 # Node ID 0a9e01492035779f0532ffac6a455f712f057385 # Parent c45d4fe2ff0a37a8490fe2d98d259892242bdb21 Revision: 201019 Kit: 2010121 diff -r c45d4fe2ff0a -r 0a9e01492035 bearermanagement/mpm/inc/mpmserver.h --- a/bearermanagement/mpm/inc/mpmserver.h Tue May 11 16:35:05 2010 +0300 +++ b/bearermanagement/mpm/inc/mpmserver.h Tue May 25 13:08:02 2010 +0300 @@ -57,6 +57,10 @@ //Total number of ranges const TUint KMPMPolicyRangeCount = 2; + +// roaming to connected wlan wait interval +// in micro seconds (10 sec) +const TInt KRoamingToWlanUpdateInterval = 10000000; //Definition of the ranges of IPC numbers const TInt KMPMPolicyRanges[KMPMPolicyRangeCount] = @@ -712,6 +716,14 @@ void StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo ); /** + * Starts forced roaming sequence to connected wlan + * + * @param aIapInfo Info about available IAPs + * @since 5.2 + */ + static TInt StartForcedRoamingToConnectedWlanL( TAny* aUpdater ); + + /** * Starts forced roaming sequence from WLAN if necessary * * @param aIapInfo Info about available IAPs @@ -1010,6 +1022,12 @@ // Is WLAN usage already accepted in this offline session. TOfflineWlanQueryResponse iOfflineWlanQueryResponse; + + // Timer to start roaming to connected WLAN network + CPeriodic* iRoamingToWlanPeriodic; + + // TConnMonIapInfo Info about available IAPs + TConnMonIapInfo iConnMonIapInfo; }; #include "mpmserver.inl" diff -r c45d4fe2ff0a -r 0a9e01492035 bearermanagement/mpm/src/mpmserver.cpp --- a/bearermanagement/mpm/src/mpmserver.cpp Tue May 11 16:35:05 2010 +0300 +++ b/bearermanagement/mpm/src/mpmserver.cpp Tue May 25 13:08:02 2010 +0300 @@ -301,6 +301,11 @@ // CMPMServer::~CMPMServer() { + if ( iRoamingToWlanPeriodic ) + { + iRoamingToWlanPeriodic->Cancel(); + delete iRoamingToWlanPeriodic; + } if ( iDisconnectQueue ) { iDisconnectQueue->ResetAndDestroy(); @@ -984,7 +989,32 @@ TCmUsageOfWlan usageOfWlan = CommsDatAccess()->ForcedRoamingL(); if ( usageOfWlan == ECmUsageOfWlanKnown || usageOfWlan == ECmUsageOfWlanKnownAndNew ) { - StartForcedRoamingToWlanL( iapInfo ); + if ( IsWlanConnectionStartedL( CommsDatAccess() ) ) + { + iConnMonIapInfo = aIapInfo; + + if ( iRoamingToWlanPeriodic ) + { + iRoamingToWlanPeriodic->Cancel(); + } + else + { + iRoamingToWlanPeriodic = CPeriodic::NewL( + CActive::EPriorityStandard ); + } + // start periodic object that calls StartForcedRoamingToWlanL after 10s. + // this handles the case when new wlan connection is + // started from e.g. wlan sniffer but IAP is not yet in Internet SNAP + iRoamingToWlanPeriodic->Start( + TTimeIntervalMicroSeconds32( KRoamingToWlanUpdateInterval ), + TTimeIntervalMicroSeconds32( KRoamingToWlanUpdateInterval ), + TCallBack( StartForcedRoamingToConnectedWlanL, this ) ); + } + else + { + StartForcedRoamingToWlanL( iapInfo ); + } + StartForcedRoamingFromWlanL( iapInfo ); } @@ -1804,12 +1834,11 @@ void CMPMServer::StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo ) { MPMLOGSTRING( "CMPMServer::StartForcedRoamingToWlan" ) - - // First check that there is no active wlan connection - if ( IsWlanConnectionStartedL( CommsDatAccess() ) ) + + // cancel the periodic object + if ( iRoamingToWlanPeriodic != NULL ) { - // Wlan already active can't roam to it - return; + iRoamingToWlanPeriodic->Cancel(); } // Copy all available wlan iap ids to own array @@ -1869,6 +1898,20 @@ CleanupStack::PopAndDestroy( &wlanIapIds ); } + +// --------------------------------------------------------------------------- +// CMPMServer::StartForcedRoamingToConnectedWlanL +// --------------------------------------------------------------------------- +// +TInt CMPMServer::StartForcedRoamingToConnectedWlanL( TAny* aUpdater ) + { + MPMLOGSTRING( "CMPMServer::StartForcedRoamingToConnectedWlanL" ); + static_cast( aUpdater )->StartForcedRoamingToWlanL( + static_cast( aUpdater )->iConnMonIapInfo ); + return 0; + } + + // ----------------------------------------------------------------------------- // CMPMServer::StartForcedRoamingFromWlanL // ----------------------------------------------------------------------------- diff -r c45d4fe2ff0a -r 0a9e01492035 cmmanager/cmmgr/Framework/Inc/cmdesticonmap.h --- a/cmmanager/cmmgr/Framework/Inc/cmdesticonmap.h Tue May 11 16:35:05 2010 +0300 +++ b/cmmanager/cmmgr/Framework/Inc/cmdesticonmap.h Tue May 25 13:08:02 2010 +0300 @@ -137,7 +137,7 @@ * @Description: */ void DrawItem( CWindowGc& aGc, - const TRect& aSctPosition, + TInt index, TInt aIconIndex, TBool aHighlighted, TBool aDrawBackground ) const; @@ -241,8 +241,6 @@ mutable TBool iOffscreenBgDrawn; TInt iMaxColumns; - TInt iCurrentPage; - TInt iNumPages; CCmDestinationIconMapExtension* iExtension; CArrayPtr* iConsArray; TBool iDragAlreadyActive; diff -r c45d4fe2ff0a -r 0a9e01492035 cmmanager/cmmgr/Framework/Src/cmdesticonmap.cpp --- a/cmmanager/cmmgr/Framework/Src/cmdesticonmap.cpp Tue May 11 16:35:05 2010 +0300 +++ b/cmmanager/cmmgr/Framework/Src/cmdesticonmap.cpp Tue May 25 13:08:02 2010 +0300 @@ -285,9 +285,6 @@ iFirstVisibleRow = 0; iAnimated = EFalse; iCursorPos = TPoint( 0, 0 ); - iNumPages = ( iRows / iExtension->iMaxVisibleRows ) + - ( iRows % iExtension->iMaxVisibleRows ? 1 : 0 ); - iCurrentPage = 1; // Create and set the scb visible even though there is nothing to scroll delete iSBFrame; iSBFrame=NULL; @@ -364,9 +361,9 @@ // Main pane without softkeys TRect mainPaneRect; if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ) ) - { - mainPaneRect = iAvkonAppUi->ClientRect(); - } + { + mainPaneRect = iAvkonAppUi->ClientRect(); + } // Dialog layout, check variety first TAknLayoutScalableParameterLimits iconMapDialogVariety = @@ -409,10 +406,14 @@ // if more lines than possible to show, use the default // ( the biggest grid ) variety if ( varietyNumber < 0 ) - varietyNumber = 0; + { + varietyNumber = 0; + } // if zero rows, use the minimum else if ( iRows<=0 ) - varietyNumber -= 1; + { + varietyNumber -= 1; + } //add the varietyoffset varietyNumber += maxVarietyOffset; @@ -528,32 +529,20 @@ { if ( AknLayoutUtils::PenEnabled() ) { - TInt newGridX; // For the whole - TInt newGridY; // For the whole grid. + TInt xInPixels = aPointerEvent.iPosition.iX - iGridTopLeft.iX; TInt yInPixels = aPointerEvent.iPosition.iY - iGridTopLeft.iY; - newGridY = yInPixels / iGridItemHeight; - if ( ( aPointerEvent.iPosition.iX - iGridTopLeft.iX ) < 0 ) - { - newGridX = -1; - } - else - { - newGridX = ( aPointerEvent.iPosition.iX - iGridTopLeft.iX ) - / iGridItemWidth; - } + TInt newGridX = xInPixels / iGridItemWidth; + TInt newGridY = yInPixels / iGridItemHeight; + TInt globalY = newGridY + iFirstVisibleRow; // The pointer has been set down or dragged into the area of the grid. - // (it might be in the "white space" at the end of the grid) - if ( ( yInPixels >= 0 && yInPixels < iGridItemHeight - * iExtension->iMaxVisibleRows) && - // When the pointer is in rows except the recent icon row - ( ( ( ( newGridY + iFirstVisibleRow ) != 0 ) && - newGridX < iMaxColumns && newGridX >= 0 ) || - // When the pointer is in the recent icon row - ( ( newGridY + iFirstVisibleRow == 0 ) && - ( newGridX < iMaxColumns ) ) ) ) + // Also, it may NOT be in the "empty slots" at the end of the grid. + if ( xInPixels >= 0 && + yInPixels >= 0 && + newGridX < iMaxColumns && + yInPixels < iGridItemHeight * iExtension->iMaxVisibleRows && + globalY * iMaxColumns + newGridX + 1 <= iConsArray->Count() ) { - TUint globalY = newGridY + iFirstVisibleRow; // For any action to be taken, the pointer event must either be a // Button1Down or a drag event which has originated from a // Button1Down in to the grid. @@ -727,11 +716,15 @@ // if more lines than possible to show, use the default // ( the biggest grid ) variety if ( varietyNumber < 0 ) - varietyNumber = 0; + { + varietyNumber = 0; + } // if zero rows, use the minimum else if ( iRows<=0 ) - varietyNumber -= 1; - + { + varietyNumber -= 1; + } + //add the varietyoffset varietyNumber += maxVarietyOffset; @@ -749,10 +742,9 @@ else { varietyNumber = 3; - } - - } - + } + } + TAknLayoutRect popupGridLayRect; popupGridLayRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) ); @@ -832,8 +824,7 @@ { // save the old info for the magnitudes of the SCT grid TInt oldMaxColumns = iMaxColumns; - //TInt oldMaxRows = 0; - //oldMaxRows = iRows; + // calculate the new magnitudes DoLayout(); @@ -1023,7 +1014,7 @@ TPoint pos = iGridTopLeft; - TInt endX = pos.iX + iGridItemWidth * iMaxColumns + 1; + TInt endX = pos.iX + iGridItemWidth * iMaxColumns; TInt endY = pos.iY + iGridItemHeight * fullRows; TInt ii = 0; @@ -1039,7 +1030,7 @@ pos.iX += iGridItemWidth; } - pos = iGridTopLeft; + pos = iGridTopLeft; // Draw full horizontal lines for ( ii = 0 ; ii <= fullRows ; ii++ ) @@ -1074,9 +1065,8 @@ } } - TInt iconIndex = ( iCurrentPage - 1 ) * - ( iMaxColumns * iExtension->iMaxVisibleRows ); - TInt lCnt = iConsArray->Count(); + TInt iconIndex = iFirstVisibleRow * iMaxColumns; + TInt lCnt = iConsArray->Count(); cursorPos = iCursorPos.iX + iCursorPos.iY * iMaxColumns; if ( lCnt > 0 ) { @@ -1086,7 +1076,7 @@ j < lCnt && i < numberOfIconsToBeDrawn; j++, i++ ) { - DrawItem( gc, CursorRect( i ), j, cursorPos == i, EFalse ); + DrawItem( gc, i, j, cursorPos == i, EFalse ); } } @@ -1101,18 +1091,22 @@ // void CCmDestinationIconMap::DrawItem( CWindowGc& aGc, - const TRect& aSctPosition, + TInt index, TInt aIconIndex, TBool aHighlighted, TBool aDrawBackground ) const { + TRect sctPosition = CursorRect( index ); MAknsSkinInstance* skin = AknsUtils::SkinInstance(); MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); - TBool skins = AknsDrawUtils::Background( skin,cc,aGc, aSctPosition ); + TBool skins = AknsDrawUtils::Background( skin,cc,aGc, sctPosition ); TRgb color; if ( !skins ) + { aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + } + if ( aHighlighted ) { TRgb colorHightLightRect = AKN_LAF_COLOR( 215 ); @@ -1121,10 +1115,10 @@ KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG7 ); aGc.SetPenColor( colorHightLightRect ); - aGc.DrawRect( aSctPosition ); + aGc.DrawRect( sctPosition ); // Shrink by one pixel in all directions. - TRect innerRect = aSctPosition; + TRect innerRect = sctPosition; innerRect.Shrink( 1,1 ); color = AKN_LAF_COLOR( 210 ); @@ -1137,7 +1131,7 @@ } else if ( aDrawBackground ) { - TRect innerRect = aSctPosition; + TRect innerRect = sctPosition; aGc.SetBrushColor( AKN_LAF_COLOR( 0 ) ); if ( !skins ) { @@ -1159,13 +1153,8 @@ CGulIcon* bitmap = NULL; bitmap = iConsArray->At( aIconIndex ); - TInt numIconsInaPage = iExtension->iMaxVisibleRows * iMaxColumns; - TInt cellIndex = aIconIndex; - if ( aIconIndex >= numIconsInaPage ) - { - cellIndex = aIconIndex % numIconsInaPage; - } - aGc.BitBltMasked( CursorPoint( cellIndex ), + + aGc.BitBltMasked( CursorPoint( index ), bitmap->Bitmap(), cellRect, bitmap->Mask(), @@ -1218,7 +1207,7 @@ Window().Invalidate( rect ); Window().BeginRedraw( rect ); - DrawItem( SystemGc(), rect, iconIndex, aHighlighted, ETrue ); + DrawItem( SystemGc(), aCursorPos, iconIndex, aHighlighted, ETrue ); Window().EndRedraw(); SystemGc().DiscardFont(); } @@ -1272,10 +1261,14 @@ void CCmDestinationIconMap::MoveCursorL( TInt aDeltaX, TInt aDeltaY ) { if ( iIsMirrored ) + { aDeltaX = -aDeltaX; + } if ( ( iConsArray->Count() < 8 ) ) - return; + { + return; + } iOldCursorPos = iCursorPos; TInt oldFirstVisibleRow = iFirstVisibleRow; @@ -1443,11 +1436,6 @@ } } - //TInt increment( 1 ); - //if ( aDeltaY < 0 || aDeltaX < 0 ) - // { - //// increment = -1; - // } if ( iRows > iExtension->iMaxVisibleRows && ( iOldCursorPos.iY + oldFirstVisibleRow != iCursorPos.iY + iFirstVisibleRow ) ) @@ -1571,17 +1559,13 @@ TAknWindowComponentLayout scrollbarLayout = AknLayoutScalable_Avkon::scroll_pane_cp5(); - iCurrentPage = ( iFirstVisibleRow / iExtension->iMaxVisibleRows ) + 1; - - vSbarModel.iScrollSpan = iNumPages * iExtension->iMaxVisibleRows; + vSbarModel.iScrollSpan = iRows; vSbarModel.iThumbSpan = iExtension->iMaxVisibleRows; - if ( iSBFrame && iSBFrame->TypeOfVScrollBar() == - CEikScrollBarFrame::EDoubleSpan ) + if ( iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan ) { // For EDoubleSpan type scrollbar - vSbarModel.iThumbPosition = ( iCurrentPage - 1 ) * - iExtension->iMaxVisibleRows; + vSbarModel.iThumbPosition = iFirstVisibleRow; TAknDoubleSpanScrollBarModel hDsSbarModel( hSbarModel ); TAknDoubleSpanScrollBarModel vDsSbarModel( vSbarModel ); @@ -1675,7 +1659,8 @@ else if ( location == AknLayoutUtils::EAknCbaLocationLeft ) { maxVarietyOffset = varietyOffset + varietyOffset; // 2* - } + } + TInt varietyNumber = varietyOffset - iRows - 1; // if more lines than possible to show, use the default @@ -1886,7 +1871,7 @@ TInt cellHeight = cellRect.Height(); // calculate the number of items fitting to grid - iExtension->iMaxVisibleRows = 3;//gridHeight / cellHeight; + iExtension->iMaxVisibleRows = 3; //gridHeight / cellHeight; // Store the item height TAknLayoutRect secondRowLayRect; @@ -1913,9 +1898,13 @@ case EEikScrollPageUp: { // nothing done if we are already on the first page. - if ( iFirstVisibleRow != 0 ) - { - iFirstVisibleRow -= iExtension->iMaxVisibleRows; + if ( iFirstVisibleRow > 0 ) + { + iFirstVisibleRow -= iExtension->iMaxVisibleRows; + if ( iFirstVisibleRow < 0 ) + { + iFirstVisibleRow = 0; + } update = ETrue; } UpdateScrollIndicatorL(); @@ -1926,10 +1915,13 @@ case EEikScrollPageDown: { // nothing done if we are already on the last page. - if ( iFirstVisibleRow != iRows/iExtension->iMaxVisibleRows * - iExtension->iMaxVisibleRows ) + if ( iFirstVisibleRow < iRows - iExtension->iMaxVisibleRows ) { iFirstVisibleRow += iExtension->iMaxVisibleRows; + if ( iFirstVisibleRow > iRows - iExtension->iMaxVisibleRows ) + { + iFirstVisibleRow = iRows - iExtension->iMaxVisibleRows; + } update = ETrue; } UpdateScrollIndicatorL(); @@ -1937,13 +1929,10 @@ break; case EEikScrollThumbDragVert: - { - TInt thumbPosition; - TInt halfPage = iExtension->iMaxVisibleRows/2; + { // Ask which type of scrollbar is shown - //CAknAppUi* appUi = iAvkonAppUi; - TBool isDoubleSpan = - CEikScrollBarFrame::EDoubleSpan == iSBFrame->TypeOfVScrollBar(); + TInt thumbPosition; + TBool isDoubleSpan = ( CEikScrollBarFrame::EDoubleSpan == iSBFrame->TypeOfVScrollBar() ); if ( isDoubleSpan ) { thumbPosition = static_cast ( @@ -1953,24 +1942,10 @@ { thumbPosition = aScrollBar->Model()->iThumbPosition; } - - // If the slider is in the range of less then a half page from a - // possible correct thumb position. thus 0 <= iFirstVisibleRow - - // thumbPosition < halfPage. Or in the other direction: - // 0 <= thumbPosition - iFirstVisibleRow < halfPage - if ( !( ( 0 <= iFirstVisibleRow - thumbPosition && - iFirstVisibleRow - thumbPosition < halfPage )|| - ( 0 <= thumbPosition - iFirstVisibleRow && - thumbPosition - iFirstVisibleRow < halfPage ) ) ) - { - TReal toRound = thumbPosition / - ( TReal )iExtension->iMaxVisibleRows; - if ( toRound * 2 > ( TInt )toRound * 2 + 1 ) - { - toRound++; - } - iFirstVisibleRow = ( TInt )toRound * - iExtension->iMaxVisibleRows; + + if ( thumbPosition != iFirstVisibleRow ) + { + iFirstVisibleRow = thumbPosition; update = ETrue; } } @@ -1978,6 +1953,19 @@ case EEikScrollThumbReleaseVert: { + // Ask which type of scrollbar is shown + TBool isDoubleSpan = + CEikScrollBarFrame::EDoubleSpan == iSBFrame->TypeOfVScrollBar(); + if ( isDoubleSpan ) + { + iFirstVisibleRow = static_cast ( + aScrollBar->Model() )->FocusPosition(); + } + else + { + iFirstVisibleRow = aScrollBar->Model()->iThumbPosition; + } + update = ETrue; UpdateScrollIndicatorL(); } break; @@ -1988,53 +1976,11 @@ case EEikScrollPageRight: // flow through case EEikScrollThumbDragHoriz: // flow through case EEikScrollThumbReleaseHoriz: // flow through - // do nothing - break; - default: // do nothing break; } - - // If we have moved down to the last page we check that the cursor is in - // a place where it can be drawn. - if ( iFirstVisibleRow == - iRows/iExtension->iMaxVisibleRows * iExtension->iMaxVisibleRows ) - { - // the old cursor is set to a "safe" position where it at least can be. - iOldCursorPos.iX = 0; - iOldCursorPos.iY = 0; - // if the last page has only one line which isn't filled complitely. - if ( ( iConsArray->Count() % iMaxColumns - 1 < iCursorPos.iX ) && - ( iRows % iExtension->iMaxVisibleRows ) == 1 ) - { - iCursorPos.iX = iConsArray->Count()%iMaxColumns - 1; - } - // If the cursor is in a position where it would go unto a spot without - // a icon when scrolled. - if ( iCursorPos.iY + iFirstVisibleRow >= iRows ) - { - if ( iConsArray->Count() % iMaxColumns > iCursorPos.iX ) - { - iCursorPos.iY = iRows - 1 - iFirstVisibleRow; - } - else - { - iCursorPos.iY = iRows - 2 - iFirstVisibleRow; - } - } - // If the cursor is actually on the last row, but is still in the - // area where there is now icons. ( the rest of the last row ) - if ( ( iConsArray->Count() <= ( iFirstVisibleRow + iCursorPos.iY ) - * iMaxColumns + iCursorPos.iX ) && - ( iCursorPos.iY + iFirstVisibleRow + 1 == iRows ) ) - { - iCursorPos.iY--; - } - // if the corrections did not help and the cursor is in the area - // where there is a valid row, but no icons anymore - } - + // to avoid flicker we draw only if there really was something new to draw. if ( update ) { diff -r c45d4fe2ff0a -r 0a9e01492035 cmmanager/cmmgr/Framework/Src/cmdlg.cpp --- a/cmmanager/cmmgr/Framework/Src/cmdlg.cpp Tue May 11 16:35:05 2010 +0300 +++ b/cmmanager/cmmgr/Framework/Src/cmdlg.cpp Tue May 25 13:08:02 2010 +0300 @@ -190,7 +190,7 @@ if ( iHighlight ) { iListbox->ScrollToMakeItemVisible( iHighlight ); - iListbox->SetCurrentItemIndexAndDraw( iHighlight ); + iListbox->SetCurrentItemIndex( iHighlight ); } } @@ -1042,7 +1042,7 @@ //first item cannot be deleted iListbox->ScrollToMakeItemVisible( iListbox->Model()->NumberOfItems() -1 ); - iListbox->SetCurrentItemIndexAndDraw( iHighlight ); + iListbox->SetCurrentItemIndex( iHighlight ); } } } @@ -1685,6 +1685,7 @@ if ( selected >= 0 ) { iListbox->ScrollToMakeItemVisible( selected); + iListbox->SetCurrentItemIndex( selected ); } } } diff -r c45d4fe2ff0a -r 0a9e01492035 cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp --- a/cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp Tue May 11 16:35:05 2010 +0300 +++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp Tue May 25 13:08:02 2010 +0300 @@ -386,14 +386,26 @@ { CGSPluginInterface* plugin = NULL; - // 1) Decrease index with the count - TInt index = iListBox->CurrentItemIndex() - iGeneralItemCount; + // Plugins are in list box after general menu items. + TInt listBoxIndex = iListBox->CurrentItemIndex() - iGeneralItemCount; - // 2) Check that new index is in range of plugins - if ( index >= 0 && index < iPluginArray->Count() ) + // Pick the correct plugin: Skip the invisible plugin array items. + TInt i = 0; + TInt invisibleItems = 0; + CGSPluginInterface* tmpPlugin; + while ( i <= listBoxIndex + invisibleItems ) { - // 3) Get correct plugin - plugin = iPluginArray->operator[]( index ); + tmpPlugin = iPluginArray->operator[]( i ); + if ( tmpPlugin->Visible() == EFalse ) + { + invisibleItems++; + } + else if ( i == listBoxIndex + invisibleItems ) + { + plugin = tmpPlugin; + break; // Correct plugin found. + } + i++; } // Leave if not found diff -r c45d4fe2ff0a -r 0a9e01492035 connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp --- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp Tue May 25 13:08:02 2010 +0300 @@ -21,6 +21,8 @@ #include #include #include +#include // KErrPacketDataTsyMaxPdpContextsReached +#include // KErrUmtsMaxNumOfContextExceededByNetwork #include "ConnMonServ.h" #include "ConnMonSess.h" @@ -562,10 +564,10 @@ } else { - iEventInfo.Reset(); - if ( iInfoBuf().iStage != static_cast< TInt >( iEventInfo.iData ) ) { + iEventInfo.Reset(); + // Send only new stage info to clients iEventInfo.iEventType = EConnMonConnectionStatusChange; iEventInfo.iConnectionId = iConnectionId; @@ -640,13 +642,18 @@ } } - if ( iInfoBuf().iError == KErrNone ) - { - // New request + if ( iInfoBuf().iError == KErrNone || + iInfoBuf().iError == KErrGprsInsufficientResources || // -4154 + iInfoBuf().iError == KErrPacketDataTsyMaxPdpContextsReached || // -6000 + iInfoBuf().iError == KErrUmtsMaxNumOfContextExceededByNetwork || // -4179 + iInfoBuf().iError == KErrUmtsMaxNumOfContextExceededByPhone ) // -4178 + { + // New request, DisconnectDlg might be shown for the error codes above. Receive(); } else { + LOGIT1("CProgressNotifier::RunL() - connection closing - iInfoBuf().iError: %d", iInfoBuf().iError) // Connection is closing. CSubConnUpDownNotifier* subConnUpDownNotifier = 0; TInt err = iServer->Iap()->GetSubConnUpDownNotifier( diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQueryNotif.cpp --- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQueryNotif.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQueryNotif.cpp Tue May 25 13:08:02 2010 +0300 @@ -109,24 +109,23 @@ } } + TInt err( KErrNone ); + TInt emergencyCallState( 0 ); + // Check if emergency call is ongoing. If it is then do not display the dialog. - TInt err( KErrNone ); - TInt state( 0 ); - - err = RProperty::Get( - KPSUidCtsyEmergencyCallInfo, + err = RProperty::Get( KPSUidCtsyEmergencyCallInfo, KCTSYEmergencyCallInfo, - state ); - - if ( err == KErrNone && state ) + emergencyCallState ); + + if ( (err == KErrNone && emergencyCallState) || ScreenSaverOn() || AutolockOn() ) { - // Emergency call is active. Cancel connection. - CLOG_WRITE( "CConfirmationQueryNotif::StartL: Emergency call is active!" ); + // Emergency call, screen saver or autolock is active. Cancel the dialog. + CLOG_WRITE( "CConfirmationQueryNotif::StartL: Emergency call, Screen saver or Autolock is active." ); aMessage.WriteL( aReplySlot, TPckg( EMsgQueryCancelled ) ); aMessage.Complete( KErrNone ); return; } - + iChoice = EMsgQueryCancelled; TPckgBuf input; input.Copy( aBuffer ); diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp --- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp Tue May 25 13:08:02 2010 +0300 @@ -49,6 +49,13 @@ TInt aReplySlot, const RMessagePtr2& aMessage ) { + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + aMessage.Complete( KErrCancel ); + return; + } + iReplySlot = aReplySlot; iMessage = aMessage; iCancelled = EFalse; diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWpaDlgNotif.cpp --- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWpaDlgNotif.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWpaDlgNotif.cpp Tue May 25 13:08:02 2010 +0300 @@ -48,6 +48,13 @@ TInt aReplySlot, const RMessagePtr2& aMessage ) { + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + aMessage.Complete( KErrCancel ); + return; + } + iReplySlot = aReplySlot; iMessage = aMessage; iCancelled = EFalse; diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteNotif.cpp --- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteNotif.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteNotif.cpp Tue May 25 13:08:02 2010 +0300 @@ -56,8 +56,6 @@ TPckgBuf asyncVersion; asyncVersion.Copy( aBuffer ); - iCancelled = EFalse; - // We are about to display the Offline note. // Since this part of the code can be executed during the bootup, check if // the UI has really started up to display notes/dialogs. @@ -65,8 +63,17 @@ User::LeaveIfError ( RProperty::Get( KPSUidUikon, KUikGlobalNotesAllowed, notesAllowed ) ); + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + CLOG_WRITE( "COfflineWlanNoteNotif::StartL: Screen saver or Autolock is active." ); + aMessage.Complete( KErrCancel ); + return; + } + iReplySlot = aReplySlot; iMessage = aMessage; + iCancelled = EFalse; CLOG_WRITEF( _L( "notesAllowed : %d" ), notesAllowed ); diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLanDlgPlugin.cpp --- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLanDlgPlugin.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLanDlgPlugin.cpp Tue May 25 13:08:02 2010 +0300 @@ -84,6 +84,13 @@ { CLOG_ENTERFN( "CSelectWLanDlgPlugin::StartL " ); + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + aMessage.Complete( KErrCancel ); + return; + } + TPckgBuf asyncVersion; asyncVersion.Copy( aBuffer ); @@ -103,8 +110,7 @@ { aMessage.ReadL( aReplySlot, iNetworkPrefs ); - TInt err( KErrNone ); - TRAP( err, iActivePlugin = CActiveSelectWLanDlgPlugin::NewL( this ) ); + TRAPD( err, iActivePlugin = CActiveSelectWLanDlgPlugin::NewL( this ) ); if ( err ) { delete iActivePlugin; diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/easywapidlgnotif.cpp --- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/easywapidlgnotif.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/easywapidlgnotif.cpp Tue May 25 13:08:02 2010 +0300 @@ -47,6 +47,13 @@ TInt aReplySlot, const RMessagePtr2& aMessage ) { + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + aMessage.Complete( KErrCancel ); + return; + } + iReplySlot = aReplySlot; iMessage = aMessage; iCancelled = EFalse; diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionModel.cpp --- a/connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionModel.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionModel.cpp Tue May 25 13:08:02 2010 +0300 @@ -165,12 +165,12 @@ User::WaitForRequest( status ); CLOG_WRITEF(_L( "KClientInfo status: %d" ), status.Int() ); - + bearer = EBearerUnknown; iMonitor.GetIntAttribute( connId, 0, KBearer, bearer, status ); User::WaitForRequest( status ); CLOG_WRITEF(_L( "KBearer status: %d" ), status.Int() ); - + connStatus = KConnectionUninitialised; iMonitor.GetIntAttribute( connId, 0, KConnectionStatus, connStatus, status ); User::WaitForRequest( status ); diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgUi.cpp --- a/connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgUi.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgUi.cpp Tue May 25 13:08:02 2010 +0300 @@ -19,6 +19,9 @@ // INCLUDE FILES +#include +#include +#include #include "DisconnectDlgUi.h" #include "ActiveDisconnectDlgPlugin.h" #include "ConnectionModel.h" @@ -251,6 +254,31 @@ { CLOG_ENTERFN("CDisconnectDialogUi::StartL"); + TInt err( KErrNone ); + TInt screenSaverOn( 0 ); + + // Cancel the dialog if screensaver is on. + err = RProperty::Get( KPSUidScreenSaver, + KScreenSaverOn, + screenSaverOn ); + + TBool autolockOn( EFalse ); +#ifdef RD_STARTUP_CHANGE + TInt autolockStatus( 0 ); + // Cancel the dialog if Autolock is on. + err |= RProperty::Get( KPSUidCoreApplicationUIs, + KCoreAppUIsAutolockStatus, + autolockStatus ); + autolockOn = autolockStatus > EAutolockOff; +#endif + + if ( err == KErrNone && ( screenSaverOn > 0 || autolockOn ) ) + { + // Screen saver or Autolock is active. Cancel the dialog. + aMessage.Complete( KErrCancel ); + return; + } + iStarted = ETrue; TPckgBuf passedInfo; @@ -262,7 +290,7 @@ CLOG_WRITEF(_L( "iCntPrefs.iPrompt: %d" ), iConnectionPrefs.iPrompt ); - TInt err( KErrNone ); + err = KErrNone; TRAP( err, iActivePlugin = CActiveDisconnectDlgPlugin::NewL( this ) ); if ( err ) diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp --- a/connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp Tue May 25 13:08:02 2010 +0300 @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -159,7 +160,15 @@ void CConnDlgIapPlugin::StartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ) - { + { + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + CLOG_WRITE( "CConnDlgAuthenticationPlugin::StartL: Screen saver or Autolock is active." ); + aMessage.Complete( KErrCancel ); + return; + } + iPrefs.Copy( (TPtrC8) aBuffer ); iCancelled = EFalse; @@ -353,6 +362,14 @@ { CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::StartL" ); + if ( ScreenSaverOn() || AutolockOn() ) + { + // Screen saver or Autolock is active. Cancel the dialog. + CLOG_WRITE( "CConnDlgAuthenticationPlugin::StartL: Screen saver or Autolock is active." ); + aMessage.Complete( KErrCancel ); + return; + } + if ( aBuffer.Length() > iAuthPairBuff.Length() ) { CLOG_WRITE( "User::Panic, EConnDlgIllegalRequest" ); @@ -783,12 +800,26 @@ TInt aReplySlot, const RMessagePtr2& aMessage ) { + CLOG_ENTERFN( "CConnDlgSelectConnectionPlugin::StartL" ); + if ( iActivePlugin ) { aMessage.Complete( KErrServerBusy ); return; } - + + TInt iStartUpPhaseValue( EStartupUiPhaseUninitialized ); + RProperty::Get( KPSUidStartup, KPSStartupUiPhase, iStartUpPhaseValue ); + CLOG_WRITEF( _L( "CConnDlgSelectConnectionPlugin::Phone start up phase: %d" ), + iStartUpPhaseValue ); + // Don't show the dialog if phone boot up isn't complete or screen saver or Autolock is on. + if ( iStartUpPhaseValue != EStartupUiPhaseAllDone || ScreenSaverOn() || AutolockOn() ) + { + CLOG_WRITE( "CConnDlgSelectConnectionPlugin::StartL: Screen saver or Autolock is active or start up phase not completed yet." ); + aMessage.Complete( KErrCancel ); + return; + } + iPrefs.Copy( ( TPtrC8 ) aBuffer ); iCancelled = ETrue; // This method could leave before displaying the dialog. diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/group/CConnDlgPlugin.mmp --- a/connectionutilities/ConnectionDialogs/group/CConnDlgPlugin.mmp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/group/CConnDlgPlugin.mmp Tue May 25 13:08:02 2010 +0300 @@ -41,8 +41,6 @@ //Macro to /epoc32 headers MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/uikon - START RESOURCE ../cconndlg/data/CConnDlgPlugin.rss HEADER diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/group/ConnUiUtilsNotif.mmp --- a/connectionutilities/ConnectionDialogs/group/ConnUiUtilsNotif.mmp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/group/ConnUiUtilsNotif.mmp Tue May 25 13:08:02 2010 +0300 @@ -96,7 +96,6 @@ MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/uikon LIBRARY euser.lib eikdlg.lib eiksrv.lib cone.lib eikcore.lib eikcoctl.lib diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/group/DisconnectDlg.mmp --- a/connectionutilities/ConnectionDialogs/group/DisconnectDlg.mmp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/group/DisconnectDlg.mmp Tue May 25 13:08:02 2010 +0300 @@ -62,8 +62,6 @@ //Macro to /epoc32 headers MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/uikon - LIBRARY euser.lib LIBRARY cone.lib diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.h --- a/connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.h Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.h Tue May 25 13:08:02 2010 +0300 @@ -108,6 +108,20 @@ void ConstructL( const TDesC& aResourceFileName, const TBool aResourceFileResponsible ); + /** + * ScreenSaverOn() + * @param - + * return ETrue if Screen saver is on, EFalse if not. + */ + TBool ScreenSaverOn(); + + /** + * AutolockOn() + * @param - + * return ETrue if Autolock is on, EFalse if not. + */ + TBool AutolockOn(); + private: /** diff -r c45d4fe2ff0a -r 0a9e01492035 connectionutilities/ConnectionDialogs/src/ConnectionDialogsNotifBase.cpp --- a/connectionutilities/ConnectionDialogs/src/ConnectionDialogsNotifBase.cpp Tue May 11 16:35:05 2010 +0300 +++ b/connectionutilities/ConnectionDialogs/src/ConnectionDialogsNotifBase.cpp Tue May 25 13:08:02 2010 +0300 @@ -18,12 +18,14 @@ // INCLUDE FILES -#include "ConnectionDialogsNotifBase.h" - +#include +#include +#include #include #include #include +#include "ConnectionDialogsNotifBase.h" // CONSTANTS @@ -130,6 +132,43 @@ } } +// --------------------------------------------------------- +// CConnectionDialogsNotifBase::ScreenSaverOn() +// --------------------------------------------------------- +// +TBool CConnectionDialogsNotifBase::ScreenSaverOn() + { + TInt err( KErrNone ); + TInt screenSaverOn( 0 ); + + // Cancel the dialog if screen saver is on. + err = RProperty::Get( KPSUidScreenSaver, + KScreenSaverOn, + screenSaverOn ); + + return (err == KErrNone && screenSaverOn > 0); + } + +// --------------------------------------------------------- +// CConnectionDialogsNotifBase::AutolockOn() +// --------------------------------------------------------- +// +TBool CConnectionDialogsNotifBase::AutolockOn() + { + TBool retval( EFalse ); + +#ifdef RD_STARTUP_CHANGE + TInt err( KErrNone ); + TInt autolockOn( 0 ); + // Cancel the dialog if screen saver is on. + err = RProperty::Get( KPSUidCoreApplicationUIs, + KCoreAppUIsAutolockStatus, + autolockOn ); + retval = (err == KErrNone && autolockOn > EAutolockOff); +#endif + + return retval; + } // End of File