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