codhandler/codui/inc/CodAppUi.h
changeset 0 dd21522fd290
child 37 cb62a4f66ebe
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Declaration of class CCodAppUi.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef COD_APP_UI_H
       
    20 #define COD_APP_UI_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <AknAppUi.h>
       
    26 #include <AknServerApp.h>
       
    27 #include <CodLoadObserver.h>
       
    28 #include "CodWaitDialog.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 class CCodView;
       
    33 class CCodDocument;
       
    34 class CCodEng;
       
    35 class CDocumentHandler;
       
    36 class CRequestCompleteCallback;
       
    37 class CErrorUI;
       
    38 class CCodUiResource;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * COD Application UI.
       
    44 */
       
    45 NONSHARABLE_CLASS( CCodAppUi )
       
    46 : public CAknAppUi,
       
    47   public MCodLoadObserver,
       
    48   public MCodDialogCommandObserver,
       
    49   public MAknServerAppExitObserver
       
    50     {
       
    51 
       
    52     public:     // Constructors and destructor
       
    53 
       
    54         /**
       
    55         * @param aCod COD or DD?
       
    56         * Constructor.
       
    57         */      
       
    58         CCodAppUi( TBool aCod );
       
    59         
       
    60         /**
       
    61         * Second phase constructor. Leaves on failure.
       
    62         */      
       
    63         void ConstructL();
       
    64 
       
    65         /**
       
    66         * Destructor.
       
    67         */      
       
    68         virtual ~CCodAppUi();
       
    69 
       
    70     public:     // new methods
       
    71 
       
    72         /**
       
    73         * Open file done.
       
    74         * @param aError Error code.
       
    75         */
       
    76         void OpenFileDone( TInt aError );
       
    77 
       
    78         /**
       
    79         * Set service flow settings.
       
    80         * @param aSilentMode Silent Mode.
       
    81         * @param aSuppressNextUrl Suppress Next-URL.
       
    82         * @param aSuppressLaunch Suppress launch.
       
    83         */
       
    84         void SetServiceFlow
       
    85             (
       
    86             TBool aSilentMode,
       
    87             TBool aSuppressNextUrl,
       
    88             TBool aSuppressLaunch
       
    89             );
       
    90 
       
    91     public:     // from CAknAppUi
       
    92 
       
    93         /**
       
    94         * Handle model change.
       
    95         */
       
    96         virtual void HandleModelChangeL();
       
    97 
       
    98         /**
       
    99         * Open a file.
       
   100         * @param aFileName File name to open.
       
   101         */
       
   102         virtual void OpenFileL( const TDesC& aFileName );
       
   103 
       
   104         /**
       
   105         * Handle command.
       
   106         * @param aCommand Command id.
       
   107         */
       
   108         virtual void HandleCommandL( TInt aCommand );
       
   109 
       
   110     protected:  // from CAknAppUi
       
   111 
       
   112         /**
       
   113         * Process command line parameters.
       
   114         * @param aCommand Command.
       
   115         * @param aDocumentName Document name.
       
   116         * @param aTail Don't know what; ignored.
       
   117         * @return EFalse.
       
   118         */
       
   119         virtual TBool ProcessCommandParametersL
       
   120             (
       
   121             TApaCommand aCommand,
       
   122             TFileName& aDocumentName,
       
   123             const TDesC8& aTail
       
   124             );
       
   125 
       
   126         /**
       
   127         * Handle key event.
       
   128         * @param aKeyEvent The key event.
       
   129         * @param aType Key event type.
       
   130         * @return Response (was the key event consumed?).
       
   131         */
       
   132         virtual TKeyResponse HandleKeyEventL
       
   133             ( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   134 
       
   135         /**
       
   136         * Handle resource change.
       
   137         * @param aType Resource type.
       
   138         */
       
   139         virtual void HandleResourceChangeL( TInt aType );
       
   140 
       
   141     private:    // from MCodLoadObserver
       
   142 
       
   143         /**
       
   144         * Get download root path.
       
   145         * Leave with KErrCancel if query is cancelled.
       
   146         * @param aRootPath Root path returned here.
       
   147         */
       
   148         virtual void GetRootPathL( TDes& aRootPath );
       
   149 
       
   150         /**
       
   151         * Starting load (fetch content or error-notify).
       
   152         * @param aStatusCode HTTP status code.
       
   153         * - 900 (Success) indicates start of content load.
       
   154         * - Other values indicate start of error report.
       
   155         */
       
   156         virtual void StartLoadL( TInt aStatusCode );
       
   157 
       
   158         /**
       
   159         * Cancelling the fetch started. Start wait note.
       
   160         */
       
   161         virtual void StartCancelL();
       
   162 
       
   163         /**
       
   164         * Load progress update.
       
   165         * @param aFinalValue Final progress value.
       
   166         * @param aCurrentValue Current progress value.
       
   167         */
       
   168         virtual void ProgressL( TInt aFinalValue, TInt aCurrentValue );
       
   169 
       
   170         /**
       
   171         * Processing (content load or error report) ended.
       
   172         * Note that if processing does not include loading, this method can be
       
   173         * called without a preceding StartLoadL call.
       
   174         * @param aStatusCode HTTP status code (aError mapped to HTTP status
       
   175         * code).
       
   176         * @param aError Error code of result. (The Set(), Accept() or Reject()
       
   177         * request to CodEng will also complete with this value.)
       
   178         */
       
   179         virtual void Done( TInt aStatusCode, TInt aError );
       
   180 
       
   181         /**
       
   182         * Get confirmation for creating network connection.
       
   183         * @return ETrue if connection can be created.
       
   184         */
       
   185         virtual TBool ConfirmConnectL();
       
   186         /**
       
   187         * Opening a connection.
       
   188         * @param aIap AP to be used for creating the connection.
       
   189         */
       
   190         virtual void StartConnect( TUint32 aIap );
       
   191 
       
   192         /**
       
   193         * Connected.
       
   194         */
       
   195         virtual void EndConnect();
       
   196 
       
   197         /**
       
   198         * Authenticate user.
       
   199         * @param aHost Host.
       
   200         * @param aRealm Realm.
       
   201         * @param aProxyAuth ETrue if this is a proxy authentication.
       
   202         * @param aUsername Return username here.
       
   203         * @param aPasssword Return password here.
       
   204         * @return ETrue if auth is OK, EFalse if cancelled.
       
   205         */
       
   206         virtual TBool UserAuthL
       
   207             (
       
   208             const TDesC& aHost,
       
   209             const TDesC& aRealm,
       
   210             TBool aProxyAuth,
       
   211             TDes& aUsername,
       
   212             TDes& aPassword
       
   213             );
       
   214 
       
   215         /**
       
   216         * ROAP Trigger parsed (success or error).
       
   217         * @param aData ROAP Trigger data.
       
   218         */
       
   219         virtual void RoapTriggerParsedL( const CRoapData& aData );
       
   220 
       
   221         /**
       
   222         * Connection Error
       
   223         * return: Connection Error .
       
   224         */
       
   225 		inline virtual void SetConnError( TInt aError) {iConnError = aError;}
       
   226 
       
   227         /**
       
   228         * Connection Error
       
   229         * return: Connection Error .
       
   230         */
       
   231 		inline virtual TInt ConnError () {return iConnError;}
       
   232 
       
   233         /**
       
   234         * Progresive download "Play" is available
       
   235         * return: Connection Error .
       
   236         */
       
   237 		virtual void PdPlayAvailable();
       
   238         
       
   239         /**
       
   240         * Set Active Download
       
   241         */
       
   242         inline virtual void SetActiveDownload( ){}
       
   243        
       
   244         /**
       
   245         * Displays Info message "Waiting for license" 
       
   246         */
       
   247 		virtual void WaitForLicenseL();
       
   248 
       
   249         /**
       
   250         * To indicate the download is paused
       
   251         */
       
   252         inline virtual void DownloadPaused() {}
       
   253 
       
   254         /**
       
   255         * To indicate the download is resumed and ready for PD
       
   256         */
       
   257         inline virtual void DownloadResumedPdAvailable() {}
       
   258         
       
   259         /**
       
   260         * To update the server about whether or not download is pausable
       
   261         */
       
   262         inline virtual void UpdatePausable( TBool /*aPausable*/ ) {}
       
   263         
       
   264         /**
       
   265         * To update the server about next media object being downloaded.
       
   266         */        
       
   267         inline virtual void MediaObjectNameChanged() {}
       
   268         
       
   269         /**
       
   270         * To update the server about next media object being downloaded.
       
   271         */        
       
   272         inline virtual void ContentTypeChanged() {}
       
   273                         
       
   274         /**
       
   275         * To update the server about updated media info
       
   276         */
       
   277         inline virtual void UpdateMediaInfoL() {}
       
   278         
       
   279         /**
       
   280         * To update the server about updated media info
       
   281         */
       
   282         inline virtual void UpdateTrackInfoL() {}
       
   283         
       
   284         /**
       
   285         * To handle PostResponseUrlL as part of metering response
       
   286 		*/	        
       
   287         inline virtual void HandleRoapPostResponseUrlL( const TDesC8& /*aPrUrl*/ ) {}
       
   288         
       
   289                         
       
   290     private:    // from MCodDialogCommandObserver
       
   291 
       
   292         /**
       
   293         * Handle dialog command (from wait note).
       
   294         * @param aCommand Dialog command id.
       
   295         */
       
   296         void HandleDialogCommandL( TInt aCommand );
       
   297 
       
   298     private:    // from MAknServerAppExitObserver
       
   299 
       
   300         /**
       
   301         * Embedded document viewing has ended.
       
   302         * @param aReason Exit reason (unused).
       
   303         */
       
   304         void HandleServerAppExit( TInt aReason );
       
   305 
       
   306     private:    // new methods
       
   307 
       
   308         /**
       
   309         * Open file done.
       
   310         */
       
   311         void OpenFileDoneL();
       
   312 
       
   313         /**
       
   314         * Static wrapper around LoadDone (for TCallBack use).
       
   315         * @param aPtr Pointer passed to the callback (this object as TAny*).
       
   316         * @return EFalse (as TInt).
       
   317         */
       
   318         static TInt StaticLoadDone( TAny* aPtr );
       
   319 
       
   320         /**
       
   321         * Load done, follow-up processing and exit.
       
   322         */
       
   323         void LoadDone();
       
   324 
       
   325         /**
       
   326         * Load done, follow-up processing and exit.
       
   327         */
       
   328         void LoadDoneL();
       
   329 
       
   330         /**
       
   331         * Handle successful load.
       
   332         * @return ETrue if application should exit.
       
   333         */
       
   334         TBool LoadOkL();
       
   335 
       
   336         /**
       
   337         * Handle failed load.
       
   338         * @return ETrue if application should exit.
       
   339         */
       
   340         TBool LoadFailedL();
       
   341 
       
   342         /**
       
   343         * Handle successful ROAP.
       
   344         * @return ETrue if application should exit.
       
   345         */
       
   346         TBool RoapOkL();
       
   347 
       
   348         /**
       
   349         * Handle successful RoAcq ROAP.
       
   350         * @return ETrue if application should exit.
       
   351         */
       
   352         TBool RoAcqOkL();
       
   353 
       
   354         /**
       
   355         * Handle failed ROAP.
       
   356         * @return ETrue if application should exit.
       
   357         */
       
   358         TBool RoapFailedL();
       
   359 
       
   360         /**
       
   361         * Launch content.
       
   362         * @param aFname File name.
       
   363         * @param aType MIME type.
       
   364         * @return ETrue if application should exit.
       
   365         */
       
   366         TBool LaunchContentL( const TDesC& aFname, const TDesC8& aType );
       
   367         
       
   368         /**
       
   369         * Service flow: launch browser and (optionally) activate Next-URL,
       
   370         * if exists.
       
   371         */
       
   372         void ActivateNextUrlL();
       
   373 
       
   374     private:    // new methods
       
   375 
       
   376         /**
       
   377         * Set CBA.
       
   378         * @param aCommandSetResourceId Command set resource id.
       
   379         */
       
   380         void SetCbaL( TInt aCommandSetResourceId );
       
   381 
       
   382         /**
       
   383         * Access the document.
       
   384         * @return The document.
       
   385         */
       
   386         inline CCodDocument* CodDocument();
       
   387 
       
   388     private:    // data
       
   389 
       
   390         
       
   391         TBool iCod;                         ///< COD or DD?
       
   392         CCodUiResource* iCodResource;       ///< CodUi resource. Owned.
       
   393         CCodView* iView;                    ///< App's view (control). Owned.
       
   394         CCodWaitDialog* iWaitNote;          ///< Wait note. Owned.
       
   395         CRequestCompleteCallback* iCallback;///< Callback object. Owned.
       
   396         TInt iCurrentCba;                   ///< Current CBA.
       
   397         CErrorUI* iErrorUi;                 ///< Error UI. Owned.
       
   398         CDocumentHandler* iDocHandler;      ///< DocHandler or NULL. Owned.
       
   399         CAiwGenericParamList* iDocParams;   ///< DocHandler params. Owned.
       
   400         RFs iFs;                            ///< File Server Session.
       
   401         TInt iError;                        ///< Error code.
       
   402         TBool iSilentMode;                  ///< Silent mode.
       
   403         TBool iSuppressNextUrl;             ///< Suppress Next-URL.
       
   404         TBool iSuppressLaunch;              ///< Suppress launch.
       
   405         TBool iRoap;                        ///< ROAP involved?
       
   406         TInt iConnError;					///< Connection Error
       
   407     };
       
   408 
       
   409 #endif /* def COD_APP_UI_H */