epoc32/include/mw/cdownloadmgruiuserinteractions.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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     public: // Functions from CDownloadMgrUiBase
   194 
   195         /// Attribute enumerations.
   196         enum TDownloadMgrUiUserInteractionsAttr
   197             {
   198             EAttrSuppressDownloadConfirmation ///< TBool, default: EFalse
   199             };
   200 
   201         IMPORT_C virtual void GetIntAttributeL( const TUint aAttribute, TInt32& aValue );
   202         IMPORT_C virtual void GetBoolAttributeL( const TUint aAttribute, TBool& aValue );
   203         IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes16& aValue  );
   204         IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes8& aValue  );
   205         IMPORT_C virtual void SetIntAttributeL( const TUint aAttribute, TInt32 aValue );
   206         IMPORT_C virtual void SetBoolAttributeL( const TUint aAttribute, TBool aValue );
   207         IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC16& aValue );
   208         IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC8& aValue );
   209 
   210     protected: // Constructors
   211 
   212         /**
   213         * C++ default constructor.
   214         */
   215         CDownloadMgrUiUserInteractions( CDownloadMgrUiLibRegistry& aRegistryModel );
   216 
   217         /**
   218         * By default Symbian 2nd phase constructor is private.
   219         */
   220         void ConstructL();
   221 
   222     protected: // New functions
   223 
   224         // Event handler functions
   225 
   226         /**
   227         * Wraps DoHandleCompletionWithQueryL() to ensure that only one instance
   228         * of the dialog is displayed at any point in time.
   229         * @param aDownload The actual download
   230         * @return void
   231         */
   232         void HandleCompletionWithQueryL( RHttpDownload& aDownload, 
   233                                                                  TBool aIsUiBusy, 
   234                                                                  TBool aIsSupported, 
   235                                                                  TBool aIsDrm, 
   236                                                                  TBool aDrmRightsOnPhone );
   237         /**
   238         * Handle download completion with query (wait) dialog.
   239         * @param aDownload The actual download
   240         * @return -
   241         */
   242         void DoHandleCompletionWithQueryL( RHttpDownload& aDownload, 
   243                                                                  TBool aIsUiBusy, 
   244                                                                  TBool aIsSupported, 
   245                                                                  TBool aIsDrm, 
   246                                                                  TBool aDrmRightsOnPhone );
   247 
   248         /**
   249         * Leaving version of PrepareToExit().
   250         * @return None.
   251         */
   252         void PrepareToExitL( CEikAppUi* aAppUi, 
   253                              TClientAppExitType aExitType, 
   254                              TVwsViewId aViewId, 
   255                              TUid aCustomMessageId, 
   256                              const TDesC8& aViewActivationMsg );
   257 
   258         /**
   259         * Is a stand-alone instance running from the very same application?
   260         * @return True/False.
   261         */
   262         TBool IsStandAloneAppRunning();
   263 
   264         /**
   265         * Delete Event Handler(s) showing download confirmation query.
   266         * @param aDownload The actual download.
   267         */
   268         void DeleteEventHandlerShowingDlConfirmation( RHttpDownload& aDownload );
   269 
   270         /**
   271         * Delete Event Handler(s) belonging to the given download.
   272         * @param aDownload The actual download.
   273         */
   274         void DeleteEventHandlers( RHttpDownload& aDownload );
   275 
   276         /**
   277         * Handle completed normal download (not COD or OMA, not DRM).
   278         * @param aDownload The actual download
   279         * @return -
   280         */
   281         void HandleNormalDownloadL( RHttpDownload& aDownload );
   282 
   283         /**
   284         * Check if the download is COD.
   285         * @param aDownload The actual download
   286         * @return ETrue/EFalse
   287         */
   288         TBool CodDownloadL( RHttpDownload& aDownload ) const;
   289 
   290     protected: // Functions from MHttpDownloadMgrObserver
   291 
   292         virtual void HandleDMgrEventL( RHttpDownload& aDownload, 
   293                                        THttpDownloadEvent aEvent );
   294 
   295     private:  // Data
   296         
   297         CUserInteractionsExtension* iExtension; ///< Extension class, Owned.
   298 
   299         CUserInteractionsUtils*     iUiUtils; /**< Owned. Should be only one 
   300                                                    instance in the UILib! */
   301         CAsyncEventHandlerArray*    iEventHandlerArray; ///< Owned.
   302 
   303         TBool                       iDlgActive;
   304 
   305     private: // Friend classes
   306 
   307         friend class CUserInteractionsExtension;
   308     };
   309 
   310 #endif /* CDOWNLOADMGRUIUSERINTERACTIONS_H */