epoc32/include/mw/cdownloadmgruiuserinteractions.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002-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:  Supports user interaction dialogs for downloads
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef CDOWNLOADMGRUIUSERINTERACTIONS_H
    21 #define CDOWNLOADMGRUIUSERINTERACTIONS_H
    22 
    23 //  INCLUDES
    24 #include <cdownloadmgruibase.h>
    25 #include <downloadmgrclient.h>
    26 #include <vwsdef.h>
    27 
    28 // CONSTANTS
    29 _LIT8( KDrmInnerContentTypesToLaunch, "application/java-archive application/x-java-archive x-epoc/x-sisx-app application/x-pip" );
    30 _LIT8( KSisxApplication, "x-epoc/x-sisx-app application/vnd.symbian.install x-epoc/x-app268436505" );
    31 _LIT8( KPipApplication, "application/x-pip" );
    32 _LIT8( KWidgetMimeType, "application/x-nokia-widget" );
    33 _LIT8( KSharingConfig, "application/isf.sharing.config" );
    34 
    35 // DATA TYPES
    36 enum TClientAppExitType
    37     {
    38     ETerminatedByUser,
    39     ETerminatedBySystem
    40     };
    41 
    42 // FORWARD DECLARATIONS
    43 class CUserInteractionsUtils;
    44 class CDownloadMgrUiLibRegistry;
    45 class CAsyncEventHandlerArray;
    46 class CEikAppUi;
    47 class CUserInteractionsExtension;
    48 
    49 // CLASS DECLARATION
    50 
    51 /**
    52 *  The User Interactions supports the followings:
    53 *  - User confirmation when content-type header arrives
    54 *  - Handling completed downloads
    55 *  - Querying HTTP authentication credentials
    56 *  - Querying proxy authentication credentials
    57 *  - Error notification
    58 *  - Client App termination by the User
    59 *
    60 *  @lib Download Manager UI Lib
    61 *  @since Series 60 2.8
    62 */
    63 NONSHARABLE_CLASS( CDownloadMgrUiUserInteractions ) : 
    64                                                 public CDownloadMgrUiBase,
    65                                                 public MHttpDownloadMgrObserver
    66     {
    67     public:  // Constructors and destructor
    68         
    69         /**
    70         * Two-phased constructor.
    71         */
    72         static CDownloadMgrUiUserInteractions* NewL
    73                ( CDownloadMgrUiLibRegistry& aRegistryModel );
    74         
    75         /**
    76         * Destructor.
    77         */
    78         virtual ~CDownloadMgrUiUserInteractions();
    79 
    80     public: // New functions
    81 
    82         /**
    83         * Client Apps can call this function before exiting the application. 
    84         * It should be called when the user terminates the application. 
    85         * It opens a confirmation query.
    86         * @return OK to exit? True/False. It is only a suggested value!
    87         */
    88         IMPORT_C TBool OkToExitL();
    89 
    90         /**
    91         * Client Apps can call this function in the App UI's destructor. 
    92         * It has been made non-leavable, so it can be called without TRAP.
    93         * It initializes Grouped Soft Notifications, if necessary.
    94         * @param aAppUi Reference to the actual App UI.
    95         * @param aExitType Exit type when this function is called.
    96         *                  Only ETerminatedBySystem is supported.
    97         * @param aViewId View ID of the view where to switch in case user chooses
    98         *                accept softkey in the soft notification.
    99         * @param aCustomMessageId Custom message ID.
   100         * @param aViewActivationMsg Custom message sent to the view in 
   101         *                           the view activation process.
   102         * @return Error code or KErrNone.
   103         */
   104         IMPORT_C TInt PrepareToExit( CEikAppUi& aAppUi, 
   105                                      TClientAppExitType aExitType, 
   106                                      TVwsViewId aViewId, 
   107                                      TUid aCustomMessageId, 
   108                                      const TDesC8& aViewActivationMsg );
   109 
   110         /**
   111         * Client Apps can call this function in the App UI's destructor. 
   112         * It has been made non-leavable, so it can be called without TRAP.
   113         * It initializes Grouped Soft Notifications, if necessary.
   114         * @param aAppUid 3rd UID of the application.
   115         * @param aViewId View ID that needs to be activated.
   116         * @param aCustomMessageId Custom message ID.
   117         * @return Error code or KErrNone.
   118         */
   119         IMPORT_C TInt PrepareToExit( TUint32 aAppUid,
   120                                      TUint32 aViewId, 
   121                                      TUint32 aCustomMessageId );
   122 
   123         /**
   124         * Currently it supports handling completed download.
   125         * COD download is deleted, otherwise normal behaviour, that 
   126         * depends on EDlAttrAction (EDoNothing/EMove/ELaunch).
   127         * @param aDownload The actual download
   128         * @return -
   129         */
   130         IMPORT_C void HandleDownloadL( RHttpDownload& aDownload );
   131 
   132         /**
   133         * The number of download confirmations being shown.
   134         * @return Non-negative integer value.
   135         */
   136         TInt DownloadConfirmationsShown() const;
   137 
   138         /**
   139         * Ask if a handler or something uses the UI, so 
   140         * others should postpone their tasks that require UI.
   141         * @return yes/no.
   142         */
   143         TBool IsUiBusy() const;
   144 
   145         /**
   146         * Is a Cod ServiceFlow running?
   147         * @return yes/no.
   148         */
   149         TBool IsCodServiceFlowRunning() const;
   150 
   151         /**
   152         * Is Cod ServiceFlow running of the given download?
   153         * @param aDownload The download in question.
   154         * @return yes/no.
   155         */
   156         TBool IsCodServiceFlowRunning( RHttpDownload& aDownload ) const;
   157 
   158         /**
   159         * Is a Cod ServiceFlow running?
   160         * LEAVing version.
   161         * @return yes/no.
   162         */
   163         TBool IsCodServiceFlowRunningL() const;
   164 
   165         /**
   166         * Is Cod ServiceFlow running of the given download?
   167         * LEAVing version.
   168         * @param aDownload The download in question.
   169         * @return yes/no.
   170         */
   171         TBool IsCodServiceFlowRunningL( RHttpDownload& aDownload ) const;
   172 
   173         /**
   174         * Postpone handling the given COD download. The download is placed to a 
   175         * LIFO queue, and SetHandlerRunning( EFalse ) handles (restarts) the first 
   176         * download in it.
   177         * @param aDownload The download to be postponed.
   178         */
   179         void PostponeCodHandlingL( RHttpDownload& aDownload );
   180 
   181         /**
   182         * Check if the given download is postponed.
   183         * @param aDownload The download in question.
   184         * @return true/false.
   185         */
   186         TBool IsPostponed( RHttpDownload& aDownload ) const;
   187 
   188         /**
   189         * Schedule a postponed download for running.
   190         */
   191         void SchedulePostponedDownloadL();
   192         
   193         /**
   194         * To Set the flag when progressive play is Launched
   195         */
   196         inline void SetProgressiveDownloadLaunched( TBool aProgressiveDownloadLaunched ) {iProgressiveDownloadLaunched = aProgressiveDownloadLaunched; }
   197 
   198     public: // Functions from CDownloadMgrUiBase
   199 
   200         /// Attribute enumerations.
   201         enum TDownloadMgrUiUserInteractionsAttr
   202             {
   203             EAttrSuppressDownloadConfirmation ///< TBool, default: EFalse
   204             };
   205 
   206         IMPORT_C virtual void GetIntAttributeL( const TUint aAttribute, TInt32& aValue );
   207         IMPORT_C virtual void GetBoolAttributeL( const TUint aAttribute, TBool& aValue );
   208         IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes16& aValue  );
   209         IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes8& aValue  );
   210         IMPORT_C virtual void SetIntAttributeL( const TUint aAttribute, TInt32 aValue );
   211         IMPORT_C virtual void SetBoolAttributeL( const TUint aAttribute, TBool aValue );
   212         IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC16& aValue );
   213         IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC8& aValue );
   214 
   215     protected: // Constructors
   216 
   217         /**
   218         * C++ default constructor.
   219         */
   220         CDownloadMgrUiUserInteractions( CDownloadMgrUiLibRegistry& aRegistryModel );
   221 
   222         /**
   223         * By default Symbian 2nd phase constructor is private.
   224         */
   225         void ConstructL();
   226 
   227     protected: // New functions
   228 
   229         // Event handler functions
   230 
   231         /**
   232         * Wraps DoHandleCompletionWithQueryL() to ensure that only one instance
   233         * of the dialog is displayed at any point in time.
   234         * @param aDownload The actual download
   235         * @return void
   236         */
   237         void HandleCompletionWithQueryL( RHttpDownload& aDownload, 
   238                                                                  TBool aIsUiBusy, 
   239                                                                  TBool aIsSupported, 
   240                                                                  TBool aIsDrm, 
   241                                                                  TBool aDrmRightsOnPhone );
   242         /**
   243         * Handle download completion with query (wait) dialog.
   244         * @param aDownload The actual download
   245         * @return -
   246         */
   247         void DoHandleCompletionWithQueryL( RHttpDownload& aDownload, 
   248                                                                  TBool aIsUiBusy, 
   249                                                                  TBool aIsSupported, 
   250                                                                  TBool aIsDrm, 
   251                                                                  TBool aDrmRightsOnPhone );
   252 
   253         /**
   254         * Leaving version of PrepareToExit().
   255         * @return None.
   256         */
   257         void PrepareToExitL( CEikAppUi* aAppUi, 
   258                              TClientAppExitType aExitType, 
   259                              TVwsViewId aViewId, 
   260                              TUid aCustomMessageId, 
   261                              const TDesC8& aViewActivationMsg );
   262 
   263         /**
   264         * Is a stand-alone instance running from the very same application?
   265         * @return True/False.
   266         */
   267         TBool IsStandAloneAppRunning();
   268 
   269         /**
   270         * Delete Event Handler(s) showing download confirmation query.
   271         * @param aDownload The actual download.
   272         */
   273         void DeleteEventHandlerShowingDlConfirmation( RHttpDownload& aDownload );
   274 
   275         /**
   276         * Delete Event Handler(s) belonging to the given download.
   277         * @param aDownload The actual download.
   278         */
   279         void DeleteEventHandlers( RHttpDownload& aDownload );
   280 
   281         /**
   282         * Handle completed normal download (not COD or OMA, not DRM).
   283         * @param aDownload The actual download
   284         * @return -
   285         */
   286         void HandleNormalDownloadL( RHttpDownload& aDownload );
   287 
   288         /**
   289         * Check if the download is COD.
   290         * @param aDownload The actual download
   291         * @return ETrue/EFalse
   292         */
   293         TBool CodDownloadL( RHttpDownload& aDownload ) const;
   294 
   295     protected: // Functions from MHttpDownloadMgrObserver
   296 
   297         virtual void HandleDMgrEventL( RHttpDownload& aDownload, 
   298                                        THttpDownloadEvent aEvent );
   299 
   300     private:  // Data
   301         
   302         CUserInteractionsExtension* iExtension; ///< Extension class, Owned.
   303 
   304         CUserInteractionsUtils*     iUiUtils; /**< Owned. Should be only one 
   305                                                    instance in the UILib! */
   306         CAsyncEventHandlerArray*    iEventHandlerArray; ///< Owned.
   307 
   308         TBool                       iDlgActive;
   309         
   310         TBool                       iProgressiveDownloadLaunched;  
   311 
   312     private: // Friend classes
   313 
   314         friend class CUserInteractionsExtension;
   315     };
   316 
   317 #endif /* CDOWNLOADMGRUIUSERINTERACTIONS_H */