williamr@2: /* williamr@2: * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Supports user interaction dialogs for downloads williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef CDOWNLOADMGRUIUSERINTERACTIONS_H williamr@2: #define CDOWNLOADMGRUIUSERINTERACTIONS_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // CONSTANTS williamr@2: _LIT8( KDrmInnerContentTypesToLaunch, "application/java-archive application/x-java-archive x-epoc/x-sisx-app application/x-pip" ); williamr@2: _LIT8( KSisxApplication, "x-epoc/x-sisx-app application/vnd.symbian.install x-epoc/x-app268436505" ); williamr@2: _LIT8( KPipApplication, "application/x-pip" ); williamr@2: _LIT8( KWidgetMimeType, "application/x-nokia-widget" ); williamr@2: _LIT8( KSharingConfig, "application/isf.sharing.config" ); williamr@2: williamr@2: // DATA TYPES williamr@2: enum TClientAppExitType williamr@2: { williamr@2: ETerminatedByUser, williamr@2: ETerminatedBySystem williamr@2: }; williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CUserInteractionsUtils; williamr@2: class CDownloadMgrUiLibRegistry; williamr@2: class CAsyncEventHandlerArray; williamr@2: class CEikAppUi; williamr@2: class CUserInteractionsExtension; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * The User Interactions supports the followings: williamr@2: * - User confirmation when content-type header arrives williamr@2: * - Handling completed downloads williamr@2: * - Querying HTTP authentication credentials williamr@2: * - Querying proxy authentication credentials williamr@2: * - Error notification williamr@2: * - Client App termination by the User williamr@2: * williamr@2: * @lib Download Manager UI Lib williamr@2: * @since Series 60 2.8 williamr@2: */ williamr@2: NONSHARABLE_CLASS( CDownloadMgrUiUserInteractions ) : williamr@2: public CDownloadMgrUiBase, williamr@2: public MHttpDownloadMgrObserver williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: static CDownloadMgrUiUserInteractions* NewL williamr@2: ( CDownloadMgrUiLibRegistry& aRegistryModel ); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: virtual ~CDownloadMgrUiUserInteractions(); williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Client Apps can call this function before exiting the application. williamr@2: * It should be called when the user terminates the application. williamr@2: * It opens a confirmation query. williamr@2: * @return OK to exit? True/False. It is only a suggested value! williamr@2: */ williamr@2: IMPORT_C TBool OkToExitL(); williamr@2: williamr@2: /** williamr@2: * Client Apps can call this function in the App UI's destructor. williamr@2: * It has been made non-leavable, so it can be called without TRAP. williamr@2: * It initializes Grouped Soft Notifications, if necessary. williamr@2: * @param aAppUi Reference to the actual App UI. williamr@2: * @param aExitType Exit type when this function is called. williamr@2: * Only ETerminatedBySystem is supported. williamr@2: * @param aViewId View ID of the view where to switch in case user chooses williamr@2: * accept softkey in the soft notification. williamr@2: * @param aCustomMessageId Custom message ID. williamr@2: * @param aViewActivationMsg Custom message sent to the view in williamr@2: * the view activation process. williamr@2: * @return Error code or KErrNone. williamr@2: */ williamr@2: IMPORT_C TInt PrepareToExit( CEikAppUi& aAppUi, williamr@2: TClientAppExitType aExitType, williamr@2: TVwsViewId aViewId, williamr@2: TUid aCustomMessageId, williamr@2: const TDesC8& aViewActivationMsg ); williamr@2: williamr@2: /** williamr@2: * Client Apps can call this function in the App UI's destructor. williamr@2: * It has been made non-leavable, so it can be called without TRAP. williamr@2: * It initializes Grouped Soft Notifications, if necessary. williamr@2: * @param aAppUid 3rd UID of the application. williamr@2: * @param aViewId View ID that needs to be activated. williamr@2: * @param aCustomMessageId Custom message ID. williamr@2: * @return Error code or KErrNone. williamr@2: */ williamr@2: IMPORT_C TInt PrepareToExit( TUint32 aAppUid, williamr@2: TUint32 aViewId, williamr@2: TUint32 aCustomMessageId ); williamr@2: williamr@2: /** williamr@2: * Currently it supports handling completed download. williamr@2: * COD download is deleted, otherwise normal behaviour, that williamr@2: * depends on EDlAttrAction (EDoNothing/EMove/ELaunch). williamr@2: * @param aDownload The actual download williamr@2: * @return - williamr@2: */ williamr@2: IMPORT_C void HandleDownloadL( RHttpDownload& aDownload ); williamr@2: williamr@2: /** williamr@2: * The number of download confirmations being shown. williamr@2: * @return Non-negative integer value. williamr@2: */ williamr@2: TInt DownloadConfirmationsShown() const; williamr@2: williamr@2: /** williamr@2: * Ask if a handler or something uses the UI, so williamr@2: * others should postpone their tasks that require UI. williamr@2: * @return yes/no. williamr@2: */ williamr@2: TBool IsUiBusy() const; williamr@2: williamr@2: /** williamr@2: * Is a Cod ServiceFlow running? williamr@2: * @return yes/no. williamr@2: */ williamr@2: TBool IsCodServiceFlowRunning() const; williamr@2: williamr@2: /** williamr@2: * Is Cod ServiceFlow running of the given download? williamr@2: * @param aDownload The download in question. williamr@2: * @return yes/no. williamr@2: */ williamr@2: TBool IsCodServiceFlowRunning( RHttpDownload& aDownload ) const; williamr@2: williamr@2: /** williamr@2: * Is a Cod ServiceFlow running? williamr@2: * LEAVing version. williamr@2: * @return yes/no. williamr@2: */ williamr@2: TBool IsCodServiceFlowRunningL() const; williamr@2: williamr@2: /** williamr@2: * Is Cod ServiceFlow running of the given download? williamr@2: * LEAVing version. williamr@2: * @param aDownload The download in question. williamr@2: * @return yes/no. williamr@2: */ williamr@2: TBool IsCodServiceFlowRunningL( RHttpDownload& aDownload ) const; williamr@2: williamr@2: /** williamr@2: * Postpone handling the given COD download. The download is placed to a williamr@2: * LIFO queue, and SetHandlerRunning( EFalse ) handles (restarts) the first williamr@2: * download in it. williamr@2: * @param aDownload The download to be postponed. williamr@2: */ williamr@2: void PostponeCodHandlingL( RHttpDownload& aDownload ); williamr@2: williamr@2: /** williamr@2: * Check if the given download is postponed. williamr@2: * @param aDownload The download in question. williamr@2: * @return true/false. williamr@2: */ williamr@2: TBool IsPostponed( RHttpDownload& aDownload ) const; williamr@2: williamr@2: /** williamr@2: * Schedule a postponed download for running. williamr@2: */ williamr@2: void SchedulePostponedDownloadL(); williamr@2: williamr@2: public: // Functions from CDownloadMgrUiBase williamr@2: williamr@2: /// Attribute enumerations. williamr@2: enum TDownloadMgrUiUserInteractionsAttr williamr@2: { williamr@2: EAttrSuppressDownloadConfirmation ///< TBool, default: EFalse williamr@2: }; williamr@2: williamr@2: IMPORT_C virtual void GetIntAttributeL( const TUint aAttribute, TInt32& aValue ); williamr@2: IMPORT_C virtual void GetBoolAttributeL( const TUint aAttribute, TBool& aValue ); williamr@2: IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes16& aValue ); williamr@2: IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes8& aValue ); williamr@2: IMPORT_C virtual void SetIntAttributeL( const TUint aAttribute, TInt32 aValue ); williamr@2: IMPORT_C virtual void SetBoolAttributeL( const TUint aAttribute, TBool aValue ); williamr@2: IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC16& aValue ); williamr@2: IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC8& aValue ); williamr@2: williamr@2: protected: // Constructors williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: CDownloadMgrUiUserInteractions( CDownloadMgrUiLibRegistry& aRegistryModel ); williamr@2: williamr@2: /** williamr@2: * By default Symbian 2nd phase constructor is private. williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: protected: // New functions williamr@2: williamr@2: // Event handler functions williamr@2: williamr@2: /** williamr@2: * Wraps DoHandleCompletionWithQueryL() to ensure that only one instance williamr@2: * of the dialog is displayed at any point in time. williamr@2: * @param aDownload The actual download williamr@2: * @return void williamr@2: */ williamr@2: void HandleCompletionWithQueryL( RHttpDownload& aDownload, williamr@2: TBool aIsUiBusy, williamr@2: TBool aIsSupported, williamr@2: TBool aIsDrm, williamr@2: TBool aDrmRightsOnPhone ); williamr@2: /** williamr@2: * Handle download completion with query (wait) dialog. williamr@2: * @param aDownload The actual download williamr@2: * @return - williamr@2: */ williamr@2: void DoHandleCompletionWithQueryL( RHttpDownload& aDownload, williamr@2: TBool aIsUiBusy, williamr@2: TBool aIsSupported, williamr@2: TBool aIsDrm, williamr@2: TBool aDrmRightsOnPhone ); williamr@2: williamr@2: /** williamr@2: * Leaving version of PrepareToExit(). williamr@2: * @return None. williamr@2: */ williamr@2: void PrepareToExitL( CEikAppUi* aAppUi, williamr@2: TClientAppExitType aExitType, williamr@2: TVwsViewId aViewId, williamr@2: TUid aCustomMessageId, williamr@2: const TDesC8& aViewActivationMsg ); williamr@2: williamr@2: /** williamr@2: * Is a stand-alone instance running from the very same application? williamr@2: * @return True/False. williamr@2: */ williamr@2: TBool IsStandAloneAppRunning(); williamr@2: williamr@2: /** williamr@2: * Delete Event Handler(s) showing download confirmation query. williamr@2: * @param aDownload The actual download. williamr@2: */ williamr@2: void DeleteEventHandlerShowingDlConfirmation( RHttpDownload& aDownload ); williamr@2: williamr@2: /** williamr@2: * Delete Event Handler(s) belonging to the given download. williamr@2: * @param aDownload The actual download. williamr@2: */ williamr@2: void DeleteEventHandlers( RHttpDownload& aDownload ); williamr@2: williamr@2: /** williamr@2: * Handle completed normal download (not COD or OMA, not DRM). williamr@2: * @param aDownload The actual download williamr@2: * @return - williamr@2: */ williamr@2: void HandleNormalDownloadL( RHttpDownload& aDownload ); williamr@2: williamr@2: /** williamr@2: * Check if the download is COD. williamr@2: * @param aDownload The actual download williamr@2: * @return ETrue/EFalse williamr@2: */ williamr@2: TBool CodDownloadL( RHttpDownload& aDownload ) const; williamr@2: williamr@2: protected: // Functions from MHttpDownloadMgrObserver williamr@2: williamr@2: virtual void HandleDMgrEventL( RHttpDownload& aDownload, williamr@2: THttpDownloadEvent aEvent ); williamr@2: williamr@2: private: // Data williamr@2: williamr@2: CUserInteractionsExtension* iExtension; ///< Extension class, Owned. williamr@2: williamr@2: CUserInteractionsUtils* iUiUtils; /**< Owned. Should be only one williamr@2: instance in the UILib! */ williamr@2: CAsyncEventHandlerArray* iEventHandlerArray; ///< Owned. williamr@2: williamr@2: TBool iDlgActive; williamr@2: williamr@2: private: // Friend classes williamr@2: williamr@2: friend class CUserInteractionsExtension; williamr@2: }; williamr@2: williamr@2: #endif /* CDOWNLOADMGRUIUSERINTERACTIONS_H */