web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h
changeset 0 dd21522fd290
child 8 7c90e6132015
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 Download Menu and Downloads List
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CDOWNLOADMGRUIDOWNLOADSLIST_H
       
    21 #define CDOWNLOADMGRUIDOWNLOADSLIST_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <CDownloadMgrUiBase.h>
       
    25 #include <DownloadMgrClient.h>
       
    26 #include <HttpDownloadMgrCommon.h>
       
    27 #include <DownloadsListDlgObserver.h>
       
    28 
       
    29 #include <AiwServiceHandler.h>
       
    30 #include <AiwCommon.hrh>
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CDownloadMgrUiDownloadMenu;
       
    34 class CDownloadMgrUiUserInteractions;
       
    35 class CDownloadsListArray;
       
    36 class CDownloadsListDlg;
       
    37 class CUserInteractionsUtils;
       
    38 class CDownloadMgrUiLibRegistry;
       
    39 class CAsyncEventHandlerArray;
       
    40 class CAsyncEventHandlerBase;
       
    41 class CDownloadsListExtension;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46 *  Display list of downloads.
       
    47 *
       
    48 *  @lib Download Manager UI Lib
       
    49 *  @since Series 60 2.8
       
    50 */
       
    51 NONSHARABLE_CLASS( CDownloadMgrUiDownloadsList ) : 
       
    52                                                 public CDownloadMgrUiBase, 
       
    53                                                 public MHttpDownloadMgrObserver,
       
    54                                                 public MDownloadsListDlgObserver,
       
    55                                                 public MAiwNotifyCallback 
       
    56     {
       
    57     public:  // Constructors and destructor
       
    58         
       
    59         /**
       
    60         * Two-phased constructor.
       
    61         */
       
    62         static CDownloadMgrUiDownloadsList* NewL
       
    63                ( CDownloadMgrUiLibRegistry& aRegistryModel );
       
    64         
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CDownloadMgrUiDownloadsList();
       
    69 
       
    70     public: // New functions
       
    71 
       
    72         // -------------------------------------------------------------
       
    73         // ************** Download Menu
       
    74         // -------------------------------------------------------------
       
    75 
       
    76         /**
       
    77         * Access the Download Menu utility.
       
    78         * @since Series 60 2.8
       
    79         * @return -
       
    80         */
       
    81         IMPORT_C CDownloadMgrUiDownloadMenu& DownloadMenu() const;
       
    82 
       
    83         // -------------------------------------------------------------
       
    84         // ************** Downloads List
       
    85         // -------------------------------------------------------------
       
    86 
       
    87         /**
       
    88         * Display the list of downloads (the method does not block the scheduler).
       
    89         * It means that this method initializes an active object, that completes 
       
    90         * itself and it executes the Downloads List dialog in it's RunL.
       
    91         * Using this method the caller is not blocked by the wait-dialog.
       
    92         * @since Series 60 2.8
       
    93         * @return -
       
    94         */
       
    95         IMPORT_C void DisplayDownloadsListL();
       
    96 
       
    97         /**
       
    98         * Display the list of downloads (the method does not block the scheduler).
       
    99         * It means that this method initializes an active object, that completes 
       
   100         * itself and it executes the Downloads List dialog in it's RunL.
       
   101         * Using this method the caller is not blocked by the wait-dialog.
       
   102         * This method is not exported!
       
   103         * @param aHighlightDl This download is highlighted in the list.
       
   104         * @since Series 60 3.0
       
   105         * @return -
       
   106         */
       
   107         void DisplayDownloadsListL( RHttpDownload& aHighlightDl );
       
   108 
       
   109         /**
       
   110         * Cancel displaying the list of downloads.
       
   111         * @since Series 60 2.8
       
   112         * @return -
       
   113         */
       
   114         IMPORT_C void CancelDisplayingDownloadsList();
       
   115 
       
   116         /**
       
   117         * Is the List of Downloads visible?
       
   118         * @since Series 60 2.8
       
   119         * @return ETrue/EFalse
       
   120         */
       
   121         IMPORT_C TBool IsVisible() const;
       
   122 
       
   123         /**
       
   124         * Number of downloads in the List of Downloads.
       
   125         * @since Series 60 2.8
       
   126         * @return TInt
       
   127         */
       
   128         IMPORT_C TInt Count() const;
       
   129 
       
   130         /**
       
   131         * Remove the given download from the list.
       
   132         */ 
       
   133         void DeleteDownloadL( RHttpDownload& aDownload );
       
   134 
       
   135         /**
       
   136         * Is one of them progressive
       
   137         * @since Series 60 3.2
       
   138         * @return TBool 
       
   139         */
       
   140         TBool IsOneProgressive();
       
   141         
       
   142         /**
       
   143         * Is one of them progressive
       
   144         * @since Series 60 3.2
       
   145         * @return TBool 
       
   146         */
       
   147         inline TBool IsProgressiveDownloadEnabled() {return iProgressiveDownload; }
       
   148         
       
   149 
       
   150     public: // Functions from CDownloadMgrUiBase
       
   151 
       
   152         IMPORT_C virtual void GetIntAttributeL( const TUint aAttribute, TInt32& aValue );
       
   153         IMPORT_C virtual void GetBoolAttributeL( const TUint aAttribute, TBool& aValue );
       
   154         IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes16& aValue  );
       
   155         IMPORT_C virtual void GetStringAttributeL( const TUint aAttribute, TDes8& aValue  );
       
   156         IMPORT_C virtual void SetIntAttributeL( const TUint aAttribute, TInt32 aValue );
       
   157         IMPORT_C virtual void SetBoolAttributeL( const TUint aAttribute, TBool aValue );
       
   158         IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC16& aValue );
       
   159         IMPORT_C virtual void SetStringAttributeL( const TUint aAttribute, const TDesC8& aValue );
       
   160 
       
   161     protected: // Constructors
       
   162 
       
   163         /**
       
   164         * C++ default constructor.
       
   165         */
       
   166         CDownloadMgrUiDownloadsList( CDownloadMgrUiLibRegistry& aRegistryModel );
       
   167 
       
   168         /**
       
   169         * By default Symbian 2nd phase constructor is private.
       
   170         */
       
   171         void ConstructL();
       
   172 
       
   173     protected: // New functions
       
   174 
       
   175         // -------------------------------------------------------------
       
   176         // ************** List box utilities
       
   177         // -------------------------------------------------------------
       
   178 
       
   179         /**
       
   180         * Add downloads to the list residing in aDownloadMgr.
       
   181         * If a given download is already on the list, the list item is only updated.
       
   182         */ 
       
   183         void AddDownloadsToListModelL( CDownloadsListArray& aLBModel, 
       
   184                                        RHttpDownloadMgr& aDownloadMgr );
       
   185 
       
   186         /**
       
   187         * Add the download to the list.
       
   188         * If the download is already on the list, the list item is only updated.
       
   189         * This method should be used for adding new downloads - 
       
   190         * not for updating existing ones.
       
   191         * @return Returns the index relative to zero of the appended or updated item.
       
   192         */
       
   193         TInt AddDownloadToListModelL( CDownloadsListArray& aLBModel, 
       
   194                                       RHttpDownload& aDownload );
       
   195 
       
   196         // -------------------------------------------------------------
       
   197         // ************** Responses to download events
       
   198         // -------------------------------------------------------------
       
   199 
       
   200         void NewDownloadCreatedL( RHttpDownload& aDownload );
       
   201         void UpdateProgressInfoL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
   202         void DownloadPausedL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
   203         void DownloadCompletedL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
   204         void DownloadFailedL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
   205         void PauseableStateChangedL( RHttpDownload& aDownload, TBool aPausable );
       
   206 
       
   207         // -------------------------------------------------------------
       
   208         // ************** Other utility
       
   209         // -------------------------------------------------------------
       
   210 
       
   211         void HideMenu();
       
   212 
       
   213     protected: // Functions from MHttpDownloadMgrObserver
       
   214 
       
   215         virtual void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
   216 
       
   217     protected: // Functions from MDownloadsListDlgObserver
       
   218 
       
   219         virtual void PreLayoutDynInitL( CDownloadsListDlg& aDialog );
       
   220         virtual void ProcessCommandL( CDownloadsListDlg& aDialog, TInt aCommandId );
       
   221         virtual void DynInitMenuPaneL( CDownloadsListDlg& aDialog, TInt aResourceId, CEikMenuPane* aMenuPane );
       
   222         virtual TKeyResponse OfferKeyEventL( CDownloadsListDlg& aDialog, const TKeyEvent& aKeyEvent, TEventCode aType );
       
   223 
       
   224 
       
   225     protected: // Function from MAIWNotifyCallback 
       
   226         TInt HandleNotifyL( TInt /*aCmdId*/,
       
   227                             TInt /*aEventId*/,
       
   228                             CAiwGenericParamList& /*aEventParamList*/,
       
   229                             const CAiwGenericParamList& /*aInParamList*/ ){return KErrNone;}
       
   230     private: 
       
   231         void AttachAIWInterestL();
       
   232         void HandleAIWCommandL(TInt aCommand, RHttpDownload& aDownload);
       
   233         void InitializeAIWPlugInMenusL( TInt aResourceId, 
       
   234                                         CEikMenuPane* aMenuPane,
       
   235                                         RHttpDownload& aDownload );
       
   236         void ProvideInputParametersL( CAiwGenericParamList& aParams,
       
   237                                       TInt& /*aCommandOptions*/,
       
   238                                       RHttpDownload& aDownload);
       
   239 
       
   240     private:  // Data
       
   241         
       
   242         CDownloadsListExtension*    iExtension; ///< Extension class. Owned.
       
   243 
       
   244         CUserInteractionsUtils*     iUiUtils; ///< Utility. Owned.
       
   245         CDownloadMgrUiDownloadMenu* iDownloadMenu; ///< Download Menu utility. Owned.
       
   246         CAsyncEventHandlerArray*    iEventHandlerArray; ///< Owned.
       
   247         CDownloadsListArray*        iListModel; ///< Association array: list item-download. Owned.
       
   248         CDownloadsListDlg*          iDialog; ///< Owned. Unused member.
       
   249         TBool                       iIsVisible; ///< Unused member.
       
   250 		TBool						iIsTimerStarted;
       
   251 		CAiwServiceHandler* iAIWServiceHandler;
       
   252 		TBool						iProgressiveDownload;
       
   253 		
       
   254 		TBool						iIsCancelInProgress;
       
   255 
       
   256     private: // Friend classes
       
   257 
       
   258         friend class CDownloadsListExtension;
       
   259     };
       
   260 
       
   261 #endif /* CDOWNLOADMGRUIDOWNLOADSLIST_H */