|
1 /* |
|
2 * Copyright (c) 2006 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: Encapuslates the Wait dialog in an Active Object interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef EVTMGMTUIWAITDLGLAUNCHER_H |
|
20 #define EVTMGMTUIWAITDLGLAUNCHER_H |
|
21 |
|
22 // System Includes |
|
23 #include <AknWaitDialog.h> |
|
24 #include <AknProgressDialog.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 // Class Declaration |
|
28 /** |
|
29 * MLmkDlgMenuObserver class |
|
30 */ |
|
31 class MEvtMgmtUiWaitDialogLauncherObserver |
|
32 { |
|
33 public: // New functions |
|
34 virtual void HandleDialogDismissed( TInt aButtonId ) = 0; |
|
35 }; |
|
36 /** |
|
37 * Class used to encapsulate the AknWaitDialog in an Active object interface. |
|
38 * Provides the functionality to launch the Wait dialog in an asynchronous mode |
|
39 * so that the current running context is not blocked. |
|
40 */ |
|
41 NONSHARABLE_CLASS ( CEvtMgmtUiWaitDialogLauncher ) : public CActive, |
|
42 public MProgressDialogCallback |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Two phased constructor for creating the Wait dialog launcher. |
|
47 * |
|
48 * @return CEvtMgmtUiWaitDialogLauncher* Pointer to the created object. |
|
49 */ |
|
50 static CEvtMgmtUiWaitDialogLauncher* NewL(); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 ~CEvtMgmtUiWaitDialogLauncher(); |
|
56 |
|
57 /** |
|
58 * Issues an asynchronous request to start the Wait dialog. The termination |
|
59 * of the dialog either when User terminated or when terminated using the |
|
60 * StopWaitingDialog call will be notified using the MProgressDialogCallback |
|
61 * observer object. |
|
62 */ |
|
63 void StartWaitDialogL(); |
|
64 |
|
65 /** |
|
66 * Issues an asynchronous request to the stop the running Wait dialog. The |
|
67 * actual dismissal of the dialog will be communicated using the |
|
68 * MProgressDialogCallback observer object. |
|
69 * |
|
70 * @return TInt The Button ID with which the dialog was dismissed |
|
71 */ |
|
72 TInt StopWaitDialogL(); |
|
73 |
|
74 /** |
|
75 * Issues an synchronous request to start the Wait dialog. The termination |
|
76 * of the dialog either when User terminated or when terminated using the |
|
77 * StopWaitingDialog call will be notified using the MProgressDialogCallback |
|
78 * observer object. |
|
79 */ |
|
80 void StartWaitDialogSyncL(); |
|
81 |
|
82 /** |
|
83 * Issues an synchronous request to the stop the running Wait dialog. The |
|
84 * actual dismissal of the dialog will be communicated using the |
|
85 * MProgressDialogCallback observer object. |
|
86 * |
|
87 * @return TInt The Button ID with which the dialog was dismissed |
|
88 */ |
|
89 TInt StopWaitDialogSyncL(); |
|
90 |
|
91 /** |
|
92 * Sets an observer, so that, client can be notified about the |
|
93 * button id, after the dialog dismissal. |
|
94 */ |
|
95 void SetObserver( MEvtMgmtUiWaitDialogLauncherObserver* aObserver ); |
|
96 |
|
97 /* |
|
98 * Allow user to cancel busy dialog |
|
99 * @param[in] aIsCancelAvailable - True if user is allowed to cancel else false |
|
100 */ |
|
101 void AllowUserToCancel( TBool aIsCancelAvailable ); |
|
102 |
|
103 /* |
|
104 * It will set text to be displayed on wait dialog. |
|
105 * |
|
106 * @since Symbian v9.1 |
|
107 * |
|
108 * @param[in] aText - text to be displayed on wait dialog. |
|
109 */ |
|
110 void SetTextL(const TDesC& aText); |
|
111 |
|
112 /* |
|
113 * It will set text to be displayed on wait dialog. |
|
114 * |
|
115 * @since Symbian v9.1 |
|
116 * |
|
117 * @param[in] aResourceId - resource id of the text to be displayed |
|
118 * on wait dialog. |
|
119 */ |
|
120 void SetTextL( const TInt aResourceId ); |
|
121 |
|
122 private: |
|
123 /** |
|
124 * Inherited from MProgressDialogCallback. The scope of the function is |
|
125 * made private since, this should be called only from the |
|
126 * MProgressDialogCallback interface and from the Wait dialog alone. |
|
127 */ |
|
128 void DialogDismissedL( TInt aButtonId ); |
|
129 |
|
130 private: |
|
131 /** |
|
132 * Overloaded C++ constructor |
|
133 */ |
|
134 CEvtMgmtUiWaitDialogLauncher(); |
|
135 |
|
136 /** |
|
137 * Second phase constructor |
|
138 */ |
|
139 void ConstructL(); |
|
140 |
|
141 protected: |
|
142 /** |
|
143 * Inherited from CActive |
|
144 */ |
|
145 void RunL(); |
|
146 |
|
147 /** |
|
148 * Inherited from CActive |
|
149 */ |
|
150 void DoCancel(); |
|
151 |
|
152 private: |
|
153 |
|
154 /** |
|
155 * Button ID with which the dialog was cancelled |
|
156 */ |
|
157 TInt iButtonId; |
|
158 |
|
159 /** |
|
160 * Wait Note |
|
161 * Owns |
|
162 */ |
|
163 CAknWaitDialog* iWaitNote; |
|
164 |
|
165 /** |
|
166 * Active Scheduler re-loop to make Stop synchronous |
|
167 */ |
|
168 CActiveSchedulerWait* iSchedWait; |
|
169 /** |
|
170 * ref |
|
171 * Observer for callback, when the dialog is dissmissed. |
|
172 */ |
|
173 MEvtMgmtUiWaitDialogLauncherObserver* iObserver; |
|
174 |
|
175 /* |
|
176 * It determines weather user is allowed to cancel dialog. |
|
177 */ |
|
178 TBool iIsCancelAvailable; |
|
179 |
|
180 /* |
|
181 * Owns |
|
182 * text to be displayed on wait dialog. |
|
183 */ |
|
184 HBufC* iWaitText; |
|
185 }; |
|
186 |
|
187 #endif // EVTMGMTUIWAITDLGLAUNCHER_H |
|
188 |
|
189 // End of File |