widgets/widgetapp/src/WidgetUiWindow.cpp
changeset 37 cb62a4f66ebe
parent 36 0ed94ceaa377
child 38 6297cdf66332
equal deleted inserted replaced
36:0ed94ceaa377 37:cb62a4f66ebe
    19 #include "WidgetUiWindow.h"
    19 #include "WidgetUiWindow.h"
    20 #include "WidgetUiWindowView.h"
    20 #include "WidgetUiWindowView.h"
    21 #include "WidgetUiWindowContainer.h"
    21 #include "WidgetUiWindowContainer.h"
    22 #include "WidgetUiWindowManager.h"
    22 #include "WidgetUiWindowManager.h"
    23 #include "WidgetUiDialogsProviderProxy.h"
    23 #include "WidgetUiDialogsProviderProxy.h"
    24 #include "widgetregistryconstants.h"
    24 #include <widgetregistryconstants.h>
    25 #include "browser_platform_variant.hrh"
    25 #include "browser_platform_variant.hrh"
    26 #ifdef BRDO_WRT_HS_FF
    26 #ifdef BRDO_WRT_HS_FF
    27 #include "cpspublisher.h"
    27 #include "cpspublisher.h"
    28 #endif
    28 #endif
    29 #include <AknUtils.h>
    29 #include <AknUtils.h>
    39 #include <ApUtils.h>
    39 #include <ApUtils.h>
    40 #include <AiwGenericParam.h>
    40 #include <AiwGenericParam.h>
    41 #include <ActiveApDb.h>
    41 #include <ActiveApDb.h>
    42 #include <aknsdrawutils.h>
    42 #include <aknsdrawutils.h>
    43 #include "SWInstWidgetUid.h"
    43 #include "SWInstWidgetUid.h"
    44 
       
    45 
    44 
    46 // EXTERNAL DATA STRUCTURES
    45 // EXTERNAL DATA STRUCTURES
    47 
    46 
    48 // EXTERNAL FUNCTION PROTOTYPES
    47 // EXTERNAL FUNCTION PROTOTYPES
    49 
    48 
   192         SetWindowStateMiniViewL( EMiniViewNotEnabled );
   191         SetWindowStateMiniViewL( EMiniViewNotEnabled );
   193         }
   192         }
   194 
   193 
   195     iDlId = 0;
   194     iDlId = 0;
   196 
   195 
       
   196     iNeedToNotifyNetworkState = EFalse;
   197     // determine initial widget online/offline network state
   197     // determine initial widget online/offline network state
   198     DetermineNetworkState();
   198     DetermineNetworkState();
       
   199     iAsyncCallBack = new (ELeave) CAsyncCallBack(TCallBack(DeleteItself,this),CActive::EPriorityUserInput);
   199     }
   200     }
   200 
   201 
   201 // -----------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   202 // CWidgetUiWindow::~CWidgetUiWindow()
   203 // CWidgetUiWindow::~CWidgetUiWindow()
   203 // Destructor
   204 // Destructor
   218     delete iWidgetBundleId;
   219     delete iWidgetBundleId;
   219     delete iRightSoftKeyLabel;
   220     delete iRightSoftKeyLabel;
   220     delete iLeftSoftKeyLabel;
   221     delete iLeftSoftKeyLabel;
   221     delete iWidgetUiDialogsProviderProxy;
   222     delete iWidgetUiDialogsProviderProxy;
   222     delete iSchemeHandler;
   223     delete iSchemeHandler;
   223     delete iMiniviewBitmap;
   224     
       
   225     iActiveMiniviewBitmap = 0;
       
   226     iMiniviewBitmap1.Reset();
       
   227     iMiniviewBitmap2.Reset();
       
   228     
   224 #ifdef BRDO_WRT_HS_FF
   229 #ifdef BRDO_WRT_HS_FF
   225     delete iNetworkModeWait;
   230     delete iNetworkModeWait;
   226 #endif
   231 #endif
       
   232     if(iAsyncCallBack)
       
   233         {
       
   234         iAsyncCallBack->Cancel();
       
   235         }
       
   236     delete iAsyncCallBack;
       
   237     iAsyncCallBack=NULL;    
   227     }
   238     }
   228 
   239 
   229 // -----------------------------------------------------------------------------
   240 // -----------------------------------------------------------------------------
   230 // CWidgetUiWindow::CbaGroup()
   241 // CWidgetUiWindow::CbaGroup()
   231 // returns cba group
   242 // returns cba group
   611 
   622 
   612     if (iWidgetLoaded && iIsCurrent && fullView )
   623     if (iWidgetLoaded && iIsCurrent && fullView )
   613         {
   624         {
   614         Engine()->MakeVisible( ETrue );
   625         Engine()->MakeVisible( ETrue );
   615         }
   626         }
       
   627     PublishSnapShot();
       
   628     if(iWidgetLoaded && iNeedToNotifyNetworkState)
       
   629         DetermineNetworkState();
   616     }
   630     }
   617 
   631 
   618 // -----------------------------------------------------------------------------
   632 // -----------------------------------------------------------------------------
   619 // CWidgetUiWindow::PublishSnapShot()
   633 // CWidgetUiWindow::PublishSnapShot()
   620 // pubish offscreen bitmap to CPSpublisger
   634 // pubish offscreen bitmap to CPSpublisger
   625     {
   639     {
   626     if( iWidgetLoaded && (WidgetMiniViewState() == EPublishStart ) )
   640     if( iWidgetLoaded && (WidgetMiniViewState() == EPublishStart ) )
   627         {
   641         {
   628 #ifdef BRDO_WRT_HS_FF
   642 #ifdef BRDO_WRT_HS_FF
   629 
   643 
   630         if ( !iMiniviewBitmap )
   644         if ( iCpsPublisher)
   631             {
   645             {
   632             iMiniviewBitmap = new CFbsBitmap();
   646             // Swap bitmaps
   633             }
   647             if(iActiveMiniviewBitmap == &iMiniviewBitmap1)
   634 
   648             	iActiveMiniviewBitmap = &iMiniviewBitmap2;
   635         if ( iMiniviewBitmap && iCpsPublisher)
   649             else
   636             {
   650             	iActiveMiniviewBitmap = &iMiniviewBitmap1;
       
   651             
       
   652             // Take snapshot and publish	
   637             TRAP_IGNORE(
   653             TRAP_IGNORE(
   638                (iEngine->TakeSnapshotL( *iMiniviewBitmap ));
   654                (iEngine->TakeSnapshotL( *iActiveMiniviewBitmap ));
   639                 iCpsPublisher->PublishBitmapL( *iMiniviewBitmap, *iWidgetBundleId );
   655                 iCpsPublisher->PublishBitmapL( *iActiveMiniviewBitmap, *iWidgetBundleId );
   640                 );
   656                 );
   641             }
   657             }
   642 #endif
   658 #endif
   643         }
   659         }
   644     }
   660     }
   808                     TUint32 iap = apUtils->IapIdFromWapIdL( wmlId );
   824                     TUint32 iap = apUtils->IapIdFromWapIdL( wmlId );
   809                     CleanupStack::PopAndDestroy();
   825                     CleanupStack::PopAndDestroy();
   810                     iWindowManager.GetConnection()->SetRequestedAP( iap );
   826                     iWindowManager.GetConnection()->SetRequestedAP( iap );
   811                 );
   827                 );
   812             }
   828             }
       
   829 
       
   830         if ( EBrowserCenRepApSelModeAlwaysAsk == ask )
       
   831             {
       
   832               //Always ask case
       
   833               TUint32 ap( 0 );
       
   834               iWindowManager.GetConnection()->SetRequestedAP( ap );
       
   835             }
   813         }
   836         }
   814     }
   837     }
   815 
   838 
   816 // -----------------------------------------------------------------------------
   839 // -----------------------------------------------------------------------------
   817 // CWidgetUiWindow::StartNetworkConnection()
   840 // CWidgetUiWindow::StartNetworkConnection()
   823     {
   846     {
   824     *aNewConn = EFalse;
   847     *aNewConn = EFalse;
   825     if ( !iWindowManager.GetConnection()->Connected() )
   848     if ( !iWindowManager.GetConnection()->Connected() )
   826         {
   849         {
   827         // 2.2. make a connection
   850         // 2.2. make a connection
   828         TInt connFailure = iWindowManager.GetConnection()->StartConnectionL( ETrue );
   851         iConnecting=ETrue;
       
   852         TInt connFailure = 0;
       
   853         TRAPD(err, connFailure=iWindowManager.GetConnection()->StartConnectionL( ETrue ));
       
   854         iConnecting=EFalse;
       
   855         User::LeaveIfError(err);
       
   856         if(iDeleteItself)
       
   857             iAsyncCallBack->CallBack();
   829         if (KErrCancel == connFailure)
   858         if (KErrCancel == connFailure)
   830             {
   859             {
   831 #ifdef BRDO_WRT_HS_FF
   860 #ifdef BRDO_WRT_HS_FF
   832             iCpsPublisher->NetworkConnectionCancelledL();
   861             if(! (EMiniViewEnabled == WidgetMiniViewState() || 
       
   862                   EMiniViewNotEnabled == WidgetMiniViewState()) )
       
   863                 {        
       
   864                 iCpsPublisher->NetworkConnectionCancelledL();
       
   865                 }
   833 #endif
   866 #endif
   834             User::Leave( connFailure );
   867             User::Leave( connFailure );
   835             }
   868             }
   836         else if ( KErrNone != connFailure )
   869         else if ( KErrNone != connFailure )
   837             {
   870             {
  1119 //
  1152 //
  1120 void CWidgetUiWindow::DetermineNetworkState()
  1153 void CWidgetUiWindow::DetermineNetworkState()
  1121     {
  1154     {
  1122     TNetworkState currNetState;
  1155     TNetworkState currNetState;
  1123     RWidgetRegistryClientSession& widgetRegistry = iWindowManager.WidgetUIClientSession();
  1156     RWidgetRegistryClientSession& widgetRegistry = iWindowManager.WidgetUIClientSession();
  1124     TInt inMiniView = widgetRegistry.IsWidgetInMiniView( iUid);
  1157     TInt inMiniView = !(WidgetMiniViewState()==EMiniViewEnabled || WidgetMiniViewState()==EMiniViewNotEnabled);//widgetRegistry.IsWidgetInMiniView( iUid);
  1125     CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL( iUid, EAllowNetworkAccess );
  1158     CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL( iUid, EAllowNetworkAccess );
  1126     TInt netAccessWdgtProp = *propValue;    // AllowNetworkAccess in the info.plist file
  1159     TInt netAccessWdgtProp = *propValue;    // AllowNetworkAccess in the info.plist file
  1127 
  1160 
  1128     if ( netAccessWdgtProp && ((inMiniView && (iWindowManager.GetNetworkMode() == (TInt)EOnlineMode))
  1161     if ( netAccessWdgtProp && ((inMiniView && (iWindowManager.GetNetworkMode() == (TInt)EOnlineMode))
  1129                                     || (!inMiniView && iUserPermission)) )
  1162                                     || (!inMiniView && iUserPermission)) )
  1181             // status pane always off unless in text box
  1214             // status pane always off unless in text box
  1182             iWindowManager.View()->UpdateStatusPane(EFalse);
  1215             iWindowManager.View()->UpdateStatusPane(EFalse);
  1183             }
  1216             }
  1184         }
  1217         }
  1185     }
  1218     }
       
  1219 
       
  1220 // -----------------------------------------------------------------------------
       
  1221 // CWidgetUiWindow::NeedToNotifyNetworkState()
       
  1222 // -----------------------------------------------------------------------------
       
  1223 //
       
  1224 void CWidgetUiWindow::NeedToNotifyNetworkState(TBool aNetworkState)
       
  1225     {
       
  1226     iNeedToNotifyNetworkState = aNetworkState;
       
  1227     }
       
  1228 
       
  1229 // -----------------------------------------------------------------------------
       
  1230 // CWidgetUiWindow::CanBeDeleted()
       
  1231 // -----------------------------------------------------------------------------
       
  1232 //
       
  1233 TBool CWidgetUiWindow::CanBeDeleted()
       
  1234     {
       
  1235     iDeleteItself = iConnecting;
       
  1236     return !iConnecting;
       
  1237     }
       
  1238     
       
  1239 // -----------------------------------------------------------------------------
       
  1240 // CWidgetUiWindow::DeleteItself()
       
  1241 // -----------------------------------------------------------------------------
       
  1242 //
       
  1243 TInt CWidgetUiWindow::DeleteItself(TAny* aPtr)
       
  1244     {
       
  1245     CWidgetUiWindow* self = (CWidgetUiWindow*)aPtr;
       
  1246     CWidgetUiWindowManager* p = &self->iWindowManager;
       
  1247     delete self;
       
  1248     if(p->WindowListCount() == 0)
       
  1249         p->ExitNow();
       
  1250     return 0;
       
  1251     }
       
  1252 
  1186 // End of file
  1253 // End of file