widgets/widgetapp/inc/WidgetUiWindow.h
changeset 0 dd21522fd290
child 16 a359256acfc6
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006, 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WIDGETUIWINDOW_H_
       
    20 #define WIDGETUIWINDOW_H_
       
    21 
       
    22 // INCLUDES FILES
       
    23 #include <e32base.h>
       
    24 #include <BrCtlDefs.h>
       
    25 #include <BrCtlInterface.h> // for MWidgetCallback
       
    26 #include <AknServerApp.h>
       
    27 #include <coecntrl.h>
       
    28 #include "WidgetUiObserver.h"
       
    29 
       
    30 // CONSTANTS
       
    31 enum TWidgetAccessGrant
       
    32     {
       
    33     EInvalid,
       
    34     EDeny,
       
    35     EAllow
       
    36     };
       
    37     
       
    38 enum TMiniViewState
       
    39     {
       
    40     EMiniViewNotEnabled = 0,
       
    41     EMiniViewEnabled,
       
    42     EPublishStart,
       
    43     EPublishSuspend
       
    44     };
       
    45 struct TWidgetState
       
    46     {
       
    47     TBool               iFullViewState; //  full view or not
       
    48     enum TMiniViewState iMiniViewState;
       
    49     };
       
    50 
       
    51 // MACROS
       
    52 
       
    53 // DATA TYPES
       
    54 
       
    55 // FUNCTION PROTOTYPES
       
    56 
       
    57 // FORWARD DECLARATIONS
       
    58 class CWidgetUiWindowManager;
       
    59 class CWidgetUiObserver;
       
    60 class CWidgetUiDialogsProviderProxy;
       
    61 class CPeriodic;
       
    62 class CEikButtonGroupContainer;
       
    63 class CCpsPublisher;
       
    64 class CFbsBitmap;
       
    65 class CSchemeHandler;
       
    66 class CBrCtlInterface;
       
    67 
       
    68 // CLASS DECLARATION
       
    69 
       
    70 /**
       
    71 *
       
    72 *
       
    73 *  @lib WidgetUi.app
       
    74 *  @since Series 60 3.0
       
    75 */
       
    76 class CWidgetUiWindow :  public CBase, 
       
    77                     public MWidgetCallback, 
       
    78                     public MBrCtlSpecialLoadObserver,
       
    79                     public MAknServerAppExitObserver
       
    80     {
       
    81     public:
       
    82 
       
    83         /**
       
    84         * OpenWindowL
       
    85         * @since 3.1
       
    86         * @param aWindowManager
       
    87         * @param aUid 
       
    88         * @param aCpsPublisher
       
    89         * @return CBrCtlInterface*
       
    90         */
       
    91         static CWidgetUiWindow* OpenWindowL( CWidgetUiWindowManager& aWindowManager,
       
    92                                            const TUid& aUid, CCpsPublisher* aCpsPublisher );
       
    93 
       
    94         /**
       
    95         * ~CWidgetUiWindow
       
    96         * Destructor
       
    97         * @since 3.1
       
    98         * @param none
       
    99         * @return none
       
   100         */
       
   101         virtual ~CWidgetUiWindow();
       
   102 
       
   103     public: // from MWidgetCallback
       
   104 
       
   105         /**
       
   106         * DialogMimeFileSelectLC
       
   107         * Navigates through your file system and selects a file of specific mime type;
       
   108         * analogous to the Browse command in Windows.
       
   109         * @since 3.1
       
   110         * @param aSelectedFileName The selected file name.
       
   111         * @param aMimeType The accepted mime type.
       
   112         * @return ETrue if the user selected a file
       
   113         * EFalse if the user cancelled the transaction and did not select a file.
       
   114         * @attention Returned on cleanup stack. Browser control will free the buffer.
       
   115         */
       
   116         TBool DialogMimeFileSelectLC(HBufC*& aSelectedFileName,
       
   117                                  const TDesC& aMimeType);
       
   118 
       
   119        /**
       
   120         * Called to show or hide softkeys
       
   121         * @since 3.1
       
   122         * @param aVisible ETrue to show softkeys, EFalse when full screen is needed
       
   123         */
       
   124         void SetSoftkeysVisible(TBool aVisible);
       
   125 
       
   126         /**
       
   127         * Called to change the display orientation to landscape
       
   128         * @since 3.1
       
   129         */
       
   130         void SetDisplayMode(TBrCtlDefs::TBrCtlOrientation aOrientation);
       
   131 
       
   132         virtual TInt Reserved_1(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   133         virtual TInt Reserved_2(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   134         virtual TInt Reserved_3(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   135         virtual TInt Reserved_4(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   136         virtual TInt Reserved_5(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   137         virtual TInt Reserved_6(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   138         virtual TInt Reserved_7(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   139         virtual TInt Reserved_8(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   140         virtual TInt Reserved_9(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   141         virtual TInt Reserved_10(TAny*& /*a0*/, TAny* /*a1*/, TAny* /*a2*/) { return 0; }
       
   142     public:  // MBrCtlSpecialLoadObserver
       
   143         /**
       
   144        * NetworkConnectionNeededL
       
   145        * Request to create a network connection.
       
   146        * @since 3.1
       
   147        * @param aConnectionPtr A pointer to the new connection. If NULL, the proxy filter will automatically create a network connection
       
   148        * @param aSockSvrHandle A handle to the socket server.
       
   149        * @param aNewConn A flag if a new connection was created. If the connection is not new, proxy filter optimization will not read the proxy again from CommsBd
       
   150        * @param aBearerType The bearer type of the new connection
       
   151        * @return void
       
   152        */
       
   153         void NetworkConnectionNeededL( TInt* aConnectionPtr,
       
   154                                            TInt* aSockSvrHandle,
       
   155                                            TBool* aNewConn,
       
   156                                            TApBearerType* aBearerType ) ;
       
   157 
       
   158         /**
       
   159        * ConnectionManagement
       
   160        * Setup connection based on browser settings
       
   161        * @since 
       
   162        * @return void
       
   163        */
       
   164         void ConnectionManagement();
       
   165 
       
   166         /**
       
   167        * StartNetworkConnectionL
       
   168        * Start new connection
       
   169        * @param aNewConn A flag if a new connection was created. If the connection is not new, proxy filter optimization will not read the proxy again from CommsBd
       
   170        * @since 
       
   171        * @return void
       
   172        */
       
   173         void StartNetworkConnectionL(TBool* aNewConn);
       
   174 
       
   175         /**
       
   176        * HandleRequestL
       
   177        * Request the host applicaion to handle non-http request.
       
   178        * @since 3.1
       
   179        * @param aTypeArray array of download parameter types
       
   180        * @param aDesArray array of values associated with the types in the type array
       
   181        * @return ETrue is handled by the host application. EFlase if not
       
   182        */
       
   183         TBool HandleRequestL( RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray );
       
   184 
       
   185         TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray);
       
   186 
       
   187         /**
       
   188        * DoHandleRequestL
       
   189        * Request the host applicaion to handle non-http request.
       
   190        * @since 3.1
       
   191        * @param aTypeArray array of download parameter types
       
   192        * @param aDesArray array of values associated with the types in the type array
       
   193        * @return ETrue is handled by the host application. EFlase if not
       
   194        */
       
   195         TBool DoHandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray );
       
   196 
       
   197         /**
       
   198        * Extract the given BrCtl parameter from the list.
       
   199        * @param aParamTypeToFind Extract this parameter.
       
   200        * @param aTypeArray array of download parameter types.
       
   201        * @param aDesArray array of values associated with the types in the type array.
       
   202        * @param aParamFound Output: ETrue if the parameter was found.
       
   203        * @return A TPtrC pointer for the value.
       
   204        * @since 2.8
       
   205        */
       
   206         TPtrC ExtractBrCtlParam( TUint aParamTypeToFind,
       
   207                           RArray<TUint>* aTypeArray,
       
   208                           CDesCArrayFlat* aDesArray,
       
   209                           TBool& aParamFound ) const;
       
   210 
       
   211        /**
       
   212        * Make generic parameter list from BrCtl parameter list.
       
   213        * @param aTypeArray array of download parameter types
       
   214        * @param aDesArray array of values associated with the types in the type array
       
   215        * @return The dynamically allocated list.
       
   216        */
       
   217         CAiwGenericParamList* BrCtlParamList2GenericParamListL( 
       
   218                                              RArray<TUint>* aTypeArray, 
       
   219                                              CDesCArrayFlat* aDesArray ) const; 
       
   220 		
       
   221     public: //MAknServerAppExitObserver
       
   222 
       
   223         void HandleServerAppExit( TInt aReason );
       
   224 
       
   225 
       
   226     public:  // new functions
       
   227 
       
   228         /**
       
   229         * Engine
       
   230         * @since 3.1
       
   231         * @param none
       
   232         * @return CBrCtlInterface*
       
   233         */
       
   234         CBrCtlInterface* Engine() const { return iEngine; }
       
   235 
       
   236         /**
       
   237         * CbaGroup
       
   238         * @since 3.1
       
   239         * @param none
       
   240         * @return CEikButtonGroupContainer*
       
   241         */
       
   242         CEikButtonGroupContainer* CbaGroup();
       
   243 
       
   244 
       
   245         /**
       
   246         * WidgetExtension
       
   247         * @since 3.1
       
   248         * @param none
       
   249         * @return MWidgetExtension*
       
   250         */
       
   251         MWidgetExtension* WidgetExtension() const { return iWidgetExtension; }
       
   252 
       
   253         /**
       
   254         * ReloadWidget
       
   255         * Reload the current widget main html page.
       
   256         * @3.1
       
   257         * @return void
       
   258         */
       
   259         void ReloadWidget();
       
   260 
       
   261         /**
       
   262         * Url
       
   263         * Return the  main html page url of current widget.
       
   264         * @3.1
       
   265         * @return pointer to Url but does not transfer ownership
       
   266         */
       
   267        HBufC* Url() { return iUrl; }
       
   268 
       
   269         /**
       
   270         * Path
       
   271         * Return the path of current widget.
       
   272         * @3.1
       
   273         * @return pointer to WidgetPath but does not transfer ownership
       
   274         */
       
   275        HBufC* WidgetPath() { return iWidgetPath; }
       
   276 
       
   277         /**
       
   278         * Path
       
   279         * Return the bundle id of current widget.
       
   280         * @3.1
       
   281         * @return pointer to WidgetByndleId but does not transfer ownership
       
   282         */
       
   283        HBufC* WidgetBundleId() { return iWidgetBundleId; }
       
   284 
       
   285        /**
       
   286         * UId
       
   287         * Return the UId of current widget.
       
   288         * @3.1
       
   289         * @return UId
       
   290         */
       
   291        TUid Uid() const { return iUid; }
       
   292 
       
   293        /**
       
   294         * NetworkAccessGrant
       
   295         * Return network access grant.
       
   296         * @since 3.1
       
   297         * @return network access grant
       
   298         */
       
   299        TWidgetAccessGrant NetworkAccessGrant() const { return iNetworkAccessGrant; }
       
   300 
       
   301        /**
       
   302         * SetNetworkAccessGrant
       
   303         * Set network access grant.
       
   304         * @since 3.1
       
   305         * @return void
       
   306         */
       
   307        void SetNetworkAccessGrant( TWidgetAccessGrant aGrant )
       
   308          { iNetworkAccessGrant = aGrant; }
       
   309 
       
   310         /**
       
   311         * Called to change the label of the right or left softkey
       
   312         * @since 3.1
       
   313         * @param aKeySoftkey softkey top change
       
   314         * @param aText label for right softkey
       
   315         */
       
   316         void SetSoftKeyLabelL( TBrCtlKeySoftkey aKeySoftkey, const TDesC& aText);
       
   317 
       
   318        /**
       
   319         * Relayout
       
   320         * relayout display to preferred orientation
       
   321         * @since 3.1
       
   322         * @return void
       
   323         */
       
   324        void Relayout( );
       
   325 
       
   326        /**
       
   327         * SetCurrentWindow
       
   328         * sets the current window active or non-current window inactive
       
   329         * @since 3.1
       
   330         * @return void
       
   331         */
       
   332        void SetCurrentWindow( TBool aCurrent );
       
   333        
       
   334        /**
       
   335         * WindowManager
       
   336         * returns pointer to window manager
       
   337         * @since 3.1
       
   338         * @return CWidgetUiWindowManager*
       
   339         */
       
   340        CWidgetUiWindowManager& WindowManager( ) { return iWindowManager; }
       
   341 
       
   342        /**
       
   343         * SetWidgetLoaded
       
   344         * notification that widget has finished loading
       
   345         * @since 5.0
       
   346         * @return none
       
   347         */
       
   348         void SetWidgetLoaded( TBool aWidgetLoaded );
       
   349         
       
   350         /**
       
   351         * GetBundleName
       
   352         * Gets the Bundle name for Uid
       
   353         * @since 5.0
       
   354         * @return none
       
   355         */
       
   356         void GetBundleName(TPtr& aBundleName );
       
   357 
       
   358          /**
       
   359         * PublishSnapShot
       
   360         * Publishes offscreen bitmap to CPS
       
   361         * @since 5.0
       
   362         * @return none
       
   363         */
       
   364         void PublishSnapShot();
       
   365 
       
   366         /**
       
   367         * HasMiniviewL
       
   368         * Checks registry value whethre miniview is supporetd or not
       
   369         * @since 5.0
       
   370         * @return TBool
       
   371         */
       
   372         TBool HasMiniviewL();
       
   373 
       
   374         /**
       
   375         * WidgetMiniViewState
       
   376         * returns miniview state
       
   377         * @since 5.0
       
   378         * @return TMiniViewState
       
   379         */
       
   380         TMiniViewState WidgetMiniViewState() const;
       
   381 
       
   382         /**
       
   383         * SetWindowStateFullView
       
   384         * Sets	widget is started in full view or not
       
   385         * @since 5.0
       
   386         * @return none
       
   387         */
       
   388         void SetWindowStateFullView( TBool aWidgetFullViewState);
       
   389 		
       
   390         /**
       
   391         * SetWindowStateMiniView
       
   392         * Sets	miniview state
       
   393         * @since 5.0
       
   394         * @return none
       
   395         */
       
   396         void SetWindowStateMiniViewL( TMiniViewState aWidgetMiniViewState);
       
   397 
       
   398         /**
       
   399         * WidgetFullViewState
       
   400         * Get whhether widget is started in fullView or not
       
   401         * @since 5.0
       
   402         * @return none
       
   403         */
       
   404         TBool WidgetFullViewState() const;
       
   405 
       
   406         /**
       
   407         * SetIsCurrentWindow
       
   408         * Sets IsCurrent window so that when window is launched next time
       
   409         * foreground background set is done properly
       
   410         * @since 5.0
       
   411         * @return none
       
   412         */
       
   413         void SetIsCurrentWindow(TBool aIsCurrent){ iIsCurrent = aIsCurrent;}
       
   414 
       
   415         /** 
       
   416         * GetBlanketPromptDisplayed 
       
   417         * Get whether blanketprompt is displayed 
       
   418         * @since 5.0 
       
   419         * @return TBool 
       
   420         */                 
       
   421         TBool GetBlanketPromptDisplayed(){ return iBlanketPromptDisplayed;}   
       
   422          
       
   423         /** 
       
   424         * SetBlanketPermissionDisplayed 
       
   425         * Sets  Blanket Permission Prompt when displayed 
       
   426         * @since 5.0 
       
   427         * @return none 
       
   428         */               
       
   429         void SetBlanketPromptDisplayed(TBool aBlanketPromptDisplayed){ iBlanketPromptDisplayed = aBlanketPromptDisplayed;}          
       
   430  		                 
       
   431         
       
   432     protected:
       
   433 
       
   434         /**
       
   435         * CWidgetUiWindow
       
   436         * Construtor
       
   437         * @since 3.1
       
   438         * @param aWindowManger
       
   439         * @param aCpsPublisher
       
   440         * @return none
       
   441         */
       
   442         CWidgetUiWindow( CWidgetUiWindowManager& aWindowManager, CCpsPublisher* aCpsPublisher );
       
   443 
       
   444         /**
       
   445         * ConstructL
       
   446         * EPOC default constructor.
       
   447         * By default Symbian 2nd phase constructor is private.
       
   448         * @since 3.1
       
   449         * @param none
       
   450         * @return void
       
   451         */
       
   452         void ConstructL( const TUid& aUid );
       
   453 
       
   454     private:
       
   455         /**
       
   456         * UpdateCba
       
   457         * @since 3.1
       
   458         * @return none
       
   459         */
       
   460         void UpdateCba( );
       
   461         
       
   462         /**
       
   463         * SetSoftKeyImageL
       
   464         * @since 3.1
       
   465         * @param aCommand
       
   466         * @param aFilename
       
   467         * @return none
       
   468         */
       
   469         void SetSoftKeyImageL(const TInt aCommand, const TDesC& aFilename);
       
   470         
       
   471         /**
       
   472          * Constructs the publisher identifier
       
   473          * @since 5.1
       
   474          */
       
   475         HBufC* WidgetIdAndNameLC();
       
   476         
       
   477         /**
       
   478         * NetworkSecurityCheckL
       
   479         * Prompts for network access
       
   480         * @since 
       
   481         * @return void
       
   482         */
       
   483         void NetworkSecurityCheckL();
       
   484 
       
   485         /**
       
   486         * CheckNetworkAccessL
       
   487         * Checks widget registry values for whether widget is allowed network access
       
   488         * @since 
       
   489         * @return TBool
       
   490         */
       
   491         TBool CheckNetworkAccessL();
       
   492        
       
   493     private:
       
   494         CWidgetUiObserver*              iWidgetUiObserver;  // owned, responsible for deleting
       
   495         CWidgetUiWindowManager&         iWindowManager;
       
   496 
       
   497         CWidgetUiDialogsProviderProxy*  iWidgetUiDialogsProviderProxy; // owned, responsible for deleting
       
   498         HBufC*                          iUrl;               // owned, responsible for deleting
       
   499         CBrCtlInterface*                iEngine;            // owned, responsible for deleting
       
   500         MWidgetExtension*               iWidgetExtension;
       
   501         CSchemeHandler*                 iSchemeHandler;     // Own. handles links to mailto etc
       
   502         TUid                            iUid;
       
   503         TWidgetAccessGrant              iNetworkAccessGrant;
       
   504         HBufC*                          iWidgetPath;        // owned, responsible for deleting
       
   505         HBufC*                          iWidgetBundleId;    // owned, responsible for deleting
       
   506 
       
   507         TBrCtlDefs::TBrCtlOrientation   iPreferredOrientation;
       
   508         TBool                           iIsCurrent;
       
   509         TBool                           iShowSoftkeys;
       
   510         HBufC*                          iRightSoftKeyLabel; // owned- copy of latest right softkey label
       
   511         HBufC*                          iLeftSoftKeyLabel; // owned- copy of latest left softkey label
       
   512         TBool                           iWidgetLoaded;
       
   513         TBool                           iPenEnabled; // For touch
       
   514         TInt                            iCount;
       
   515         TWidgetState                    iWidgetWindowState;
       
   516         TBool                           iSchemeProcessing;
       
   517         // Interface to publish bitmap
       
   518         CCpsPublisher*                  iCpsPublisher;
       
   519         
       
   520         //Download transaction ID
       
   521         long                            iDlId;
       
   522         TBool                           iBlanketPromptDisplayed;         
       
   523    };
       
   524 
       
   525 #endif  //
       
   526 
       
   527 // End of file