diff -r e1bea15f9a39 -r 79859ed3eea9 widgets/widgetapp/src/WidgetUiWindow.cpp --- a/widgets/widgetapp/src/WidgetUiWindow.cpp Thu Aug 19 10:58:56 2010 +0300 +++ b/widgets/widgetapp/src/WidgetUiWindow.cpp Tue Aug 31 16:17:46 2010 +0300 @@ -21,31 +21,27 @@ #include "WidgetUiWindowContainer.h" #include "WidgetUiWindowManager.h" #include "WidgetUiDialogsProviderProxy.h" -#include -#include "browser_platform_variant.hrh" +#include "WidgetRegistryConstants.h" +#include "Browser_platform_variant.hrh" #ifdef BRDO_WRT_HS_FF #include "cpspublisher.h" #endif #include -#include +#include #include -#include -#include -#include + +#include +#include #include "WidgetInstallerInternalCRKeys.h" -#include +#include #include #include #include #include #include -#include +#include #include "SWInstWidgetUid.h" -#ifdef RD_SCALABLE_UI_V2 -#include -#include -#endif //RD_SCALABLE_UI_V2 // EXTERNAL DATA STRUCTURES @@ -57,7 +53,6 @@ const TUint KWmlNoDefaultAccessPoint = KMaxTUint; // see cenrep setting default -1 as int, here as uint const TUint KWmlNoDefaultSnapId = KMaxTUint; // see cenrep setting default -1 as int, here as uint - // MACROS // LOCAL CONSTANTS AND MACROS @@ -98,9 +93,8 @@ : iWindowManager( aWindowManager ), iCpsPublisher( aCpsPublisher ), iNetworkAccessGrant(EInvalid), iPreferredOrientation(TBrCtlDefs::EOrientationUndefined), iIsCurrent(EFalse), iShowSoftkeys(EFalse), iWidgetLoaded(EFalse), - iSchemeProcessing (EFalse), iNetworkState(ENetworkNotAllowed), iUserPermission(ETrue), - iClickCount(0), iWidgetLoadStarted(EFalse), iSapiPromptCleared(ETrue),iNeedToIgnoreSapiNtfn(0), - iNeedToIgnoreSapiClearNtfn(0) + iSchemeProcessing (EFalse),iClickCount(0), iWidgetLoadStarted(EFalse), + iNetworkState(ENetworkNotAllowed), iUserPermission(ETrue) { } @@ -113,8 +107,7 @@ void CWidgetUiWindow::ConstructL( const TUid& aUid ) { iUid = aUid; - iDialogsProvider = CBrowserDialogsProvider::NewL( NULL ); - + iPenEnabled = AknLayoutUtils::PenEnabled(); iShowSoftkeys = iPenEnabled; @@ -127,7 +120,7 @@ iUrl = GetUlrL( clientSession, aUid ); iWidgetUiObserver = CWidgetUiObserver::NewL( *this ); - iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*iDialogsProvider, NULL, *this); + iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*(iWindowManager.DialogsProvider()), NULL, *this); #ifdef BRDO_WRT_HS_FF iNetworkModeWait = new(ELeave) CActiveSchedulerWait(); @@ -201,10 +194,8 @@ iDlId = 0; - iNeedToNotifyNetworkState = EFalse; // determine initial widget online/offline network state DetermineNetworkState(); - iAsyncCallBack = new (ELeave) CAsyncCallBack(TCallBack(DeleteItself,this),CActive::EPriorityLow); } // ----------------------------------------------------------------------------- @@ -215,10 +206,6 @@ // CWidgetUiWindow::~CWidgetUiWindow() { - if( iDialogsProvider) - { - iDialogsProvider->CancelAll(); - } if (iEngine && iWidgetUiObserver) { iEngine->RemoveLoadEventObserver( iWidgetUiObserver ); @@ -233,21 +220,10 @@ delete iLeftSoftKeyLabel; delete iWidgetUiDialogsProviderProxy; delete iSchemeHandler; - - iActiveMiniviewBitmap = 0; - iMiniviewBitmap1.Reset(); - iMiniviewBitmap2.Reset(); - + delete iMiniviewBitmap; #ifdef BRDO_WRT_HS_FF delete iNetworkModeWait; #endif - if(iAsyncCallBack) - { - iAsyncCallBack->Cancel(); - } - delete iAsyncCallBack; - iAsyncCallBack=NULL; - delete iDialogsProvider; } // ----------------------------------------------------------------------------- @@ -357,7 +333,7 @@ TBool CWidgetUiWindow::DialogMimeFileSelectLC(HBufC*& aSelectedFileName, const TDesC& aMimeType) { - return iDialogsProvider->DialogMimeFileSelectLC(aSelectedFileName, aMimeType); + return iWindowManager.DialogsProvider()->DialogMimeFileSelectLC(aSelectedFileName, aMimeType); } // ----------------------------------------------------------------------------- @@ -510,33 +486,15 @@ } // ----------------------------------------------------------------------------- -// CWidgetUiWindow::RelayoutL( TInt aType ) +// CWidgetUiWindow::Relayout() // switch the display orientation based on preferred setting // // ----------------------------------------------------------------------------- // -void CWidgetUiWindow::RelayoutL( TInt aType ) +void CWidgetUiWindow::Relayout( ) { if (iIsCurrent) { -#ifdef RD_SCALABLE_UI_V2 - if(aType == KEikDynamicLayoutVariantSwitch) - { - CRepository* iSensor = CRepository::NewLC(KCRUidSensorSettings); - TInt sensorOn = 0; - //get sensor is on/off from general settings - iSensor->Get(KSenSettingsSensorsOn, sensorOn); - if(sensorOn == 0) - { - TRect rec = iWindowManager.View()->Container()->Rect(); - if( rec.Height() < rec.Width()) - iPreferredOrientation = TBrCtlDefs::EOrientationLandscape; - else - iPreferredOrientation = TBrCtlDefs::EOrientationPortrait; - } - CleanupStack::PopAndDestroy(); - } -#endif // RD_SCALABLE_UI_V2 SetDisplayMode(iPreferredOrientation); SetSoftkeysVisible(iShowSoftkeys); //iWindowManager.View()->Container()->SizeChanged(); @@ -562,7 +520,7 @@ UpdateCba(); Engine()->MakeVisible( iWidgetLoaded ); // redraw incase the orientation changed while in the background - RelayoutL(KEikDynamicLayoutVariantSwitch); + Relayout(); } else { @@ -612,17 +570,7 @@ // reset the Right Softkey TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyRight,KNullDesC,KDummyCommand,EChangeReasonLoad)); } - if (iLeftSoftKeyLabel) - { - // restore the Left Softkey - TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyLeft,*iLeftSoftKeyLabel,KDummyCommand,EChangeReasonLoad)); - } - else - { - // reset the Left Softkey - TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyLeft,KNullDesC,KDummyCommand,EChangeReasonLoad)); - } - + // restore state if ( !showSoftkeys ) { @@ -665,9 +613,6 @@ { Engine()->MakeVisible( ETrue ); } - PublishSnapShot(); - if(iWidgetLoaded && iNeedToNotifyNetworkState) - DetermineNetworkState(); } // ----------------------------------------------------------------------------- @@ -682,18 +627,16 @@ { #ifdef BRDO_WRT_HS_FF - if ( iCpsPublisher) + if ( !iMiniviewBitmap ) { - // Swap bitmaps - if(iActiveMiniviewBitmap == &iMiniviewBitmap1) - iActiveMiniviewBitmap = &iMiniviewBitmap2; - else - iActiveMiniviewBitmap = &iMiniviewBitmap1; - - // Take snapshot and publish + iMiniviewBitmap = new CFbsBitmap(); + } + + if ( iMiniviewBitmap && iCpsPublisher) + { TRAP_IGNORE( - (iEngine->TakeSnapshotL( *iActiveMiniviewBitmap )); - iCpsPublisher->PublishBitmapL( *iActiveMiniviewBitmap, *iWidgetBundleId ); + (iEngine->TakeSnapshotL( *iMiniviewBitmap )); + iCpsPublisher->PublishBitmapL( *iMiniviewBitmap, *iWidgetBundleId ); ); } #endif @@ -751,7 +694,6 @@ CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL(iUid, EAllowNetworkAccess ); TInt networkAccess = *propValue; delete propValue; - propValue = widgetRegistry.GetWidgetPropertyValueL(iUid, EAllowFullAccess ); TInt fullAccess = *propValue; delete propValue; @@ -796,11 +738,13 @@ if ( prompt ) { + CBrowserDialogsProvider* dialogProvider + = iWindowManager.DialogsProvider(); TBool grant = EFalse; HBufC* message = StringLoader::LoadLC( R_WIDGETUI_NETWORK_ACCESS ); HBufC* yes = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_YES ); HBufC* no = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_NO ); - grant = iDialogsProvider->DialogConfirmL( _L(""), *message, *yes, *no ); + grant = dialogProvider->DialogConfirmL( _L(""), *message, *yes, *no ); CleanupStack::PopAndDestroy( 3 ); // save prompt result for session SetNetworkAccessGrant( grant? EAllow : EDeny ); @@ -838,7 +782,6 @@ TInt ask( 1 ); TInt wmlId( KWmlNoDefaultAccessPoint ); TInt snapId( KWmlNoDefaultSnapId ); -#ifndef BRDO_OCC_ENABLED_FF CRepository* rep( NULL ); TRAPD( cenrepError, rep = CRepository::NewL( KCRUidBrowser ) ); if ( KErrNone == cenrepError ) @@ -848,7 +791,6 @@ (void)rep->Get( KBrowserNGDefaultSnapId, snapId ); } delete rep; -#endif if ( ask == EBrowserCenRepApSelModeDestination && ( snapId != KWmlNoDefaultSnapId) ) { @@ -868,18 +810,6 @@ iWindowManager.GetConnection()->SetRequestedAP( iap ); ); } - - if ( EBrowserCenRepApSelModeAlwaysAsk == ask ) - { - //Always ask case - TUint32 ap( 0 ); - iWindowManager.GetConnection()->SetRequestedAP( ap ); -#ifdef BRDO_OCC_ENABLED_FF - TUint32 snapId = 0; //Defaults connects to Internet snap - iWindowManager.GetConnection()->SetConnectionType(CMManager::EDestination); - iWindowManager.GetConnection()->SetRequestedSnap(snapId); -#endif - } } } @@ -895,22 +825,11 @@ if ( !iWindowManager.GetConnection()->Connected() ) { // 2.2. make a connection - iConnecting=ETrue; - TInt connFailure = 0; - TRAPD(err, connFailure=iWindowManager.GetConnection()->StartConnectionL( ETrue )); - iConnecting=EFalse; - User::LeaveIfError(err); - if(iDeleteItself) - iAsyncCallBack->CallBack(); + TInt connFailure = iWindowManager.GetConnection()->StartConnectionL( ETrue ); if (KErrCancel == connFailure) { #ifdef BRDO_WRT_HS_FF - if(! (EMiniViewEnabled == WidgetMiniViewState() || - EMiniViewNotEnabled == WidgetMiniViewState()) ) - { - iCpsPublisher->NetworkConnectionCancelledL(); - iNetworkModeWait->Start(); - } + iCpsPublisher->NetworkConnectionCancelledL(); #endif User::Leave( connFailure ); } @@ -924,16 +843,7 @@ User::Leave( connFailure ); } *aNewConn = ETrue; - if(iWindowManager.GetNetworkMode() == EOfflineMode) - { - iWindowManager.GetConnection()->CancelConnection(); - iWindowManager.GetConnection()->StopConnectionL(); - User::Leave( KErrAccessDenied ); - } -#ifdef BRDO_OCC_ENABLED_FF - else - TRAP_IGNORE(iWindowManager.ConnNeededStatusL(KErrNone)); -#endif + } } @@ -948,13 +858,6 @@ TApBearerType* aBearerType ) { -#ifdef BRDO_OCC_ENABLED_FF - TBool retryFlag = iWindowManager.GetRetryFlag(); - if( retryFlag ) - { - return; - } -#endif // default in case connection setup fails *aConnectionPtr = 0; @@ -1054,11 +957,8 @@ aDesArray, paramFound ); - if ( paramFound ) - { - TLex lex(dlId); - User::LeaveIfError(lex.Val(iDlId)); - } + TLex lex(dlId); + User::LeaveIfError(lex.Val(iDlId)); TDataType dataType( *contentType8 ); CAiwGenericParamList* genericParamList = @@ -1221,10 +1121,9 @@ { TNetworkState currNetState; RWidgetRegistryClientSession& widgetRegistry = iWindowManager.WidgetUIClientSession(); - TInt inMiniView = !(WidgetMiniViewState()==EMiniViewEnabled || WidgetMiniViewState()==EMiniViewNotEnabled);//widgetRegistry.IsWidgetInMiniView( iUid); + TInt inMiniView = widgetRegistry.IsWidgetInMiniView( iUid); CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL( iUid, EAllowNetworkAccess ); - TInt netAccessWdgtProp = propValue && *propValue; // AllowNetworkAccess in the info.plist file - delete propValue; + TInt netAccessWdgtProp = *propValue; // AllowNetworkAccess in the info.plist file if ( netAccessWdgtProp && ((inMiniView && (iWindowManager.GetNetworkMode() == (TInt)EOnlineMode)) || (!inMiniView && iUserPermission)) ) @@ -1284,66 +1183,4 @@ } } } - -// ----------------------------------------------------------------------------- -// CWidgetUiWindow::NeedToNotifyNetworkState() -// ----------------------------------------------------------------------------- -// -void CWidgetUiWindow::NeedToNotifyNetworkState(TBool aNetworkState) - { - iNeedToNotifyNetworkState = aNetworkState; - } - -// ----------------------------------------------------------------------------- -// CWidgetUiWindow::CanBeDeleted() -// ----------------------------------------------------------------------------- -// -TBool CWidgetUiWindow::CanBeDeleted() - { - iDeleteItself = iConnecting; - return !iConnecting; - } - - -void CWidgetUiWindow::DeleteItself() - { - iAsyncCallBack->CallBack(); - } - -// ----------------------------------------------------------------------------- -// CWidgetUiWindow::DeleteItself() -// ----------------------------------------------------------------------------- -// -TInt CWidgetUiWindow::DeleteItself(TAny* aPtr) - { - CWidgetUiWindow* self = (CWidgetUiWindow*)aPtr; - CWidgetUiWindowManager* p = &self->iWindowManager; - //if sync request start another event loop - if(self->Engine()->IsSynchRequestPending()) - { - self->DeleteItself(); - return KErrNone; - } - delete self; - //The Correct fix is to call AppUI::Exit() - //But that is leaving - if(p->WindowListCount() == 0) - User::Exit(KErrNone); - return 0; - } - -#ifdef BRDO_OCC_ENABLED_FF - void CWidgetUiWindow::CancelAllDialogs() - { - if( iDialogsProvider) - { - iDialogsProvider->CancelAll(); - } - } - - TBool CWidgetUiWindow::IsDialogsLaunched() - { - return (iDialogsProvider && iDialogsProvider->IsDialogLaunched() ); - } -#endif // End of file