|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * This class creates a progress dialog, which shows the progress of an upload |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef BROWSERUPLOADPROGRESSNOTE_H |
|
22 #define BROWSERUPLOADPROGRESSNOTE_H |
|
23 |
|
24 #include <eikprogi.h> |
|
25 #include <AknProgressDialog.h> |
|
26 |
|
27 class CEikDialog; |
|
28 class CEikProgressInfo; |
|
29 class MBrowserDialogsProviderObserver; |
|
30 |
|
31 class CBrowserUploadProgressNote : public CAknProgressDialog, |
|
32 public MProgressDialogCallback |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Constructor |
|
37 * @param aMaxValue The maximal value of the progress. |
|
38 * @param aObserver Observers of the dialog |
|
39 * @param aSelfPtr self pointer |
|
40 */ |
|
41 CBrowserUploadProgressNote( TInt aMaxValue, |
|
42 MBrowserDialogsProviderObserver* aObserver, |
|
43 CEikDialog** aSelfPtr ); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CBrowserUploadProgressNote(); |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. Leaves on failure. |
|
52 * @param aMaxValue The maximal value of the progress. |
|
53 * @param aObserver Observers of the dialog |
|
54 * @param aSelfPtr self pointer |
|
55 * @return The constructed progress note. |
|
56 */ |
|
57 static CBrowserUploadProgressNote* NewL( TInt aMaxValue, |
|
58 MBrowserDialogsProviderObserver* aObserver, |
|
59 CEikDialog** aSelfPtr ); |
|
60 |
|
61 /** |
|
62 * Two-phased constructor. Leaves on failure. |
|
63 * Places the instance on the cleanup stack. |
|
64 * @param aMaxValue The maximal value of the progress. |
|
65 * @param aObserver Observers of the dialog |
|
66 * @param aSelfPtr self pointer |
|
67 * @return The constructed progress note. |
|
68 */ |
|
69 static CBrowserUploadProgressNote* NewLC( TInt aMaxValue, |
|
70 MBrowserDialogsProviderObserver* aObserver, |
|
71 CEikDialog** aSelfPtr ); |
|
72 |
|
73 /** |
|
74 * Updates the progress bar by a given value. |
|
75 * @param aChunkSize The size of chunk of data uploaded this time. |
|
76 */ |
|
77 void UpdateL( TInt aChunkSize ); |
|
78 |
|
79 public: // from MProgressDialogCallback |
|
80 |
|
81 /** |
|
82 * Callback which is called when a dialog has beed dismissed |
|
83 * Requires registration with SetCallback( MProgressDialogCallback* ) |
|
84 * |
|
85 */ |
|
86 void DialogDismissedL( TInt aButtonId ); |
|
87 |
|
88 private: |
|
89 /** |
|
90 * Two-phased constructor. Leaves on failure. |
|
91 */ |
|
92 void ConstructL( ); |
|
93 |
|
94 /** |
|
95 * Divides the given parameters, and returns the result |
|
96 * as a formatted string. |
|
97 * @param aNumerator The numerator of the division. |
|
98 * @param aDenominator The denominator of the division. |
|
99 * @return A pointer to the created descriptor on the heap. |
|
100 * |
|
101 * The calling program must destroy the heap descriptor when it is no |
|
102 * longer needed. |
|
103 */ |
|
104 HBufC* DivisionL( TInt aNumerator, TInt aDenominator ); |
|
105 |
|
106 |
|
107 private: |
|
108 /** |
|
109 * The sum of sizes for all uploaded fields (to be uploaded). |
|
110 */ |
|
111 TInt iMaxValue; |
|
112 |
|
113 /** |
|
114 * The currently uploaded size of data. |
|
115 */ |
|
116 TInt iUploaded; |
|
117 |
|
118 /** |
|
119 * Handle of the progress note. |
|
120 */ |
|
121 //CAknProgressDialog* iProgressDlg; |
|
122 |
|
123 /** |
|
124 * Handle to the progress bar of the progress note. |
|
125 */ |
|
126 CEikProgressInfo* iProgressInfo; |
|
127 |
|
128 /** |
|
129 * Handle to the "Uploaded:\n %U / %U " decriptor in resource. |
|
130 */ |
|
131 HBufC* iStrUploaded; |
|
132 |
|
133 /** |
|
134 * Handle to the "kB" / "MB" decriptor in resource. |
|
135 */ |
|
136 HBufC* iStrUnit; |
|
137 |
|
138 /** |
|
139 * Dialog Observer Pointer |
|
140 */ |
|
141 MBrowserDialogsProviderObserver* iObserver; |
|
142 }; |
|
143 |
|
144 #endif |