|
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: Dialog containing the Downloads List |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CDOWNLOADSLISTDLG_H |
|
21 #define CDOWNLOADSLISTDLG_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <eikmobs.h> |
|
26 #include <aknPopup.h> |
|
27 |
|
28 // DATA TYPES |
|
29 enum TDownloadsListDlgEvent |
|
30 { |
|
31 EDownloadAdded, |
|
32 EDownloadChanged, |
|
33 EDownloadRemoved |
|
34 }; |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CEikonEnv; |
|
38 class CEikFormattedCellListBox; |
|
39 class CEikMenuBar; |
|
40 class CDownloadsListArray; |
|
41 class MDownloadsListDlgObserver; |
|
42 class RHttpDownload; |
|
43 class CDownloadUtils; |
|
44 |
|
45 // CONSTANTS |
|
46 /// Refresh timer setting. If this is zero, no timer is used! (Micro is 10^(-6)) |
|
47 const TInt KRefreshIntervalMicroSeconds = 2000000; |
|
48 /** Refresh timer setting. Active object priority. Ensure that this is higher |
|
49 * than standard so that user will be notified. */ |
|
50 const TInt KRefreshTimerPriority = CActive::EPriorityStandard + 1; |
|
51 |
|
52 // CLASS DECLARATION |
|
53 |
|
54 /** |
|
55 * This is the 'view' containing the Downloads List with Options menu. |
|
56 * Use it like a dialog! |
|
57 * |
|
58 * @lib Download Manager UI Lib |
|
59 * @since Series 60 2.8 |
|
60 */ |
|
61 NONSHARABLE_CLASS( CDownloadsListDlg ) : public CAknPopupList, public MEikMenuObserver |
|
62 { |
|
63 public: // Constructors and destructor |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 */ |
|
68 static CDownloadsListDlg* NewL( MDownloadsListDlgObserver& aDlgObserver ); |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 */ |
|
73 static CDownloadsListDlg* NewL( MDownloadsListDlgObserver& aDlgObserver, TBool aProgressiveDownload ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 virtual ~CDownloadsListDlg(); |
|
79 |
|
80 public: // New functions |
|
81 |
|
82 /** |
|
83 * Set the model. |
|
84 */ |
|
85 void SetModelL( CDownloadsListArray& aModel ); |
|
86 |
|
87 /** |
|
88 * Notify the dialog that model has changed. |
|
89 */ |
|
90 void HandleModelChangeL( TDownloadsListDlgEvent aEvent, TInt aIndex ); |
|
91 |
|
92 /** |
|
93 * The index of the highlighted download. |
|
94 */ |
|
95 TInt CurrentItemIndex() const; |
|
96 |
|
97 /** |
|
98 * Display the Options menu. |
|
99 */ |
|
100 void DisplayMenuL(); |
|
101 |
|
102 /** |
|
103 * Hide the Options menu. |
|
104 */ |
|
105 void HideMenu(); |
|
106 |
|
107 /** |
|
108 * Is the Options menu opened? |
|
109 */ |
|
110 TBool MenuShowing() const; |
|
111 |
|
112 /** |
|
113 * Move the highlight to the given download. |
|
114 */ |
|
115 void HighlightDownload( RHttpDownload& aHighlightDl ); |
|
116 |
|
117 /** |
|
118 * Handle Middle Softkey Change |
|
119 */ |
|
120 void HandleMiddleSoftKeyChangeL(); |
|
121 |
|
122 public: // From CAknPopupList |
|
123 |
|
124 /** |
|
125 * Execute the list. It calls CAknPopupList::ExecuteLD(), which calls CActiveScheduler::Start()! |
|
126 * @return ETrue if the popup was accepted. EFalse if the popup was cancelled. |
|
127 */ |
|
128 TBool ExecuteLD(); |
|
129 |
|
130 public: // From MEikMenuObserver |
|
131 |
|
132 void ProcessCommandL( TInt aCommandId ); |
|
133 void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis ); |
|
134 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
135 |
|
136 public: // from MEikListBoxObserver |
|
137 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
138 |
|
139 |
|
140 public: // From CCoeControl |
|
141 |
|
142 void FocusChanged( TDrawNow aDrawNow ); |
|
143 |
|
144 /** |
|
145 * HandlePointerEventL |
|
146 * From CCoeControl |
|
147 * |
|
148 */ |
|
149 void HandlePointerEventL(const TPointerEvent& /*aPointerEvent*/); |
|
150 |
|
151 protected: // Constructors |
|
152 |
|
153 /** |
|
154 * C++ default constructor. |
|
155 */ |
|
156 CDownloadsListDlg( MDownloadsListDlgObserver& aDlgObserver ); |
|
157 |
|
158 /** |
|
159 * C++ default constructor. |
|
160 */ |
|
161 CDownloadsListDlg( MDownloadsListDlgObserver& aDlgObserver, TBool aProgressiveFlag ); |
|
162 |
|
163 /** |
|
164 * By default Symbian 2nd phase constructor is private. |
|
165 */ |
|
166 void ConstructL(); |
|
167 |
|
168 protected: // From CAknPopupList |
|
169 |
|
170 /** |
|
171 * Key event handling. |
|
172 */ |
|
173 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
174 |
|
175 private: // New functions |
|
176 |
|
177 /** |
|
178 * Number of visible, inprogress downlods. |
|
179 */ |
|
180 TInt VisibleInProgressDownloads() const; |
|
181 |
|
182 /** |
|
183 * Refreshes progress info for the given download at index. |
|
184 */ |
|
185 void RefreshProgressL( TInt aIndex ); |
|
186 |
|
187 /** |
|
188 * Refreshing timer static callback. |
|
189 */ |
|
190 static TInt RefreshTimerCallback( TAny* aPtr ); |
|
191 |
|
192 private: // Data |
|
193 |
|
194 CEikonEnv& iMyEikonEnv; |
|
195 CEikFormattedCellListBox* iListBox; ///< Owned. |
|
196 CEikMenuBar* iMenuBar; ///< Owned menu bar. |
|
197 MDownloadsListDlgObserver& iDlgObserver; |
|
198 CDownloadsListArray* iDownloadsListArray; ///< Not owned; |
|
199 RHttpDownload* iHighlightDownload; ///< Not owned. |
|
200 CPeriodic* iRefreshTimer; ///< Refreshes the list. Owned. |
|
201 CDownloadUtils* iDownloadUtils; ///< Owned. |
|
202 TBool iIsMSKChangeHandled; |
|
203 TBool iProgressiveDownload; |
|
204 }; |
|
205 |
|
206 #endif /* CDOWNLOADSLISTDLG_H */ |