|
1 /* |
|
2 * Copyright (c) 2002-2009 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 * Implements the application UI and the methods derived from |
|
16 * MSatUiActionImplementer i.e. showing messages and asking input. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <barsread.h> |
|
24 #include <badesca.h> // for descriptor arrays |
|
25 #include <e32std.h> |
|
26 #include <eikenv.h> |
|
27 #include <eikapp.h> |
|
28 #include <StringLoader.h> |
|
29 #include <aknview.h> |
|
30 #include <aknnotedialog.h> |
|
31 #include <aknstaticnotedialog.h> |
|
32 #include <AknGlobalNote.h> |
|
33 #include <AknQueryDialog.h> |
|
34 #include <aknmessagequerydialog.h> |
|
35 #include <AudioPreference.h> |
|
36 #include <mdaaudiotoneplayer.h> |
|
37 #include <activitymanager.h> |
|
38 #include <AknIconArray.h> |
|
39 #include <AknPopupform.h> //DisplayText icon popupform |
|
40 #include <eikcapc.h> //CEikCaptionedControl |
|
41 #include <txtrich.h> //CRichText |
|
42 #include <eikrted.h> //CEikRichTextEditor |
|
43 #include <hlplch.h> |
|
44 #include <aknsoundsystem.h> |
|
45 #include <AknWaitDialog.h> |
|
46 #include <akntitle.h> |
|
47 #include <AknUtils.h> |
|
48 #include <AknIconUtils.h> |
|
49 #include <aknconsts.h> |
|
50 #include <avkon.hrh> |
|
51 #include <SatUi.rsg> |
|
52 #include <msatuiadapter.h> |
|
53 #include <aknkeylock.h> |
|
54 |
|
55 #include "satui.hrh" |
|
56 #include "CSatUiApplication.h" |
|
57 #include "CSatUiViewAppUi.h" |
|
58 #include "CSatUiView.h" |
|
59 #include "CSatUiTextQueryDialog.h" |
|
60 #include "CSatUiMessageQueryIcon.h" |
|
61 #include "CSatUiWaitDialog.h" |
|
62 #include "tflogger.h" |
|
63 |
|
64 #include <MProfile.h> |
|
65 #include <MProfileEngine.h> |
|
66 #include <MProfileTones.h> |
|
67 #include <TProfileToneSettings.h> |
|
68 #include <MProfileName.h> |
|
69 #include <MProfileExtraTones.h> |
|
70 #include <featmgr.h> // Used for FeatureManager |
|
71 #include <BTSapDomainPSKeys.h> // For BT SAP connection state keys. |
|
72 #include <e32property.h> // Used for RProperty |
|
73 #include <aknnotewrappers.h> |
|
74 |
|
75 #include <aknlayout.cdl.h> |
|
76 #include <aknlayoutscalable_avkon.cdl.h> |
|
77 #include <ctsydomainpskeys.h> |
|
78 #include <mda/common/resource.h> |
|
79 |
|
80 #include <ProfileEngineSDKCRKeys.h> |
|
81 #include <centralrepository.h> |
|
82 |
|
83 |
|
84 // CONSTANTS |
|
85 const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine |
|
86 const TInt K32TIntMaxValue = 0x7FFFFFFF; |
|
87 // From UI spec 60 sec delay user response. |
|
88 const TInt KNoResponseFromUserDelay = 60; |
|
89 const TInt KMicroSecondsInSecond = 1000000; |
|
90 const TInt KClearScreenDelay = 3; |
|
91 const TInt KMicroSecondsInTenthOfSecond = 100000; |
|
92 const TInt K3Seconds = 3000000; |
|
93 |
|
94 // Maximum length for sound file. |
|
95 const TInt KMaxSoundFileLength = 256; |
|
96 // Audio sample is repeated indefinitely. |
|
97 const TInt KSoundPlayerRepeatForever = KMdaRepeatForever; |
|
98 // Used when dividing some values. Used only for preventing the use of magic |
|
99 // numbers |
|
100 const TInt KDivideByEight = 8; |
|
101 |
|
102 const TUint8 KGetInputStringMaxSize = 0xEF; |
|
103 |
|
104 _LIT( K3Spaces, " " ); // Used for empty title. |
|
105 const TInt KEmptyTitleLength( 3 ); // Length of empty title. |
|
106 _LIT( KSatEmptySpace, " " ); // Used for empty item. |
|
107 _LIT( KSatEmptyDes, "" ); |
|
108 |
|
109 const TUint8 KKeyZero = 0x30; |
|
110 const TUint8 KKeyNine = 0x39; |
|
111 const TUint8 KHwAsterisk = 0x2a; // In hw scan code value for asterisk |
|
112 |
|
113 // ================= MEMBER FUNCTIONS ======================= |
|
114 |
|
115 // C++ default constructor can NOT contain any code, that |
|
116 // might leave. |
|
117 // |
|
118 CSatUiViewAppUi::CSatUiViewAppUi(): |
|
119 iHelp( EFalse ), |
|
120 iSetUpMenuFirst( ETrue ), |
|
121 iSelectItemFirst( ETrue ), |
|
122 iPreviousForeground( EFalse ), |
|
123 iViewLoopCounter( 0 ), |
|
124 iDuration( TTimeIntervalMicroSeconds( static_cast<TInt64>( 0 ) ) ), |
|
125 iReqWSBufferID( KErrNone ) |
|
126 { |
|
127 } |
|
128 |
|
129 // Symbian OS default constructor can leave. |
|
130 void CSatUiViewAppUi::ConstructL() |
|
131 { |
|
132 TFLOGSTRING( "CSatUiViewAppUi::ConstructL() called" ) |
|
133 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); |
|
134 |
|
135 // Requests Window Server client buffer used by the application to |
|
136 // be of at least the given size. |
|
137 iReqWSBufferID = CAknEnv::Static()->RequestWsBuffer( KAknMaxWsBufferSize ); |
|
138 TFLOGSTRING2( "iReqWSBufferID is %d", iReqWSBufferID ) |
|
139 |
|
140 if ( BTSAPActivatedL() ) |
|
141 { |
|
142 HBufC* sapText = |
|
143 iCoeEnv->AllocReadResourceLC( R_QTN_OFFLINE_NOT_POSSIBLE_SAP ); |
|
144 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
145 iForegroundControl = note; |
|
146 note->ExecuteLD( *sapText ); |
|
147 iForegroundControl = NULL; |
|
148 CleanupStack::PopAndDestroy( sapText ); |
|
149 Exit(); |
|
150 } |
|
151 |
|
152 if ( ProfileState() == KSatActiveProfileOffline ) |
|
153 { |
|
154 ShowNotAvailableNoteL(); |
|
155 Exit(); |
|
156 } |
|
157 |
|
158 |
|
159 if ( StatusPane()->PaneCapabilities( TUid::Uid( |
|
160 EEikStatusPaneUidTitle ) ).IsPresent() ) |
|
161 { |
|
162 CAknTitlePane* titlePane = STATIC_CAST( CAknTitlePane*, |
|
163 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
164 titlePane->SetTextL( KNullDesC ); |
|
165 titlePane->DrawNow(); |
|
166 } |
|
167 |
|
168 TFLOGSTRING( "CSatUiViewAppUi::ConstructL() exit" ) |
|
169 } |
|
170 |
|
171 // Destructor. |
|
172 CSatUiViewAppUi::~CSatUiViewAppUi() |
|
173 { |
|
174 TFLOGSTRING( "CSatUiViewAppUi::~CSatUiViewAppUi() called" ) |
|
175 this->StopShowWaitNote(); |
|
176 |
|
177 delete iTitle; |
|
178 delete iAppName; |
|
179 delete iPlayer; |
|
180 delete iTimer; |
|
181 |
|
182 TFLOGSTRING( "CSatUiViewAppUi::~CSatUiViewAppUi() exit" ) |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------- |
|
186 // CSatUiViewAppUi::CreateEmptyMenuL |
|
187 // Creates empty menu. This is used in SIM originated commands. |
|
188 // (other items were commented in a header). |
|
189 // --------------------------------------------------------- |
|
190 // |
|
191 void CSatUiViewAppUi::CreateEmptyMenuL() |
|
192 { |
|
193 TFLOGSTRING( "CSatUiViewAppUi::CreateEmptyMenuL() called" ) |
|
194 |
|
195 // Create the menu item array with no content. |
|
196 CDesCArrayFlat* menuItems = new( ELeave ) CDesCArrayFlat( 1 ); |
|
197 CleanupStack::PushL( menuItems ); |
|
198 menuItems->Reset(); |
|
199 menuItems->AppendL( KSatEmptySpace ); |
|
200 |
|
201 // Create the empty next action indicator array. |
|
202 CArrayFixFlat<TSatAction>* menuActions = |
|
203 new( ELeave ) CArrayFixFlat<TSatAction>( 1 ); |
|
204 CleanupStack::PushL( menuActions ); |
|
205 menuActions->Reset(); |
|
206 |
|
207 // Create empty title pane. |
|
208 HBufC* satTitle = HBufC::NewLC( KEmptyTitleLength ); |
|
209 satTitle->Des().Append( K3Spaces ); |
|
210 |
|
211 iSetUpMenuFirst = EFalse; |
|
212 iSetUpMenuView = CSatUiView::NewL( ETrue, this, ETrue ); |
|
213 iSetUpMenuView->SetItemsL( satTitle, |
|
214 *menuItems, |
|
215 menuActions, |
|
216 EFalse ); |
|
217 |
|
218 // Hide list box. |
|
219 iSetUpMenuView->MakeListBoxVisible( EFalse ); |
|
220 |
|
221 // Transfer ownership to CAknViewAppUi. |
|
222 AddViewL( iSetUpMenuView ); |
|
223 |
|
224 iSetUpMenuView->SetAdapter( iAdapter ); |
|
225 iActiveView = KSetUpMenuViewId; |
|
226 |
|
227 // satTitle, menuActions, menuItems |
|
228 CleanupStack::PopAndDestroy( satTitle ); |
|
229 CleanupStack::PopAndDestroy( menuActions ); |
|
230 CleanupStack::PopAndDestroy( menuItems ); |
|
231 TFLOGSTRING( "CSatUiViewAppUi::CreateEmptyMenuL() exit" ) |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------- |
|
235 // CSatUiViewAppUi::SetAdapter |
|
236 // Sets the pointer to MSatUiAdapter object. |
|
237 // (other items were commented in a header). |
|
238 // --------------------------------------------------------- |
|
239 // |
|
240 void CSatUiViewAppUi::SetAdapter( |
|
241 MSatUiAdapter* aAdapter ) |
|
242 { |
|
243 iAdapter = aAdapter; |
|
244 } |
|
245 |
|
246 // --------------------------------------------------------- |
|
247 // CSatUiViewAppUi::ShowWaitNoteL |
|
248 // Displays the wait note. |
|
249 // (other items were commented in a header). |
|
250 // --------------------------------------------------------- |
|
251 // |
|
252 void CSatUiViewAppUi::ShowWaitNoteL() |
|
253 { |
|
254 TFLOGSTRING( "CSatUiViewAppUi::ShowWaitNoteL() called" ) |
|
255 if ( !iWaitNote ) |
|
256 { |
|
257 iWaitNote = new(ELeave)CAknWaitDialog( |
|
258 (REINTERPRET_CAST(CEikDialog**,&iWaitNote))); |
|
259 iForegroundControl = iWaitNote; |
|
260 iWaitNote->ExecuteLD( R_SATUI_WAIT_NOTE ); |
|
261 // iForegroundControl won't be clear until the wait dialog |
|
262 // closed. It will avoid we lose the chance to set focus for |
|
263 // the wait dialog when the switch of foreground/background |
|
264 // happened. |
|
265 } |
|
266 TFLOGSTRING( "CSatUiViewAppUi::ShowWaitNoteL() exit" ) |
|
267 } |
|
268 |
|
269 // --------------------------------------------------------- |
|
270 // CSatUiViewAppUi::ShowWaitNoteWithoutDelayL |
|
271 // Displays the wait note without delay |
|
272 // (other items were commented in a header). |
|
273 // --------------------------------------------------------- |
|
274 // |
|
275 void CSatUiViewAppUi::ShowWaitNoteWithoutDelayL() |
|
276 { |
|
277 TFLOGSTRING( "CSatUiViewAppUi::ShowWaitNoteWithoutDelayL() called" ) |
|
278 if ( !iWaitNote ) |
|
279 { |
|
280 iWaitNote = new(ELeave)CAknWaitDialog( |
|
281 (REINTERPRET_CAST(CEikDialog**,&iWaitNote)), ETrue ); |
|
282 iForegroundControl = iWaitNote; |
|
283 iWaitNote->ExecuteLD( R_SATUI_WAIT_NOTE ); |
|
284 // iForegroundControl won't be clear until the wait dialog |
|
285 // closed. It will avoid we lose the chance to set focus for |
|
286 // the wait dialog when the switch of foreground/background |
|
287 // happened. |
|
288 } |
|
289 TFLOGSTRING( "CSatUiViewAppUi::ShowWaitNoteWithoutDelayL() exit" ) |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------- |
|
293 // CSatUiViewAppUi::StopShowWaitNote |
|
294 // Removes the wait note from the screen. |
|
295 // (other items were commented in a header). |
|
296 // --------------------------------------------------------- |
|
297 // |
|
298 void CSatUiViewAppUi::StopShowWaitNote() |
|
299 { |
|
300 TFLOGSTRING( "CSatUiViewAppUi::StopShowWaitNote() called" ) |
|
301 |
|
302 if ( iNoteDialog ) |
|
303 { |
|
304 iForegroundControl = NULL; |
|
305 |
|
306 TFLOGSTRING( "CSatUiViewAppUi::StopShowWaitNote() Closing \ |
|
307 NoteDialog" ) |
|
308 delete iNoteDialog; |
|
309 iNoteDialog = NULL; |
|
310 } |
|
311 |
|
312 if ( iWaitNote ) |
|
313 { |
|
314 iForegroundControl = NULL; |
|
315 |
|
316 TFLOGSTRING( "CSatUiViewAppUi::StopShowWaitNote() Closing WaitNote" ) |
|
317 // Process finished. The function was either ExecuteLD or RunLD. |
|
318 // This function call stops the execution of these function and |
|
319 // causes the deletion of object |
|
320 TInt err(0); |
|
321 TRAP( err, iWaitNote->ProcessFinishedL() ) |
|
322 TFLOGSTRING2(" 2nd: iWaitNote: %x ", iWaitNote ) |
|
323 TFLOGSTRING2( "TRAP: %d", err ) |
|
324 // Delete the object just in case. Seems that above method does not |
|
325 // delete the object in some cases. e.g in very fast execution |
|
326 delete iWaitNote; |
|
327 iWaitNote = NULL; |
|
328 } |
|
329 if ( iBipWaitNote ) |
|
330 { |
|
331 iForegroundControl = NULL; |
|
332 |
|
333 TFLOGSTRING( "CSatUiViewAppUi::StopShowWaitNote() Closing BIP note" ) |
|
334 delete iBipWaitNote; |
|
335 iBipWaitNote = NULL; |
|
336 } |
|
337 |
|
338 if ( iPermanentNote ) |
|
339 { |
|
340 TFLOGSTRING( "CSatUiViewAppUi::StopShowWaitNote() \ |
|
341 iPermanentNote cleared" ) |
|
342 // If iPermanentNote exists until wait note is stopped, |
|
343 // then dialog has been already removed. |
|
344 iPermanentNote->ExitSleepingDialog(); |
|
345 delete iPermanentNote; |
|
346 iPermanentNote = NULL; |
|
347 } |
|
348 |
|
349 TFLOGSTRING( "CSatUiViewAppUi::StopShowWaitNote() exit" ) |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------- |
|
353 // CSatUiViewAppUi::BTSAPActivatedL |
|
354 // Check that if BT SAP connection activated. |
|
355 // (other items were commented in a header). |
|
356 // --------------------------------------------------------- |
|
357 // |
|
358 TBool CSatUiViewAppUi::BTSAPActivatedL() |
|
359 { |
|
360 |
|
361 TFLOGSTRING( "CSatUiViewAppUi::BTSAPActivated() called" ) |
|
362 |
|
363 TBool isActive( EFalse ); |
|
364 FeatureManager::InitializeLibL(); |
|
365 if ( FeatureManager::FeatureSupported( KFeatureIdBtSap ) ) |
|
366 { |
|
367 TFLOGSTRING( "BTSAP is supported by ME" ) |
|
368 TInt status( EBTSapNotConnected ); |
|
369 TInt err = RProperty::Get( KPSUidBluetoothSapConnectionState, |
|
370 KBTSapConnectionState, |
|
371 status ); |
|
372 |
|
373 if ( EBTSapNotConnected != status && !err ) |
|
374 { |
|
375 TFLOGSTRING( "BTSAP is connected" ) |
|
376 isActive = ETrue; |
|
377 } |
|
378 else |
|
379 { |
|
380 TFLOGSTRING3( "BTSAP status %d and error %d", status, err ) |
|
381 } |
|
382 } |
|
383 else |
|
384 { |
|
385 TFLOGSTRING( "BTSAP is not supported by ME" ) |
|
386 } |
|
387 |
|
388 FeatureManager::UnInitializeLib(); |
|
389 TFLOGSTRING( "CSatUiViewAppUi::BTSAPActivated() exit" ) |
|
390 return isActive; |
|
391 |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------- |
|
395 // CSatUiViewAppUi::CoeEnv |
|
396 // Returns CoeEnv. |
|
397 // (other items were commented in a header). |
|
398 // --------------------------------------------------------- |
|
399 // |
|
400 CCoeEnv* CSatUiViewAppUi::CoeEnv() |
|
401 { |
|
402 return iCoeEnv; |
|
403 } |
|
404 |
|
405 // --------------------------------------------------------- |
|
406 // CSatUiViewAppUi::DisplayTextL |
|
407 // Displays the text in a note. |
|
408 // (other items were commented in a header). |
|
409 // --------------------------------------------------------- |
|
410 // |
|
411 TSatUiResponse CSatUiViewAppUi::DisplayTextL( |
|
412 const TDesC& aText, |
|
413 const TDesC& aSimApplicationName, |
|
414 CFbsBitmap* aIconBitmapDisplayText, |
|
415 const TBool aSelfExplanatoryIcon, |
|
416 const TBool aSustainedText, |
|
417 const TTimeIntervalSeconds aDuration, |
|
418 const TBool aWaitUserToClear ) |
|
419 { |
|
420 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL called" ) |
|
421 StopShowWaitNote(); |
|
422 |
|
423 TSatUiResponse response( ESatSuccess ); |
|
424 iHighPriorityEvent = EFalse; |
|
425 |
|
426 // Indication immediate response TLV for Display Text during MT call, |
|
427 // if it is immediate response, close dialog, otherwise leave it alone. |
|
428 iImmediateRsp = aSustainedText; |
|
429 TFLOGSTRING2( "CSatUiViewAppUi::DisplayTextL immediate rsp: %d", |
|
430 iImmediateRsp ) |
|
431 |
|
432 HBufC* header; |
|
433 |
|
434 if ( iHelp ) |
|
435 { |
|
436 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL iHelp ETrue" ) |
|
437 header = StringLoader::LoadLC( |
|
438 R_QTN_SAT_HELP_HEADER, iCoeEnv ); |
|
439 iHelp = EFalse; |
|
440 } |
|
441 else |
|
442 { |
|
443 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL iHelp EFalse" ) |
|
444 TFLOGSTRING2( "CSatUiViewAppUi::DisplayTextL length of \ |
|
445 aSimApplicationName: %d", aSimApplicationName.Length() ) |
|
446 if ( aSimApplicationName.Length() > 0 ) |
|
447 { |
|
448 header = aSimApplicationName.AllocLC(); |
|
449 } |
|
450 else |
|
451 { |
|
452 //Reads a resource string with memory allocation |
|
453 header = StringLoader::LoadLC( R_QTN_SAT_MESSAGE_HEADER, iCoeEnv ); |
|
454 } |
|
455 } |
|
456 |
|
457 // Remove NULL characters from title |
|
458 RemoveNullCharacters( header ); |
|
459 |
|
460 if ( aIconBitmapDisplayText ) |
|
461 { |
|
462 //icon available use querydialog |
|
463 iDisplayTextIconDialog = CAknPopupForm::NewL(); |
|
464 } |
|
465 |
|
466 CUserActivityManager* activityManager = |
|
467 CUserActivityManager::NewL( EPriorityNormal ); |
|
468 |
|
469 CleanupStack::PushL( activityManager ); |
|
470 |
|
471 // Duration handling: |
|
472 // If duration is given use that value for timeout. |
|
473 TTimeIntervalSeconds duration ( aDuration ); |
|
474 |
|
475 // If user is expected to clear shown dialog and |
|
476 // duration is NOT given use 60s timeout. |
|
477 if ( aWaitUserToClear && !aDuration.Int() ) |
|
478 { |
|
479 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL wait user to clear" ) |
|
480 duration = TTimeIntervalSeconds( KNoResponseFromUserDelay ); |
|
481 } |
|
482 // If user is NOT expected to clear shown dialog and |
|
483 // duration is NOT given use 3s timeout. |
|
484 else if ( !aDuration.Int() ) |
|
485 { |
|
486 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL don't wait user \ |
|
487 to clear" ) |
|
488 duration = TTimeIntervalSeconds( KClearScreenDelay ); |
|
489 } |
|
490 |
|
491 // If not sustained or Clear after delay requested start timer |
|
492 if ( !aSustainedText || aDuration.Int() || !aWaitUserToClear ) |
|
493 { |
|
494 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL No sustained text" ) |
|
495 TFLOGSTRING2( "CSatUiViewAppUi::DisplayTextL duration: %d", |
|
496 duration.Int() ) |
|
497 |
|
498 // If duration is given start timer which doesn't |
|
499 // care about user activity. |
|
500 if ( aDuration.Int() ) |
|
501 { |
|
502 CreateCallBackTimerL( duration.Int() * KMicroSecondsInSecond, |
|
503 DelayCallback ); |
|
504 } |
|
505 // Otherwise start timer which takes account user activity. |
|
506 else |
|
507 { |
|
508 User::ResetInactivityTime(); |
|
509 activityManager->Start( duration, |
|
510 TCallBack( DispatchUserInactive, this ), 0 ); |
|
511 } |
|
512 } |
|
513 |
|
514 TInt userResponse; |
|
515 |
|
516 if ( aIconBitmapDisplayText ) |
|
517 { |
|
518 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL have IconBitmap" ) |
|
519 // Prepare dialog with icon |
|
520 iDisplayTextIconDialog->SetPopupFormType( EAknQuery ); |
|
521 iDisplayTextIconDialog->PrepareLC( R_SATUI_MESSAGE_TEXT_ICON ); |
|
522 iDisplayTextIconDialog->SetTitleL( *header ); |
|
523 |
|
524 // Get richtext control |
|
525 CEikCaptionedControl* capControl = |
|
526 iDisplayTextIconDialog->GetControlByControlType |
|
527 ( EEikCtRichTextEditor ); |
|
528 CCoeControl* coeControl = capControl->iControl; |
|
529 CEikRichTextEditor* rtxtEditor = |
|
530 reinterpret_cast<CEikRichTextEditor*>( coeControl ); |
|
531 |
|
532 if ( !aSelfExplanatoryIcon ) |
|
533 { |
|
534 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL not \ |
|
535 SelfExplanatoryIcon" ) |
|
536 // Not selfexplanatory icon, add text |
|
537 // Get font |
|
538 const CFont* logicalFont = AknLayoutUtils::FontFromId( |
|
539 EAknLogicalFontSecondaryFont ); |
|
540 |
|
541 // Extract font information |
|
542 TFontSpec fontspec = logicalFont->FontSpecInTwips(); |
|
543 TCharFormat charFormat( fontspec.iTypeface.iName, |
|
544 fontspec.iHeight ); |
|
545 |
|
546 // Make the font to be anti-aliased |
|
547 TFontStyle style; |
|
548 style.SetBitmapType( EAntiAliasedGlyphBitmap ); |
|
549 charFormat.iFontSpec.iFontStyle = style; |
|
550 |
|
551 // Set mask (which settings are set) |
|
552 TCharFormatMask charFormatMask; |
|
553 charFormatMask.SetAttrib( EAttColor ); |
|
554 charFormatMask.SetAttrib( EAttFontTypeface ); |
|
555 charFormatMask.SetAttrib( EAttFontHeight ); |
|
556 |
|
557 // Apply settings |
|
558 rtxtEditor->RichText()->ApplyCharFormatL( |
|
559 charFormat, charFormatMask, 0, 0 ); |
|
560 |
|
561 // One space between icon and text |
|
562 rtxtEditor->RichText()->InsertL( 0, KSatEmptySpace ); |
|
563 rtxtEditor->RichText()->InsertL( 1, aText ); |
|
564 } |
|
565 |
|
566 // Count icon size in twips |
|
567 CWsScreenDevice* device = CCoeEnv::Static()->ScreenDevice(); |
|
568 TInt width = device->HorizontalPixelsToTwips( |
|
569 aIconBitmapDisplayText->SizeInPixels().iWidth ); |
|
570 TInt height = device->VerticalPixelsToTwips( |
|
571 aIconBitmapDisplayText->SizeInPixels().iHeight ); |
|
572 TSize twipsSize( width, height ); |
|
573 |
|
574 // Create picture |
|
575 CSatUiMessageQueryIcon* picture = new( ELeave ) |
|
576 CSatUiMessageQueryIcon( twipsSize, *aIconBitmapDisplayText ); |
|
577 TPictureHeader pictureHeader; |
|
578 pictureHeader.iPicture = TSwizzle<CPicture>( picture ); |
|
579 //Insert picture |
|
580 rtxtEditor->RichText()->InsertL( 0, pictureHeader ); |
|
581 //Needed to show whole picture |
|
582 _LIT( KString, "\f\f\f"); |
|
583 rtxtEditor->RichText()->InsertL( rtxtEditor->Text()->DocumentLength(), |
|
584 KString ); |
|
585 |
|
586 // Set MSK same as LSK without any text causing the icon drawing |
|
587 iDisplayTextIconDialog->ButtonGroupContainer().SetCommandL( |
|
588 CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknSoftkeyOk, |
|
589 KSatEmptyDes ); |
|
590 iForegroundControl = iDisplayTextIconDialog; |
|
591 userResponse = iDisplayTextIconDialog->RunLD(); |
|
592 } |
|
593 else |
|
594 { |
|
595 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL don't have IconBitmap" ) |
|
596 // Dialog without icon |
|
597 iDisplayTextDialog = new (ELeave) CAknMessageQueryDialog(); |
|
598 iDisplayTextDialog->PrepareLC( R_SATUI_MESSAGE ); |
|
599 iDisplayTextDialog->SetMessageTextL( aText ); |
|
600 iDisplayTextDialog->QueryHeading()->SetTextL( *header ); |
|
601 |
|
602 // Set MSK same as LSK without any text causing the icon drawing |
|
603 iDisplayTextDialog->ButtonGroupContainer().SetCommandL( |
|
604 CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknSoftkeyOk, |
|
605 KSatEmptyDes ); |
|
606 iForegroundControl = iDisplayTextDialog; |
|
607 userResponse = iDisplayTextDialog->RunLD(); |
|
608 } |
|
609 iForegroundControl = NULL; |
|
610 |
|
611 CleanupStack::PopAndDestroy( activityManager ); |
|
612 CleanupStack::PopAndDestroy( header ); // header,activityManager |
|
613 // After duration call back timer is destroyed |
|
614 DestroyCallBackTimer(); |
|
615 |
|
616 // If user is not expected to clear message used response is success |
|
617 // in timeout case. |
|
618 if ( userResponse |
|
619 || ( iNoteClearedAfterDelay && !aWaitUserToClear ) ) |
|
620 { |
|
621 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL successful response" ) |
|
622 response = ESatSuccess; |
|
623 } |
|
624 else if ( iNoResponseFromUserAfterDelay || |
|
625 ( aWaitUserToClear && iHighPriorityEvent ) ) |
|
626 { |
|
627 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL no user response" ) |
|
628 // User did not close the text, closed by the timer or MT call |
|
629 response = ESatNoResponseFromUser; |
|
630 } |
|
631 else |
|
632 { |
|
633 if ( IsAppShutterRunning() ) |
|
634 { |
|
635 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL satsession \ |
|
636 terminated by user " ) |
|
637 response = ESatSessionTerminatedByUser; |
|
638 iSessionTerminated = ETrue; |
|
639 } |
|
640 else |
|
641 { |
|
642 TFLOGSTRING( "CSatUiViewAppUi::DisplayTextL backward \ |
|
643 requested by user " ) |
|
644 response = ESatBackwardModeRequestedByUser; |
|
645 } |
|
646 } |
|
647 |
|
648 if ( iDisplayTextDialog ) |
|
649 { |
|
650 iDisplayTextDialog = NULL; |
|
651 } |
|
652 if ( iDisplayTextIconDialog ) |
|
653 { |
|
654 iDisplayTextIconDialog = NULL; |
|
655 } |
|
656 |
|
657 iNoteClearedAfterDelay = EFalse; |
|
658 iNoResponseFromUserAfterDelay = EFalse; |
|
659 |
|
660 ShowWaitNoteL(); |
|
661 |
|
662 TFLOGSTRING2( "CSatUiViewAppUi::DisplayTextL exit, return: %d", response ) |
|
663 return response; |
|
664 } |
|
665 |
|
666 // --------------------------------------------------------- |
|
667 // CSatUiViewAppUi::ClearScreen |
|
668 // Displays yes/no confirmation query. |
|
669 // (other items were commented in a header). |
|
670 // --------------------------------------------------------- |
|
671 // |
|
672 void CSatUiViewAppUi::ClearScreen() |
|
673 { |
|
674 TFLOGSTRING( "CSatUiViewAppUi::ClearScreen() called" ) |
|
675 |
|
676 iNoteClearedAfterDelay = ETrue; |
|
677 CloseDialogs(); |
|
678 |
|
679 TFLOGSTRING( "CSatUiViewAppUi::ClearScreen() exit" ) |
|
680 } |
|
681 // --------------------------------------------------------- |
|
682 // CSatUiViewAppUi::GetYesNoL |
|
683 // Displays yes/no confirmation query. |
|
684 // (other items were commented in a header). |
|
685 // --------------------------------------------------------- |
|
686 // |
|
687 TSatUiResponse CSatUiViewAppUi::GetYesNoL( |
|
688 const TDesC& aText, |
|
689 const TSatCharacterSet aCharacterSet, |
|
690 TChar& aInkey, |
|
691 const CFbsBitmap* aIconBitmap, |
|
692 const TBool aSelfExplanatory, |
|
693 TUint& aDuration, |
|
694 const TBool aImmediateDigitResponse ) |
|
695 { |
|
696 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL called" ) |
|
697 TSatUiResponse response( ESatSuccess ); |
|
698 |
|
699 StopShowWaitNote(); |
|
700 |
|
701 CUserActivityManager* activityManager = |
|
702 CUserActivityManager::NewL( EPriorityNormal ); |
|
703 CleanupStack::PushL( activityManager ); |
|
704 |
|
705 // Start time for duration |
|
706 TTime startTime; |
|
707 iImmediateDigitResponse = aImmediateDigitResponse; |
|
708 |
|
709 TFLOGSTRING2( "CSatUiViewAppUi::GetYesNoL duration in 1/10 sec: %d", |
|
710 aDuration ) |
|
711 |
|
712 // If duration is given use that value for timeout. |
|
713 // Start timer which doesn't care about user activity. |
|
714 if ( aDuration ) |
|
715 { |
|
716 TInt duration ( 0 ); |
|
717 |
|
718 TTimeIntervalMicroSeconds max32Bit( |
|
719 static_cast<TInt64>( K32TIntMaxValue ) ); |
|
720 TTimeIntervalMicroSeconds durationInTenthOfSeconds( |
|
721 static_cast<TInt64>( aDuration ) ); |
|
722 TTimeIntervalMicroSeconds durationInus( |
|
723 durationInTenthOfSeconds.Int64() * KMicroSecondsInTenthOfSecond ); |
|
724 |
|
725 if ( durationInus > max32Bit ) |
|
726 { |
|
727 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL durationInus bigger \ |
|
728 than max32Bit" ) |
|
729 // since timers can only handle 32-bit values, |
|
730 // let's break the aDuration to smaller bits. |
|
731 // we break it here to 8 bits to fit in 32-bit value |
|
732 duration = durationInus.Int64() / KDivideByEight; |
|
733 iTimerRepeatOn = ETrue; |
|
734 } |
|
735 else |
|
736 { |
|
737 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL durationInus less \ |
|
738 than max32Bit" ) |
|
739 duration = durationInus.Int64(); |
|
740 } |
|
741 |
|
742 CreateCallBackTimerL( duration, DelayCallback ); |
|
743 startTime.HomeTime(); |
|
744 } |
|
745 // Otherwise start timer which takes account user activity. |
|
746 else |
|
747 { |
|
748 User::ResetInactivityTime(); |
|
749 activityManager->Start( |
|
750 TTimeIntervalSeconds( KNoResponseFromUserDelay ), |
|
751 TCallBack( DispatchUserInactive, this ), 0 ); |
|
752 } |
|
753 |
|
754 TInt resource( 0 ); |
|
755 |
|
756 if ( aIconBitmap ) |
|
757 { |
|
758 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL iGetYesNoIconDialog" ) |
|
759 |
|
760 if ( ESatYesNo == aCharacterSet ) |
|
761 { |
|
762 resource = R_SATUI_CONFIRM_YES_NO_QUERY_WITH_ICON; |
|
763 } |
|
764 else |
|
765 { |
|
766 resource = R_SATUI_IMMEDIATE_DIGIT_NOTE_WITH_ICON; |
|
767 } |
|
768 } |
|
769 else |
|
770 { |
|
771 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL iGetYesNoDialog" ) |
|
772 |
|
773 if ( ESatYesNo == aCharacterSet ) |
|
774 { |
|
775 resource = R_SATUI_CONFIRM_YES_NO_QUERY; |
|
776 } |
|
777 else |
|
778 { |
|
779 resource = R_SATUI_IMMEDIATE_DIGIT_QUERY; |
|
780 } |
|
781 } |
|
782 |
|
783 TInt userResponse = RunQueryDialogL( resource , aText, aIconBitmap, |
|
784 aSelfExplanatory, EAknSoftkeyYes ); |
|
785 |
|
786 iImmediateDigitResponse = EFalse; |
|
787 |
|
788 // set received immediate digit response |
|
789 aInkey = iKey; |
|
790 iKey = 0; |
|
791 |
|
792 if ( aDuration ) |
|
793 { |
|
794 TTime endTime; |
|
795 endTime.HomeTime(); |
|
796 TTimeIntervalMicroSeconds timeDifference( 0 ); |
|
797 timeDifference = endTime.MicroSecondsFrom( startTime ); |
|
798 aDuration = timeDifference.Int64() / KMicroSecondsInTenthOfSecond; |
|
799 |
|
800 // After duration call back timer is destroyed |
|
801 DestroyCallBackTimer(); |
|
802 } |
|
803 |
|
804 CleanupStack::PopAndDestroy( activityManager ); |
|
805 |
|
806 // Timeout |
|
807 if ( iNoResponseFromUserAfterDelay ) |
|
808 { |
|
809 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL no response from user" ) |
|
810 response = ESatNoResponseFromUser; |
|
811 } |
|
812 // Cancel is pressed if immediate digit response without Yes/No |
|
813 else if ( !userResponse && ESatYesNo != aCharacterSet && !aInkey ) |
|
814 { |
|
815 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL backward request by user" ) |
|
816 response = ESatBackwardModeRequestedByUser; |
|
817 } |
|
818 // Yes button is used |
|
819 else if ( userResponse && !aInkey) |
|
820 { |
|
821 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL button used" ) |
|
822 aInkey = 1; |
|
823 } |
|
824 // No button is used |
|
825 else if ( !aInkey ) |
|
826 { |
|
827 TFLOGSTRING( "CSatUiViewAppUi::GetYesNoL no button used" ) |
|
828 aInkey = 0; |
|
829 } |
|
830 |
|
831 iNoResponseFromUserAfterDelay = EFalse; |
|
832 |
|
833 ShowWaitNoteL(); |
|
834 |
|
835 TFLOGSTRING2( "CSatUiViewAppUi::GetYesNoL exit, return: %d", response ) |
|
836 return response; |
|
837 } |
|
838 |
|
839 // --------------------------------------------------------- |
|
840 // CSatUiViewAppUi::GetInputL |
|
841 // Displays data query. |
|
842 // (other items were commented in a header). |
|
843 // --------------------------------------------------------- |
|
844 // |
|
845 TSatUiResponse CSatUiViewAppUi::GetInputL( |
|
846 const TDesC& aText, |
|
847 const TSatCharacterSet aCharacterSet, |
|
848 TDes& aInput, |
|
849 const TInt aMinLength, |
|
850 const TInt aMaxLength, |
|
851 const TBool aHideInput, |
|
852 const TBool aGetInkey, |
|
853 const CFbsBitmap* aIconBitmapGetInput, |
|
854 const TBool aSelfExplanatory, |
|
855 TUint& aDuration ) |
|
856 { |
|
857 TFLOGSTRING( "CSatUiViewAppUi::GetInputL called" ) |
|
858 StopShowWaitNote(); |
|
859 |
|
860 TSatUiResponse response( ESatSuccess ); |
|
861 |
|
862 TPtrC textPtr( aText ); |
|
863 |
|
864 TInt minLength( 0 ); |
|
865 TInt maxLength( 1 ); |
|
866 |
|
867 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL aMinLength %d", aMinLength ) |
|
868 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL aMaxLength %d", aMaxLength ) |
|
869 //lint -e{961} else block not needed, minLength initialized. |
|
870 if ( aMinLength <= KGetInputStringMaxSize && aMinLength > 0 ) |
|
871 { |
|
872 minLength = aMinLength; |
|
873 } |
|
874 else if ( aMinLength > KGetInputStringMaxSize ) |
|
875 { |
|
876 minLength = KGetInputStringMaxSize; |
|
877 } |
|
878 |
|
879 //lint -e{961} else block not needed, maxLength initialized. |
|
880 if ( aMaxLength < minLength ) |
|
881 { |
|
882 maxLength = minLength; |
|
883 } |
|
884 else if ( aMaxLength <= KGetInputStringMaxSize && aMaxLength > 1 ) |
|
885 { |
|
886 maxLength = aMaxLength; |
|
887 } |
|
888 else if ( aMaxLength > KGetInputStringMaxSize ) |
|
889 { |
|
890 maxLength = KGetInputStringMaxSize; |
|
891 } |
|
892 |
|
893 HBufC* input = HBufC::NewLC( KGetInputStringMaxSize ); |
|
894 TPtr inputPtr(input->Des()); |
|
895 |
|
896 HBufC* textHolder = NULL; |
|
897 |
|
898 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL aInput.Length %d",\ |
|
899 aInput.Length() ) |
|
900 |
|
901 if ( ( aInput.Length() >= minLength ) |
|
902 && ( aInput.Length() <= maxLength ) ) |
|
903 { |
|
904 inputPtr = aInput; |
|
905 } |
|
906 |
|
907 TInt userResponse; |
|
908 |
|
909 CUserActivityManager* activityManager = |
|
910 CUserActivityManager::NewL( EPriorityNormal ); |
|
911 |
|
912 CleanupStack::PushL( activityManager ); |
|
913 |
|
914 // Start time for timer |
|
915 TTime startTime; |
|
916 |
|
917 // If duration is given use that value for timeout. |
|
918 // Start timer which doesn't care about user activity. |
|
919 if ( aDuration && aGetInkey ) |
|
920 { |
|
921 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL duration in 1/10 sec: %d", |
|
922 aDuration ) |
|
923 |
|
924 TInt duration ( 0 ); |
|
925 |
|
926 TTimeIntervalMicroSeconds max32Bit( |
|
927 static_cast<TInt64>( K32TIntMaxValue ) ); |
|
928 TTimeIntervalMicroSeconds durationInTenthOfSeconds( |
|
929 static_cast<TInt64>( aDuration ) ); |
|
930 TTimeIntervalMicroSeconds durationInus( |
|
931 durationInTenthOfSeconds.Int64() * KMicroSecondsInTenthOfSecond ); |
|
932 |
|
933 if ( durationInus > max32Bit ) |
|
934 { |
|
935 TFLOGSTRING( "CSatUiViewAppUi::GetInputL durationInus bigger \ |
|
936 than max32Bit" ) |
|
937 // since timers can only handle 32-bit values, |
|
938 // let's break the aDuration to smaller bits. |
|
939 // we break it here to 8 bits to fit in 32-bit value |
|
940 duration = durationInus.Int64() / KDivideByEight; |
|
941 iTimerRepeatOn = ETrue; |
|
942 } |
|
943 else |
|
944 { |
|
945 TFLOGSTRING( "CSatUiViewAppUi::GetInputL durationInus less \ |
|
946 than max32Bit" ) |
|
947 duration = durationInus.Int64(); |
|
948 } |
|
949 |
|
950 CreateCallBackTimerL( duration, DelayCallback ); |
|
951 startTime.HomeTime(); |
|
952 } |
|
953 // Otherwise start timer which takes account user activity. |
|
954 else |
|
955 { |
|
956 User::ResetInactivityTime(); |
|
957 activityManager->Start( |
|
958 TTimeIntervalSeconds( KNoResponseFromUserDelay ), |
|
959 TCallBack( DispatchUserInactive, this ), 0 ); |
|
960 } |
|
961 |
|
962 CEikImage* image = new(ELeave) CEikImage; |
|
963 CleanupStack::PushL( image ); |
|
964 |
|
965 if ( aIconBitmapGetInput ) |
|
966 { |
|
967 image->SetBitmap( aIconBitmapGetInput ); |
|
968 |
|
969 // Create mask for icon bitmap |
|
970 CFbsBitmap* mask = new(ELeave) CFbsBitmap; |
|
971 |
|
972 TSize size = aIconBitmapGetInput->SizeInPixels(); |
|
973 CleanupStack::PushL( mask ); |
|
974 MakeGetInputBitmapMask( mask, size ); |
|
975 |
|
976 image->SetMask( mask ); |
|
977 CleanupStack::Pop( mask ); |
|
978 } |
|
979 |
|
980 TInt resource( 0 ); |
|
981 TInt textResource( 0 ); |
|
982 // Query dialog |
|
983 iGetInputDialog = new (ELeave) CSatUiTextQueryDialog( inputPtr, |
|
984 CAknQueryDialog::ENoTone, minLength, maxLength ); |
|
985 iForegroundControl = iGetInputDialog; |
|
986 |
|
987 if ( aCharacterSet == ESatDigitOnly ) |
|
988 { |
|
989 TFLOGSTRING( "CSatUiViewAppUi::GetInputL ESatDigitOnly" ) |
|
990 if ( aText.Length() == 0 ) |
|
991 { |
|
992 if ( aGetInkey ) |
|
993 { |
|
994 textResource = R_TEXT_SIMATK_ENTER_NBR; |
|
995 } |
|
996 else |
|
997 { |
|
998 textResource = R_TEXT_SIMATK_ENTER_NBR_STRING; |
|
999 } |
|
1000 } |
|
1001 |
|
1002 // Hidden digit as input |
|
1003 if ( aHideInput ) |
|
1004 { |
|
1005 TFLOGSTRING( "CSatUiViewAppUi::GetInputL Hidden digit" ) |
|
1006 if ( aIconBitmapGetInput ) |
|
1007 { |
|
1008 resource = R_SATUI_HIDDEN_NUMBER_QUERY_WITH_LABEL_AND_ICON; |
|
1009 } |
|
1010 else |
|
1011 { |
|
1012 resource = R_SATUI_HIDDEN_NUMBER_QUERY_WITHOUT_LABEL; |
|
1013 } |
|
1014 } |
|
1015 // Normal number query |
|
1016 else |
|
1017 { |
|
1018 TFLOGSTRING( "CSatUiViewAppUi::GetInputL normal digit" ) |
|
1019 if ( aIconBitmapGetInput ) |
|
1020 { |
|
1021 resource = R_SATUI_NUMBER_QUERY_WITH_LABEL_AND_ICON; |
|
1022 } |
|
1023 else |
|
1024 { |
|
1025 resource = R_SATUI_NUMBER_QUERY_WITHOUT_LABEL; |
|
1026 } |
|
1027 } |
|
1028 } |
|
1029 |
|
1030 else // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet |
|
1031 { |
|
1032 TFLOGSTRING( "CSatUiViewAppUi::GetInputL ESatCharSmsDefaultAlphabet \ |
|
1033 or ESatCharUcs2Alphabet" ) |
|
1034 if ( aText.Length() == 0 ) |
|
1035 { |
|
1036 if ( aGetInkey ) |
|
1037 { |
|
1038 textResource = R_TEXT_SIMATK_ENTER_CHAR; |
|
1039 } |
|
1040 else |
|
1041 { |
|
1042 textResource = R_TEXT_SIMATK_ENTER_CHAR_STRING; |
|
1043 } |
|
1044 } |
|
1045 |
|
1046 if ( !aGetInkey ) |
|
1047 { |
|
1048 iGetInputDialog->SetPredictiveTextInputPermitted( ETrue ); |
|
1049 } |
|
1050 |
|
1051 iGetInputDialog->SetMaxLength( maxLength ); |
|
1052 |
|
1053 if ( aIconBitmapGetInput ) |
|
1054 { |
|
1055 resource = R_SATUI_TEXT_QUERY_WITH_LABEL_AND_ICON; |
|
1056 } |
|
1057 else |
|
1058 { |
|
1059 resource = R_SATUI_TEXT_QUERY_WITHOUT_LABEL; |
|
1060 } |
|
1061 } |
|
1062 |
|
1063 // Read default text if sim doesn't provide text to dialog |
|
1064 if ( aText.Length() == 0 ) |
|
1065 { |
|
1066 // Reads a resource string with memory allocation |
|
1067 // and pushes the string onto the cleanup stack. |
|
1068 textHolder = StringLoader::LoadLC( textResource, iCoeEnv); |
|
1069 textPtr.Set( *textHolder ); |
|
1070 } |
|
1071 |
|
1072 // Icon is used and command is get input |
|
1073 if ( aIconBitmapGetInput ) |
|
1074 { |
|
1075 TFLOGSTRING( "CSatUiViewAppUi::GetInputL icon is used" ) |
|
1076 iGetInputDialog->PrepareLC( resource ); |
|
1077 if ( !aSelfExplanatory ) |
|
1078 { |
|
1079 // Icon is not self-explanatory, show also text |
|
1080 iGetInputDialog->SetPromptL( textPtr ); |
|
1081 } |
|
1082 // Add icon to query |
|
1083 iGetInputDialog->QueryHeading()->SetHeaderImageL( image ); |
|
1084 // Set MSK same as LSK without any text causing the icon drawing |
|
1085 iGetInputDialog->ButtonGroupContainer().SetCommandL( |
|
1086 CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknSoftkeyOk, |
|
1087 KSatEmptyDes ); |
|
1088 userResponse = iGetInputDialog->RunLD(); |
|
1089 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL userResponse is: %d", |
|
1090 userResponse ) |
|
1091 } |
|
1092 // No icon in use |
|
1093 else |
|
1094 { |
|
1095 TFLOGSTRING( "CSatUiViewAppUi::GetInputL icon isn't used" ) |
|
1096 iGetInputDialog->PrepareLC( resource ); |
|
1097 iGetInputDialog->SetPromptL( textPtr ); |
|
1098 // Set MSK same as LSK without any text causing the icon drawing |
|
1099 iGetInputDialog->ButtonGroupContainer().SetCommandL( |
|
1100 CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknSoftkeyOk, |
|
1101 KSatEmptyDes ); |
|
1102 userResponse = iGetInputDialog->RunLD(); |
|
1103 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL userResponse is: %d", |
|
1104 userResponse ) |
|
1105 } |
|
1106 iForegroundControl = NULL; |
|
1107 |
|
1108 if ( textHolder ) |
|
1109 { |
|
1110 CleanupStack::PopAndDestroy( textHolder ); |
|
1111 } |
|
1112 |
|
1113 if ( aDuration && aGetInkey ) |
|
1114 { |
|
1115 TTime endTime; |
|
1116 endTime.HomeTime(); |
|
1117 TTimeIntervalMicroSeconds timeDifference( 0 ); |
|
1118 timeDifference = endTime.MicroSecondsFrom( startTime ); |
|
1119 aDuration = timeDifference.Int64() / KMicroSecondsInTenthOfSecond; |
|
1120 |
|
1121 // After duration call back timer is destroyed |
|
1122 DestroyCallBackTimer(); |
|
1123 } |
|
1124 |
|
1125 CleanupStack::PopAndDestroy( image ); |
|
1126 CleanupStack::PopAndDestroy( activityManager ); // image, activityManager |
|
1127 iGetInputDialog = NULL; |
|
1128 |
|
1129 if ( iNoResponseFromUserAfterDelay ) |
|
1130 { |
|
1131 TFLOGSTRING( "CSatUiViewAppUi::GetInputL no response from user" ) |
|
1132 response = ESatNoResponseFromUser; |
|
1133 } |
|
1134 else if ( userResponse ) |
|
1135 { |
|
1136 TFLOGSTRING( "CSatUiViewAppUi::GetInputL successful response" ) |
|
1137 if ( inputPtr.Length() ) |
|
1138 { |
|
1139 aInput.Copy( inputPtr ); |
|
1140 } |
|
1141 response = ESatSuccess; |
|
1142 } |
|
1143 else |
|
1144 { |
|
1145 if ( IsAppShutterRunning() ) |
|
1146 { |
|
1147 TFLOGSTRING( "CSatUiViewAppUi::GetInputL satsession \ |
|
1148 terminated by user " ) |
|
1149 response = ESatSessionTerminatedByUser; |
|
1150 iSessionTerminated = ETrue; |
|
1151 } |
|
1152 else |
|
1153 { |
|
1154 TFLOGSTRING( "CSatUiViewAppUi::GetInputL backward \ |
|
1155 requested by user " ) |
|
1156 response = ESatBackwardModeRequestedByUser; |
|
1157 } |
|
1158 } |
|
1159 |
|
1160 iNoResponseFromUserAfterDelay = EFalse; |
|
1161 |
|
1162 CleanupStack::PopAndDestroy( input ); // input |
|
1163 |
|
1164 ShowWaitNoteL(); |
|
1165 |
|
1166 TFLOGSTRING2( "CSatUiViewAppUi::GetInputL exit, return: %d", response ) |
|
1167 return response; |
|
1168 } |
|
1169 |
|
1170 // --------------------------------------------------------- |
|
1171 // CSatUiViewAppUi::SetUpMenuL |
|
1172 // Sets the parameters for SetUpMenu view and calls the method |
|
1173 // from the CSatUiView class. |
|
1174 // (other items were commented in a header). |
|
1175 // --------------------------------------------------------- |
|
1176 // |
|
1177 TSatUiResponse CSatUiViewAppUi::SetUpMenuL( |
|
1178 const TDesC& aText, |
|
1179 const MDesCArray& aMenuItems, |
|
1180 const CArrayFixFlat<TSatAction>* aMenuItemNextActions, |
|
1181 const CFbsBitmap* aIconBitmap, |
|
1182 const CAknIconArray* aItemsIconArray, |
|
1183 const TBool aSelfExplanatoryItems, |
|
1184 const TBool aHelpIsAvailable ) |
|
1185 { |
|
1186 TFLOGSTRING( "CSatUiViewAppUi::SetUpMenuL called" ) |
|
1187 StopShowWaitNote(); |
|
1188 TSatUiResponse response( ESatSuccess ); |
|
1189 |
|
1190 delete iTitle; |
|
1191 iTitle = NULL; |
|
1192 |
|
1193 delete iAppName; |
|
1194 iAppName = NULL; |
|
1195 |
|
1196 TFLOGSTRING2( "CSatUiViewAppUi::SetUpMenuL length of aText %d", \ |
|
1197 aText.Length() ) |
|
1198 if ( aText.Length() > 0 ) |
|
1199 { |
|
1200 iTitle = aText.AllocL(); |
|
1201 iAppName = aText.AllocL(); |
|
1202 } |
|
1203 else |
|
1204 { |
|
1205 //Reads a resource string with memory allocation |
|
1206 iTitle = StringLoader::LoadL( R_QTN_SAT_TITLE, iCoeEnv ); |
|
1207 } |
|
1208 |
|
1209 if ( iSetUpMenuFirst ) |
|
1210 { |
|
1211 iSetUpMenuFirst = EFalse; |
|
1212 iSetUpMenuView = CSatUiView::NewL( ETrue, this, EFalse ); |
|
1213 |
|
1214 // transfer ownership to CAknViewAppUi: |
|
1215 AddViewL( iSetUpMenuView ); |
|
1216 |
|
1217 iSetUpMenuView->SetAdapter( iAdapter ); |
|
1218 } |
|
1219 |
|
1220 // Make list box visible. |
|
1221 iSetUpMenuView->MakeListBoxVisible( ETrue ); |
|
1222 |
|
1223 //set contextpane icon and item icons |
|
1224 iSetUpMenuView->SetIconL( aIconBitmap ); |
|
1225 iSetUpMenuView->SetItemsIconL( aItemsIconArray, aSelfExplanatoryItems ); |
|
1226 iSetUpMenuView->SetTitle( iTitle ); |
|
1227 |
|
1228 response = iSetUpMenuView->SetUpMenuL( iTitle, aMenuItems, |
|
1229 aMenuItemNextActions, aHelpIsAvailable ); |
|
1230 |
|
1231 iActiveView = KSetUpMenuViewId; |
|
1232 |
|
1233 // Reset counter for detecting possible loop in HandleForegroundEventL. |
|
1234 iViewLoopCounter = 0; |
|
1235 |
|
1236 TFLOGSTRING2( "CSatUiViewAppUi::SetUpMenuL exit, return: %d", response ) |
|
1237 return response; |
|
1238 } |
|
1239 |
|
1240 // --------------------------------------------------------- |
|
1241 // CSatUiViewAppUi::HandleForegroundEventL |
|
1242 // Called when satui is brought to foreground or put into |
|
1243 // background |
|
1244 // (other items were commented in a header). |
|
1245 // --------------------------------------------------------- |
|
1246 // |
|
1247 void CSatUiViewAppUi::HandleForegroundEventL( TBool aForeground ) |
|
1248 { |
|
1249 TFLOGSTRING2( "CSatUiViewAppUi::HandleForegroundEventL called \ |
|
1250 value %d", aForeground ) |
|
1251 |
|
1252 iForeground = aForeground; |
|
1253 |
|
1254 // Check whether it is only need to display a dialog. |
|
1255 if ( iForeground && ( iForegroundControl || iCcNote ) ) |
|
1256 { |
|
1257 TFLOGSTRING( "CSatUiViewAppUi::HandleForegroundEventL \ |
|
1258 need to display a dialog" ) |
|
1259 if ( iForegroundControl ) |
|
1260 { |
|
1261 iForegroundControl->SetFocus( ETrue, EDrawNow ); |
|
1262 } |
|
1263 } |
|
1264 // Check is it allowed to activate local view. |
|
1265 // Removes possibility of view activation loop for example when |
|
1266 // launching Browser. |
|
1267 else if ( ViewActivationAllowed( aForeground, iActiveView ) ) |
|
1268 { |
|
1269 TFLOGSTRING( "CSatUiViewAppUi::HandleForegroundEventL \ |
|
1270 activate local view allowed" ) |
|
1271 TVwsViewId viewId; |
|
1272 GetActiveViewId( viewId ); |
|
1273 TFLOGSTRING2( "CSatUiViewAppUi::HandleForegroundEventL called \ |
|
1274 appUid %x", viewId.iAppUid ) |
|
1275 TFLOGSTRING2( "CSatUiViewAppUi::HandleForegroundEventL called \ |
|
1276 viewUid %x", viewId.iViewUid ) |
|
1277 |
|
1278 if( ( KUidSATUI != viewId.iAppUid ) || |
|
1279 ( ( KUidSATUI == viewId.iAppUid ) |
|
1280 && ( viewId.iViewUid != iActiveView ) ) ) |
|
1281 { |
|
1282 TFLOGSTRING( "CSatUiViewAppUi::HandleForegroundEventL \ |
|
1283 activate local view executing" ) |
|
1284 if ( KSetUpMenuViewId == iActiveView ) |
|
1285 { |
|
1286 ActivateLocalViewL( KSetUpMenuViewId ); |
|
1287 } |
|
1288 else |
|
1289 { |
|
1290 ActivateLocalViewL( KSelectItemViewId ); |
|
1291 } |
|
1292 } |
|
1293 |
|
1294 } |
|
1295 // Forwards event to the base class. |
|
1296 CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
1297 TFLOGSTRING( "CSatUiViewAppUi::HandleForegroundEventL exit" ) |
|
1298 } |
|
1299 |
|
1300 // --------------------------------------------------------- |
|
1301 // CSatUiViewAppUi::ViewActivationAllowed |
|
1302 // Sets the parameters for SelectItem view and calls the method |
|
1303 // from the CSatUiView class. |
|
1304 // (other items were commented in a header). |
|
1305 // --------------------------------------------------------- |
|
1306 // |
|
1307 TBool CSatUiViewAppUi::ViewActivationAllowed( const TBool aForeground, |
|
1308 const TUid aActiveView ) |
|
1309 { |
|
1310 |
|
1311 TFLOGSTRING( "CSatUiViewAppUi::ViewActivationAllowed called" ) |
|
1312 TBool activationAllowed( EFalse ); |
|
1313 // Value for detecting view activation loop. |
|
1314 const TInt certainViewLoopCount( 6 ); |
|
1315 |
|
1316 // Check for foreground event, background event, |
|
1317 // foreground event, background event, ... sequence. |
|
1318 if ( aForeground ^ iPreviousForeground ) |
|
1319 { |
|
1320 TFLOGSTRING( "CSatUiViewAppUi::ViewActivationAllowed \ |
|
1321 check foreground event" ) |
|
1322 iViewLoopCounter++; |
|
1323 } |
|
1324 else |
|
1325 { |
|
1326 TFLOGSTRING( "CSatUiViewAppUi::ViewActivationAllowed \ |
|
1327 no foreground event" ) |
|
1328 iViewLoopCounter = 0; |
|
1329 } |
|
1330 |
|
1331 // Store information is application in foreground or |
|
1332 // in background for next evaluation round. |
|
1333 iPreviousForeground = aForeground; |
|
1334 |
|
1335 // Check that there is no loop. |
|
1336 if ( aForeground && aActiveView.iUid ) |
|
1337 { |
|
1338 if ( iViewLoopCounter < certainViewLoopCount ) |
|
1339 { |
|
1340 TFLOGSTRING( "CSatUiViewAppUi::ViewActivationAllowed \ |
|
1341 there are loops" ) |
|
1342 activationAllowed = ETrue; |
|
1343 } |
|
1344 else |
|
1345 { |
|
1346 TFLOGSTRING( "CSatUiViewAppUi::ViewActivationAllowed \ |
|
1347 no loop" ) |
|
1348 // Counter is reset in case of foreground event |
|
1349 // because of background event does not draw anything. |
|
1350 iViewLoopCounter = 0; |
|
1351 } |
|
1352 |
|
1353 } |
|
1354 |
|
1355 if ( iDisplayTextDialog || iDisplayTextIconDialog ) |
|
1356 { |
|
1357 activationAllowed = EFalse; |
|
1358 } |
|
1359 |
|
1360 TFLOGSTRING2( "CSatUiViewAppUi::ViewActivationAllowed exit, return: %d",\ |
|
1361 activationAllowed ) |
|
1362 return activationAllowed; |
|
1363 |
|
1364 } |
|
1365 |
|
1366 // --------------------------------------------------------- |
|
1367 // CSatUiViewAppUi::SelectItemL |
|
1368 // Sets the parameters for SelectItem view and calls the method |
|
1369 // from the CSatUiView class. |
|
1370 // (other items were commented in a header). |
|
1371 // --------------------------------------------------------- |
|
1372 // |
|
1373 TSatUiResponse CSatUiViewAppUi::SelectItemL( |
|
1374 const TDesC& aText, |
|
1375 const MDesCArray& aMenuItems, |
|
1376 const CArrayFixFlat<TSatAction>* aMenuItemNextActions, |
|
1377 const TInt aDefaultItem, |
|
1378 TUint8& aSelection, |
|
1379 const CFbsBitmap* aIconBitmap, |
|
1380 const CAknIconArray* aItemsIconArray, |
|
1381 const TBool aSelfExplanatoryItems, |
|
1382 const TBool aHelpIsAvailable ) |
|
1383 { |
|
1384 TFLOGSTRING( "CSatUiViewAppUi::SelectItemL called" ) |
|
1385 StopShowWaitNote(); |
|
1386 |
|
1387 TSatUiResponse response( ESatSuccess ); |
|
1388 |
|
1389 delete iTitle; |
|
1390 iTitle = NULL; |
|
1391 |
|
1392 TFLOGSTRING2( "CSatUiViewAppUi::SelectItemL length of aText %d", |
|
1393 aText.Length() ) |
|
1394 if ( aText.Length() > 0 ) |
|
1395 { |
|
1396 iTitle = aText.AllocL(); |
|
1397 } |
|
1398 else if ( iAppName ) |
|
1399 { |
|
1400 TFLOGSTRING( "CSatUiViewAppUi::SelectItemL there is appname" ) |
|
1401 iTitle = iAppName->AllocL(); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 TFLOGSTRING( "CSatUiViewAppUi::SelectItemL read appname" ) |
|
1406 //Reads a resource string with memory allocation |
|
1407 iTitle = StringLoader::LoadL( R_QTN_SAT_TITLE, iCoeEnv ); |
|
1408 } |
|
1409 |
|
1410 if ( iSelectItemFirst ) |
|
1411 { |
|
1412 iSelectItemFirst = EFalse; |
|
1413 iSelectItemView = CSatUiView::NewL( EFalse, this, EFalse ); |
|
1414 |
|
1415 // transfer ownership to CAknViewAppUi: |
|
1416 AddViewL( iSelectItemView ); |
|
1417 } |
|
1418 |
|
1419 iSelectItemPending = ETrue; |
|
1420 iActiveView = KSelectItemViewId; |
|
1421 |
|
1422 //set contextpane icon and item icons |
|
1423 iSelectItemView->SetIconL( aIconBitmap ); |
|
1424 iSelectItemView->SetItemsIconL( aItemsIconArray, aSelfExplanatoryItems ); |
|
1425 response = iSelectItemView->SelectItemL( iTitle, aMenuItems, |
|
1426 aMenuItemNextActions, aDefaultItem, aSelection, aHelpIsAvailable ); |
|
1427 |
|
1428 iSelectItemPending = EFalse; |
|
1429 |
|
1430 if ( iEndKeyPressed ) |
|
1431 { |
|
1432 response = ESatSessionTerminatedByUser; |
|
1433 } |
|
1434 |
|
1435 if ( response != ESatSessionTerminatedByUser ) |
|
1436 { |
|
1437 ShowWaitNoteL(); |
|
1438 } |
|
1439 |
|
1440 TFLOGSTRING2( "CSatUiViewAppUi::SelectItemL exit, return: %d", response ) |
|
1441 return response; |
|
1442 } |
|
1443 |
|
1444 // --------------------------------------------------------- |
|
1445 // CSatUiViewAppUi::MatoPrepareComplete |
|
1446 // Indicates success or failure. |
|
1447 // (other items were commented in a header). |
|
1448 // --------------------------------------------------------- |
|
1449 // |
|
1450 void CSatUiViewAppUi::MatoPrepareComplete(TInt aError) |
|
1451 { |
|
1452 TFLOGSTRING( "CSatUiViewAppUi::MatoPrepareComplete called" ) |
|
1453 TFLOGSTRING2( "CSatUiViewAppUi::MatoPrepareComplete error %i", aError ) |
|
1454 if ( KErrNone == aError ) |
|
1455 { |
|
1456 iPlayToneError = ESatSuccess; |
|
1457 |
|
1458 TTimeIntervalMicroSeconds zero( static_cast<TInt64>( 0 ) ); |
|
1459 |
|
1460 iPlayer->SetPriority( KAudioPriorityLowLevel, |
|
1461 STATIC_CAST( TMdaPriorityPreference, KAudioPrefConfirmation ) ); |
|
1462 |
|
1463 iPlayer->SetRepeats( KMdaAudioToneRepeatForever, zero ); |
|
1464 |
|
1465 iPlayer->Play(); |
|
1466 } |
|
1467 else |
|
1468 { |
|
1469 iPlayToneError = ESatFailure; |
|
1470 } |
|
1471 TFLOGSTRING( "CSatUiViewAppUi::MatoPrepareComplete exit" ) |
|
1472 } |
|
1473 |
|
1474 // --------------------------------------------------------- |
|
1475 // CSatUiViewAppUi::MatoPlayComplete |
|
1476 // Indicates success or failure. |
|
1477 // (other items were commented in a header). |
|
1478 // --------------------------------------------------------- |
|
1479 // |
|
1480 void CSatUiViewAppUi::MatoPlayComplete( TInt aError ) |
|
1481 { |
|
1482 TFLOGSTRING( "CSatUiViewAppUi::MatoPlayComplete calling" ) |
|
1483 if ( KErrNone == aError && iPlayer ) |
|
1484 { |
|
1485 TFLOGSTRING( "CSatUiViewAppUi::MatoPlayComplete play" ) |
|
1486 iPlayer->Play(); |
|
1487 } |
|
1488 else if ( iWait && iWait->IsStarted() ) |
|
1489 { |
|
1490 TFLOGSTRING( "CSatUiViewAppUi::MatoPlayComplete stop playing" ) |
|
1491 // Stops playing if error. |
|
1492 iWait->AsyncStop(); |
|
1493 } |
|
1494 TFLOGSTRING2( "CSatUiViewAppUi::MatoPlayComplete exit, error %i", aError ) |
|
1495 } |
|
1496 |
|
1497 // --------------------------------------------------------- |
|
1498 // CSatUiViewAppUi::PlayStandardToneL |
|
1499 // Plays Standard Tone. If needed displays the text in a note |
|
1500 // while playing. |
|
1501 // (other items were commented in a header). |
|
1502 // --------------------------------------------------------- |
|
1503 // |
|
1504 TSatUiResponse CSatUiViewAppUi::PlayStandardToneL( |
|
1505 const TDesC& aText, |
|
1506 const TDesC8& aSequence, |
|
1507 TTimeIntervalMicroSeconds aDuration, |
|
1508 const CFbsBitmap* aIconBitmap, |
|
1509 const TBool aSelfExplanatory ) |
|
1510 { |
|
1511 TFLOGSTRING( "CSatUiViewAppUi::PlayStandardToneL called" ) |
|
1512 StopShowWaitNote(); |
|
1513 // Delete timer just in case e.g. if DisplayText was on the screen |
|
1514 DestroyCallBackTimer(); |
|
1515 |
|
1516 iPermanentNote = NULL; |
|
1517 iTimerRepeatOn = EFalse; |
|
1518 |
|
1519 TFLOGSTRING2( "CSatUiViewAppUi::PlayStandardToneL length of aText %i", \ |
|
1520 aText.Length() ) |
|
1521 if (aText.Length() != 0) |
|
1522 { |
|
1523 iPermanentNote = new (ELeave) CAknStaticNoteDialog(); |
|
1524 iPermanentNote->PrepareLC( R_SATUI_PERMANENT_NOTE ); |
|
1525 |
|
1526 if ( ( !aSelfExplanatory ) || ( !aIconBitmap ) ) |
|
1527 { |
|
1528 // Set text |
|
1529 iPermanentNote->SetTextL( aText ); |
|
1530 } |
|
1531 |
|
1532 if ( aIconBitmap ) |
|
1533 { |
|
1534 //Set image |
|
1535 TFLOGSTRING( "CSatUiViewAppUi::PlayStandardToneL SetImage" ) |
|
1536 // Get scalable bitmap if available. |
|
1537 CEikImage* image = new ( ELeave ) CEikImage(); |
|
1538 CleanupStack::PushL( image ); |
|
1539 image->SetBitmap( aIconBitmap ); |
|
1540 iPermanentNote->SetImageL( image ); |
|
1541 CleanupStack::Pop( image ); |
|
1542 } |
|
1543 |
|
1544 iForegroundControl = iPermanentNote; |
|
1545 iPermanentNote->RunLD(); |
|
1546 iPermanentNote->DrawNow(); |
|
1547 iCoeEnv->WsSession().Flush(); |
|
1548 } |
|
1549 |
|
1550 iPlayer = CMdaAudioToneUtility::NewL(*this); |
|
1551 |
|
1552 TInt volume( iPlayer->MaxVolume() ); |
|
1553 iPlayer->SetVolume( volume ); |
|
1554 |
|
1555 iPlayer->PrepareToPlayDesSequence( aSequence ); |
|
1556 |
|
1557 TTimeIntervalMicroSeconds max32Bit( |
|
1558 static_cast<TInt64>( K32TIntMaxValue ) ); |
|
1559 |
|
1560 if ( aDuration > max32Bit ) |
|
1561 { |
|
1562 // since timers can only handle 32-bit values, |
|
1563 // let's break the aDuration to smaller bits. |
|
1564 // we break it here to 8 bits to fit in 32-bit value |
|
1565 aDuration = aDuration.Int64() / KDivideByEight; |
|
1566 iTimerRepeatOn = ETrue; |
|
1567 } |
|
1568 |
|
1569 CreateCallBackTimerL( I64INT( aDuration.Int64() ), DelayCallback ); |
|
1570 |
|
1571 if ( !iWait->IsStarted() ) |
|
1572 { |
|
1573 TFLOGSTRING( "CSatUiViewAppUi::PlayStandardToneL starting iWait" ) |
|
1574 iWait->Start(); |
|
1575 TFLOGSTRING( "CSatUiViewAppUi::PlayStandardToneL strarting done" ) |
|
1576 } |
|
1577 |
|
1578 iPlayer->CancelPlay(); |
|
1579 |
|
1580 DestroyCallBackTimer(); |
|
1581 |
|
1582 delete iPlayer; |
|
1583 iPlayer = NULL; |
|
1584 |
|
1585 if ( iPermanentNote ) |
|
1586 { |
|
1587 iPermanentNote->ExitSleepingDialog(); |
|
1588 delete iPermanentNote; |
|
1589 iPermanentNote = NULL; |
|
1590 } |
|
1591 iForegroundControl = NULL; |
|
1592 |
|
1593 if ( !iEndKeyPressed ) |
|
1594 { |
|
1595 ShowWaitNoteL(); |
|
1596 } |
|
1597 |
|
1598 //get warning and game tones setting from active profile |
|
1599 GetProfileParamsL(); |
|
1600 |
|
1601 if( ( EFalse == iWarningAndPlayTones ) && |
|
1602 ( ESatSuccess == iPlayToneError ) ) |
|
1603 { |
|
1604 iPlayToneError = ESatSuccessToneNotPlayed; |
|
1605 } |
|
1606 |
|
1607 TFLOGSTRING2( "CSatUiViewAppUi::PlayStandardToneL exit,return: %d", \ |
|
1608 iPlayToneError ) |
|
1609 return iPlayToneError; |
|
1610 } |
|
1611 |
|
1612 // --------------------------------------------------------- |
|
1613 // CSatUiViewAppUi::ConfirmSendL |
|
1614 // Displays a query to get confirmation for Send SMS, |
|
1615 // Send SS or Send USSD command. |
|
1616 // (other items were commented in a header). |
|
1617 // --------------------------------------------------------- |
|
1618 // |
|
1619 TSatUiResponse CSatUiViewAppUi::ConfirmSendL( |
|
1620 const TDesC& /* aText */, |
|
1621 TBool& aActionAccepted, |
|
1622 TInt aType) |
|
1623 { |
|
1624 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmSendL called, aType: %d", \ |
|
1625 aType ) |
|
1626 HBufC* textHolder = NULL; |
|
1627 |
|
1628 switch ( aType ) |
|
1629 { |
|
1630 case ESatUiConfirmSendSms: |
|
1631 textHolder = StringLoader::LoadLC( R_TEXT_SIMATK_SEND_SMS, |
|
1632 iCoeEnv ); |
|
1633 break; |
|
1634 case ESatUiConfirmSendSs: |
|
1635 case ESatUiConfirmSendUssd: //the same string for SS and USSD |
|
1636 textHolder = StringLoader::LoadLC( R_TEXT_SIMATK_SEND_SS, |
|
1637 iCoeEnv ); |
|
1638 break; |
|
1639 default: |
|
1640 return ESatFailure; |
|
1641 } |
|
1642 |
|
1643 TInt userResponse = RunQueryDialogL( R_SATUI_CONFIRM_SEND_CANCEL_QUERY, |
|
1644 *textHolder, NULL, EFalse, ESatUiSoftkeySend ); |
|
1645 |
|
1646 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmSendL userResponse: %d", \ |
|
1647 userResponse ) |
|
1648 if ( userResponse ) |
|
1649 { |
|
1650 aActionAccepted = ETrue; |
|
1651 } |
|
1652 else |
|
1653 { |
|
1654 aActionAccepted = EFalse; |
|
1655 } |
|
1656 |
|
1657 if ( textHolder ) |
|
1658 { |
|
1659 CleanupStack::PopAndDestroy( textHolder ); //textHolder |
|
1660 } |
|
1661 |
|
1662 TFLOGSTRING( "CSatUiViewAppUi::ConfirmSendL return ESatSuccess" ) |
|
1663 return ESatSuccess; |
|
1664 } |
|
1665 |
|
1666 // --------------------------------------------------------- |
|
1667 // CSatUiViewAppUi::ShowSmsWaitNoteL |
|
1668 // Displays a wait note to indicate SMS sending. |
|
1669 // (other items were commented in a header). |
|
1670 // --------------------------------------------------------- |
|
1671 // |
|
1672 void CSatUiViewAppUi::ShowSmsWaitNoteL( const TDesC& aText, |
|
1673 const CFbsBitmap* aIconBitmapSendSM, |
|
1674 const TBool aSelfExplanatoryIcon ) |
|
1675 { |
|
1676 |
|
1677 TFLOGSTRING( "CSatUiViewAppUi::ShowSmsWaitNoteL called" ) |
|
1678 |
|
1679 iWaitNoteInUse = ETrue; |
|
1680 |
|
1681 TFLOGSTRING2( "CSatUiViewAppUi::ShowSmsWaitNoteL iWaitNote: %d", \ |
|
1682 iWaitNote ) |
|
1683 if ( NULL == iWaitNote ) |
|
1684 { |
|
1685 iWaitNote = new(ELeave) CAknWaitDialog( |
|
1686 ( REINTERPRET_CAST( CEikDialog**, &iWaitNote ) ), ETrue ); |
|
1687 iWaitNote->PrepareLC( R_SATUI_SMS_WAIT_NOTE ); |
|
1688 |
|
1689 if ( ( aText.Length() > 0 ) && ( !aSelfExplanatoryIcon || |
|
1690 !aIconBitmapSendSM ) ) |
|
1691 { |
|
1692 //Set text |
|
1693 TFLOGSTRING( "CSatUiViewAppUi::ShowSmsWaitNoteL SetText" ) |
|
1694 iWaitNote->SetTextL( aText ); |
|
1695 } |
|
1696 |
|
1697 if ( aIconBitmapSendSM ) |
|
1698 { |
|
1699 //Set image |
|
1700 TFLOGSTRING( "CSatUiViewAppUi::ShowSmsWaitNoteL SetImage" ) |
|
1701 CEikImage* image = new ( ELeave ) CEikImage(); |
|
1702 CleanupStack::PushL( image ); |
|
1703 image->SetBitmap( aIconBitmapSendSM ); |
|
1704 iWaitNote->SetImageL( image ); |
|
1705 CleanupStack::Pop( image ); |
|
1706 } |
|
1707 |
|
1708 iForegroundControl = iWaitNote; |
|
1709 iWaitNote->RunLD(); |
|
1710 // iForegroundControl won't be clear until the wait dialog |
|
1711 // closed. It will avoid we lose the chance to set focus for |
|
1712 // the wait dialog when the switch of foreground/background |
|
1713 // happened. |
|
1714 } |
|
1715 |
|
1716 TFLOGSTRING( "CSatUiViewAppUi::ShowSmsWaitNoteL exit" ) |
|
1717 } |
|
1718 |
|
1719 // --------------------------------------------------------- |
|
1720 // CSatUiViewAppUi::ShowSsWaitNoteL |
|
1721 // Displays a wait note to indicate SS sending. |
|
1722 // (other items were commented in a header). |
|
1723 // --------------------------------------------------------- |
|
1724 // |
|
1725 void CSatUiViewAppUi::ShowSsWaitNoteL( const TDesC& aText, |
|
1726 const CFbsBitmap* aIconBitmap, |
|
1727 const TBool aSelfExplanatoryIcon ) |
|
1728 { |
|
1729 TFLOGSTRING( "CSatUiViewAppUi::ShowSsWaitNoteL called" ) |
|
1730 |
|
1731 iWaitNoteInUse = ETrue; |
|
1732 |
|
1733 TFLOGSTRING2( "CSatUiViewAppUi::ShowSsWaitNoteL iWaitNote: %d", \ |
|
1734 iWaitNote ) |
|
1735 if ( !iWaitNote ) |
|
1736 { |
|
1737 iWaitNote = new ( ELeave ) CSatUiWaitDialog( |
|
1738 ( REINTERPRET_CAST ( CEikDialog**,&iWaitNote ) ), |
|
1739 *iAdapter, ETrue ); |
|
1740 iForegroundControl = iWaitNote; |
|
1741 |
|
1742 TFLOGSTRING2( "CSatUiViewAppUi::ShowSsWaitNoteL length of aText: %d",\ |
|
1743 aText.Length() ) |
|
1744 // if there is an alpha id |
|
1745 if ( aText.Length() > 0 ) |
|
1746 { |
|
1747 // if there is not an icon or it's not self explanatory |
|
1748 if ( ( !aSelfExplanatoryIcon ) || ( !aIconBitmap ) ) |
|
1749 { |
|
1750 iWaitNote->SetTextL( aText ); |
|
1751 } |
|
1752 |
|
1753 if ( aIconBitmap ) |
|
1754 { |
|
1755 //Set image |
|
1756 TFLOGSTRING( "CSatUiViewAppUi::ShowSsWaitNoteL SetImage" ) |
|
1757 CEikImage* image = new ( ELeave ) CEikImage(); |
|
1758 CleanupStack::PushL( image ); |
|
1759 image->SetBitmap( aIconBitmap ); |
|
1760 iWaitNote->SetImageL( image ); |
|
1761 CleanupStack::Pop( image ); |
|
1762 } |
|
1763 |
|
1764 iWaitNote->ExecuteLD( R_SATUI_SS_WAIT_NOTE ); |
|
1765 } |
|
1766 else |
|
1767 { |
|
1768 iWaitNote->ExecuteLD( R_SATUI_REQUESTING_WAIT_NOTE ); |
|
1769 } |
|
1770 // iForegroundControl won't be clear until the wait dialog |
|
1771 // closed. It will avoid we lose the chance to set focus for |
|
1772 // the wait dialog when the switch of foreground/background |
|
1773 // happened. |
|
1774 } |
|
1775 TFLOGSTRING( "CSatUiViewAppUi::ShowSsWaitNoteL exit" ) |
|
1776 } |
|
1777 |
|
1778 // --------------------------------------------------------- |
|
1779 // CSatUiViewAppUi::ShowDtmfWaitNoteL |
|
1780 // Shows a wait note while DTMF are being sent. |
|
1781 // (other items were commented in a header). |
|
1782 // --------------------------------------------------------- |
|
1783 // |
|
1784 TSatUiResponse CSatUiViewAppUi::ShowDtmfWaitNoteL( const TDesC& aText, |
|
1785 const CFbsBitmap* aIconBitmap, |
|
1786 const TBool aSelfExplanatoryIcon ) |
|
1787 { |
|
1788 TFLOGSTRING( "CSatUiViewAppUi::ShowDtmfWaitNoteL called" ) |
|
1789 TSatUiResponse response(ESatFailure); |
|
1790 |
|
1791 iWaitNoteInUse = ETrue; |
|
1792 |
|
1793 TFLOGSTRING2( "CSatUiViewAppUi::ShowDtmfWaitNoteL iWaitNote: %d", \ |
|
1794 iWaitNote ) |
|
1795 if ( !iWaitNote ) |
|
1796 { |
|
1797 iWaitNote = new ( ELeave ) CSatUiWaitDialog( |
|
1798 (REINTERPRET_CAST( CEikDialog**,&iWaitNote ) ), *iAdapter, ETrue ); |
|
1799 |
|
1800 if ( ( aText.Length() > 0 ) && |
|
1801 ( ( !aSelfExplanatoryIcon ) || ( !aIconBitmap ) ) ) |
|
1802 { |
|
1803 iWaitNote->SetTextL( aText ); |
|
1804 } |
|
1805 |
|
1806 if ( aIconBitmap ) |
|
1807 { |
|
1808 //Set image |
|
1809 TFLOGSTRING( "CSatUiViewAppUi::ShowDtmfWaitNoteL SetImage" ) |
|
1810 CEikImage* image = new ( ELeave ) CEikImage(); |
|
1811 CleanupStack::PushL( image ); |
|
1812 image->SetBitmap( aIconBitmap ); |
|
1813 iWaitNote->SetImageL( image ); |
|
1814 CleanupStack::Pop( image ); |
|
1815 } |
|
1816 |
|
1817 iForegroundControl = iWaitNote; |
|
1818 iWaitNote->ExecuteLD( R_SATUI_DTMF_WAIT_NOTE ); |
|
1819 // iForegroundControl won't be clear until the wait dialog |
|
1820 // closed. It will avoid we lose the chance to set focus for |
|
1821 // the wait dialog when the switch of foreground/background |
|
1822 // happened. |
|
1823 response = ESatSuccess; |
|
1824 } |
|
1825 TFLOGSTRING2( "CSatUiViewAppUi::ShowDtmfWaitNoteL exit, return: %d",\ |
|
1826 response ) |
|
1827 return response; |
|
1828 } |
|
1829 |
|
1830 // --------------------------------------------------------- |
|
1831 // CSatUiViewAppUi::ConfirmRefreshL |
|
1832 // Displays a query to get confirmation Refresh command. |
|
1833 // (other items were commented in a header). |
|
1834 // --------------------------------------------------------- |
|
1835 // |
|
1836 TSatUiResponse CSatUiViewAppUi::ConfirmRefreshL(TBool& aActionAccepted) |
|
1837 { |
|
1838 TFLOGSTRING( "CSatUiViewAppUi::ConfirmRefreshL called" ) |
|
1839 StopShowWaitNote(); |
|
1840 |
|
1841 TSatUiResponse response( ESatSuccess ); |
|
1842 |
|
1843 HBufC* textHolder = NULL; |
|
1844 |
|
1845 textHolder = StringLoader::LoadLC( R_QTN_SAT_QUERY_ALLOW_RESET, |
|
1846 iCoeEnv ); |
|
1847 |
|
1848 TInt userResponse = RunQueryDialogL( R_SATUI_CONFIRM_OK_CANCEL_QUERY, |
|
1849 *textHolder, NULL, EFalse, EAknSoftkeyOk ); |
|
1850 |
|
1851 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmRefreshL userResponse: %d", \ |
|
1852 userResponse ) |
|
1853 if ( userResponse ) |
|
1854 { |
|
1855 aActionAccepted = ETrue; |
|
1856 } |
|
1857 else |
|
1858 { |
|
1859 aActionAccepted = EFalse; |
|
1860 } |
|
1861 |
|
1862 if ( textHolder ) |
|
1863 { |
|
1864 CleanupStack::PopAndDestroy( textHolder ); //textHolder |
|
1865 } |
|
1866 |
|
1867 ShowWaitNoteL(); |
|
1868 |
|
1869 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmRefreshL exit, return: %d",\ |
|
1870 response ) |
|
1871 return response; |
|
1872 } |
|
1873 |
|
1874 // --------------------------------------------------------- |
|
1875 // CSatUiViewAppUi::CallControlL |
|
1876 // Displays info about call control to user |
|
1877 // (other items were commented in a header). |
|
1878 // --------------------------------------------------------- |
|
1879 // |
|
1880 TSatUiResponse CSatUiViewAppUi::CallControlL( |
|
1881 const TDesC& aText, |
|
1882 const TSatAlphaIdStatus aAlphaIdStatus ) |
|
1883 { |
|
1884 TFLOGSTRING( "CSatUiViewAppUi::CallControlL called" ) |
|
1885 |
|
1886 if ( !iCcNote ) |
|
1887 { |
|
1888 iCcNote = CAknGlobalNote::NewL(); |
|
1889 } |
|
1890 iCcNote->SetTone( CAknNoteDialog::ENoTone ); |
|
1891 |
|
1892 if ( ESatAlphaIdNotNull == aAlphaIdStatus ) |
|
1893 { |
|
1894 TFLOGSTRING( "CSatUiViewAppUi::CallControlL AlphaIdNotNull" ) |
|
1895 |
|
1896 // The note will be disabled by the phone UI when the call is |
|
1897 // in connecting status. But call controll case is an exception, So we |
|
1898 // use RAknKeyLock to enable soft notifications. |
|
1899 RAknKeyLock keyLock; |
|
1900 TInt errorCode = keyLock.Connect(); |
|
1901 TFLOGSTRING2( "CSatUiViewAppUi::CallControlL connect error %d", \ |
|
1902 errorCode ) |
|
1903 if ( KErrNone == errorCode ) |
|
1904 { |
|
1905 keyLock.EnableSoftNotifications( ETrue ); |
|
1906 } |
|
1907 keyLock.Close(); |
|
1908 |
|
1909 iCcNote->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
1910 iCcNoteId = iCcNote->ShowNoteL( |
|
1911 EAknGlobalInformationNote, aText ); |
|
1912 CreateCallBackTimerL( K3Seconds, CloseCallControlNoteL ); |
|
1913 if ( iWait && !iWait->IsStarted() ) |
|
1914 { |
|
1915 TFLOGSTRING( "CSatUiViewAppUi::CallControlL iWait starting" ) |
|
1916 iWait->Start(); |
|
1917 } |
|
1918 DestroyCallBackTimer(); |
|
1919 } |
|
1920 else |
|
1921 { |
|
1922 TFLOGSTRING( "CSatUiViewAppUi::CallControlL AlphaId Null" ) |
|
1923 iCcNote->ShowNoteL( EAknGlobalInformationNote, aText ); |
|
1924 } |
|
1925 |
|
1926 if ( iCcNote ) |
|
1927 { |
|
1928 delete iCcNote; |
|
1929 iCcNote = NULL; |
|
1930 } |
|
1931 TFLOGSTRING( "CSatUiViewAppUi::CallControlL exit" ) |
|
1932 |
|
1933 return ESatSuccess; |
|
1934 } |
|
1935 |
|
1936 // --------------------------------------------------------- |
|
1937 // CSatUiViewAppUi::MoSmControlL |
|
1938 // Displays info about Mo SM control to user |
|
1939 // (other items were commented in a header). |
|
1940 // --------------------------------------------------------- |
|
1941 // |
|
1942 TSatUiResponse CSatUiViewAppUi::MoSmControlL( |
|
1943 const TDesC& aText, |
|
1944 const TSatAlphaIdStatus aAlphaIdStatus ) |
|
1945 { |
|
1946 TFLOGSTRING( "CSatUiViewAppUi::MoSmControlL called" ) |
|
1947 if ( ESatAlphaIdNotNull == aAlphaIdStatus ) |
|
1948 { |
|
1949 TFLOGSTRING( "CSatUiViewAppUi::MoSmControlL AlphaIdNotNull" ) |
|
1950 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
|
1951 REINTERPRET_CAST( CEikDialog**,&dialog ), |
|
1952 CAknNoteDialog::ENoTone, |
|
1953 CAknNoteDialog::ELongTimeout ); |
|
1954 |
|
1955 dialog->PrepareLC( R_SATUI_MOSM_CONTROL_NOTE ); |
|
1956 |
|
1957 dialog->SetTextL( aText ); |
|
1958 |
|
1959 iForegroundControl = dialog; |
|
1960 dialog->RunLD(); |
|
1961 } |
|
1962 else |
|
1963 { |
|
1964 TFLOGSTRING( "CSatUiViewAppUi::MoSmControlL AlphaId Null" ) |
|
1965 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
|
1966 REINTERPRET_CAST( CEikDialog**,&dialog ), |
|
1967 CAknNoteDialog::ENoTone, |
|
1968 CAknNoteDialog::ELongTimeout ); |
|
1969 |
|
1970 dialog->PrepareLC( R_SATUI_INFORMATION_NOTE ); |
|
1971 |
|
1972 dialog->SetTextL( aText ); |
|
1973 |
|
1974 iForegroundControl = dialog; |
|
1975 dialog->RunLD(); |
|
1976 } |
|
1977 iForegroundControl = NULL; |
|
1978 TFLOGSTRING( "CSatUiViewAppUi::MoSmControlL exit" ) |
|
1979 return ESatSuccess; |
|
1980 } |
|
1981 |
|
1982 // --------------------------------------------------------- |
|
1983 // CSatUiViewAppUi::ConfirmLaunchBrowserL |
|
1984 // Displays a query to get confirmation for Launch Browser |
|
1985 // (other items were commented in a header). |
|
1986 // --------------------------------------------------------- |
|
1987 // |
|
1988 void CSatUiViewAppUi::ConfirmLaunchBrowserL( |
|
1989 const TDesC& aText, |
|
1990 TBool& aActionAccepted, |
|
1991 const CFbsBitmap* aIconBitmap, |
|
1992 const TBool aSelfExplanatory ) |
|
1993 { |
|
1994 TFLOGSTRING( "CSatUiViewAppUi::ConfirmLaunchBrowserL called" ) |
|
1995 |
|
1996 TInt resource( 0 ); |
|
1997 |
|
1998 if ( aIconBitmap ) |
|
1999 { |
|
2000 TFLOGSTRING( "CSatUiViewAppUi::ConfirmLaunchBrowserL icon" ) |
|
2001 resource = R_SATUI_CONFIRM_OK_CANCEL_QUERY_WITH_ICON; |
|
2002 } |
|
2003 else |
|
2004 { |
|
2005 TFLOGSTRING( "CSatUiViewAppUi::ConfirmLaunchBrowserL no icon" ) |
|
2006 resource = R_SATUI_CONFIRM_OK_CANCEL_QUERY; |
|
2007 } |
|
2008 |
|
2009 TInt userResponse = RunQueryDialogL( resource, aText, aIconBitmap, |
|
2010 aSelfExplanatory, EAknSoftkeyOk ); |
|
2011 |
|
2012 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmLaunchBrowserL userResponse %d",\ |
|
2013 userResponse ) |
|
2014 if ( userResponse ) |
|
2015 { |
|
2016 aActionAccepted = ETrue; |
|
2017 } |
|
2018 else |
|
2019 { |
|
2020 aActionAccepted = EFalse; |
|
2021 } |
|
2022 |
|
2023 TFLOGSTRING( "CSatUiViewAppUi::ConfirmLaunchBrowserL exit" ) |
|
2024 } |
|
2025 |
|
2026 // --------------------------------------------------------- |
|
2027 // CSatUiViewAppUi::HandleCommandL |
|
2028 // Called by CSatUiView::HandleCommandL. |
|
2029 // (other items were commented in a header). |
|
2030 // --------------------------------------------------------- |
|
2031 // |
|
2032 void CSatUiViewAppUi::HandleCommandL( |
|
2033 TInt aCommand ) |
|
2034 { |
|
2035 TFLOGSTRING2( "CSatUiViewAppUi::HandleCommandL called, aCommand: %d",\ |
|
2036 aCommand ) |
|
2037 switch ( aCommand ) |
|
2038 { |
|
2039 case EEikCmdExit: |
|
2040 { |
|
2041 HandleExitCommandL(); |
|
2042 break; |
|
2043 } |
|
2044 case EAknCmdHelp: |
|
2045 { |
|
2046 //Show Series 60 Help |
|
2047 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
2048 AppHelpContextL() ); |
|
2049 break; |
|
2050 } |
|
2051 default: |
|
2052 break; |
|
2053 } |
|
2054 TFLOGSTRING( "CSatUiViewAppUi::HandleCommandL exit" ) |
|
2055 } |
|
2056 |
|
2057 // --------------------------------------------------------- |
|
2058 // CSatUiViewAppUi::HandleExitCommandL |
|
2059 // Handling of the exit softkey. |
|
2060 // (other items were commented in a header). |
|
2061 // --------------------------------------------------------- |
|
2062 // |
|
2063 void CSatUiViewAppUi::HandleExitCommandL() |
|
2064 { |
|
2065 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL called" ) |
|
2066 |
|
2067 if ( iBipWaitNote ) |
|
2068 { |
|
2069 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL iBipWaitNote" ) |
|
2070 SetCommandPending( EFalse ); |
|
2071 } |
|
2072 |
|
2073 if ( iWait ) |
|
2074 { |
|
2075 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL iWait " ) |
|
2076 if ( iWait->IsStarted() ) |
|
2077 { |
|
2078 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL \ |
|
2079 iWait->AsyncStop()" ) |
|
2080 iWait->AsyncStop(); |
|
2081 } |
|
2082 } |
|
2083 |
|
2084 CloseDialogs(); |
|
2085 |
|
2086 if ( iEndKeyPressed ) |
|
2087 { |
|
2088 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL endkeypressed" ) |
|
2089 // Inform SAT Server that end key has been pressed |
|
2090 iAdapter->SessionTerminated( EEndKeyUsed ); |
|
2091 } |
|
2092 |
|
2093 if ( !iCommandPending ) |
|
2094 { |
|
2095 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL !iCommandPending" ) |
|
2096 |
|
2097 if ( iPlayer && EMdaAudioToneUtilityPlaying == iPlayer->State() ) |
|
2098 { |
|
2099 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL cancel playtone") |
|
2100 iPlayer->CancelPlay(); |
|
2101 } |
|
2102 |
|
2103 if ( iAudioPlayer ) |
|
2104 { |
|
2105 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL cancel \ |
|
2106 userselected tone" ) |
|
2107 iAudioPlayer->Stop(); |
|
2108 delete iAudioPlayer; |
|
2109 iAudioPlayer = NULL; |
|
2110 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL\ |
|
2111 iAudioPlayer deleted" ) |
|
2112 } |
|
2113 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL exiting AppUI ") |
|
2114 Exit(); |
|
2115 } |
|
2116 if ( iWaitNoteInUse ) |
|
2117 { |
|
2118 iCommandPending = EFalse; |
|
2119 } |
|
2120 if ( iSelectItemPending && !iEndKeyPressed ) |
|
2121 { |
|
2122 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL SelectItem pending" ) |
|
2123 iSessionTerminated = ETrue; |
|
2124 iSelectItemView->HandleCommandL( ESatUiCmdExit ); |
|
2125 } |
|
2126 |
|
2127 TFLOGSTRING( "CSatUiViewAppUi::HandleExitCommandL exit" ) |
|
2128 } |
|
2129 |
|
2130 // --------------------------------------------------------- |
|
2131 // CSatUiViewAppUi::HandleWsEventL |
|
2132 // Handling of the window server events. |
|
2133 // (other items were commented in a header). |
|
2134 // --------------------------------------------------------- |
|
2135 // |
|
2136 void CSatUiViewAppUi::HandleWsEventL( |
|
2137 const TWsEvent& aEvent, |
|
2138 CCoeControl* aDestination ) |
|
2139 { |
|
2140 switch ( aEvent.Type() ) |
|
2141 { |
|
2142 // This is End key closing event. If this window server event is |
|
2143 // received, by default application will be closed unless it is |
|
2144 // the system application. |
|
2145 case KAknUidValueEndKeyCloseEvent: |
|
2146 { |
|
2147 // Performs the same behaviour as when Exit softkey is pressed. |
|
2148 TFLOGSTRING( "CSatUiViewAppUi::HandleWsEventL End key pressed" ) |
|
2149 iEndKeyPressed = ETrue; |
|
2150 HandleExitCommandL(); |
|
2151 break; |
|
2152 } |
|
2153 case EEventPointer: |
|
2154 { |
|
2155 TFLOGSTRING( "CSatUiViewAppUi::HandleWsEventL EEventPointer" ) |
|
2156 const TPointerEvent& pointer = *( aEvent.Pointer() ); |
|
2157 const TPointerEvent::TType pointerType = pointer.iType; |
|
2158 |
|
2159 if ( ( TPointerEvent::EButton1Down == pointerType ) || |
|
2160 ( TPointerEvent::EButton2Down == pointerType ) || |
|
2161 ( TPointerEvent::EButton3Down == pointerType ) ) |
|
2162 { |
|
2163 TFLOGSTRING( "CSatUiViewAppUi::HandleWsEventL EEventPointer\ |
|
2164 handle the event" ) |
|
2165 // Check if we need to end play tone |
|
2166 StopPlayToneL(); |
|
2167 } |
|
2168 break; |
|
2169 } |
|
2170 case EEventKeyDown: |
|
2171 { |
|
2172 // Handles other user key presses |
|
2173 TFLOGSTRING( "CSatUiViewAppUi::HandleWsEventL EEventKeyDown" ) |
|
2174 // Check if we need to end play tone |
|
2175 StopPlayToneL(); |
|
2176 if ( iImmediateDigitResponse ) |
|
2177 { |
|
2178 HandleImmediateDigitResponse( aEvent.Key()->iScanCode ); |
|
2179 } |
|
2180 break; |
|
2181 } |
|
2182 |
|
2183 default: |
|
2184 break; |
|
2185 } |
|
2186 // Forwards event to the base class. |
|
2187 CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); |
|
2188 PriorityVerifyAndClose( aEvent ); |
|
2189 } |
|
2190 |
|
2191 // --------------------------------------------------------- |
|
2192 // CSatUiViewAppUi::HelpStatus |
|
2193 // Help support status |
|
2194 // (other items were commented in a header). |
|
2195 // --------------------------------------------------------- |
|
2196 // |
|
2197 void CSatUiViewAppUi::HelpStatus( TBool aStatus ) |
|
2198 { |
|
2199 TFLOGSTRING( "CSatUiViewAppUi::HelpStatus calling" ) |
|
2200 iHelp = aStatus; |
|
2201 TFLOGSTRING( "CSatUiViewAppUi::HelpStatus exiting" ) |
|
2202 } |
|
2203 |
|
2204 // --------------------------------------------------------- |
|
2205 // CSatUiViewAppUi::DelayCallback |
|
2206 // Delay Callback function. Completes after predefined |
|
2207 // time has passed |
|
2208 // (other items were commented in a header). |
|
2209 // --------------------------------------------------------- |
|
2210 // |
|
2211 TInt CSatUiViewAppUi::DelayCallback( TAny* aPtr ) |
|
2212 { |
|
2213 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback calling" ) |
|
2214 if ( ((CSatUiViewAppUi* )aPtr)->iTimerRepeatOn ) |
|
2215 { |
|
2216 if ( ((CSatUiViewAppUi* )aPtr)->iTimerRepeatCount++ == KDivideByEight ) |
|
2217 { |
|
2218 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 1" ) |
|
2219 if ( ((CSatUiViewAppUi* )aPtr)->iWait->IsStarted() ) |
|
2220 { |
|
2221 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 2" ) |
|
2222 ((CSatUiViewAppUi* )aPtr)->iWait->AsyncStop(); |
|
2223 } |
|
2224 if ( ( ( CSatUiViewAppUi* ) aPtr )->iGetInputDialog || |
|
2225 ( ( CSatUiViewAppUi* ) aPtr )->iQueryDialog ) |
|
2226 { |
|
2227 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 3" ) |
|
2228 ( ( CSatUiViewAppUi* ) aPtr )-> |
|
2229 iNoResponseFromUserAfterDelay = ETrue; |
|
2230 ( ( CSatUiViewAppUi* ) aPtr )->CloseDialogs(); |
|
2231 } |
|
2232 } |
|
2233 else |
|
2234 { |
|
2235 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 4" ) |
|
2236 return ( ETrue ); |
|
2237 } |
|
2238 } |
|
2239 else |
|
2240 { |
|
2241 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 5" ) |
|
2242 if ( ((CSatUiViewAppUi* )aPtr)->iWait->IsStarted() ) |
|
2243 { |
|
2244 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 6" ) |
|
2245 ((CSatUiViewAppUi* )aPtr)->iWait->AsyncStop(); |
|
2246 } |
|
2247 } |
|
2248 |
|
2249 // Close DisplayText dialog if clearing after delay is requested |
|
2250 if ( ((CSatUiViewAppUi* )aPtr)->iDisplayTextDialog || |
|
2251 ((CSatUiViewAppUi* )aPtr)->iDisplayTextIconDialog ) |
|
2252 { |
|
2253 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 7" ) |
|
2254 ( ( CSatUiViewAppUi* ) aPtr )->iNoResponseFromUserAfterDelay = ETrue; |
|
2255 ( ( CSatUiViewAppUi* ) aPtr )->ClearScreen(); |
|
2256 } |
|
2257 else if ( ( ( CSatUiViewAppUi* ) aPtr )->iGetInputDialog || |
|
2258 ( ( CSatUiViewAppUi* ) aPtr )->iQueryDialog ) |
|
2259 { |
|
2260 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback -- 8" ) |
|
2261 ( ( CSatUiViewAppUi* ) aPtr )->iNoResponseFromUserAfterDelay = ETrue; |
|
2262 ( ( CSatUiViewAppUi* ) aPtr )->CloseDialogs(); |
|
2263 } |
|
2264 |
|
2265 TFLOGSTRING( "CSatUiViewAppUi::DelayCallback exiting" ) |
|
2266 return ( EFalse ); |
|
2267 } |
|
2268 |
|
2269 // --------------------------------------------------------- |
|
2270 // CSatUiViewAppUi::CreateCallBackTimerLC |
|
2271 // Creates a callback timer |
|
2272 // (other items were commented in a header). |
|
2273 // --------------------------------------------------------- |
|
2274 // |
|
2275 void CSatUiViewAppUi::CreateCallBackTimerL( const TInt aDelay, |
|
2276 TInt (*aFunction)(TAny* aPtr) ) |
|
2277 { |
|
2278 TFLOGSTRING( "CSatUiViewAppUi::CreateCallBackTimerLC called" ) |
|
2279 iTimerRepeatCount = 0; |
|
2280 iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
2281 |
|
2282 if ( iTimerRepeatOn ) |
|
2283 { |
|
2284 TFLOGSTRING( "CSatUiViewAppUi::CreateCallBackTimerLC repeating" ) |
|
2285 iTimer->Start( aDelay, aDelay, |
|
2286 TCallBack( aFunction, this ) ); |
|
2287 } |
|
2288 else |
|
2289 { |
|
2290 TFLOGSTRING( "CSatUiViewAppUi::CreateCallBackTimerLC \ |
|
2291 no repeating" ) |
|
2292 iTimer->Start( aDelay, KMicroSecondsInSecond, |
|
2293 TCallBack( aFunction, this ) ); |
|
2294 } |
|
2295 |
|
2296 TFLOGSTRING( "CSatUiViewAppUi::CreateCallBackTimerLC exit" ) |
|
2297 } |
|
2298 |
|
2299 // --------------------------------------------------------- |
|
2300 // CSatUiViewAppUi::DestroyCallBackTimer |
|
2301 // Destroys the callback timer |
|
2302 // (other items were commented in a header). |
|
2303 // --------------------------------------------------------- |
|
2304 // |
|
2305 void CSatUiViewAppUi::DestroyCallBackTimer( ) |
|
2306 { |
|
2307 TFLOGSTRING( "CSatUiViewAppUi::DestroyCallBackTimer() called" ) |
|
2308 delete iTimer; |
|
2309 iTimer = NULL; |
|
2310 iTimerRepeatOn = EFalse; |
|
2311 TFLOGSTRING( "CSatUiViewAppUi::DestroyCallBackTimer() exit" ) |
|
2312 } |
|
2313 |
|
2314 // --------------------------------------------------------- |
|
2315 // CSatUiViewAppUi::ProcessCommandParametersL |
|
2316 // Takes care of external launching. |
|
2317 // (other items were commented in a header). |
|
2318 // --------------------------------------------------------- |
|
2319 // |
|
2320 TBool CSatUiViewAppUi::ProcessCommandParametersL( |
|
2321 TApaCommand aCommand, |
|
2322 TFileName& aDocumentName, |
|
2323 const TDesC8& aTail ) |
|
2324 { |
|
2325 TFLOGSTRING2( "CSatUiViewAppUi::ProcessCommandParametersL called,\ |
|
2326 aCommand: %d", aCommand ) |
|
2327 // TApaCommand is 0 for SIM originated opening and 2 for user originated |
|
2328 // opening. Empty view is only needed for SIM originated opening. |
|
2329 if ( EApaCommandOpen == aCommand ) |
|
2330 { |
|
2331 // Creates empty view for commands without view. |
|
2332 CreateEmptyMenuL(); |
|
2333 } |
|
2334 |
|
2335 TFLOGSTRING( "CSatUiViewAppUi::ProcessCommandParametersL exit" ) |
|
2336 return CAknViewAppUi::ProcessCommandParametersL( aCommand, aDocumentName, |
|
2337 aTail ); |
|
2338 } |
|
2339 |
|
2340 // --------------------------------------------------------- |
|
2341 // CSatUiViewAppUi::DispatchUserInactive |
|
2342 // Called when user has been inactive for a pre-defined time period |
|
2343 // (other items were commented in a header). |
|
2344 // --------------------------------------------------------- |
|
2345 // |
|
2346 TInt CSatUiViewAppUi::DispatchUserInactive( TAny* aPtr ) |
|
2347 { |
|
2348 TFLOGSTRING( "CSatUiViewAppUi::DispatchUserInactive calling" ) |
|
2349 ((CSatUiViewAppUi* )aPtr)->iNoResponseFromUserAfterDelay = ETrue; |
|
2350 |
|
2351 //lint -e{961} else block not needed. |
|
2352 if ( ( ( CSatUiViewAppUi* ) aPtr )->iDisplayTextDialog || |
|
2353 ( ( CSatUiViewAppUi* ) aPtr )->iDisplayTextIconDialog ) |
|
2354 { |
|
2355 TFLOGSTRING( "CSatUiViewAppUi::DispatchUserInactive clear screen" ) |
|
2356 ( ( CSatUiViewAppUi* ) aPtr )->ClearScreen(); |
|
2357 } |
|
2358 else if ( ( ( CSatUiViewAppUi* ) aPtr )->iQueryDialog || |
|
2359 ( (CSatUiViewAppUi* ) aPtr )->iGetInputDialog ) |
|
2360 { |
|
2361 TFLOGSTRING( "CSatUiViewAppUi::DispatchUserInactive close dialog" ) |
|
2362 ( ( CSatUiViewAppUi* ) aPtr )->CloseDialogs(); |
|
2363 } |
|
2364 |
|
2365 TFLOGSTRING( "CSatUiViewAppUi::DispatchUserInactive exiting" ) |
|
2366 return (EFalse); |
|
2367 } |
|
2368 |
|
2369 // --------------------------------------------------------- |
|
2370 // CSatUiViewAppUi::MakeGetInputBitmapMask |
|
2371 // Make a mask for get input icon |
|
2372 // (other items were commented in a header). |
|
2373 // --------------------------------------------------------- |
|
2374 // |
|
2375 void CSatUiViewAppUi::MakeGetInputBitmapMask( CFbsBitmap* aMask, |
|
2376 TSize aSize ) const |
|
2377 { |
|
2378 TFLOGSTRING( "CSatUiViewAppUi::MakeGetInputBitmapMask calling" ) |
|
2379 TInt width = aSize.iWidth; |
|
2380 TInt height = aSize.iHeight; |
|
2381 aMask->Create( TSize( width, height ), EColor16M ); |
|
2382 |
|
2383 TBitmapUtil bitmap1Util( aMask ); |
|
2384 // Begin manipulation with bitmap1Util, setting initial pixel to 0,0 |
|
2385 bitmap1Util.Begin( TPoint( 0,0 ) ); |
|
2386 |
|
2387 // Make mask which covers whole icon |
|
2388 for ( TInt y = 0; y < height; y++ ) |
|
2389 { |
|
2390 for ( TInt x = 0; x < width; x++ ) |
|
2391 { |
|
2392 bitmap1Util.SetPos( TPoint( x, y ) ); |
|
2393 bitmap1Util.SetPixel( 0x0000ff ); |
|
2394 } |
|
2395 } |
|
2396 bitmap1Util.End(); |
|
2397 TFLOGSTRING( "CSatUiViewAppUi::MakeGetInputBitmapMask exiting" ) |
|
2398 } |
|
2399 |
|
2400 // --------------------------------------------------------- |
|
2401 // CSatUiViewAppUi::DispatchTimer |
|
2402 // Dispatch iWait to action implementer. |
|
2403 // (other items were commented in a header). |
|
2404 // --------------------------------------------------------- |
|
2405 // |
|
2406 void CSatUiViewAppUi::DispatchTimer( CActiveSchedulerWait& aWait ) |
|
2407 { |
|
2408 TFLOGSTRING( "CSatUiViewAppUi::DispatchTimer calling" ) |
|
2409 iWait = &aWait; |
|
2410 TFLOGSTRING( "CSatUiViewAppUi::DispatchTimer exiting" ) |
|
2411 } |
|
2412 |
|
2413 // --------------------------------------------------------- |
|
2414 // CSatUiViewAppUi::GetEndKey |
|
2415 // Get a flag which is indicating if end key is pressed. |
|
2416 // (other items were commented in a header). |
|
2417 // --------------------------------------------------------- |
|
2418 // |
|
2419 TBool CSatUiViewAppUi::GetEndKey() |
|
2420 { |
|
2421 TFLOGSTRING( "CSatUiViewAppUi::GetEndKey calling-exiting" ) |
|
2422 return iEndKeyPressed; |
|
2423 } |
|
2424 |
|
2425 // --------------------------------------------------------- |
|
2426 // CSatUiViewAppUi::SetEndKey |
|
2427 // Set a flag which is indicating if end key is pressed. |
|
2428 // (other items were commented in a header). |
|
2429 // --------------------------------------------------------- |
|
2430 // |
|
2431 void CSatUiViewAppUi::SetEndKey( TBool aValue ) |
|
2432 { |
|
2433 TFLOGSTRING2( "CSatUiViewAppUi::SetEndKey calling, aValue:%d", aValue ) |
|
2434 iEndKeyPressed = aValue; |
|
2435 TFLOGSTRING( "CSatUiViewAppUi::SetEndKey exiting" ) |
|
2436 } |
|
2437 |
|
2438 // --------------------------------------------------------- |
|
2439 // CSatUiViewAppUi::SetCommandPending |
|
2440 // Set a flag which is indicating proactive command is pending. |
|
2441 // (other items were commented in a header). |
|
2442 // --------------------------------------------------------- |
|
2443 // |
|
2444 void CSatUiViewAppUi::SetCommandPending( TBool aValue ) |
|
2445 { |
|
2446 TFLOGSTRING2( "CSatUiViewAppUi::SetCommandPending calling, aValue:%d", \ |
|
2447 aValue ) |
|
2448 iCommandPending = aValue; |
|
2449 if ( aValue ) |
|
2450 { |
|
2451 // Cancels a request to save RAM when higher than normal buffer size is |
|
2452 // no longer required. |
|
2453 CAknEnv::Static()->CancelWsBufferRequest( iReqWSBufferID ); |
|
2454 } |
|
2455 TFLOGSTRING( "CSatUiViewAppUi::SetCommandPending exiting" ) |
|
2456 } |
|
2457 |
|
2458 // --------------------------------------------------------- |
|
2459 // CSatUiViewAppUi::CloseDialogs |
|
2460 // Close all existing dialogs. |
|
2461 // (other items were commented in a header). |
|
2462 // --------------------------------------------------------- |
|
2463 // |
|
2464 void CSatUiViewAppUi::CloseDialogs() |
|
2465 { |
|
2466 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() called" ) |
|
2467 if ( iWaitNote || iBipWaitNote || iNoteDialog ) |
|
2468 { |
|
2469 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() StopShowWaitNote" ) |
|
2470 StopShowWaitNote(); |
|
2471 } |
|
2472 if ( iDisplayTextDialog ) |
|
2473 { |
|
2474 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() iDisplayTextDialog" ) |
|
2475 delete iDisplayTextDialog; |
|
2476 iDisplayTextDialog = NULL; |
|
2477 iImmediateRsp = EFalse; |
|
2478 } |
|
2479 if ( iDisplayTextIconDialog ) |
|
2480 { |
|
2481 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() iDisplayTextIconDialog" ) |
|
2482 delete iDisplayTextIconDialog; |
|
2483 iDisplayTextIconDialog = NULL; |
|
2484 iImmediateRsp = EFalse; |
|
2485 } |
|
2486 if ( iGetInputDialog ) |
|
2487 { |
|
2488 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() iGetInputDialog" ) |
|
2489 TRAP_IGNORE( iGetInputDialog->DismissQueryL() ) |
|
2490 iGetInputDialog = NULL; |
|
2491 } |
|
2492 if ( iQueryDialog ) |
|
2493 { |
|
2494 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() iQueryDialog" ) |
|
2495 delete iQueryDialog; |
|
2496 iQueryDialog = NULL; |
|
2497 } |
|
2498 if ( iPermanentNote ) |
|
2499 { |
|
2500 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() iPermanentNote" ) |
|
2501 // CAknNoteDialog has already performed deletion when user action. |
|
2502 iPermanentNote = NULL; |
|
2503 } |
|
2504 TFLOGSTRING( "CSatUiViewAppUi::CloseDialogs() exit" ) |
|
2505 } |
|
2506 |
|
2507 // --------------------------------------------------------- |
|
2508 // CSatUiViewAppUi::MapcInitComplete |
|
2509 // Plays the tone. |
|
2510 // (other items were commented in a header). |
|
2511 // --------------------------------------------------------- |
|
2512 // |
|
2513 void CSatUiViewAppUi::MapcInitComplete( TInt aError, |
|
2514 const TTimeIntervalMicroSeconds& /*aDuration*/ ) |
|
2515 { |
|
2516 TFLOGSTRING( "CSatUiViewAppUi::MapcInitComplete called" ) |
|
2517 // Audio player is initialised, so if there is no error, we can start |
|
2518 // playing the tone. |
|
2519 if( KErrNone == aError ) |
|
2520 { |
|
2521 const TInt volume( Max( 0, Min( iVolume, |
|
2522 iAudioPlayer->MaxVolume() ) ) ); |
|
2523 TFLOGSTRING2( "CSatUiViewAppUi::\ |
|
2524 MapcInitComplete SetVolume %i", volume ) |
|
2525 // Set volume according Settings. |
|
2526 iAudioPlayer->SetVolume( volume ); |
|
2527 iAudioPlayer->Play(); |
|
2528 TFLOGSTRING( "CSatUiViewAppUi::MapcInitComplete Play" ) |
|
2529 } |
|
2530 else |
|
2531 { |
|
2532 // Otherwise, we delete the initialised audio player. |
|
2533 if ( iAudioPlayer ) |
|
2534 { |
|
2535 TFLOGSTRING( "CSatUiViewAppUi::MapcInitComplete iAudioPlayer \ |
|
2536 true" ) |
|
2537 delete iAudioPlayer; |
|
2538 iAudioPlayer = NULL; |
|
2539 } |
|
2540 |
|
2541 // Remove also the note for play tone |
|
2542 if ( iPermanentNote ) |
|
2543 { |
|
2544 TFLOGSTRING( "CSatUiViewAppUi::MapcInitComplete iPermanentNote \ |
|
2545 true" ) |
|
2546 iPermanentNote->ExitSleepingDialog(); |
|
2547 delete iPermanentNote; |
|
2548 iPermanentNote = NULL; |
|
2549 } |
|
2550 |
|
2551 // If there was a duration for play tone, stop waiting |
|
2552 if ( iWait->IsStarted() ) |
|
2553 { |
|
2554 TFLOGSTRING( "CSatUiViewAppUi::MapcInitComplete stop iWait" ) |
|
2555 iWait->AsyncStop(); |
|
2556 } |
|
2557 |
|
2558 TFLOGSTRING2( "CSatUiViewAppUi::MapcInitComplete Error %i", aError ) |
|
2559 } |
|
2560 |
|
2561 TFLOGSTRING( "CSatUiViewAppUi::MapcInitComplete exit" ) |
|
2562 } |
|
2563 |
|
2564 // --------------------------------------------------------- |
|
2565 // CSatUiViewAppUi::MapcPlayComplete |
|
2566 // Deletes audio player after playing is completed. |
|
2567 // (other items were commented in a header). |
|
2568 // --------------------------------------------------------- |
|
2569 // |
|
2570 void CSatUiViewAppUi::MapcPlayComplete( TInt aError ) |
|
2571 { |
|
2572 TFLOGSTRING( "CSatUiViewAppUi::MapcPlayComplete called" ) |
|
2573 |
|
2574 // When playing is completed, deleting the audio player. |
|
2575 if ( iAudioPlayer ) |
|
2576 { |
|
2577 TFLOGSTRING( "CSatUiViewAppUi::MapcPlayComplete delete iAudioPlayer" ) |
|
2578 delete iAudioPlayer; |
|
2579 iAudioPlayer = NULL; |
|
2580 } |
|
2581 // Remove note after play has completed. |
|
2582 if ( iPermanentNote ) |
|
2583 { |
|
2584 TFLOGSTRING( "CSatUiViewAppUi::MapcPlayComplete ExitSleepingDialog" ) |
|
2585 iPermanentNote->ExitSleepingDialog(); |
|
2586 delete iPermanentNote; |
|
2587 iPermanentNote = NULL; |
|
2588 } |
|
2589 // Show wait note only for samples that have duration, otherwise there is |
|
2590 // chance that wait note is not stopped. |
|
2591 if ( TTimeIntervalMicroSeconds( static_cast<TInt64>( 0 ) ) != iDuration ) |
|
2592 { |
|
2593 // It does not affect for tone playing if wait note |
|
2594 // is not able to show. |
|
2595 TFLOGSTRING( "CSatUiViewAppUi::MapcPlayComplete ShowWaitNoteL" ) |
|
2596 TRAP_IGNORE( ShowWaitNoteL() ) |
|
2597 } |
|
2598 |
|
2599 TFLOGSTRING2( "CSatUiViewAppUi::MapcPlayComplete exit, error:%i", aError ) |
|
2600 } |
|
2601 |
|
2602 // --------------------------------------------------------- |
|
2603 // CSatUiViewAppUi::PlayUserSelectedToneL |
|
2604 // Plays user selected tone from active Profile. |
|
2605 // If needed displays the text in a note while playing. |
|
2606 // (other items were commented in a header). |
|
2607 // --------------------------------------------------------- |
|
2608 // |
|
2609 TSatUiResponse CSatUiViewAppUi::PlayUserSelectedToneL( |
|
2610 const TDesC& aText, |
|
2611 TTimeIntervalMicroSeconds aDuration, |
|
2612 TSatTone aTone, |
|
2613 const CFbsBitmap* aIconBitmap, |
|
2614 const TBool aSelfExplanatory ) |
|
2615 { |
|
2616 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL called" ) |
|
2617 StopShowWaitNote(); |
|
2618 // Delete timer just in case e.g. if DisplayText was on the screen |
|
2619 DestroyCallBackTimer(); |
|
2620 |
|
2621 iPermanentNote = NULL; |
|
2622 iDuration = aDuration; |
|
2623 |
|
2624 TFLOGSTRING2( "CSatUiViewAppUi::PlayUserSelectedToneL length of aText \ |
|
2625 %d", aText.Length() ) |
|
2626 if ( 0 != aText.Length() ) |
|
2627 { |
|
2628 iPermanentNote = new (ELeave) CAknStaticNoteDialog(); |
|
2629 iPermanentNote->PrepareLC( R_SATUI_PERMANENT_NOTE ); |
|
2630 |
|
2631 if ( ( !aSelfExplanatory ) || ( !aIconBitmap ) ) |
|
2632 { |
|
2633 // Set text |
|
2634 iPermanentNote->SetTextL( aText ); |
|
2635 } |
|
2636 |
|
2637 if ( aIconBitmap ) |
|
2638 { |
|
2639 //Set image |
|
2640 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL SetImage" ) |
|
2641 CEikImage* image = new ( ELeave ) CEikImage(); |
|
2642 CleanupStack::PushL( image ); |
|
2643 image->SetBitmap( aIconBitmap ); |
|
2644 iPermanentNote->SetImageL( image ); |
|
2645 CleanupStack::Pop( image ); |
|
2646 } |
|
2647 |
|
2648 iPermanentNote->SetTimeout( CAknNoteDialog::ENoTimeout ); |
|
2649 iForegroundControl = iPermanentNote; |
|
2650 iPermanentNote->RunLD(); |
|
2651 } |
|
2652 |
|
2653 // If several messages/calls arrive during a small amount of time and if the |
|
2654 // message received or incoming call tone is already being played we do not |
|
2655 // restart it. |
|
2656 if ( iAudioPlayer ) |
|
2657 { |
|
2658 TFLOGSTRING( "CSatUiViewAppUi::\ |
|
2659 PlayUserSelectedToneL Error - already played" ) |
|
2660 return ESatFailure; |
|
2661 } |
|
2662 |
|
2663 // This defines name for the current message alert or incoming call tone. |
|
2664 TBuf<KMaxSoundFileLength> soundFileName; |
|
2665 GetProfileParamsL( aTone, &soundFileName ); |
|
2666 // This defines the behaviour to be adopted by an |
|
2667 // audio client if a higher priority client takes over the device. |
|
2668 TInt mdaPriority( KAudioPrefIncomingCall ); |
|
2669 // This is used to resolve conflicts when more than one client tries to |
|
2670 // access the same sound output device simultaneously. |
|
2671 TInt audioPriority( KAudioPriorityPhoneCall ); |
|
2672 |
|
2673 TFLOGSTRING2( "CSatUiViewAppUi::PlayUserSelectedToneL\ |
|
2674 Volume is %i ", iVolume ) |
|
2675 |
|
2676 // Creates the audio player. |
|
2677 iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( |
|
2678 soundFileName, |
|
2679 *this, |
|
2680 audioPriority, |
|
2681 ( TMdaPriorityPreference ) mdaPriority ); |
|
2682 |
|
2683 if ( TTimeIntervalMicroSeconds( static_cast<TInt64>( 0 ) ) != aDuration ) |
|
2684 { |
|
2685 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL duration not 0" ) |
|
2686 TTimeIntervalMicroSeconds max32Bit( |
|
2687 static_cast<TInt64>( K32TIntMaxValue ) ); |
|
2688 if ( aDuration > max32Bit ) |
|
2689 { |
|
2690 // Timers can only handle 32-bit values |
|
2691 // and 64-bit value is received. |
|
2692 // Let's break the aDuration to smaller bits. |
|
2693 // Divided here by 8 to fit in 32-bit maxvalue. |
|
2694 // Loops 8 times in DelayCallback to play tone |
|
2695 // right duration. |
|
2696 aDuration = aDuration.Int64() / KDivideByEight; |
|
2697 iTimerRepeatOn = ETrue; |
|
2698 } |
|
2699 iAudioPlayer->SetRepeats( KSoundPlayerRepeatForever, |
|
2700 TTimeIntervalMicroSeconds( |
|
2701 static_cast<TInt64>( 0 ) ) ); |
|
2702 CreateCallBackTimerL( I64INT( aDuration.Int64() ), DelayCallback ); |
|
2703 |
|
2704 if ( !iWait->IsStarted() ) |
|
2705 { |
|
2706 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL\ |
|
2707 starting iWait" ) |
|
2708 iWait->Start(); |
|
2709 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL\ |
|
2710 strarting done" ) |
|
2711 } |
|
2712 |
|
2713 // Sample is played in forever loop for the duration. |
|
2714 // After duration call back timers are destroyed |
|
2715 DestroyCallBackTimer(); |
|
2716 // If player exists, stop playing and delete player. MapcPlayComplete |
|
2717 // is not called because CallBackTimer stops the playing. |
|
2718 if ( iAudioPlayer ) |
|
2719 { |
|
2720 iAudioPlayer->Stop(); |
|
2721 delete iAudioPlayer; |
|
2722 iAudioPlayer = NULL; |
|
2723 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL\ |
|
2724 iAudioPlayer deleted" ) |
|
2725 } |
|
2726 // Remove note after play has completed. |
|
2727 if ( iPermanentNote ) |
|
2728 { |
|
2729 iPermanentNote->ExitSleepingDialog(); |
|
2730 delete iPermanentNote; |
|
2731 iPermanentNote = NULL; |
|
2732 } |
|
2733 iForegroundControl = NULL; |
|
2734 |
|
2735 if ( !iEndKeyPressed ) |
|
2736 { |
|
2737 ShowWaitNoteL(); |
|
2738 } |
|
2739 |
|
2740 } |
|
2741 else |
|
2742 { |
|
2743 // If duration is zero then tone is played only once. |
|
2744 // Playing duration is same as duration of the sample. |
|
2745 iAudioPlayer->SetRepeats( |
|
2746 0, TTimeIntervalMicroSeconds( static_cast<TInt64>( 0 ) ) ); |
|
2747 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL SetRepeats 0" ) |
|
2748 } |
|
2749 |
|
2750 TFLOGSTRING( "CSatUiViewAppUi::PlayUserSelectedToneL exit" ) |
|
2751 if( EFalse == iWarningAndPlayTones ) |
|
2752 { |
|
2753 return ESatSuccessToneNotPlayed; |
|
2754 } |
|
2755 |
|
2756 return ESatSuccess; |
|
2757 } |
|
2758 |
|
2759 |
|
2760 // --------------------------------------------------------- |
|
2761 // CSatUiViewAppUi::ConfirmOpenChannelL |
|
2762 // Displays a query to get confirmation for Open Channel command. |
|
2763 // (other items were commented in a header). |
|
2764 // --------------------------------------------------------- |
|
2765 // |
|
2766 TSatUiResponse CSatUiViewAppUi::ConfirmOpenChannelL( |
|
2767 const TDesC& aText, |
|
2768 TBool& aActionAccepted, |
|
2769 const CFbsBitmap* aIconBitmapOpenChannel, |
|
2770 const TBool aSelfExplanatory ) |
|
2771 { |
|
2772 TFLOGSTRING( "CSatUiViewAppUi::ConfirmOpenChannelL called" ) |
|
2773 |
|
2774 TSatUiResponse response( ESatSuccess ); |
|
2775 TInt resource( 0 ); |
|
2776 TPtrC textPtr( aText ); |
|
2777 HBufC* textHolder = NULL; |
|
2778 |
|
2779 if ( aIconBitmapOpenChannel ) |
|
2780 { |
|
2781 TFLOGSTRING( "CSatUiViewAppUi::ConfirmOpenChannelL have icon" ) |
|
2782 resource = R_SATUI_CONFIRM_OK_CANCEL_QUERY_WITH_ICON; |
|
2783 } |
|
2784 else |
|
2785 { |
|
2786 TFLOGSTRING( "CSatUiViewAppUi::ConfirmOpenChannelL no icon" ) |
|
2787 resource = R_SATUI_CONFIRM_OK_CANCEL_QUERY; |
|
2788 |
|
2789 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmOpenChannelL length of \ |
|
2790 aText %d", aText.Length() ) |
|
2791 if ( 0 == aText.Length() ) |
|
2792 { |
|
2793 textHolder = StringLoader::LoadLC( R_QTN_SAT_CONF_OPEN_CHANNEL_BIP, |
|
2794 iCoeEnv ); |
|
2795 textPtr.Set( *textHolder ); |
|
2796 } |
|
2797 } |
|
2798 |
|
2799 TInt userResponse = RunQueryDialogL( resource, textPtr, |
|
2800 aIconBitmapOpenChannel, aSelfExplanatory, EAknSoftkeyOk ); |
|
2801 |
|
2802 if ( textHolder ) |
|
2803 { |
|
2804 CleanupStack::PopAndDestroy( textHolder ); |
|
2805 } |
|
2806 |
|
2807 if ( userResponse ) |
|
2808 { |
|
2809 TFLOGSTRING( "CSatUiViewAppUi::ConfirmOpenChannelL action accepted" ) |
|
2810 aActionAccepted = ETrue; |
|
2811 } |
|
2812 else |
|
2813 { |
|
2814 TFLOGSTRING( "CSatUiViewAppUi::ConfirmOpenChannelL action not \ |
|
2815 accepted" ) |
|
2816 aActionAccepted = EFalse; |
|
2817 } |
|
2818 |
|
2819 |
|
2820 |
|
2821 ShowWaitNoteL(); |
|
2822 |
|
2823 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmOpenChannelL exit,return: %d",\ |
|
2824 response ) |
|
2825 return response; |
|
2826 } |
|
2827 |
|
2828 // --------------------------------------------------------- |
|
2829 // CSatUiViewAppUi::ShowBIPNoteL |
|
2830 // Displays the BIP note. |
|
2831 // (other items were commented in a header). |
|
2832 // --------------------------------------------------------- |
|
2833 // |
|
2834 void CSatUiViewAppUi::ShowBIPNoteL( TInt aCommand, const TDesC& aText, |
|
2835 const CFbsBitmap* aIconBitmap, |
|
2836 const TBool aSelfExplanatory ) |
|
2837 { |
|
2838 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL() called" ) |
|
2839 TFLOGSTRING2( "CSatUiViewAppUi::ShowBIPNoteL() aCommand: %d", aCommand ) |
|
2840 |
|
2841 iWaitNoteInUse = ETrue; |
|
2842 TBool showNote( EFalse ); |
|
2843 TInt resourceId( 0 ); |
|
2844 switch ( aCommand ) |
|
2845 { |
|
2846 case ESendDataIdentier: // fall through |
|
2847 case EReceiveDataIdentifier: |
|
2848 { |
|
2849 resourceId = R_SATUI_BIP_WAIT_NOTE; |
|
2850 showNote = ETrue; |
|
2851 break; |
|
2852 } |
|
2853 case ECloseChannelIdentifier: |
|
2854 { |
|
2855 HBufC* textHolder = StringLoader::LoadLC( |
|
2856 R_QTN_SAT_CONF_CLOSE_CHANNEL_BIP, iCoeEnv ); |
|
2857 |
|
2858 if ( !iNoteDialog ) |
|
2859 { |
|
2860 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL no NoteDialog" ) |
|
2861 iNoteDialog = new (ELeave) CAknNoteDialog( |
|
2862 REINTERPRET_CAST( CEikDialog**, &iNoteDialog ), |
|
2863 CAknNoteDialog::ENoTone, |
|
2864 CAknNoteDialog::EShortTimeout ); |
|
2865 |
|
2866 if ( aIconBitmap ) |
|
2867 { |
|
2868 iNoteDialog->PrepareLC( R_SATUI_CLOSE_CHANNEL_ICON_NOTE ); |
|
2869 //Set image |
|
2870 TFLOGSTRING( |
|
2871 "CSatUiViewAppUi::ShowBIPNoteL SetImage" ) |
|
2872 CEikImage* image = new ( ELeave ) CEikImage(); |
|
2873 CleanupStack::PushL( image ); |
|
2874 image->SetBitmap( aIconBitmap ); |
|
2875 iNoteDialog->SetImageL( image ); |
|
2876 CleanupStack::Pop( image ); |
|
2877 } |
|
2878 else |
|
2879 { |
|
2880 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL no Icon" ) |
|
2881 iNoteDialog->PrepareLC( R_SATUI_CLOSE_CHANNEL_NOTE ); |
|
2882 } |
|
2883 |
|
2884 // inform the user using received alpha id |
|
2885 if ( ( aText.Length() > 0 ) && |
|
2886 ( !aSelfExplanatory || !aIconBitmap ) ) |
|
2887 { |
|
2888 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL using \ |
|
2889 received alpha id" ) |
|
2890 iNoteDialog->SetTextL( aText ); |
|
2891 } |
|
2892 // inform the user using localized text |
|
2893 else if ( aText.Length() == 0 ) |
|
2894 { |
|
2895 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL using \ |
|
2896 localized text" ) |
|
2897 iNoteDialog->SetTextL( *textHolder ); |
|
2898 } |
|
2899 |
|
2900 iForegroundControl = iNoteDialog; |
|
2901 iNoteDialog->RunLD(); |
|
2902 // iForegroundControl won't be clear until the note dialog |
|
2903 // closed. It will avoid we lose the chance to set focus for |
|
2904 // the wait dialog when the switch of foreground/background |
|
2905 // happened. |
|
2906 } |
|
2907 |
|
2908 CleanupStack::PopAndDestroy( textHolder ); // textHolder |
|
2909 |
|
2910 showNote = EFalse; |
|
2911 break; |
|
2912 } |
|
2913 default: |
|
2914 { |
|
2915 showNote = EFalse; |
|
2916 break; |
|
2917 } |
|
2918 } |
|
2919 if ( showNote ) |
|
2920 { |
|
2921 |
|
2922 // First, stop normal wait note. |
|
2923 if ( iWaitNote ) |
|
2924 { |
|
2925 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL() Closing WaitNote" ) |
|
2926 TRAP_IGNORE( iWaitNote->ProcessFinishedL() ) |
|
2927 iWaitNote = NULL; |
|
2928 } |
|
2929 |
|
2930 if ( !iBipWaitNote ) |
|
2931 { |
|
2932 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL() no BipWaitNote" ) |
|
2933 iBipWaitNote = new ( ELeave ) CSatUiWaitDialog( |
|
2934 (REINTERPRET_CAST(CEikDialog**,&iBipWaitNote)), |
|
2935 *iAdapter, ETrue ); |
|
2936 |
|
2937 if ( ( aText.Length() > 0 ) && ( !aSelfExplanatory || |
|
2938 !aIconBitmap ) ) |
|
2939 { |
|
2940 iBipWaitNote->SetTextL( aText ); |
|
2941 } |
|
2942 |
|
2943 if ( aIconBitmap ) |
|
2944 { |
|
2945 //Set image |
|
2946 TFLOGSTRING( |
|
2947 "CSatUiViewAppUi::ShowBIPNoteL SetImage" ) |
|
2948 CEikImage* image = new ( ELeave ) CEikImage(); |
|
2949 CleanupStack::PushL( image ); |
|
2950 image->SetBitmap( aIconBitmap ); |
|
2951 iBipWaitNote->SetImageL( image ); |
|
2952 CleanupStack::Pop( image ); |
|
2953 } |
|
2954 |
|
2955 iForegroundControl = iBipWaitNote; |
|
2956 iBipWaitNote->ExecuteLD( resourceId ); |
|
2957 // iForegroundControl won't be clear until the BipWait dialog |
|
2958 // closed. It will avoid we lose the chance to set focus for |
|
2959 // the wait dialog when the switch of foreground/background |
|
2960 // happened. |
|
2961 } |
|
2962 else |
|
2963 { |
|
2964 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL() have BipWaitNote" ) |
|
2965 // BIP note already exists, update text if not with self |
|
2966 // explanatory icon |
|
2967 if ( ( aText.Length() > 0 ) && |
|
2968 ( !aSelfExplanatory || !aIconBitmap ) ) |
|
2969 { |
|
2970 iBipWaitNote->SetTextL( aText ); |
|
2971 } |
|
2972 else if ( aSelfExplanatory && aIconBitmap ) |
|
2973 { |
|
2974 const TDesC emptyText( KNullDesC ); |
|
2975 iBipWaitNote->SetTextL( emptyText ); |
|
2976 } |
|
2977 // BIP note already exists, update image |
|
2978 if ( aIconBitmap ) |
|
2979 { |
|
2980 //Set image |
|
2981 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL SetImage" ) |
|
2982 CEikImage* image = new ( ELeave ) CEikImage(); |
|
2983 CleanupStack::PushL( image ); |
|
2984 image->SetBitmap( aIconBitmap ); |
|
2985 iBipWaitNote->SetImageL( image ); |
|
2986 CleanupStack::Pop( image ); |
|
2987 } |
|
2988 } |
|
2989 } |
|
2990 TFLOGSTRING( "CSatUiViewAppUi::ShowBIPNoteL() exit" ) |
|
2991 } |
|
2992 |
|
2993 // --------------------------------------------------------- |
|
2994 // CSatUiViewAppUi::RemoveNullCharacters |
|
2995 // Null characters are removed from text |
|
2996 // (other items were commented in a header). |
|
2997 // --------------------------------------------------------- |
|
2998 // |
|
2999 void CSatUiViewAppUi::RemoveNullCharacters( HBufC* aText ) |
|
3000 { |
|
3001 TFLOGSTRING( "CSatUiViewAppUi::RemoveNullCharacters calling" ) |
|
3002 TPtr titleptr = aText->Des(); |
|
3003 TInt nullLocation( 0 ); |
|
3004 while ( ( nullLocation = titleptr.Locate( NULL ) ) >= 0 ) |
|
3005 { |
|
3006 titleptr.Delete( nullLocation, 1 ); |
|
3007 } |
|
3008 TFLOGSTRING( "CSatUiViewAppUi::RemoveNullCharacters exiting" ) |
|
3009 } |
|
3010 |
|
3011 // --------------------------------------------------------- |
|
3012 // CSatUiViewAppUi::ConfirmSetUpCallL |
|
3013 // (other items were commented in a header). |
|
3014 // --------------------------------------------------------- |
|
3015 // |
|
3016 void CSatUiViewAppUi::ConfirmSetUpCallL( |
|
3017 const TDesC& aText, |
|
3018 const TDesC& aSimAppName, |
|
3019 TBool& aActionAccepted, |
|
3020 const CFbsBitmap* aIconBitmap, |
|
3021 const TBool aSelfExplanatory ) |
|
3022 { |
|
3023 TFLOGSTRING( "CSatUiViewAppUi::ConfirmSetUpCallL calling" ) |
|
3024 |
|
3025 aActionAccepted = EFalse; |
|
3026 TPtrC text( aText ); |
|
3027 HBufC* textHolder = NULL; |
|
3028 HBufC* titleHolder = NULL; |
|
3029 TInt resource( 0 ); |
|
3030 |
|
3031 if ( aIconBitmap ) |
|
3032 { |
|
3033 TFLOGSTRING( "CSatUiViewAppUi::ConfirmSetUpCallL have icon" ) |
|
3034 resource = R_SATUI_CONFIRM_CALL_CANCEL_QUERY_WITH_ICON; |
|
3035 |
|
3036 } |
|
3037 else |
|
3038 { |
|
3039 TFLOGSTRING( "CSatUiViewAppUi::ConfirmSetUpCallL no icon" ) |
|
3040 resource = R_SATUI_CONFIRM_CALL_CANCEL_QUERY; |
|
3041 |
|
3042 TFLOGSTRING2( "CSatUiViewAppUi::ConfirmSetUpCallL length of aText, \ |
|
3043 %d", aText.Length() ) |
|
3044 if ( aText.Length() == 0 ) |
|
3045 { |
|
3046 |
|
3047 if ( aSimAppName.Length() > 0 ) |
|
3048 { |
|
3049 titleHolder = aSimAppName.AllocLC(); |
|
3050 } |
|
3051 else |
|
3052 { |
|
3053 titleHolder = StringLoader::LoadLC( R_QTN_SAT_QUERY_TITLE, |
|
3054 iCoeEnv ); |
|
3055 } |
|
3056 |
|
3057 textHolder = StringLoader::LoadLC( R_TEXT_CALL_SETUP_BY_SIMATK, |
|
3058 *titleHolder, iCoeEnv ); |
|
3059 |
|
3060 RemoveNullCharacters( textHolder ); |
|
3061 |
|
3062 text.Set(*textHolder); |
|
3063 } |
|
3064 } |
|
3065 |
|
3066 TInt userResponse = RunQueryDialogL( resource, text, aIconBitmap, |
|
3067 aSelfExplanatory, ESatUiSoftkeyCall ); |
|
3068 |
|
3069 if ( textHolder ) |
|
3070 { |
|
3071 CleanupStack::PopAndDestroy( textHolder ); //textHolder |
|
3072 } |
|
3073 |
|
3074 if ( titleHolder ) |
|
3075 { |
|
3076 CleanupStack::PopAndDestroy( titleHolder ); //titleHolder |
|
3077 } |
|
3078 |
|
3079 if ( userResponse ) |
|
3080 { |
|
3081 aActionAccepted = ETrue; |
|
3082 } |
|
3083 |
|
3084 TFLOGSTRING( "CSatUiViewAppUi::ConfirmSetUpCallL exiting" ) |
|
3085 } |
|
3086 |
|
3087 // --------------------------------------------------------- |
|
3088 // CSatUiViewAppUi::ShowNotAvailableNoteL |
|
3089 // Show note indicating SAT is not available |
|
3090 // (other items were commented in a header). |
|
3091 // --------------------------------------------------------- |
|
3092 // |
|
3093 void CSatUiViewAppUi::ShowNotAvailableNoteL() |
|
3094 { |
|
3095 TFLOGSTRING( "CSatUiViewAppUi::ShowNotAvailableNoteL() called" ) |
|
3096 CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog( |
|
3097 REINTERPRET_CAST(CEikDialog**,¬eDialog), |
|
3098 CAknNoteDialog::ENoTone, |
|
3099 CAknNoteDialog::ELongTimeout ); |
|
3100 |
|
3101 HBufC* textHolder = StringLoader::LoadLC( R_QTN_SAT_SERVICES_NOT_AVAILABLE, |
|
3102 iCoeEnv ); |
|
3103 |
|
3104 noteDialog->PrepareLC( R_SATUI_INFORMATION_NOTE ); |
|
3105 noteDialog->SetTextL( *textHolder ); |
|
3106 iForegroundControl = noteDialog; |
|
3107 noteDialog->RunLD(); |
|
3108 iForegroundControl = NULL; |
|
3109 |
|
3110 CleanupStack::PopAndDestroy( textHolder ); |
|
3111 |
|
3112 TFLOGSTRING( "CSatUiViewAppUi::ShowNotAvailableNoteL() exit" ) |
|
3113 } |
|
3114 |
|
3115 // --------------------------------------------------------- |
|
3116 // CSatUiViewAppUi::RunQueryIconDialogL |
|
3117 // Make and run note dialog with an icon |
|
3118 // (other items were commented in a header). |
|
3119 // --------------------------------------------------------- |
|
3120 // |
|
3121 TInt CSatUiViewAppUi::RunQueryDialogL( |
|
3122 TInt aResourceId, const TDesC& aText, const CFbsBitmap* aIconBitmap, |
|
3123 const TBool aSelfExplanatory, TInt aMskCommand ) |
|
3124 { |
|
3125 TFLOGSTRING( "CSatUiViewAppUi::RunQueryDialogL called" ) |
|
3126 CEikImage* image = new(ELeave) CEikImage; |
|
3127 CleanupStack::PushL( image ); |
|
3128 iQueryDialog = CAknQueryDialog::NewL(); |
|
3129 iQueryDialog->PrepareLC( aResourceId ); |
|
3130 TInt userResponse( 0 ); |
|
3131 |
|
3132 if ( aIconBitmap ) |
|
3133 { |
|
3134 TFLOGSTRING( "CSatUiViewAppUi::RunQueryDialogL set icon" ) |
|
3135 image->SetBitmap( aIconBitmap ); |
|
3136 |
|
3137 // Create mask for icon bitmap |
|
3138 CFbsBitmap* mask = new(ELeave) CFbsBitmap; |
|
3139 TSize size = aIconBitmap->SizeInPixels(); |
|
3140 MakeGetInputBitmapMask( mask, size ); |
|
3141 image->SetMask( mask ); |
|
3142 // Add icon to query |
|
3143 iQueryDialog->QueryHeading()->SetHeaderImageL( image ); |
|
3144 } |
|
3145 |
|
3146 if ( !aSelfExplanatory || !aIconBitmap ) |
|
3147 { |
|
3148 TFLOGSTRING( "CSatUiViewAppUi::RunQueryDialogL set text" ) |
|
3149 TPtrC textPtr( aText ); |
|
3150 // Icon is not self-explanatory, show also text |
|
3151 iQueryDialog->SetPromptL( textPtr ); |
|
3152 } |
|
3153 |
|
3154 // Set MSK same as LSK without any text causing the icon drawing |
|
3155 iQueryDialog->ButtonGroupContainer().SetCommandL( |
|
3156 CEikButtonGroupContainer::EMiddleSoftkeyPosition, aMskCommand, |
|
3157 KSatEmptyDes ); |
|
3158 iForegroundControl = iQueryDialog; |
|
3159 userResponse = iQueryDialog->RunLD(); |
|
3160 iForegroundControl = NULL; |
|
3161 CleanupStack::PopAndDestroy( image ); // image |
|
3162 |
|
3163 iQueryDialog = NULL; |
|
3164 |
|
3165 TFLOGSTRING2( "CSatUiViewAppUi::RunQueryDialogL exit,return: %d", \ |
|
3166 userResponse ) |
|
3167 return userResponse; |
|
3168 } |
|
3169 |
|
3170 // --------------------------------------------------------- |
|
3171 // CSatUiViewAppUi::CloseSatUI |
|
3172 // Start SatUi closing process |
|
3173 // (other items were commented in a header). |
|
3174 // --------------------------------------------------------- |
|
3175 // |
|
3176 void CSatUiViewAppUi::CloseSatUI() |
|
3177 { |
|
3178 TFLOGSTRING( "CSatUiViewAppUi::CloseSatUI called" ) |
|
3179 |
|
3180 TRAP_IGNORE( HandleExitCommandL() ); |
|
3181 |
|
3182 if ( !IsAppShutterRunning() ) |
|
3183 { |
|
3184 TFLOGSTRING( "CSatUiViewAppUi::CloseSatUI RunAppShutter" ) |
|
3185 RunAppShutter(); |
|
3186 } |
|
3187 |
|
3188 TFLOGSTRING( "CSatUiViewAppUi::CloseSatUI exit" ) |
|
3189 } |
|
3190 |
|
3191 // --------------------------------------------------------- |
|
3192 // CSatUiViewAppUi::GetProfileParamsL |
|
3193 // Get and store settings from current profile |
|
3194 // (other items were commented in a header). |
|
3195 // --------------------------------------------------------- |
|
3196 // |
|
3197 void CSatUiViewAppUi::GetProfileParamsL( TSatTone aTone /*= ESatToneNotSet*/, |
|
3198 TDes* aToneName /*= NULL*/ ) |
|
3199 { |
|
3200 TFLOGSTRING( "CSatUiViewAppUi::GetProfileParamsL calling" ) |
|
3201 |
|
3202 MProfile* profile = NULL; |
|
3203 MProfileEngine* engine = NULL; |
|
3204 |
|
3205 engine = CreateProfileEngineL(); |
|
3206 CleanupReleasePushL( *engine ); |
|
3207 |
|
3208 profile = engine->ActiveProfileLC(); |
|
3209 |
|
3210 const MProfileTones& tones = profile->ProfileTones(); |
|
3211 |
|
3212 // Takes a current warning and gametones setting. |
|
3213 const TProfileToneSettings& ts = tones.ToneSettings(); |
|
3214 iWarningAndPlayTones = ts.iWarningAndGameTones; |
|
3215 iVolume = ts.iRingingVolume; |
|
3216 |
|
3217 if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) ) |
|
3218 { |
|
3219 TFLOGSTRING( "CSatUiViewAppUi::GetProfileParamsL message tone" ) |
|
3220 aToneName->Copy( tones.MessageAlertTone() ); |
|
3221 } |
|
3222 else if( aToneName ) |
|
3223 { |
|
3224 TFLOGSTRING( "CSatUiViewAppUi::GetProfileParamsL ring tone" ) |
|
3225 aToneName->Copy( tones.RingingTone1() ); |
|
3226 } |
|
3227 |
|
3228 CleanupStack::PopAndDestroy( 2 ); // engine, profile |
|
3229 |
|
3230 TFLOGSTRING( "CSatUiViewAppUi::GetProfileParamsL exits" ) |
|
3231 } |
|
3232 |
|
3233 // --------------------------------------------------------- |
|
3234 // CSatUiViewAppUi::HandleImmediateDigitResponse |
|
3235 // Check received key event. |
|
3236 // (other items were commented in a header). |
|
3237 // --------------------------------------------------------- |
|
3238 // |
|
3239 void CSatUiViewAppUi::HandleImmediateDigitResponse( TInt aScanCode ) |
|
3240 { |
|
3241 TFLOGSTRING2( "CSatUiViewAppUi::HandleImmediateDigitResponse() code: %d", |
|
3242 aScanCode ) |
|
3243 TBool closeDialog( ETrue ); |
|
3244 |
|
3245 // If number button is pressed |
|
3246 if ( ( KKeyZero <= aScanCode ) && ( KKeyNine >= aScanCode ) ) |
|
3247 { |
|
3248 TFLOGSTRING( "CSatUiViewAppUi::HandleImmediateDigitResponse press \ |
|
3249 digit 0-9" ) |
|
3250 iKey = aScanCode; |
|
3251 } |
|
3252 else if ( EStdKeyNkpAsterisk == aScanCode || KHwAsterisk == aScanCode ) |
|
3253 { |
|
3254 TFLOGSTRING( "CSatUiViewAppUi::HandleImmediateDigitResponse press \ |
|
3255 *" ) |
|
3256 iKey = 0x2A; |
|
3257 } |
|
3258 else if ( EStdKeyHash == aScanCode ) |
|
3259 { |
|
3260 TFLOGSTRING( "CSatUiViewAppUi::HandleImmediateDigitResponse press \ |
|
3261 #" ) |
|
3262 iKey = 0x23; |
|
3263 } |
|
3264 else |
|
3265 { |
|
3266 TFLOGSTRING( "CSatUiViewAppUi::HandleImmediateDigitResponse press \ |
|
3267 others" ) |
|
3268 closeDialog = EFalse; |
|
3269 iKey = 0x00; |
|
3270 } |
|
3271 |
|
3272 if( closeDialog ) |
|
3273 { |
|
3274 CloseDialogs(); |
|
3275 } |
|
3276 |
|
3277 TFLOGSTRING( "CSatUiViewAppUi::HandleImmediateDigitResponse exits" ) |
|
3278 } |
|
3279 |
|
3280 // --------------------------------------------------------- |
|
3281 // CSatUiViewAppUi::PriorityVerifyAndClose |
|
3282 // Handle closing display text in high priority events |
|
3283 // (other items were commented in a header). |
|
3284 // --------------------------------------------------------- |
|
3285 // |
|
3286 void CSatUiViewAppUi::PriorityVerifyAndClose( const TWsEvent& aEvent ) |
|
3287 { |
|
3288 TFLOGSTRING( "CSatUiViewAppUi::PriorityVerifyAndClose calling" ) |
|
3289 |
|
3290 if ( ( iDisplayTextDialog || iDisplayTextIconDialog ) && |
|
3291 ( EEventFocusLost == aEvent.Type() ) ) |
|
3292 { |
|
3293 // Open the WS server session. |
|
3294 RWsSession wsSession; |
|
3295 if ( KErrNone == wsSession.Connect() ) |
|
3296 { |
|
3297 TInt wgFocus( wsSession.GetFocusWindowGroup() ); |
|
3298 TInt wgPriority( |
|
3299 wsSession.GetWindowGroupOrdinalPriority( wgFocus ) ); |
|
3300 TFLOGSTRING2( |
|
3301 "CSatUiViewAppUi::PriorityVerifyAndClose priority=%d", |
|
3302 wgPriority ) |
|
3303 |
|
3304 // For some reason window group priority for call dialogs was 0 |
|
3305 // so those cases must be checked in addition |
|
3306 TInt callActiveState = EPSCTsyCallStateNone; |
|
3307 |
|
3308 // Get current call status from P&S |
|
3309 const TInt errCode( RProperty::Get( |
|
3310 KPSUidCtsyCallInformation, |
|
3311 KCTsyCallState, |
|
3312 callActiveState ) ); |
|
3313 |
|
3314 // Receiving MT or creating MO call |
|
3315 const TBool callIncoming( |
|
3316 ( EPSCTsyCallStateAlerting == callActiveState ) || |
|
3317 ( EPSCTsyCallStateRinging == callActiveState ) || |
|
3318 ( EPSCTsyCallStateDialling == callActiveState ) ); |
|
3319 TFLOGSTRING2( |
|
3320 "CSatUiViewAppUi::PriorityVerifyAndClose callActiveState=%d", |
|
3321 callActiveState ) |
|
3322 TFLOGSTRING2( |
|
3323 "CSatUiViewAppUi::PriorityVerifyAndClose iImmediateRsp=%d", |
|
3324 iImmediateRsp ) |
|
3325 |
|
3326 // If the new focus window group has high priority |
|
3327 // close dialog |
|
3328 if ( ( wgPriority > 0 && iForeground ) || |
|
3329 ( iImmediateRsp && callIncoming ) ) |
|
3330 { |
|
3331 iHighPriorityEvent = ETrue; |
|
3332 CloseDialogs(); |
|
3333 } |
|
3334 |
|
3335 wsSession.Close(); |
|
3336 } |
|
3337 } |
|
3338 |
|
3339 TFLOGSTRING( "CSatUiViewAppUi::PriorityVerifyAndClose exiting" ) |
|
3340 } |
|
3341 |
|
3342 // --------------------------------------------------------- |
|
3343 // CSatUiViewAppUi::CloseCallControlNote |
|
3344 // Call back method, close the note in call control. |
|
3345 // (other items were commented in a header). |
|
3346 // --------------------------------------------------------- |
|
3347 // |
|
3348 TInt CSatUiViewAppUi::CloseCallControlNoteL( TAny* aPtr ) |
|
3349 { |
|
3350 TFLOGSTRING( "CSatUiViewAppUi::CloseCallControlNote calling" ) |
|
3351 |
|
3352 if ( !aPtr ) |
|
3353 { |
|
3354 return KErrArgument; |
|
3355 } |
|
3356 |
|
3357 CSatUiViewAppUi* pAppUi = |
|
3358 reinterpret_cast<CSatUiViewAppUi*>( aPtr ); |
|
3359 |
|
3360 TRAPD( err, pAppUi->iCcNote->CancelNoteL( pAppUi->iCcNoteId ) ); |
|
3361 if( KErrNone != err ) |
|
3362 { |
|
3363 return err; |
|
3364 } |
|
3365 |
|
3366 if ( pAppUi->iWait->IsStarted() ) |
|
3367 { |
|
3368 pAppUi->iWait->AsyncStop(); |
|
3369 } |
|
3370 delete pAppUi->iCcNote; |
|
3371 pAppUi->iCcNote = NULL; |
|
3372 |
|
3373 TFLOGSTRING( "CSatUiViewAppUi::CloseCallControlNote exiting" ) |
|
3374 |
|
3375 return 0; |
|
3376 } |
|
3377 |
|
3378 // --------------------------------------------------------- |
|
3379 // CSatUiViewAppUi::ShowSsErrorNoteL |
|
3380 // Show a Ss Error note. |
|
3381 // (other items were commented in a header). |
|
3382 // --------------------------------------------------------- |
|
3383 // |
|
3384 void CSatUiViewAppUi::ShowSsErrorNoteL() |
|
3385 { |
|
3386 TFLOGSTRING( "CSatUiViewAppUi::ShowSsErrorNoteL calling" ) |
|
3387 CAknNoteDialog* errorNote = new ( ELeave ) CAknNoteDialog( |
|
3388 REINTERPRET_CAST( CEikDialog**,&errorNote ), |
|
3389 CAknNoteDialog::ENoTone, |
|
3390 CAknNoteDialog::ELongTimeout ); |
|
3391 CleanupStack::PushL( errorNote ); |
|
3392 |
|
3393 HBufC* textHolder = StringLoader::LoadLC(R_TEXT_NOT_DONE, iCoeEnv ); |
|
3394 errorNote->SetTextL( *textHolder ); |
|
3395 CleanupStack::PopAndDestroy( textHolder ); |
|
3396 CleanupStack::Pop( errorNote ); |
|
3397 errorNote->ExecuteLD( R_SATUI_INFORMATION_NOTE ); |
|
3398 |
|
3399 TFLOGSTRING( "CSatUiViewAppUi::ShowSsErrorNoteL exiting" ) |
|
3400 } |
|
3401 |
|
3402 // ----------------------------------------------------------------------------- |
|
3403 // CSatUiViewAppUi::ProfileState |
|
3404 // Return current profile state |
|
3405 // ----------------------------------------------------------------------------- |
|
3406 // |
|
3407 TInt CSatUiViewAppUi::ProfileState() |
|
3408 { |
|
3409 TFLOGSTRING( "CSatUiViewAppUi::ProfileState called" ) |
|
3410 |
|
3411 TInt profileId( 0 ); |
|
3412 CRepository* cr ( NULL ); |
|
3413 |
|
3414 TRAPD( err, cr = CRepository::NewL( KCRUidProfileEngine ) ); |
|
3415 if ( ( KErrNone == err ) && cr ) |
|
3416 { |
|
3417 TFLOGSTRING( "CSatUiViewAppUi::ProfileState no err" ) |
|
3418 // Get the ID of the currently active profile: |
|
3419 cr->Get( KProEngActiveProfile, profileId ); |
|
3420 delete cr; |
|
3421 } |
|
3422 |
|
3423 else |
|
3424 { |
|
3425 TFLOGSTRING2( "CR failed: %i", err ) |
|
3426 } |
|
3427 |
|
3428 TFLOGSTRING2( "CSatUiViewAppUi::ProfileState exit value: %d", |
|
3429 profileId ) |
|
3430 |
|
3431 return profileId; |
|
3432 } |
|
3433 // ----------------------------------------------------------------------------- |
|
3434 // CSatUiViewAppUi::StopPlayToneL |
|
3435 // Stops playing play tone. Used when user terminates play tone |
|
3436 // ----------------------------------------------------------------------------- |
|
3437 // |
|
3438 void CSatUiViewAppUi::StopPlayToneL() |
|
3439 { |
|
3440 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL called" ) |
|
3441 if ( iPlayer && iWait->IsStarted() ) |
|
3442 { |
|
3443 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL\ |
|
3444 iPlayer exists" ) |
|
3445 iWait->AsyncStop(); |
|
3446 } |
|
3447 if ( iAudioPlayer ) |
|
3448 { |
|
3449 TFLOGSTRING( "StopPlayToneL iAudioPlayer exists" ) |
|
3450 if ( iWait->IsStarted() ) |
|
3451 { |
|
3452 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL\ |
|
3453 iWait started" ) |
|
3454 // Remove note when play has been interrupted. |
|
3455 if ( iPermanentNote ) |
|
3456 { |
|
3457 iPermanentNote->ExitSleepingDialog(); |
|
3458 delete iPermanentNote; |
|
3459 iPermanentNote = NULL; |
|
3460 } |
|
3461 iWait->AsyncStop(); |
|
3462 } |
|
3463 else |
|
3464 { |
|
3465 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL\ |
|
3466 iWait not started" ) |
|
3467 iAudioPlayer->Stop(); |
|
3468 // When playing is stopped, deleting the audio player. |
|
3469 // MapcPlayComplete is not called because user stops |
|
3470 // the playing. |
|
3471 if ( iAudioPlayer ) |
|
3472 { |
|
3473 delete iAudioPlayer; |
|
3474 iAudioPlayer = NULL; |
|
3475 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL\ |
|
3476 iAudioPlayer deleted" ) |
|
3477 |
|
3478 // Remove note after play has completed. |
|
3479 if ( iPermanentNote ) |
|
3480 { |
|
3481 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL\ |
|
3482 iPermanentNote true" ) |
|
3483 iPermanentNote->ExitSleepingDialog(); |
|
3484 delete iPermanentNote; |
|
3485 iPermanentNote = NULL; |
|
3486 } |
|
3487 |
|
3488 // Show wait note only for samples that have |
|
3489 // duration, otherwise there is chance that wait |
|
3490 // note is not stopped. |
|
3491 if ( TTimeIntervalMicroSeconds( |
|
3492 static_cast<TInt64>( 0 ) ) != iDuration ) |
|
3493 { |
|
3494 ShowWaitNoteL(); |
|
3495 } |
|
3496 } |
|
3497 } |
|
3498 } |
|
3499 TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL exiting" ) |
|
3500 } |
|
3501 |
|
3502 // End of File |