|
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: Interface for service request |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSERVICEREQUEST_H |
|
21 #define CSERVICEREQUEST_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <e32base.h> |
|
26 #include <AknProgressDialog.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MServiceRequestObserver; |
|
30 class CAknWaitDialog; |
|
31 class RConeResourceLoader; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Interface for service request |
|
37 * |
|
38 * -Create instance by calling the static NewL method. User must implement the |
|
39 * observer interface MServiceRequestObserver. Cancelling the wait note is |
|
40 * informed through this API. |
|
41 * |
|
42 * iServiceRequest = CServiceRequest::NewL( *this ); |
|
43 * |
|
44 * |
|
45 * -The instance can be deleted at any time and all notes are dismissed. |
|
46 * |
|
47 * delete iServiceRequest; |
|
48 * |
|
49 * |
|
50 * -The wait note can be launched by calling StartL function: |
|
51 * |
|
52 * iServiceRequest->StartL(); |
|
53 * |
|
54 * By default the text "Requesting" is used, but the user may give the text |
|
55 * as a parameter: |
|
56 * |
|
57 * iServiceRequest->StartL( _L("Please wait...") ); |
|
58 * |
|
59 * Call to the StartL function will delete own notes visible at the call time. |
|
60 * |
|
61 * |
|
62 * -Wait note can deleteted by calling the ShowCompletionNoteL function. This removes |
|
63 * all own notes. If the user wants to show a completion note for the request, |
|
64 * the parameter aShowNote must be set to ETrue. Creation of a new note may leave. |
|
65 * By deafult the Supplementary Service UI specification texts and note types are |
|
66 * used. The user may override some parameters, like note type and text. By default, |
|
67 * the error code is converted into note, e.g.: |
|
68 * KErrNone, Global confirmation note "Done" |
|
69 * KErrCancel, Local information note "Request not confirmed" |
|
70 * KErrAccessDenied, Global information note "Not allowed" |
|
71 * and so on. |
|
72 * |
|
73 * |
|
74 * |
|
75 * @lib ServiceRequest.lib |
|
76 * @since 1.2 |
|
77 */ |
|
78 class CServiceRequest : public CActive, public MProgressDialogCallback |
|
79 { |
|
80 public: // Constructors and destructor |
|
81 |
|
82 // Used note types |
|
83 enum TSerqNoteType |
|
84 { |
|
85 ESerqDefault, |
|
86 ESerqLocalInformationNote, |
|
87 ESerqLocalConfirmationNote, |
|
88 ESerqGlobalInformationNote, |
|
89 ESerqGlobalErrorNote, |
|
90 ESerqGlobalConfirmationNote |
|
91 }; |
|
92 |
|
93 |
|
94 /** |
|
95 * Two-phased constructor. |
|
96 * @param aObserver Oberver to inform cancelling. |
|
97 * @return New CServiceRequest object. |
|
98 */ |
|
99 IMPORT_C static CServiceRequest* NewL( MServiceRequestObserver& aObserver ); |
|
100 |
|
101 /** |
|
102 * Destructor. |
|
103 */ |
|
104 IMPORT_C virtual ~CServiceRequest(); |
|
105 |
|
106 public: // New functions |
|
107 |
|
108 /** |
|
109 * Starts a wait note. |
|
110 * @since 1.2 |
|
111 * @param aText "Requesting" text is used, if this descriptor's |
|
112 * lenght is zero. |
|
113 */ |
|
114 IMPORT_C void StartL( const TDesC& aText = KNullDesC() ); |
|
115 |
|
116 /** |
|
117 * Removes wait note and shows new note if wanted. |
|
118 * If aShowNote = EFalse, this function won't leave! |
|
119 * Removal of the wait note is guaranteed in leave cases also. |
|
120 * @since 1.2 |
|
121 * @param aShowNote ETrue: a note is shown |
|
122 * EFalse: no additional note is shown |
|
123 * @param aError Used in default notes. The default note type and used |
|
124 * text is decided based on this value. These vales are |
|
125 * overridden if note type or used text is geven as a |
|
126 * parameter. |
|
127 * @param aNoteType Type of the note. If EDefault is used, then the |
|
128 * aError parameter is checked. |
|
129 * @param aText Given text. If lenght is zero, aError parameter is checked. |
|
130 */ |
|
131 IMPORT_C void ShowCompletionNoteL( |
|
132 TBool aShowNote = ETrue, |
|
133 TInt aError = KErrNone, |
|
134 TSerqNoteType aNoteType = ESerqDefault, |
|
135 const TDesC& aText = KNullDesC() ); |
|
136 |
|
137 protected: // From baseclasses |
|
138 |
|
139 // From MProgressDialogCallback |
|
140 void DialogDismissedL( TInt aButtonId ); |
|
141 |
|
142 // From CActive |
|
143 void RunL(); |
|
144 |
|
145 // From CActive |
|
146 void DoCancel(); |
|
147 |
|
148 /** |
|
149 * From CActive |
|
150 * @param aError |
|
151 * @return TInt |
|
152 */ |
|
153 TInt RunError(TInt aError); |
|
154 |
|
155 private: |
|
156 |
|
157 /** |
|
158 * C++ default constructor. |
|
159 */ |
|
160 CServiceRequest( MServiceRequestObserver& aObserver ); |
|
161 |
|
162 /** |
|
163 * By default Symbian 2nd phase constructor is private. |
|
164 */ |
|
165 void ConstructL(); |
|
166 |
|
167 /** |
|
168 * Zeroes data members |
|
169 */ |
|
170 void Reset(); |
|
171 |
|
172 /** |
|
173 * Gets default note implementation for give error value. |
|
174 */ |
|
175 static void GetDefaultNote( |
|
176 const TInt aError , |
|
177 TSerqNoteType& aNoteType , |
|
178 TInt& aResourceId ); |
|
179 |
|
180 /** |
|
181 * Launches given note. Text is fetched from iNoteText. |
|
182 */ |
|
183 void LaunchNoteL( const TSerqNoteType aNoteType); |
|
184 |
|
185 private: // Data |
|
186 // Service request observer |
|
187 MServiceRequestObserver& iObserver; |
|
188 |
|
189 // Requesting wait note: |
|
190 CAknWaitDialog* iRequestingNote; |
|
191 |
|
192 // Resource loader |
|
193 RConeResourceLoader* iResourceLoader; |
|
194 |
|
195 // Text for note |
|
196 HBufC* iNoteText; |
|
197 |
|
198 // Enables instance deletion in call back. |
|
199 TBool* iDestroyed; |
|
200 |
|
201 // Reserved pointer for future extension |
|
202 TAny* iReserved; |
|
203 }; |
|
204 |
|
205 #endif // CSERVICEREQUEST_H |
|
206 |
|
207 // End of File |