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
20 #ifndef CDOWNLOADMGRUIDOWNLOADSLIST_H
21 #define CDOWNLOADMGRUIDOWNLOADSLIST_H
24 #include <CDownloadMgrUiBase.h>
25 #include <DownloadMgrClient.h>
26 #include <HttpDownloadMgrCommon.h>
27 #include <DownloadsListDlgObserver.h>
29 #include <AiwServiceHandler.h>
30 #include <AiwCommon.hrh>
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;
46 * Display list of downloads.
48 * @lib Download Manager UI Lib
49 * @since Series 60 2.8
51 NONSHARABLE_CLASS( CDownloadMgrUiDownloadsList ) :
52 public CDownloadMgrUiBase,
53 public MHttpDownloadMgrObserver,
54 public MDownloadsListDlgObserver,
55 public MAiwNotifyCallback
57 public: // Constructors and destructor
60 * Two-phased constructor.
62 static CDownloadMgrUiDownloadsList* NewL
63 ( CDownloadMgrUiLibRegistry& aRegistryModel );
68 virtual ~CDownloadMgrUiDownloadsList();
70 public: // New functions
72 // -------------------------------------------------------------
73 // ************** Download Menu
74 // -------------------------------------------------------------
77 * Access the Download Menu utility.
78 * @since Series 60 2.8
81 IMPORT_C CDownloadMgrUiDownloadMenu& DownloadMenu() const;
83 // -------------------------------------------------------------
84 // ************** Downloads List
85 // -------------------------------------------------------------
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
95 IMPORT_C void DisplayDownloadsListL();
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
107 void DisplayDownloadsListL( RHttpDownload& aHighlightDl );
110 * Cancel displaying the list of downloads.
111 * @since Series 60 2.8
114 IMPORT_C void CancelDisplayingDownloadsList();
117 * Is the List of Downloads visible?
118 * @since Series 60 2.8
119 * @return ETrue/EFalse
121 IMPORT_C TBool IsVisible() const;
124 * Number of downloads in the List of Downloads.
125 * @since Series 60 2.8
128 IMPORT_C TInt Count() const;
131 * Remove the given download from the list.
133 void DeleteDownloadL( RHttpDownload& aDownload );
136 * Is one of them progressive
137 * @since Series 60 3.2
140 TBool IsOneProgressive();
143 * Is one of them progressive
144 * @since Series 60 3.2
147 inline TBool IsProgressiveDownloadEnabled() {return iProgressiveDownload; }
150 public: // Functions from CDownloadMgrUiBase
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 );
161 protected: // Constructors
164 * C++ default constructor.
166 CDownloadMgrUiDownloadsList( CDownloadMgrUiLibRegistry& aRegistryModel );
169 * By default Symbian 2nd phase constructor is private.
173 protected: // New functions
175 // -------------------------------------------------------------
176 // ************** List box utilities
177 // -------------------------------------------------------------
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.
183 void AddDownloadsToListModelL( CDownloadsListArray& aLBModel,
184 RHttpDownloadMgr& aDownloadMgr );
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.
193 TInt AddDownloadToListModelL( CDownloadsListArray& aLBModel,
194 RHttpDownload& aDownload );
196 // -------------------------------------------------------------
197 // ************** Responses to download events
198 // -------------------------------------------------------------
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 );
207 // -------------------------------------------------------------
208 // ************** Other utility
209 // -------------------------------------------------------------
213 protected: // Functions from MHttpDownloadMgrObserver
215 virtual void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
217 protected: // Functions from MDownloadsListDlgObserver
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 );
225 protected: // Function from MAIWNotifyCallback
226 TInt HandleNotifyL( TInt /*aCmdId*/,
228 CAiwGenericParamList& /*aEventParamList*/,
229 const CAiwGenericParamList& /*aInParamList*/ ){return KErrNone;}
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);
240 void LaunchFileManagerApplication();
244 CDownloadsListExtension* iExtension; ///< Extension class. Owned.
246 CUserInteractionsUtils* iUiUtils; ///< Utility. Owned.
247 CDownloadMgrUiDownloadMenu* iDownloadMenu; ///< Download Menu utility. Owned.
248 CAsyncEventHandlerArray* iEventHandlerArray; ///< Owned.
249 CDownloadsListArray* iListModel; ///< Association array: list item-download. Owned.
250 CDownloadsListDlg* iDialog; ///< Owned. Unused member.
251 TBool iIsVisible; ///< Unused member.
252 TBool iIsTimerStarted;
253 CAiwServiceHandler* iAIWServiceHandler;
254 TBool iProgressiveDownload;
256 TBool iIsCancelInProgress;
257 TBool iPlatformSupportsGallery;
259 private: // Friend classes
261 friend class CDownloadsListExtension;
264 #endif /* CDOWNLOADMGRUIDOWNLOADSLIST_H */