widgets/widgetapp/inc/WidgetUiWindowManager.h
changeset 10 a359256acfc6
parent 0 dd21522fd290
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
    26 #include <coecntrl.h>
    26 #include <coecntrl.h>
    27 #include "WidgetUiObserver.h"
    27 #include "WidgetUiObserver.h"
    28 #include "Browser_platform_variant.hrh"
    28 #include "Browser_platform_variant.hrh"
    29 // CONSTANTS
    29 // CONSTANTS
    30 
    30 
       
    31 enum TNetworkMode
       
    32     {
       
    33     EUnknownMode = 0,
       
    34     EOnlineMode,
       
    35     EOfflineMode
       
    36     };
       
    37 
    31 // MACROS
    38 // MACROS
    32 
    39 
    33 // DATA TYPES
    40 // DATA TYPES
    34 
    41 
    35 // FUNCTION PROTOTYPES
    42 // FUNCTION PROTOTYPES
    45 class CBrCtlInterface;
    52 class CBrCtlInterface;
    46 class CLiwServiceHandler;
    53 class CLiwServiceHandler;
    47 class MLiwInterface;
    54 class MLiwInterface;
    48 class CInternetConnectionManager;
    55 class CInternetConnectionManager;
    49 class CSchemeHandler;
    56 class CSchemeHandler;
       
    57 class CWidgetUiNetworkListener;
    50 
    58 
    51 #ifdef BRDO_WRT_HS_FF
    59 #ifdef BRDO_WRT_HS_FF
    52 class CCpsPublisher;
    60 class CCpsPublisher;
    53 #endif
    61 #endif
    54 // CLASS DECLARATION
    62 // CLASS DECLARATION
    91         * @param aOperation Whether to open or close the widget, and how.
    99         * @param aOperation Whether to open or close the widget, and how.
    92         */
   100         */
    93         void HandleWidgetCommandL( 
   101         void HandleWidgetCommandL( 
    94             const TUid& aUid,
   102             const TUid& aUid,
    95             TUint32 aOperation );
   103             TUint32 aOperation );
    96 
   104         
    97 // Suspend/resume miniview stuff.        
   105         /**
    98         /**
   106         * Resume a suspended widget.
    99         * Suspend a widget.
       
   100         * @since 5.0
   107         * @since 5.0
   101         * @param aUid UID of widget.
   108         * @param aUid UID of widget.
   102         */
   109         */
   103         void SuspendWidget( const TUid& aUid );
       
   104         
       
   105         /**
       
   106         * Resume a suspended widget.
       
   107         * @since 5.0
       
   108         * @param aUid UID of widget.
       
   109         */
       
   110         void ResumeWidgetL( const TUid& aUid );
   110         void ResumeWidgetL( const TUid& aUid );
   111 
       
   112         /**
       
   113         * Suspend all the publishing widget.
       
   114         * @since 5.0
       
   115         * @return none.
       
   116         */
       
   117         void SuspendAllWidget();
       
   118 
       
   119         /**
       
   120         * Stop mini view and exit
       
   121         * @since 5.0
       
   122         * @param aUrl
       
   123         * @return none
       
   124         */
       
   125         void DeactivateMiniViewL( const TUid& aUid );
       
   126  
       
   127         /**
       
   128         * Suspend publishing on home screen
       
   129         * @since 5.0
       
   130         * @param aUid UID of widget.
       
   131         * @param aSize Size of miniview.
       
   132         * @return Successful or not.
       
   133         */
       
   134         TBool ActivateMiniViewL( const TUid& aUid, const TRect& aRect );
       
   135         
       
   136 // Close / terminate widgets.
       
   137         
       
   138         /**
       
   139         * CloseWindow
       
   140         * Closes the window of the widget identified by a Uid
       
   141         * @since 3.1
       
   142         * @param aUid - Uid to identify the widget
       
   143         * @return none
       
   144         */
       
   145         void CloseWindow( const TUid& aUid );
       
   146 
       
   147         /**
       
   148         * CloseWindow
       
   149         * Closes the window of the widget
       
   150         * @since 3.1
       
   151         * @param aWidgetWindow - window of the widget
       
   152         * @return none
       
   153         */
       
   154         void CloseWindow( CWidgetUiWindow* aWidgetWindow );
       
   155 
       
   156          /**
       
   157         * RemoveFromWindowList
       
   158         * Remove  the widget window from window list
       
   159         * @since 5.0
       
   160         * @param aWidgetWindow - window of the widget
       
   161         * @return none
       
   162         */
       
   163         void RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow );
       
   164 
   111 
   165         /**
   112         /**
   166         * CloseWindowsAsync
   113         * CloseWindowsAsync
   167         * Close window async
   114         * Close window async
   168         * @param aAllWindows ETrue closes all windows; EFalse closes active window
   115         * @param aAllWindows ETrue closes all windows; EFalse closes active window
   285         * HandleOOMEventL
   232         * HandleOOMEventL
   286         * Called when out of memory message is received by app ui
   233         * Called when out of memory message is received by app ui
   287         * @since 3.1
   234         * @since 3.1
   288         */
   235         */
   289         void HandleOOMEventL( TBool aForeground );
   236         void HandleOOMEventL( TBool aForeground );
   290 
       
   291         /**
       
   292         * AllowPlatformAccessL
       
   293         * Prompt for Allow Platform Access
       
   294         * @since 5.0
       
   295         */
       
   296         void AllowPlatformAccessL( const TUid& aUid );
       
   297 
   237 
   298 // Utility stuff.
   238 // Utility stuff.
   299 
   239 
   300         /**
   240         /**
   301         * WindowList
   241         * WindowList
   348         * GetDb
   288         * GetDb
   349         * @since 5.0
   289         * @since 5.0
   350         * @return CActiveApDb
   290         * @return CActiveApDb
   351         */
   291         */
   352         CActiveApDb*  GetDb() {return iDb;}
   292         CActiveApDb*  GetDb() {return iDb;}
   353        
   293         
       
   294         /**
       
   295          * GetNetworkMode
       
   296          * @since 5.0
       
   297          * @returns online/offline mode
       
   298          */
       
   299         TNetworkMode GetNetworkMode() {return iNetworkMode;}
       
   300         
       
   301         /**
       
   302          * GetNetworkConn
       
   303          * @since 5.0
       
   304          * @returns ETrue if there is an active network connection
       
   305          */
       
   306         TBool GetNetworkConn() {return iNetworkConnected;}
       
   307         
       
   308         /**
       
   309          * GetCenrepHSModeL
       
   310          * @since 5.0
       
   311          * @returns online/offline mode read from the cenrep
       
   312          */
       
   313         TInt GetCenrepHSModeL();
       
   314         
       
   315         /**
       
   316          * FullViewWidgetsOpen
       
   317          * @since 5.0
       
   318          * @returns ETrue if atleast one full view widget is open
       
   319          */
       
   320         TBool FullViewWidgetsOpen();
       
   321 		
       
   322         /**
       
   323         * CloseWindowWithLeastClick
       
   324         * Removes widget window with least click count
       
   325         * @since 5.0
       
   326         * @return TBool
       
   327         */
       
   328         TBool CloseWindowWithLeastClick();  
       
   329         
       
   330         /**
       
   331         * DeleteOOMNotifyTimer
       
   332         * @since 5.0
       
   333         * @return void
       
   334         */
       
   335         void  DeleteOOMNotifyTimer();
       
   336 
       
   337 	    /**
       
   338         * OpenOrCreateWindowL
       
   339         * @since 5.0
       
   340         * @param aUid UID of widget.
       
   341         * @param aOperation Whether to open widget to miniview or full screen.
       
   342         */
       
   343         void OpenOrCreateWindowL( 
       
   344             const TUid& aUid,
       
   345             TUint32 aOperation );     
       
   346         
       
   347         /**
       
   348         * CanWindowBeCreated
       
   349         * Checks for available RAM before creating window
       
   350         * @since 5.0
       
   351         * @return none
       
   352         */
       
   353         void CanWindowBeCreated(const TUid& aUid, TUint32 aOperation);  	
       
   354         
       
   355         /**
       
   356         * StartHarvesterNotifyTimer
       
   357         * @since 5.0
       
   358         * @return void
       
   359         */        
       
   360         void StartHarvesterNotifyTimer();	
       
   361         
       
   362         /**
       
   363         * DeleteHarvesterNotifyTimer
       
   364         * @since 5.0
       
   365         * @return void
       
   366         */        
       
   367         void DeleteHarvesterNotifyTimer();
       
   368         
       
   369         /**
       
   370         * SendAppToBackground
       
   371         * Send widget ui to background
       
   372         * @since 5.0
       
   373         * @return void
       
   374         */        
       
   375         void SendAppToBackground();
       
   376         
       
   377         /**
       
   378         * NotifyConnecionChange
       
   379         * Notify widgets of a network connection change
       
   380         * @since 5.0
       
   381         * @return void
       
   382         */        
       
   383         void NotifyConnecionChange(TBool aConn);
       
   384         
       
   385 #ifdef  OOM_WIDGET_CLOSEALL
       
   386         /**
       
   387         * CloseAllWidgetsUnderOOM
       
   388         * @param none
       
   389         * @return ETrue if all widgets were closed else EFalse
       
   390         */        
       
   391         TBool CloseAllWidgetsUnderOOM();
       
   392         
       
   393         /**
       
   394         * GetLastWidgetRestartTime
       
   395         * @param none
       
   396         * @return Time when last widget was created after OOM
       
   397         */        
       
   398         TTime GetLastWidgetRestartTime(){return iTimeLastWidgetOpen; }
       
   399 
       
   400         /**
       
   401         * SetLastWidgetRestartTime
       
   402         * The time when last widget was restarted in case of OOM
       
   403         * @param aStartTime 
       
   404         * @return none
       
   405         */        
       
   406         void SetLastWidgetRestartTime(TTime aStartTime){iTimeLastWidgetOpen = aStartTime;}
       
   407 #endif  // OOM_WIDGET_CLOSEALL
       
   408         
   354     protected:
   409     protected:
   355 
   410 
   356         /**
   411         /**
   357         * CWidgetUiWindowManager
   412         * CWidgetUiWindowManager
   358         * Constructor
   413         * Constructor
   370         * @return void
   425         * @return void
   371         */
   426         */
   372         void ConstructL();
   427         void ConstructL();
   373 
   428 
   374     private:
   429     private:
   375 
   430         
       
   431         /**
       
   432         * Suspend a widget.
       
   433         * @since 5.0
       
   434         * @param aUid UID of widget.
       
   435         */
       
   436         void SuspendWidget( const TUid& aUid );
       
   437         
       
   438         /**
       
   439         * Suspend all the publishing widget.
       
   440         * @since 5.0
       
   441         * @return none.
       
   442         */
       
   443         void SuspendAllWidget();
       
   444 
       
   445         /**
       
   446         * Stop mini view and exit
       
   447         * @since 5.0
       
   448         * @param aUrl
       
   449         * @return ETrue if last window was closed
       
   450         */
       
   451         TBool DeactivateMiniViewL( const TUid& aUid );
       
   452  
       
   453         /**
       
   454         * Suspend publishing on home screen
       
   455         * @since 5.0
       
   456         * @param aUid UID of widget.
       
   457         * @param aSize Size of miniview.
       
   458         * @return Successful or not.
       
   459         */
       
   460         TBool ActivateMiniViewL( const TUid& aUid, const TRect& aRect );
       
   461 
       
   462 // Close / terminate widgets.
       
   463 
       
   464         /**
       
   465         * CloseWindow
       
   466         * Closes the window of the widget
       
   467         * @since 3.1
       
   468         * @param aWidgetWindow - window of the widget
       
   469         * @return ETrue if last window was closed
       
   470         */
       
   471         TBool CloseWindow( CWidgetUiWindow* aWidgetWindow );
       
   472         
       
   473         /**
       
   474         * RemoveFromWindowList
       
   475         * Remove  the widget window from window list
       
   476         * @since 5.0
       
   477         * @param aWidgetWindow - window of the widget
       
   478         * @return ETrue if last window was closed
       
   479         */
       
   480         TBool RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow );
       
   481         
   376         /**
   482         /**
   377         * Hide the window.
   483         * Hide the window.
   378         * @param aWindow Window. Ownership is retained.
   484         * @param aWindow Window. Ownership is retained.
   379         */
   485         */
   380         void HideWindow( CWidgetUiWindow* aWindow );
   486         void HideWindow( CWidgetUiWindow* aWindow );
   406         *
   512         *
   407         * @param aUid UID.
   513         * @param aUid UID.
   408         * @return Whether widgets are supported or not.
   514         * @return Whether widgets are supported or not.
   409         */
   515         */
   410         TBool DoesWidgetSupportMiniviewL( const TUid& aUid );
   516         TBool DoesWidgetSupportMiniviewL( const TUid& aUid );
   411 		
   517 
   412     		/**
       
   413         * OpenOrCreateWindowL
       
   414         * @since 5.0
       
   415         * @param aUid UID of widget.
       
   416         * @param aOperation Whether to open widget to miniview or full screen.
       
   417         */
       
   418         void OpenOrCreateWindowL( 
       
   419             const TUid& aUid,
       
   420             TUint32 aOperation );
       
   421             
   518             
   422         /**
   519         /**
   423         * Set the given window as "active full-screen window".
   520         * Set the given window as "active full-screen window".
   424         * The method handles swapping of active window.
   521         * The method handles swapping of active window.
   425         * @since 5.0
   522         * @since 5.0
   426         * @param aWindow Window. Onwership is retained.
   523         * @param aWindow Window. Onwership is retained.
   427         */
   524         */
   428         void ShowWindow(
   525         void ShowWindow( CWidgetUiWindow* aWindow );
   429             CWidgetUiWindow* aWindow );
       
   430             
   526             
   431         /**
   527         /**
   432         * Exit Publishing Widget
   528         * SendWidgetToBackground
   433         * @since 5.0
   529         * @since 5.0
   434         * @param aUid
   530         * @param aUid
   435         * @return none
   531         * @return none
   436         */
   532         */
   437         void ExitPublishingWidget( const TUid& aUid );
   533         void SendWidgetToBackground( const TUid& aUid );
   438 
   534 
   439     private:
   535     private:
   440 
   536 
   441         CWidgetUiWindow*                    iActiveFsWindow;    // reference.
   537         CWidgetUiWindow*                    iActiveFsWindow;    // reference.
   442         CWidgetUiWindowView*                iContentView;   // not owned, not responsible for deleting
   538         CWidgetUiWindowView*                iContentView;   // not owned, not responsible for deleting
   443         RPointerArray<CWidgetUiWindow>      iWindowList;    // owned, responsible for deleting
   539         RPointerArray<CWidgetUiWindow>      iWindowList;    // owned, responsible for deleting
   444         CWidgetUiAppUi&                     iAppUi;          // not owned, not responsible for deleting.
   540         CWidgetUiAppUi&                     iAppUi;          // not owned, not responsible for deleting.
       
   541         CWidgetUiNetworkListener*           iNetworkListener;   // owned, responsible for deleting
   445         CDocumentHandler*                   iHandler;           // own        
   542         CDocumentHandler*                   iHandler;           // own        
   446         RWidgetRegistryClientSession        iClientSession;     // owned
   543         RWidgetRegistryClientSession        iClientSession;     // owned
   447         TBool                               iServerConnected;   // connected to Widget Registry server ?
   544         TBool                               iServerConnected;   // connected to Widget Registry server ?
   448         TBool                               iStrictMode;
   545         TBool                               iStrictMode;
   449         CBrowserDialogsProvider*            iDialogsProvider;// owned, responsible for deleting
   546         CBrowserDialogsProvider*            iDialogsProvider;// owned, responsible for deleting
   450         CInternetConnectionManager*         iConnection;        // owned, responsible for deleting 
   547         CInternetConnectionManager*         iConnection;        // owned, responsible for deleting
       
   548         TNetworkMode                        iNetworkMode;       // unknown mode =  0, online mode = 1, offline mode = 2
       
   549         TBool                               iNetworkConnected;  // ETrue if there is an active network connection, else EFalse
   451 #ifdef BRDO_WRT_HS_FF       
   550 #ifdef BRDO_WRT_HS_FF       
   452         CCpsPublisher*                      iCpsPublisher;      // Owned, interface to publish bitmap to CPS
   551         CCpsPublisher*                      iCpsPublisher;      // Owned, interface to publish bitmap to CPS
   453 #endif
   552 #endif
   454         // TODO should this be created only when needed?
   553         // TODO should this be created only when needed?
   455         CActiveApDb*                        iDb;                // owned, responsible for deleting
   554         CActiveApDb*                        iDb;                // owned, responsible for deleting        
   456 
   555         CPeriodic*                          iNotifyOOMFlagTimer;//Timer for one min timeout before next oom note is shown
       
   556         CPeriodic*                          iNotifyHarvester;//Notify harvester to send next event
       
   557 #ifdef  OOM_WIDGET_CLOSEALL
       
   558         TTime                               iTimeLastWidgetOpen;
       
   559 #endif         
   457     };
   560     };
   458 
   561 
   459 #endif  // WIDGETUIWINDOWMANAGER_H_
   562 #endif  // WIDGETUIWINDOWMANAGER_H_
   460 
   563 
   461 // End of File
   564 // End of File