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