|
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 "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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef COBEXUTILSDIALOG_H |
|
20 #define COBEXUTILSDIALOG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <AknWaitDialog.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CAknWaitDialog; |
|
28 class CObexUtilsDialogTimer; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * An observer interface for asking progress status of an operation using |
|
34 * a progress dialog. |
|
35 */ |
|
36 NONSHARABLE_CLASS( MObexUtilsProgressObserver ) |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Returns the progress status of the operation. |
|
42 * @since 2.6 |
|
43 * @return A progress value relative to final value. |
|
44 */ |
|
45 virtual TInt GetProgressStatus() = 0; |
|
46 }; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * An observer interface for informing about dialog events. |
|
52 */ |
|
53 NONSHARABLE_CLASS( MObexUtilsDialogObserver ) |
|
54 { |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Informs the observer that a dialog has been dismissed. |
|
59 * @since 2.6 |
|
60 * @param aButtonId The button that was used to dismiss the dialog. |
|
61 * @return None. |
|
62 */ |
|
63 virtual void DialogDismissed( TInt aButtonId ) = 0; |
|
64 }; |
|
65 |
|
66 |
|
67 // CLASS DECLARATION |
|
68 |
|
69 /** |
|
70 * A class for launching and managing dialogs. |
|
71 */ |
|
72 NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, public MProgressDialogCallback |
|
73 { |
|
74 public:// Constructors and destructor |
|
75 |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 */ |
|
79 IMPORT_C static CObexUtilsDialog* NewL( |
|
80 MObexUtilsDialogObserver* aObserverPtr ); |
|
81 |
|
82 IMPORT_C static CObexUtilsDialog* NewLC( |
|
83 MObexUtilsDialogObserver* aObserverPtr ); |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 */ |
|
88 virtual ~CObexUtilsDialog(); |
|
89 |
|
90 public: // New functions |
|
91 |
|
92 /** |
|
93 * Launches a progress dialog. |
|
94 * @since 2.6 |
|
95 * @param aObserverPtr A pointer to progress observer. A NULL pointer if |
|
96 the progress dialog is updated manually. |
|
97 * @param aFinalValue The final value of the operation (progress=100%). |
|
98 * @param aResId A resource id for the string to be shown in the dialog. |
|
99 * @param aTimeoutValue A value telling how often should the dialog be |
|
100 updated. Relevant only if observer given. |
|
101 * @return None. |
|
102 */ |
|
103 IMPORT_C void LaunchProgressDialogL( |
|
104 MObexUtilsProgressObserver* aObserverPtr, TInt aFinalValue, |
|
105 TInt aResId, TInt aTimeoutValue ); |
|
106 |
|
107 /** |
|
108 * Launches a wait dialog. |
|
109 * @since 2.6 |
|
110 * @param aResId A resource id for the string to be shown in the dialog. |
|
111 * @return None. |
|
112 */ |
|
113 IMPORT_C void LaunchWaitDialogL( TInt aResId ); |
|
114 |
|
115 /** |
|
116 * Cancels a wait dialog if one exists. |
|
117 * @since 2.6 |
|
118 * @return None. |
|
119 */ |
|
120 IMPORT_C void CancelWaitDialogL(); |
|
121 |
|
122 /** |
|
123 * Cancels a wait progress dialog if one exists. |
|
124 * @since 2.6 |
|
125 * @return None. |
|
126 */ |
|
127 IMPORT_C void CancelProgressDialogL(); |
|
128 |
|
129 /** |
|
130 * Updates a progress dialog. Should not be used if the |
|
131 * MObexUtilsDialogObserver pointer was given. |
|
132 * @since 2.6 |
|
133 * @param aValue A progress value relative to final value. |
|
134 * @param aResId A resource id for the string to be shown in the dialog. |
|
135 * @return None |
|
136 */ |
|
137 IMPORT_C void UpdateProgressDialogL( TInt aValue, TInt aResId ); |
|
138 |
|
139 /** |
|
140 * Show a query note |
|
141 * @param aResourceID A resource id for the note. |
|
142 * @return User's input - Yes/No |
|
143 */ |
|
144 IMPORT_C TInt LaunchQueryDialogL( const TInt& aResourceID ); |
|
145 |
|
146 /** |
|
147 * Show how many files are sent in case not all images are supported |
|
148 * @param aSentNum Number of sent files |
|
149 * @param aTotlNum Number of total files |
|
150 * return None. |
|
151 */ |
|
152 |
|
153 IMPORT_C void ShowNumberOfSendFileL( TInt aSentNum, TInt aTotalNum ); |
|
154 |
|
155 /** |
|
156 * Prepares dialog for execution |
|
157 * @param aResourceID Resource ID of the dialog |
|
158 * @param aDialog Dialog |
|
159 */ |
|
160 void PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ); |
|
161 |
|
162 /** |
|
163 * Check if cover display is enabled |
|
164 * return True if enabled |
|
165 */ |
|
166 TBool IsCoverDisplayL(); |
|
167 |
|
168 public: // New functions (not exported) |
|
169 |
|
170 /** |
|
171 * Updates the progress dialog. |
|
172 * @return None. |
|
173 */ |
|
174 void UpdateProgressDialog(); |
|
175 |
|
176 private: // Functions from base classes |
|
177 |
|
178 /** |
|
179 * From MProgressDialogCallback A dialog has been dismissed. |
|
180 * @param aButtonId The button that was used to dismiss the dialog. |
|
181 * @return None. |
|
182 */ |
|
183 void DialogDismissedL( TInt aButtonId ); |
|
184 |
|
185 private: |
|
186 TInt ExecuteDialogL( const TInt& aResourceID, CEikDialog* aDialog ); |
|
187 |
|
188 private: |
|
189 |
|
190 /** |
|
191 * C++ default constructor. |
|
192 */ |
|
193 CObexUtilsDialog( MObexUtilsDialogObserver* aObserverPtr ); |
|
194 |
|
195 /** |
|
196 * By default Symbian OS constructor is private. |
|
197 */ |
|
198 void ConstructL(); |
|
199 |
|
200 private: // Data |
|
201 |
|
202 CAknProgressDialog* iProgressDialog; |
|
203 CAknWaitDialog* iWaitDialog; |
|
204 CObexUtilsDialogTimer* iObexDialogTimer; |
|
205 TInt iResourceFileId; |
|
206 TInt iProgressDialogResId; |
|
207 TBool iCoverDisplayEnabled; |
|
208 |
|
209 // Not Owned |
|
210 // |
|
211 MObexUtilsProgressObserver* iProgressObserverPtr; |
|
212 MObexUtilsDialogObserver* iDialogObserverPtr; |
|
213 }; |
|
214 |
|
215 #endif // COBEXUTILSDIALOG_H |
|
216 |
|
217 // End of File |