2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Supports Download Menu and Downloads List
18 #ifndef CDOWNLOADMGRUIDOWNLOADSLIST_H
19 #define CDOWNLOADMGRUIDOWNLOADSLIST_H
22 #include <cdownloadmgruibase.h>
23 #include <downloadmgrclient.h>
24 #include <httpdownloadmgrcommon.h>
25 #include <downloadslistdlgobserver.h>
27 #include <AiwServiceHandler.h>
28 #include <AiwCommon.hrh>
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;
44 * Display list of downloads.
46 * @lib Download Manager UI Lib
47 * @since Series 60 2.8
49 NONSHARABLE_CLASS( CDownloadMgrUiDownloadsList ) :
50 public CDownloadMgrUiBase,
51 public MHttpDownloadMgrObserver,
52 public MDownloadsListDlgObserver,
53 public MAiwNotifyCallback
55 public: // Constructors and destructor
58 * Two-phased constructor.
60 static CDownloadMgrUiDownloadsList* NewL
61 ( CDownloadMgrUiLibRegistry& aRegistryModel );
66 virtual ~CDownloadMgrUiDownloadsList();
68 public: // New functions
70 // -------------------------------------------------------------
71 // ************** Download Menu
72 // -------------------------------------------------------------
75 * Access the Download Menu utility.
76 * @since Series 60 2.8
79 IMPORT_C CDownloadMgrUiDownloadMenu& DownloadMenu() const;
81 // -------------------------------------------------------------
82 // ************** Downloads List
83 // -------------------------------------------------------------
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
93 IMPORT_C void DisplayDownloadsListL();
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
105 void DisplayDownloadsListL( RHttpDownload& aHighlightDl );
108 * Cancel displaying the list of downloads.
109 * @since Series 60 2.8
112 IMPORT_C void CancelDisplayingDownloadsList();
115 * Is the List of Downloads visible?
116 * @since Series 60 2.8
117 * @return ETrue/EFalse
119 IMPORT_C TBool IsVisible() const;
122 * Number of downloads in the List of Downloads.
123 * @since Series 60 2.8
126 IMPORT_C TInt Count() const;
129 * Remove the given download from the list.
131 void DeleteDownloadL( RHttpDownload& aDownload );
134 * Is one of them progressive
135 * @since Series 60 3.2
138 TBool IsOneProgressive();
141 * Is one of them progressive
142 * @since Series 60 3.2
145 inline TBool IsProgressiveDownloadEnabled() {return iProgressiveDownload; }
148 * Gets the value of downloadlist hide
151 inline TBool GetDownloadHide() { return iDownloadListHide; }
152 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
154 * Adding Aiw Commands to the given MenuPane
156 void AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane);
159 public: // Functions from CDownloadMgrUiBase
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 );
170 protected: // Constructors
173 * C++ default constructor.
175 CDownloadMgrUiDownloadsList( CDownloadMgrUiLibRegistry& aRegistryModel );
178 * By default Symbian 2nd phase constructor is private.
182 protected: // New functions
184 // -------------------------------------------------------------
185 // ************** List box utilities
186 // -------------------------------------------------------------
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.
192 void AddDownloadsToListModelL( CDownloadsListArray& aLBModel,
193 RHttpDownloadMgr& aDownloadMgr );
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.
202 TInt AddDownloadToListModelL( CDownloadsListArray& aLBModel,
203 RHttpDownload& aDownload );
205 // -------------------------------------------------------------
206 // ************** Responses to download events
207 // -------------------------------------------------------------
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 );
216 // -------------------------------------------------------------
217 // ************** Other utility
218 // -------------------------------------------------------------
222 protected: // Functions from MHttpDownloadMgrObserver
224 virtual void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
226 protected: // Functions from MDownloadsListDlgObserver
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 );
234 protected: // Function from MAIWNotifyCallback
235 TInt HandleNotifyL( TInt /*aCmdId*/,
237 CAiwGenericParamList& /*aEventParamList*/,
238 const CAiwGenericParamList& /*aInParamList*/ ){return KErrNone;}
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);
249 void LaunchFileManagerApplication();
253 * Sets the value of downloadlist hide
256 void SetDownloadListHide( TBool aHide );
260 CDownloadsListExtension* iExtension; ///< Extension class. Owned.
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;
272 TBool iIsCancelInProgress;
273 TBool iPlatformSupportsGallery;
275 TBool iDownloadListHide;
276 private: // Friend classes
278 friend class CDownloadsListExtension;
281 #endif /* CDOWNLOADMGRUIDOWNLOADSLIST_H */