|
1 /* |
|
2 * Copyright (c) 2002 - 2007 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: Test notifiers_api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* |
|
20 * [INCLUDE FILES] |
|
21 */ |
|
22 #include <aknglobalconfirmationquery.h> |
|
23 #include <akngloballistquery.h> |
|
24 #include <aknglobalmsgquery.h> |
|
25 #include <aknglobalnote.h> |
|
26 #include <aknglobalprogressdialog.h> |
|
27 #include <avkon.mbg> |
|
28 #include <akngloballistmsgquery.h> |
|
29 #include <bamdesca.h> |
|
30 #include <badesca.h> |
|
31 #include <aknsddata.h> |
|
32 |
|
33 #include "testsdknotifiers.hrh" |
|
34 #include "activeexample.h" |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CActiveExample::ShowAndCancelConfirmationQueryLL |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 void CActiveExample::ShowAndCancelConfirmationQueryLL( const TDesC& aPrompt ) |
|
41 { |
|
42 CActiveExample* self = new( ELeave ) CActiveExample(); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 self->ShowAndCancelConfirmationQueryL( aPrompt ); |
|
46 CleanupStack::PopAndDestroy( self ); |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CActiveExample::ShowAndCancelConfirmationQueryL |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 void CActiveExample::ShowAndCancelConfirmationQueryL( const TDesC& aPrompt ) |
|
54 { |
|
55 iConfirmationquery->ShowConfirmationQueryL( iStatus, aPrompt ); |
|
56 iConfirmationquery->CancelConfirmationQuery(); |
|
57 SetActive(); |
|
58 CActiveScheduler::Start(); |
|
59 |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CActiveExample::ShowAndCancelListQueryLL |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CActiveExample::ShowAndCancelListQueryLL( const MDesCArray* aItems ) |
|
67 { |
|
68 CActiveExample* self = new( ELeave ) CActiveExample(); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 self->ShowAndCancelListQueryL( aItems ); |
|
72 CleanupStack::PopAndDestroy( self ); |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CActiveExample::ShowAndCancelListQueryL |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CActiveExample::ShowAndCancelListQueryL( const MDesCArray* aItems ) |
|
80 { |
|
81 iListQuery->ShowListQueryL( aItems, iStatus, KOne ); |
|
82 iListQuery->CancelListQuery(); |
|
83 SetActive(); |
|
84 CActiveScheduler::Start(); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CActiveExample::ShowMsgQueryLL |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CActiveExample::ShowMsgQueryLL( const TDesC& aMsgText, |
|
92 TInt aSoftkeys, |
|
93 const TDesC& aHeaderText, |
|
94 const TDesC& aHeaderImageFile, |
|
95 TInt aImageId, |
|
96 TInt aImageMaskId ) |
|
97 { |
|
98 CActiveExample* self = new(ELeave) CActiveExample(); |
|
99 CleanupStack::PushL( self ); |
|
100 self->ConstructL(); |
|
101 self->ShowMsgQueryL( aMsgText, aSoftkeys, aHeaderText, aHeaderImageFile, |
|
102 aImageId, aImageMaskId ); |
|
103 CleanupStack::PopAndDestroy( self ); |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CActiveExample::ShowMsgQueryL |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CActiveExample::ShowMsgQueryL( const TDesC& aMsgText, |
|
111 TInt aSoftkeys, |
|
112 const TDesC& aHeaderText, |
|
113 const TDesC& aHeaderImageFile, |
|
114 TInt aImageId, |
|
115 TInt aImageMaskId ) |
|
116 { |
|
117 iMsgQuery->ShowMsgQueryL( iStatus, aMsgText, aSoftkeys, aHeaderText, |
|
118 aHeaderImageFile, aImageId, aImageMaskId ); |
|
119 iMsgQuery->CancelMsgQuery(); |
|
120 SetActive(); |
|
121 CActiveScheduler::Start(); |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CActiveExample::ShowNoteLL |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 void CActiveExample::ShowNoteLL( TAknGlobalNoteType aType, const TDesC& aNoteText ) |
|
129 { |
|
130 CActiveExample* self = new( ELeave ) CActiveExample(); |
|
131 CleanupStack::PushL( self ); |
|
132 self->ConstructL(); |
|
133 self->ShowNoteL( aType, aNoteText ); |
|
134 CleanupStack::PopAndDestroy( self ); |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CActiveExample::ShowNoteL |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 void CActiveExample::ShowNoteL( TAknGlobalNoteType aType, const TDesC& aNoteText ) |
|
142 { |
|
143 iNote->ShowNoteL( iStatus, aType, aNoteText ); |
|
144 SetActive(); |
|
145 CActiveScheduler::Start(); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CActiveExample::ShowAndCancelProgressDialogLL |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 void CActiveExample::ShowAndCancelProgressDialogLL( const TDesC& aPrompt ) |
|
153 { |
|
154 CActiveExample* self = new(ELeave) CActiveExample(); |
|
155 CleanupStack::PushL( self ); |
|
156 self->ConstructL(); |
|
157 self->ShwoAndCancelProgressDialogL( aPrompt ); |
|
158 CleanupStack::PopAndDestroy( self ); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CActiveExample::ShwoAndCancelProgressDialogL |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CActiveExample::ShwoAndCancelProgressDialogL( const TDesC& aPrompt ) |
|
166 { |
|
167 iProgressDialog->ShowProgressDialogL( iStatus, aPrompt ); |
|
168 iProgressDialog->CancelProgressDialog(); |
|
169 SetActive(); |
|
170 CActiveScheduler::Start(); |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CActiveExample::ShowTheListMsgQueryL |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 void CActiveExample::ShowTheListMsgQueryL() |
|
178 { |
|
179 |
|
180 _LIT( KHead, "Message" ); |
|
181 _LIT( KText, "Item" ); |
|
182 |
|
183 TBufC<20> tempString( KText ); |
|
184 CDesCArrayFlat* arrayItem = new( ELeave ) CDesCArrayFlat( 20 ); |
|
185 arrayItem->AppendL( tempString ); |
|
186 iGlobalListMsgQuery->ShowListMsgQueryL( arrayItem, iStatus, KHead, KText ); |
|
187 SetActive(); |
|
188 |
|
189 CActiveScheduler::Start(); |
|
190 |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CActiveExample::DoCancel |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void CActiveExample::DoCancel() |
|
198 { |
|
199 Cancel(); |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CActiveExample::RunL |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 void CActiveExample::RunL() |
|
207 { |
|
208 CActiveScheduler::Stop(); |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CActiveExample::CActiveExample |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 CActiveExample::CActiveExample() : CActive(CActive::EPriorityStandard) |
|
216 { |
|
217 CActiveScheduler::Add( this ); |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CActiveExample::ConstructL |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 void CActiveExample::ConstructL() |
|
225 { |
|
226 iConfirmationquery = CAknGlobalConfirmationQuery::NewL(); |
|
227 iListQuery = CAknGlobalListQuery::NewL(); |
|
228 iMsgQuery = CAknGlobalMsgQuery::NewL(); |
|
229 iNote = CAknGlobalNote::NewL(); |
|
230 iProgressDialog = CAknGlobalProgressDialog::NewL(); |
|
231 iGlobalListMsgQuery = CAknGlobalListMsgQuery::NewL(); |
|
232 |
|
233 TFileName file( KMbmFile ); |
|
234 User::LeaveIfError( CompleteWithAppPath( file ) ); |
|
235 |
|
236 TBuf<KBufSize> buf( KTestString ); |
|
237 iProgressDialog->SetIconL( buf, file, EMbmAvkonQgn_indi_mic, |
|
238 EMbmAvkonQgn_indi_mic_mask ); |
|
239 iProgressDialog->SetImageL( file, EMbmAvkonQgn_indi_mic, |
|
240 EMbmAvkonQgn_indi_mic_mask ); |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CActiveExample::~CActiveExample |
|
245 // ----------------------------------------------------------------------------- |
|
246 // |
|
247 CActiveExample::~CActiveExample() |
|
248 { |
|
249 Cancel(); |
|
250 delete iConfirmationquery; |
|
251 delete iListQuery; |
|
252 delete iMsgQuery; |
|
253 delete iNote; |
|
254 delete iProgressDialog; |
|
255 delete iGlobalListMsgQuery; |
|
256 } |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CActiveExample::NewL() |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 CActiveExample* CActiveExample::NewL() |
|
263 { |
|
264 CActiveExample* self=CActiveExample::NewLC(); |
|
265 CleanupStack::Pop( self ); // self; |
|
266 return self; |
|
267 } |
|
268 |
|
269 // ----------------------------------------------------------------------------- |
|
270 // CActiveExample::NewLC |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 CActiveExample* CActiveExample::NewLC() |
|
274 { |
|
275 CActiveExample* self = new (ELeave)CActiveExample(); |
|
276 CleanupStack::PushL( self ); |
|
277 self->ConstructL(); |
|
278 return self; |
|
279 } |
|
280 |
|
281 //End file |