|
1 /* |
|
2 * Copyright (c) 2002-2010 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: This class handles the communication between server and |
|
15 * user interface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32test.h> |
|
22 #include <msatuiadapter.h> |
|
23 #include <ProfileEngineSDKCRKeys.h> |
|
24 #include <centralrepository.h> |
|
25 #include <settingsinternalcrkeys.h> |
|
26 #include <gulicon.h> //for itemsicon |
|
27 #include <fbs.h> |
|
28 |
|
29 #include "csatuiobserver.h" |
|
30 #include "msatuiactionimplementer.h" |
|
31 #include "csatuiiconhandler.h" |
|
32 #include "tflogger.h" |
|
33 |
|
34 // CONSTANTS |
|
35 const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine |
|
36 |
|
37 // PlayTone durations |
|
38 const TInt64 KSatDur170ms = 170000; // 170ms |
|
39 const TInt64 KSatDur200ms = 200000; // 200ms |
|
40 const TInt64 KSatDur250ms = 250000; // 250ms |
|
41 const TInt64 KSatDur1200ms = 1200000; // 1200ms |
|
42 |
|
43 // play tone tones |
|
44 _LIT8(KNetToneSeqNetBusy, "\x00\x11\x05\x4E\x30\x40\x30\x07\x0B"); |
|
45 |
|
46 _LIT8(KNetToneSeqNetCallWaiting, "\x00\x11\x05\x4E\x14\x40\x3C\x4E\x14\ |
|
47 \x40\x64\x40\x64\x40\x64\x4E\x14\x40\x3C\x4E\x14\x40\x64\x40\x64\x40\x64\ |
|
48 \x07\x0B"); |
|
49 |
|
50 _LIT8(KNetToneSeqNetCongestion, "\x00\x11\x05\x4E\x14\x40\x14\x07\x0B"); |
|
51 |
|
52 _LIT8(KNetToneSeqNetSpecialInformation, "\x00\x11\x05\x4F\x21\x50\ |
|
53 \x21\x51\x21\x40\x64\x07\x0B"); |
|
54 |
|
55 _LIT8(KNetToneSeqDial,"\x00\x11\x05\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\ |
|
56 \x4E\xFE\x4E\xFE\x4E\xFE\x07\x0B"); |
|
57 |
|
58 _LIT8(KNetToneSeqRingGoing, "\x00\x11\x05\x4E\x64\x05\x04\x40\x64\06\x07\x0B"); |
|
59 |
|
60 // General Beep is set for forever duration. Instead of AVKON definition 170ms. |
|
61 _LIT8(KGeneralBeep, "\x00\x11\x0A\x76\x00\x0B"); |
|
62 _LIT8(KErrorTone, "\x00\x11\x0A\x6C\x19\x0B"); |
|
63 _LIT8(KRadioPathNotAvailable, "\x00\x11\x0A\x05\x03\x4E\x14\x40\x14\x06\x0B"); |
|
64 _LIT8(KRadioPathAck, "\x00\x11\x0A\x02\xFC\x0A\x80\x4E\x14\x0A\x7f\x0B"); |
|
65 |
|
66 // ================= MEMBER FUNCTIONS ========================================= |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // CSatUiObserver::CSatUiObserver |
|
70 // (other items were commented in a header). |
|
71 // ---------------------------------------------------------------------------- |
|
72 // |
|
73 CSatUiObserver::CSatUiObserver(): |
|
74 iRefresh(EFalse), |
|
75 iIconSupport(ETrue), |
|
76 iClearScreenEvent(EFalse) |
|
77 { |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CSatUiObserver::ConstructL |
|
82 // (other items were commented in a header). |
|
83 // ---------------------------------------------------------------------------- |
|
84 // |
|
85 void CSatUiObserver::ConstructL() |
|
86 { |
|
87 TFLOGSTRING("SATAPP: CSatUiObserver::ConstructL called") |
|
88 |
|
89 //Register to Server as subsession |
|
90 //If Server is not up, this function call may take time |
|
91 iSatSession.ConnectL(); |
|
92 |
|
93 iSat.RegisterL(iSatSession, this); |
|
94 iAdapter = iSat.Adapter(); |
|
95 if (!iAdapter) |
|
96 { |
|
97 User::Leave(KErrNotFound); |
|
98 } |
|
99 |
|
100 // create icon handler |
|
101 //iIconHandler = CSatUiIconHandler::NewL(); |
|
102 |
|
103 //Item icons |
|
104 //iItemIcons = new (ELeave) CAknIconArray(1); |
|
105 |
|
106 TFLOGSTRING("SATAPP: CSatUiObserver::ConstructL exit") |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------------------------------- |
|
110 // CSatUiObserver::NewL |
|
111 // (other items were commented in a header). |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 CSatUiObserver* CSatUiObserver::NewL() |
|
115 { |
|
116 TFLOGSTRING("SATAPP: CSatUiObserver::NewL() called") |
|
117 CSatUiObserver* self = new (ELeave) CSatUiObserver; |
|
118 |
|
119 CleanupStack::PushL(self); |
|
120 self->ConstructL(); |
|
121 CleanupStack::Pop(self); |
|
122 TFLOGSTRING("SATAPP: CSatUiObserver::NewL() exit") |
|
123 return self; |
|
124 } |
|
125 |
|
126 // ---------------------------------------------------------------------------- |
|
127 // CSatUiObserver::~CSatUiObserver |
|
128 // (other items were commented in a header). |
|
129 // ---------------------------------------------------------------------------- |
|
130 // |
|
131 CSatUiObserver::~CSatUiObserver() |
|
132 { |
|
133 TFLOGSTRING("SATAPP: CSatUiObserver::~CSatUiObserver() called") |
|
134 |
|
135 iSat.Close(); |
|
136 iSatSession.Close(); |
|
137 |
|
138 // if (iItemIcons) |
|
139 // { |
|
140 // iItemIcons->ResetAndDestroy(); |
|
141 // delete iItemIcons; |
|
142 // } |
|
143 |
|
144 // delete icon handler |
|
145 // delete iIconHandler; |
|
146 // iIconHandler = NULL; |
|
147 |
|
148 iActionImplementer = NULL; |
|
149 iAdapter = NULL; |
|
150 |
|
151 TFLOGSTRING("SATAPP: CSatUiObserver::~CSatUiObserver() exit") |
|
152 } |
|
153 |
|
154 // ---------------------------------------------------------------------------- |
|
155 // CSatUiObserver::SetImplementer |
|
156 // Sets a pointer to CSatUiViewAppUi object. |
|
157 // (other items were commented in a header). |
|
158 // ---------------------------------------------------------------------------- |
|
159 // |
|
160 void CSatUiObserver::SetImplementer( |
|
161 MSatUiActionImplementer* aImplementer) |
|
162 { |
|
163 TFLOGSTRING("SATAPP: CSatUiObserver::SetImplementer calling") |
|
164 iActionImplementer = aImplementer; |
|
165 TFLOGSTRING("SATAPP: CSatUiObserver::SetImplementer exiting") |
|
166 } |
|
167 |
|
168 // ---------------------------------------------------------------------------- |
|
169 // CSatUiObserver::Adapter |
|
170 // Returns a pointer to MSatUiAdapter provided by SatCli. |
|
171 // (other items were commented in a header). |
|
172 // ---------------------------------------------------------------------------- |
|
173 // |
|
174 MSatUiAdapter* CSatUiObserver::Adapter() |
|
175 { |
|
176 TFLOGSTRING("SATAPP: CSatUiObserver::Adapter calling-exiting") |
|
177 return iAdapter; |
|
178 } |
|
179 |
|
180 // ---------------------------------------------------------------------------- |
|
181 // CSatUiObserver::DisplayTextL |
|
182 // Checks length of the text and calls method from |
|
183 // the CSatUiViewAppUi class if the length is OK. |
|
184 // (other items were commented in a header). |
|
185 // ---------------------------------------------------------------------------- |
|
186 // |
|
187 TSatUiResponse CSatUiObserver::DisplayTextL( |
|
188 const TDesC& aText, |
|
189 const TDesC& aSimApplicationName, |
|
190 const TSatIconId& aIconId, |
|
191 TBool& aRequestedIconDisplayed, |
|
192 const TBool aSustainedText, |
|
193 const TTimeIntervalSeconds aDuration, |
|
194 const TBool aWaitUserToClear) |
|
195 { |
|
196 TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText called") |
|
197 TSatUiResponse response(ESatFailure); |
|
198 aRequestedIconDisplayed = ETrue; |
|
199 TBool selfExplanatoryIcon(EFalse); |
|
200 |
|
201 TInt textLength(aText.Length()); |
|
202 |
|
203 if ((!textLength) || (textLength > RSat::KTextToDisplayMaxSize)) |
|
204 { |
|
205 TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText no text") |
|
206 aRequestedIconDisplayed = EFalse; |
|
207 return response; |
|
208 } |
|
209 |
|
210 CFbsBitmap* iconBitmapDisplayText = NULL; |
|
211 iActionImplementer->SetCommandPending(ETrue); |
|
212 |
|
213 //if icon is available for command |
|
214 if (((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
215 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
216 (iIconSupport)) |
|
217 { |
|
218 TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText have icon") |
|
219 iconBitmapDisplayText = FetchIcon(aIconId.iIdentifier, |
|
220 EIconDisplayText); |
|
221 |
|
222 if (ESatSelfExplanatory == aIconId.iIconQualifier) |
|
223 { |
|
224 TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText self \ |
|
225 explanatory icon") |
|
226 selfExplanatoryIcon = ETrue; |
|
227 } |
|
228 } |
|
229 |
|
230 //icon not found not shown |
|
231 if (!iconBitmapDisplayText) |
|
232 { |
|
233 aRequestedIconDisplayed = EFalse; |
|
234 } |
|
235 |
|
236 iActionImplementer->DispatchTimer(iWait); |
|
237 |
|
238 TFLOGSTRING2("CSatUiObserver::DisplayTextL aDuration: %d", aDuration.Int()) |
|
239 TRAPD(err, |
|
240 response = iActionImplementer->DisplayTextL(aText, aSimApplicationName, |
|
241 iconBitmapDisplayText, selfExplanatoryIcon, |
|
242 aSustainedText, aDuration, aWaitUserToClear); |
|
243 ); |
|
244 |
|
245 if (err != KErrNone) |
|
246 { |
|
247 response = ESatFailure; |
|
248 aRequestedIconDisplayed = EFalse; |
|
249 } |
|
250 |
|
251 if (iActionImplementer->GetEndKey()) |
|
252 { |
|
253 response = ESatSessionTerminatedByUser; |
|
254 iActionImplementer->SetEndKey(EFalse); |
|
255 } |
|
256 |
|
257 iActionImplementer->SetCommandPending(EFalse); |
|
258 |
|
259 TFLOGSTRING2("SATAPP: CSatUiObserver::DisplayText exit, return: %d", \ |
|
260 response) |
|
261 return response; |
|
262 } |
|
263 |
|
264 // ---------------------------------------------------------------------------- |
|
265 // CSatUiObserver::GetInkeyL |
|
266 // Checks type of the input wanted and calls right method |
|
267 // from the CSatUiViewAppUi class. |
|
268 // (other items were commented in a header). |
|
269 // ---------------------------------------------------------------------------- |
|
270 // |
|
271 TSatUiResponse CSatUiObserver::GetInkeyL( |
|
272 const TDesC& aText, |
|
273 const TSatCharacterSet aCharacterSet, |
|
274 TChar& aInput, |
|
275 const TBool /*aHelpIsAvailable*/, |
|
276 const TSatIconId& aIconId, |
|
277 TBool& aRequestedIconDisplayed, |
|
278 TUint& aDuration, |
|
279 const TBool aImmediateDigitResponse) |
|
280 { |
|
281 TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey called") |
|
282 |
|
283 TSatUiResponse response(ESatSuccess); |
|
284 aRequestedIconDisplayed = EFalse; |
|
285 TBuf<1> input; |
|
286 |
|
287 if (aInput.IsAssigned()) |
|
288 { |
|
289 input.Fill(aInput, 1); |
|
290 } |
|
291 |
|
292 if ((aCharacterSet == ESatYesNo) && (aText.Length() == 0)) |
|
293 { |
|
294 TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey return ESatFailure") |
|
295 return ESatFailure; |
|
296 } |
|
297 |
|
298 CFbsBitmap* iconBitmapGetInkey = NULL; |
|
299 iActionImplementer->SetCommandPending(ETrue); |
|
300 |
|
301 // If icon is available for command |
|
302 if (((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
303 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
304 (iIconSupport)) |
|
305 { |
|
306 TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey have icon") |
|
307 TIconCommand iconCommand (EIconGetInkey); |
|
308 |
|
309 if (ESatYesNo == aCharacterSet) |
|
310 { |
|
311 iconCommand = EIconGetYesNo; |
|
312 } |
|
313 |
|
314 iconBitmapGetInkey = FetchIcon(aIconId.iIdentifier, |
|
315 iconCommand); |
|
316 GetScalableBitmap(iconBitmapGetInkey, iconCommand, |
|
317 aRequestedIconDisplayed); |
|
318 } |
|
319 |
|
320 TBool selfExplanatory(EFalse); |
|
321 |
|
322 // Icon is self-explanatory |
|
323 if (ESatSelfExplanatory == aIconId.iIconQualifier) |
|
324 { |
|
325 selfExplanatory = ETrue; |
|
326 } |
|
327 |
|
328 iActionImplementer->DispatchTimer(iWait); |
|
329 |
|
330 TRAPD(err, |
|
331 |
|
332 if (ESatYesNo == aCharacterSet || aImmediateDigitResponse) |
|
333 { |
|
334 TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey digit response") |
|
335 response = iActionImplementer->GetYesNoL(aText, aCharacterSet, |
|
336 aInput, iconBitmapGetInkey, selfExplanatory, aDuration, |
|
337 aImmediateDigitResponse); |
|
338 } |
|
339 else //ESatCharSmsDefaultAlphabet, ESatCharUcs2Alphabet, ESatDigitOnly |
|
340 { |
|
341 TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey other conditions") |
|
342 response = iActionImplementer->GetInputL( |
|
343 aText, aCharacterSet, input, 1, 1, EFalse, ETrue, |
|
344 iconBitmapGetInkey, selfExplanatory, aDuration); |
|
345 |
|
346 if (ESatSuccess == response) |
|
347 { |
|
348 if (input.Length()) |
|
349 { |
|
350 aInput = input[0]; |
|
351 } |
|
352 } |
|
353 } |
|
354 ); |
|
355 |
|
356 if (err != KErrNone) |
|
357 { |
|
358 response = ESatFailure; |
|
359 } |
|
360 |
|
361 if (iActionImplementer->GetEndKey()) |
|
362 { |
|
363 response = ESatSessionTerminatedByUser; |
|
364 iActionImplementer->SetEndKey(EFalse); |
|
365 } |
|
366 iActionImplementer->SetCommandPending(EFalse); |
|
367 |
|
368 TFLOGSTRING2("SATAPP: CSatUiObserver::GetInkey exit, return: %d", \ |
|
369 response) |
|
370 return response; |
|
371 } |
|
372 |
|
373 // -------------------------------------------------------- |
|
374 // CSatUiObserver::GetInputL |
|
375 // Checks type of the input wanted and whether it should be |
|
376 // hidden and calls right method from the CSatUiViewAppUi class. |
|
377 // (other items were commented in a header). |
|
378 // ---------------------------------------------------------------------------- |
|
379 // |
|
380 TSatUiResponse CSatUiObserver::GetInputL( |
|
381 const TDesC& aText, |
|
382 const TSatCharacterSet aCharacterSet, |
|
383 TDes& aInput, |
|
384 const TInt aMinLength, |
|
385 const TInt aMaxLength, |
|
386 const TBool aHideInput, |
|
387 const TBool /*aHelpIsAvailable*/, |
|
388 const TSatIconId& aIconId, |
|
389 TBool& aRequestedIconDisplayed) |
|
390 { |
|
391 TFLOGSTRING("SATAPP: CSatUiObserver::GetInput called") |
|
392 TSatUiResponse response(ESatSuccess); |
|
393 aRequestedIconDisplayed = EFalse; |
|
394 |
|
395 if (((aCharacterSet == ESatCharSmsDefaultAlphabet) || |
|
396 (aCharacterSet == ESatCharUcs2Alphabet)) && |
|
397 (aHideInput)) |
|
398 { |
|
399 TFLOGSTRING("SATAPP: CSatUiObserver::GetInput return ESatFailure") |
|
400 return ESatFailure; |
|
401 } |
|
402 |
|
403 CFbsBitmap* iconBitmapGetInput = NULL; |
|
404 iActionImplementer->SetCommandPending(ETrue); |
|
405 |
|
406 // If icon is available for command |
|
407 if (((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
408 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
409 (iIconSupport)) |
|
410 { |
|
411 iconBitmapGetInput = FetchIcon(aIconId.iIdentifier, EIconGetInput); |
|
412 GetScalableBitmap(iconBitmapGetInput, EIconGetInput, |
|
413 aRequestedIconDisplayed); |
|
414 } |
|
415 |
|
416 TBool selfExplanatory(EFalse); |
|
417 |
|
418 // Icon is self-explanatory |
|
419 if (ESatSelfExplanatory == aIconId.iIconQualifier) |
|
420 { |
|
421 selfExplanatory = ETrue; |
|
422 } |
|
423 |
|
424 iActionImplementer->DispatchTimer(iWait); |
|
425 |
|
426 TUint duration (0); |
|
427 TRAPD(err, |
|
428 response = iActionImplementer->GetInputL( |
|
429 aText, aCharacterSet, aInput, aMinLength, aMaxLength, |
|
430 aHideInput, EFalse, iconBitmapGetInput, selfExplanatory, |
|
431 duration); |
|
432 ); |
|
433 |
|
434 if (err != KErrNone) |
|
435 { |
|
436 TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput err:%d", err) |
|
437 response = ESatFailure; |
|
438 aRequestedIconDisplayed = EFalse; |
|
439 } |
|
440 |
|
441 if (iActionImplementer->GetEndKey()) |
|
442 { |
|
443 response = ESatSessionTerminatedByUser; |
|
444 iActionImplementer->SetEndKey(EFalse); |
|
445 } |
|
446 iActionImplementer->SetCommandPending(EFalse); |
|
447 |
|
448 TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput response:%d", response) |
|
449 TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput aRequestedIconDisplayed:%d", |
|
450 aRequestedIconDisplayed) |
|
451 TFLOGSTRING("SATAPP: CSatUiObserver::GetInput exit") |
|
452 return response; |
|
453 } |
|
454 |
|
455 // ---------------------------------------------------------------------------- |
|
456 // CSatUiObserver::SetUpMenuL |
|
457 // Calls the method from the CSatUiViewAppUi class to show |
|
458 // a SetUpMenu view. |
|
459 // (other items were commented in a header). |
|
460 // ---------------------------------------------------------------------------- |
|
461 // |
|
462 TSatUiResponse CSatUiObserver::SetUpMenuL( |
|
463 const TDesC& aText, |
|
464 const MDesCArray& aMenuItems, |
|
465 const CArrayFixFlat<TSatAction>* aMenuItemNextActions, |
|
466 const TBool aHelpIsAvailable, |
|
467 const TSatIconId& aIconId, |
|
468 const CArrayFixFlat<TInt>* aMenuIcons, |
|
469 const enum TSatIconQualifier aIconListQualifier, |
|
470 const enum TSatSelectionPreference /*aSelectionPreference*/) |
|
471 { |
|
472 TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu called") |
|
473 TSatUiResponse response(ESatSuccess); |
|
474 TBool selfExplanatoryItems(EFalse); |
|
475 CFbsBitmap* iconTitleBitmap = NULL; |
|
476 iActionImplementer->SetCommandPending(ETrue); |
|
477 |
|
478 TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu item count: %d", |
|
479 aMenuItems.MdcaCount()) |
|
480 |
|
481 if (!aMenuItems.MdcaCount() || |
|
482 (KSatActiveProfileOffline == ProfileState())) |
|
483 { |
|
484 iActionImplementer->SetCommandPending(EFalse); |
|
485 iActionImplementer->ShowNotAvailableNoteL(); |
|
486 iActionImplementer->CloseSatUI(); |
|
487 return response; |
|
488 } |
|
489 |
|
490 //if contextpane icon available for command |
|
491 TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu icon qua: %d", |
|
492 aIconId.iIconQualifier) |
|
493 if (((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
494 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
495 (iIconSupport)) |
|
496 { |
|
497 iconTitleBitmap = FetchIcon(aIconId.iIdentifier, |
|
498 EIconSetUpMenuContext); |
|
499 GetScalableBitmap(iconTitleBitmap, EIconSetUpMenuContext); |
|
500 } |
|
501 |
|
502 // iItemIcons->ResetAndDestroy(); |
|
503 TInt iconCount(0); |
|
504 |
|
505 if (aMenuIcons) |
|
506 { |
|
507 iconCount = aMenuIcons->Count(); |
|
508 TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu icon count: %d", iconCount) |
|
509 } |
|
510 |
|
511 |
|
512 //if icons are available for item list |
|
513 if ((aMenuItems.MdcaCount() == iconCount) && |
|
514 ((aIconListQualifier == ESatSelfExplanatory) || |
|
515 (aIconListQualifier == ESatNotSelfExplanatory)) && |
|
516 (iIconSupport)) |
|
517 { |
|
518 TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu have icon") |
|
519 if (aIconListQualifier == ESatSelfExplanatory) |
|
520 { |
|
521 selfExplanatoryItems = ETrue; |
|
522 } |
|
523 |
|
524 TBool continueLoop(ETrue); |
|
525 TInt count(0); |
|
526 for (count = 0; (count < iconCount) && continueLoop; count++) |
|
527 { |
|
528 CGulIcon* gulIcon = CGulIcon::NewLC(); |
|
529 TUint8 itemIconId(STATIC_CAST(TUint8, |
|
530 aMenuIcons->operator[](count))); |
|
531 CFbsBitmap* iconItemBitmap = NULL; |
|
532 iconItemBitmap = FetchIcon(itemIconId, EIconSetUpMenuItems); |
|
533 |
|
534 if (!iconItemBitmap && |
|
535 (aIconListQualifier == ESatSelfExplanatory)) |
|
536 { |
|
537 TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \ |
|
538 SelfExplanatory ") |
|
539 CleanupStack::PopAndDestroy(gulIcon); // gulIcon |
|
540 // iItemIcons->ResetAndDestroy(); |
|
541 continueLoop = EFalse; |
|
542 } |
|
543 else |
|
544 { |
|
545 if (!iconItemBitmap && |
|
546 (aIconListQualifier == ESatNotSelfExplanatory)) |
|
547 { |
|
548 TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \ |
|
549 not SelfExplanatory ") |
|
550 iconItemBitmap = new(ELeave)CFbsBitmap(); |
|
551 } |
|
552 else |
|
553 { |
|
554 TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \ |
|
555 other conditions ") |
|
556 GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems); |
|
557 } |
|
558 |
|
559 gulIcon->SetBitmap(iconItemBitmap); |
|
560 // iItemIcons->AppendL(gulIcon); |
|
561 CleanupStack::Pop(gulIcon); |
|
562 } |
|
563 } |
|
564 TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu count: %d", count) |
|
565 } |
|
566 |
|
567 TRAPD(err, |
|
568 response = iActionImplementer->SetUpMenuL( |
|
569 aText, aMenuItems, aMenuItemNextActions, iconTitleBitmap, |
|
570 /*iItemIcons,*/ selfExplanatoryItems, aHelpIsAvailable); |
|
571 ); |
|
572 |
|
573 TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu err: %d", err) |
|
574 |
|
575 if (KErrNone != err) |
|
576 { |
|
577 response = ESatFailure; |
|
578 } |
|
579 |
|
580 if (iActionImplementer->GetEndKey()) |
|
581 { |
|
582 response = ESatSessionTerminatedByUser; |
|
583 iActionImplementer->SetEndKey(EFalse); |
|
584 } |
|
585 |
|
586 iActionImplementer->SetCommandPending(EFalse); |
|
587 TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu exit, \ |
|
588 return:%i", response) |
|
589 return response; |
|
590 } |
|
591 |
|
592 // ---------------------------------------------------------------------------- |
|
593 // CSatUiObserver::SelectItemL |
|
594 // Calls the method from the CSatUiViewAppUi class to show |
|
595 // a SelectItem view. |
|
596 // (other items were commented in a header). |
|
597 // ---------------------------------------------------------------------------- |
|
598 // |
|
599 TSatUiResponse CSatUiObserver::SelectItemL( |
|
600 const TDesC& aText, |
|
601 const MDesCArray& aMenuItems, |
|
602 const CArrayFixFlat<TSatAction>* aMenuItemNextActions, |
|
603 const TInt aDefaultItem, |
|
604 TUint8& aSelection, |
|
605 const TBool aHelpIsAvailable, |
|
606 const TSatIconId& aIconId, |
|
607 const CArrayFixFlat<TInt>* aMenuIcons, |
|
608 const enum TSatIconQualifier aIconListQualifier, |
|
609 TBool& aRequestedIconDisplayed, |
|
610 const enum TSatSelectionPreference /*aSelectionPreference*/) |
|
611 { |
|
612 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem called") |
|
613 TSatUiResponse response(ESatSuccess); |
|
614 aRequestedIconDisplayed = ETrue; |
|
615 TBool selfExplanatoryItems(EFalse); |
|
616 |
|
617 CFbsBitmap* iconTitleBitmap = NULL; |
|
618 iActionImplementer->SetCommandPending(ETrue); |
|
619 |
|
620 //if contextpane icon available for command |
|
621 if (((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
622 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
623 (iIconSupport)) |
|
624 { |
|
625 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem icon available") |
|
626 iconTitleBitmap = FetchIcon(aIconId.iIdentifier, |
|
627 EIconSetUpMenuContext); |
|
628 GetScalableBitmap(iconTitleBitmap, EIconSetUpMenuContext, |
|
629 aRequestedIconDisplayed); |
|
630 } |
|
631 |
|
632 //iItemIcons->ResetAndDestroy(); |
|
633 |
|
634 TInt iconCount(0); |
|
635 |
|
636 if (aMenuIcons) |
|
637 { |
|
638 iconCount = aMenuIcons->Count(); |
|
639 } |
|
640 |
|
641 TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem iconCount:%d", iconCount) |
|
642 |
|
643 //if icons are available for item list |
|
644 if ((aMenuItems.MdcaCount() == iconCount) && |
|
645 ((aIconListQualifier == ESatSelfExplanatory) || |
|
646 (aIconListQualifier == ESatNotSelfExplanatory)) && |
|
647 (iIconSupport)) |
|
648 { |
|
649 TFLOGSTRING( |
|
650 "SATAPP: CSatUiObserver::SelectItem icon available for item list") |
|
651 |
|
652 if (aIconListQualifier == ESatSelfExplanatory) |
|
653 { |
|
654 selfExplanatoryItems = ETrue; |
|
655 } |
|
656 |
|
657 TBool continueLoop(ETrue); |
|
658 TInt count(0); |
|
659 for (count = 0; (count < iconCount) && continueLoop; count++) |
|
660 { |
|
661 CGulIcon* gulIcon = CGulIcon::NewLC(); |
|
662 TUint8 itemIconId = STATIC_CAST(TUint8, |
|
663 aMenuIcons->operator[](count)); |
|
664 CFbsBitmap* iconItemBitmap = NULL; |
|
665 iconItemBitmap = FetchIcon(itemIconId, EIconSetUpMenuItems); |
|
666 |
|
667 // when icon can't be received and is set to self explanatory, we |
|
668 // iqnore all icons and show only text |
|
669 if (!iconItemBitmap && |
|
670 (aIconListQualifier == ESatSelfExplanatory)) |
|
671 { |
|
672 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ |
|
673 SelfExplanatory ") |
|
674 CleanupStack::PopAndDestroy(gulIcon); // gulIcon |
|
675 //iItemIcons->ResetAndDestroy(); |
|
676 continueLoop = EFalse; |
|
677 aRequestedIconDisplayed = EFalse; |
|
678 } |
|
679 else |
|
680 { |
|
681 // when icon can't be received and is set to not self |
|
682 // explanatory, we replace it with empty icon |
|
683 if (!iconItemBitmap && |
|
684 (aIconListQualifier == ESatNotSelfExplanatory)) |
|
685 { |
|
686 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ |
|
687 not SelfExplanatory ") |
|
688 iconItemBitmap = new(ELeave)CFbsBitmap(); |
|
689 aRequestedIconDisplayed = EFalse; |
|
690 } |
|
691 // when icon was able to receive, we scale it |
|
692 // if every prior icon is correctly received |
|
693 else if (aRequestedIconDisplayed) |
|
694 { |
|
695 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ |
|
696 receive icon ") |
|
697 GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems, |
|
698 aRequestedIconDisplayed); |
|
699 } |
|
700 // if aRequestIconDisplayed is false, at least one prior icon |
|
701 // fetch had problems and thus we must report that by not |
|
702 // updating aRequestedIconDisplayed |
|
703 else |
|
704 { |
|
705 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \ |
|
706 aRequestIconDisplayed false ") |
|
707 GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems); |
|
708 } |
|
709 |
|
710 gulIcon->SetBitmap(iconItemBitmap); |
|
711 //iItemIcons->AppendL(gulIcon); |
|
712 CleanupStack::Pop(gulIcon); |
|
713 } |
|
714 } |
|
715 TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem count: %d", count) |
|
716 } |
|
717 |
|
718 TRAPD(err, |
|
719 response = iActionImplementer->SelectItemL(aText, aMenuItems, |
|
720 aMenuItemNextActions, aDefaultItem, aSelection, iconTitleBitmap, |
|
721 /*iItemIcons,*/ selfExplanatoryItems, aHelpIsAvailable); |
|
722 ); |
|
723 |
|
724 if (err != KErrNone) |
|
725 { |
|
726 response = ESatFailure; |
|
727 aRequestedIconDisplayed = EFalse; |
|
728 } |
|
729 |
|
730 if (iActionImplementer->GetEndKey()) |
|
731 { |
|
732 response = ESatSessionTerminatedByUser; |
|
733 iActionImplementer->SetEndKey(EFalse); |
|
734 } |
|
735 |
|
736 iActionImplementer->SetCommandPending(EFalse); |
|
737 |
|
738 TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem aSelection:%d", aSelection) |
|
739 TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem response:%d", response) |
|
740 TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem exit") |
|
741 return response; |
|
742 } |
|
743 |
|
744 // ---------------------------------------------------------------------------- |
|
745 // CSatUiObserver::PlayTone |
|
746 // Checks type of the tone wanted and calls right method |
|
747 // from the CSatUiViewAppUi class. |
|
748 // (other items were commented in a header). |
|
749 // ---------------------------------------------------------------------------- |
|
750 // |
|
751 TSatUiResponse CSatUiObserver::PlayTone( |
|
752 const TDesC& aText, |
|
753 const TSatTone aTone, |
|
754 const TTimeIntervalMicroSeconds aDuration, |
|
755 const TSatIconId& aIconId, |
|
756 TBool& aRequestedIconDisplayed) |
|
757 { |
|
758 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone called") |
|
759 TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone tone is %i", aTone) |
|
760 |
|
761 aRequestedIconDisplayed = EFalse; |
|
762 |
|
763 iSequence.Zero(); |
|
764 TTimeIntervalMicroSeconds duration(aDuration.Int64()); |
|
765 iActionImplementer->SetCommandPending(ETrue); |
|
766 // This is used to determine zero length duration. |
|
767 const TTimeIntervalMicroSeconds zeroDuration(static_cast<TInt64>(0)); |
|
768 |
|
769 CFbsBitmap* iconBitmap = NULL; |
|
770 // If icon is available for command |
|
771 if (((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
772 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
773 (iIconSupport)) |
|
774 { |
|
775 iconBitmap = FetchIcon(aIconId.iIdentifier, EIconPlayTone); |
|
776 GetScalableBitmap(iconBitmap, EIconPlayTone, |
|
777 aRequestedIconDisplayed); |
|
778 } |
|
779 |
|
780 TBool selfExplanatory(EFalse); |
|
781 |
|
782 // Icon is self-explanatory |
|
783 if (ESatSelfExplanatory == aIconId.iIconQualifier) |
|
784 { |
|
785 selfExplanatory = ETrue; |
|
786 } |
|
787 |
|
788 // Check if the current Profile is Meeting |
|
789 TInt errCR(KErrNone); |
|
790 TInt profileId(0); |
|
791 |
|
792 CRepository* repository = NULL; |
|
793 TSatTone tone = aTone; |
|
794 |
|
795 // Which UID to monitor. |
|
796 TRAP(errCR, repository = CRepository::NewL(KCRUidProfileEngine)); |
|
797 |
|
798 if (!errCR && repository) |
|
799 { |
|
800 errCR = repository->StartTransaction( |
|
801 CRepository::EReadWriteTransaction); |
|
802 errCR = repository->Get(KProEngActiveProfile, profileId); |
|
803 } |
|
804 |
|
805 delete repository; |
|
806 |
|
807 TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone(): err = %d", errCR) |
|
808 |
|
809 TFLOGSTRING2("SCSatUiObserver::PlayTone() profileId: %d", |
|
810 profileId) |
|
811 |
|
812 switch (tone) |
|
813 { |
|
814 case ESatGeneralBeep: |
|
815 case ESatPositiveTone: |
|
816 case ESatToneNotSet: |
|
817 if (zeroDuration == duration) |
|
818 { |
|
819 duration = KSatDur170ms; // 170ms |
|
820 } |
|
821 iSequence.Copy(KGeneralBeep); |
|
822 break; |
|
823 case ESatNegativeTone: |
|
824 if (zeroDuration == duration) |
|
825 { |
|
826 duration = KSatDur250ms; // 250ms |
|
827 } |
|
828 iSequence.Copy(KErrorTone); |
|
829 break; |
|
830 case ESatRadioPathNotAvailableCallDropped: |
|
831 if (zeroDuration == duration) |
|
832 { |
|
833 duration = KSatDur1200ms; // 1200ms |
|
834 } |
|
835 iSequence.Copy(KRadioPathNotAvailable); |
|
836 break; |
|
837 case ESatRadioPathAcknowledge: |
|
838 if (zeroDuration == duration) |
|
839 { |
|
840 duration = KSatDur200ms; // 200ms |
|
841 } |
|
842 iSequence.Copy(KRadioPathAck); |
|
843 break; |
|
844 case ESatDialTone: |
|
845 { |
|
846 if (zeroDuration == duration) |
|
847 { |
|
848 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone() ESatDialTone") |
|
849 return ESatCmdDataNotUnderstood; |
|
850 } |
|
851 else |
|
852 { |
|
853 iSequence.Copy(KNetToneSeqDial); |
|
854 } |
|
855 } |
|
856 break; |
|
857 case ESatCalledSubscriberBusy: |
|
858 { |
|
859 if (zeroDuration == duration) |
|
860 { |
|
861 return ESatCmdDataNotUnderstood; |
|
862 } |
|
863 else |
|
864 { |
|
865 iSequence.Copy(KNetToneSeqNetBusy); |
|
866 } |
|
867 } |
|
868 break; |
|
869 case ESatCongestion: |
|
870 { |
|
871 if (zeroDuration == duration) |
|
872 { |
|
873 return ESatCmdDataNotUnderstood; |
|
874 } |
|
875 else |
|
876 { |
|
877 iSequence.Copy(KNetToneSeqNetCongestion); |
|
878 } |
|
879 } |
|
880 break; |
|
881 case ESatErrorSpecialInfo: |
|
882 { |
|
883 if (zeroDuration == duration) |
|
884 { |
|
885 return ESatCmdDataNotUnderstood; |
|
886 } |
|
887 else |
|
888 { |
|
889 iSequence.Copy(KNetToneSeqNetSpecialInformation); |
|
890 } |
|
891 } |
|
892 break; |
|
893 case ESatCallWaitingTone: |
|
894 { |
|
895 if (zeroDuration == duration) |
|
896 { |
|
897 return ESatCmdDataNotUnderstood; |
|
898 } |
|
899 else |
|
900 { |
|
901 iSequence.Copy(KNetToneSeqNetCallWaiting); |
|
902 } |
|
903 } |
|
904 break; |
|
905 case ESatRingingTone: |
|
906 { |
|
907 if (zeroDuration == duration) |
|
908 { |
|
909 return ESatCmdDataNotUnderstood; |
|
910 } |
|
911 else |
|
912 { |
|
913 iSequence.Copy(KNetToneSeqRingGoing); |
|
914 } |
|
915 } |
|
916 break; |
|
917 case ESatUserSelectedToneIncomingSpeech: |
|
918 case ESatUserSelectedToneIncomingSms: |
|
919 { |
|
920 // These are handled later. |
|
921 } |
|
922 break; |
|
923 default: |
|
924 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone Default") |
|
925 return ESatCmdDataNotUnderstood; |
|
926 } |
|
927 |
|
928 TSatUiResponse response(ESatFailure); |
|
929 |
|
930 iActionImplementer->DispatchTimer(iWait); |
|
931 |
|
932 // ESatSClearScreenEvent doesn't occur,clear displaytext on screen. |
|
933 if (EFalse == iClearScreenEvent) |
|
934 { |
|
935 // Clear displaytext on the screen. |
|
936 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone clear screen") |
|
937 iActionImplementer->ClearScreen(); |
|
938 } |
|
939 |
|
940 if (0 != iSequence.Length()) |
|
941 { |
|
942 TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone duration microseconds %d", |
|
943 aDuration.Int64()) |
|
944 TRAPD(err, |
|
945 response = iActionImplementer->PlayStandardToneL( |
|
946 aText, |
|
947 iSequence, |
|
948 duration, |
|
949 iconBitmap, |
|
950 selfExplanatory); |
|
951 ); |
|
952 |
|
953 if (KErrNone != err) |
|
954 { |
|
955 response = ESatFailure; |
|
956 TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone error %i", err) |
|
957 } |
|
958 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone StandardTone exit") |
|
959 } |
|
960 else |
|
961 { |
|
962 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone length of sequence \ |
|
963 is zero") |
|
964 |
|
965 TRAPD(err, |
|
966 response = iActionImplementer->PlayUserSelectedToneL( |
|
967 aText, |
|
968 aDuration.Int64(), |
|
969 tone, |
|
970 iconBitmap, |
|
971 selfExplanatory); |
|
972 ); |
|
973 |
|
974 if (KErrNone != err) |
|
975 { |
|
976 response = ESatFailure; |
|
977 TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone error %i", err) |
|
978 } |
|
979 |
|
980 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone UserSelectedTone exit") |
|
981 } |
|
982 |
|
983 if (iActionImplementer->GetEndKey()) |
|
984 { |
|
985 response = ESatSessionTerminatedByUser; |
|
986 iActionImplementer->SetEndKey(EFalse); |
|
987 } |
|
988 |
|
989 iActionImplementer->SetCommandPending(EFalse); |
|
990 |
|
991 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone iClearScreenEvent false") |
|
992 iClearScreenEvent = EFalse; |
|
993 |
|
994 TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone response: %d", response) |
|
995 TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone exit") |
|
996 return response; |
|
997 } |
|
998 |
|
999 // ---------------------------------------------------------------------------- |
|
1000 // CSatUiObserver::ConfirmCommand |
|
1001 // (other items were commented in a header). |
|
1002 // ---------------------------------------------------------------------------- |
|
1003 // |
|
1004 void CSatUiObserver::ConfirmCommand( |
|
1005 const TSatSQueryCommand aCommandId, |
|
1006 const TSatAlphaIdStatus aAlphaIdStatus, |
|
1007 const TDesC& aText, |
|
1008 const TDesC& aAdditionalText, |
|
1009 TBool& aActionAccepted, |
|
1010 const TSatIconId& aIconId, |
|
1011 TBool& aRequestedIconDisplayed, |
|
1012 TBool& aTerminatedByUser) |
|
1013 { |
|
1014 TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand calling") |
|
1015 aRequestedIconDisplayed = EFalse; |
|
1016 TInt error(KErrNone); |
|
1017 TBool selfExplanatory(EFalse); |
|
1018 |
|
1019 // Icon is self-explanatory |
|
1020 if (ESatSelfExplanatory == aIconId.iIconQualifier) |
|
1021 { |
|
1022 selfExplanatory = ETrue; |
|
1023 } |
|
1024 |
|
1025 aActionAccepted = ETrue; |
|
1026 |
|
1027 iActionImplementer->SetCommandPending(ETrue); |
|
1028 |
|
1029 iActionImplementer->StopShowWaitNote(); |
|
1030 |
|
1031 CFbsBitmap* iconBitmap = NULL; |
|
1032 // If icon is available for command |
|
1033 if ((((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
1034 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
1035 ((ESatOpenChannelQuery == aCommandId) || |
|
1036 (ESatSLaunchBrowserQuery == aCommandId) || |
|
1037 (ESatSSetUpCallQuery == aCommandId))) && |
|
1038 (iIconSupport)) |
|
1039 { |
|
1040 iconBitmap = FetchIcon(aIconId.iIdentifier, |
|
1041 EIconConfirmCommand); |
|
1042 GetScalableBitmap(iconBitmap, EIconConfirmCommand, |
|
1043 aRequestedIconDisplayed); |
|
1044 } |
|
1045 TFLOGSTRING2("SATAPP: CSatUiObserver::ConfirmCommand aCommandId: %d", |
|
1046 aCommandId) |
|
1047 // Check quering command |
|
1048 switch (aCommandId) |
|
1049 { |
|
1050 case ESatOpenChannelQuery: |
|
1051 { |
|
1052 TFLOGSTRING(" Quering OpenChannel") |
|
1053 //TRAP(error, iActionImplementer->ConfirmOpenChannelL( |
|
1054 // aText, aActionAccepted, iconBitmap, selfExplanatory)); |
|
1055 break; |
|
1056 } |
|
1057 |
|
1058 case ESatSRefreshQuery: |
|
1059 { |
|
1060 TFLOGSTRING(" Quering Refresh") |
|
1061 //TRAP(error, iActionImplementer->ConfirmRefreshL(aActionAccepted)); |
|
1062 break; |
|
1063 } |
|
1064 |
|
1065 case ESatSLaunchBrowserQuery: |
|
1066 { |
|
1067 TFLOGSTRING(" Quering LaunchBrowser") |
|
1068 HBufC* textHolder = NULL; |
|
1069 |
|
1070 TRAP(error, |
|
1071 if (ESatAlphaIdNull != aAlphaIdStatus) |
|
1072 { |
|
1073 TFLOGSTRING(" CSatUiObserver::ConfirmCommand AlphaId \ |
|
1074 isn't null") |
|
1075 if (ESatAlphaIdNotProvided == aAlphaIdStatus) |
|
1076 { |
|
1077 TFLOGSTRING(" CSatUiObserver::ConfirmCommand \ |
|
1078 AlphaId not provided") |
|
1079 // ToDo: replace the resouce with qt. |
|
1080 //textHolder = StringLoader::LoadLC( |
|
1081 // R_QTN_SAT_CONF_LAUNCH_BROW, |
|
1082 // iActionImplementer->CoeEnv()); |
|
1083 } |
|
1084 else |
|
1085 { |
|
1086 TFLOGSTRING(" CSatUiObserver::ConfirmCommand \ |
|
1087 AlphaId provided") |
|
1088 textHolder = HBufC::NewLC(aText.Length()); |
|
1089 TPtr ptr = textHolder->Des(); |
|
1090 ptr.Append(aText); |
|
1091 } |
|
1092 |
|
1093 //TRAP(error, iActionImplementer->ConfirmLaunchBrowserL(*textHolder, |
|
1094 // aActionAccepted, iconBitmap, selfExplanatory)); |
|
1095 |
|
1096 // Clean textHolder |
|
1097 CleanupStack::PopAndDestroy(textHolder); |
|
1098 } |
|
1099 |
|
1100 ); // TRAP |
|
1101 break; |
|
1102 } |
|
1103 |
|
1104 case ESatSSendSmQuery: |
|
1105 { |
|
1106 TFLOGSTRING( " Quering SendSm" ) |
|
1107 TRAP( error, iActionImplementer->ConfirmSendL( aText, |
|
1108 aActionAccepted, ESatUiConfirmSendSms ) ); |
|
1109 break; |
|
1110 } |
|
1111 |
|
1112 case ESatSSendSsQuery: |
|
1113 { |
|
1114 TFLOGSTRING(" Quering SendSs") |
|
1115 //TRAP(error, iActionImplementer->ConfirmSendL(aText, |
|
1116 // aActionAccepted, ESatUiConfirmSendSs)); |
|
1117 break; |
|
1118 } |
|
1119 |
|
1120 case ESatSSendUssdQuery: |
|
1121 { |
|
1122 TFLOGSTRING(" Quering SendUssd") |
|
1123 //TRAP(error, iActionImplementer->ConfirmSendL(aText, |
|
1124 // aActionAccepted, ESatUiConfirmSendUssd)); |
|
1125 break; |
|
1126 } |
|
1127 |
|
1128 case ESatSSetUpCallQuery: |
|
1129 { |
|
1130 TFLOGSTRING(" Quering SetUpCall") |
|
1131 TRAP(error, iActionImplementer->ConfirmSetUpCallL( |
|
1132 aText, aAdditionalText, aActionAccepted, iconBitmap, |
|
1133 selfExplanatory)); |
|
1134 break; |
|
1135 } |
|
1136 |
|
1137 default: |
|
1138 { |
|
1139 TFLOGSTRING(" Unknown quering command") |
|
1140 aActionAccepted = EFalse; |
|
1141 } |
|
1142 } |
|
1143 |
|
1144 if (KErrNone != error) |
|
1145 { |
|
1146 TFLOGSTRING2("SATAPP: CSatUiObserver::ConfirmCommand error:%d", error) |
|
1147 aActionAccepted = EFalse; |
|
1148 } |
|
1149 else if (iActionImplementer->GetEndKey()) |
|
1150 { |
|
1151 TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand press endkey") |
|
1152 aTerminatedByUser = ETrue; |
|
1153 aActionAccepted = EFalse; |
|
1154 iActionImplementer->SetEndKey(EFalse); |
|
1155 } |
|
1156 else |
|
1157 { |
|
1158 // Meaningless else |
|
1159 } |
|
1160 |
|
1161 iActionImplementer->SetCommandPending(EFalse); |
|
1162 TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand exiting") |
|
1163 } |
|
1164 |
|
1165 // ---------------------------------------------------------------------------- |
|
1166 // CSatUiObserver::Notification |
|
1167 // (other items were commented in a header). |
|
1168 // ---------------------------------------------------------------------------- |
|
1169 // |
|
1170 TSatUiResponse CSatUiObserver::Notification( |
|
1171 const TSatSNotifyCommand aCommandId, |
|
1172 const TSatAlphaIdStatus aAlphaIdStatus, |
|
1173 const TDesC& aText, |
|
1174 const TSatIconId& aIconId, |
|
1175 TBool& aRequestedIconDisplayed, |
|
1176 const TSatControlResult aControlResult) |
|
1177 { |
|
1178 TFLOGSTRING("SATAPP: CSatUiObserver::Notification calling") |
|
1179 TSatUiResponse response = ESatSuccess; |
|
1180 TInt error(KErrNone); |
|
1181 aRequestedIconDisplayed = EFalse; |
|
1182 iActionImplementer->SetCommandPending(ETrue); |
|
1183 |
|
1184 HBufC* textHolder = NULL; |
|
1185 |
|
1186 // In case where command id is SendDtmf and alphaID is not provided, |
|
1187 // DTMF string to be sent is shown in dialog along with default text. |
|
1188 if ((ESatSSendDtmfNotify == aCommandId) && |
|
1189 (ESatAlphaIdNotProvided == aAlphaIdStatus)) |
|
1190 { |
|
1191 TFLOGSTRING("SATAPP: CSatUiObserver::Notification SendDtmf") |
|
1192 TRAP(error, |
|
1193 TInt resource = DefaultAlphaIdL(aCommandId, aControlResult); |
|
1194 |
|
1195 // Todo: |
|
1196 // Now that resource is defined, get default text |
|
1197 //textHolder = StringLoader::LoadL( |
|
1198 // resource, aText) |
|
1199 ); |
|
1200 } |
|
1201 // Get default text, if alpha not provided or it is NULL |
|
1202 else if (aText.Length() == 0 && ESatAlphaIdNotNull != aAlphaIdStatus) |
|
1203 { |
|
1204 TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is null") |
|
1205 TRAP(error, |
|
1206 TInt resource = DefaultAlphaIdL(aCommandId, aControlResult); |
|
1207 // Todo: |
|
1208 // Now that resource is defined, get default text |
|
1209 //textHolder = StringLoader::LoadL( |
|
1210 // resource, iActionImplementer->CoeEnv()) |
|
1211 ); |
|
1212 } |
|
1213 // else use given text |
|
1214 else |
|
1215 { |
|
1216 TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is provided") |
|
1217 TRAP(error, |
|
1218 textHolder = HBufC::NewL(aText.Length()); |
|
1219 TPtr ptr = textHolder->Des(); |
|
1220 ptr.Copy(aText); |
|
1221 ); |
|
1222 } |
|
1223 |
|
1224 if (!textHolder) |
|
1225 { |
|
1226 TRAP(error, textHolder = HBufC::NewL(0)); |
|
1227 } |
|
1228 |
|
1229 // No need to add textHolder into CleanupStack, since this is |
|
1230 // not a leaving function |
|
1231 |
|
1232 if ((KErrNone == error || KErrArgument == error) && textHolder) |
|
1233 { |
|
1234 TFLOGSTRING("SATAPP: CSatUiObserver::Notification none error ") |
|
1235 CFbsBitmap* iconBitmap = NULL; |
|
1236 TBool selfExplanatoryIcon(EFalse); |
|
1237 // Fetch icon |
|
1238 // Icons not supported for sending and receiving data |
|
1239 if ((((ESatSelfExplanatory == aIconId.iIconQualifier) || |
|
1240 (ESatNotSelfExplanatory == aIconId.iIconQualifier)) && |
|
1241 ((ESatSSendDataNotify != aCommandId) && |
|
1242 (ESatSReceiveDataNotify != aCommandId))) && |
|
1243 (iIconSupport)) |
|
1244 { |
|
1245 iconBitmap = FetchIcon(aIconId.iIdentifier, |
|
1246 EIconNotification); |
|
1247 //GetScalableBitmap(iconBitmap, EIconNotification, |
|
1248 // aRequestedIconDisplayed); |
|
1249 } |
|
1250 |
|
1251 if (ESatSelfExplanatory == aIconId.iIconQualifier) |
|
1252 { |
|
1253 selfExplanatoryIcon = ETrue; |
|
1254 } |
|
1255 |
|
1256 // Check notifying command |
|
1257 switch (aCommandId) |
|
1258 { |
|
1259 case ESatSSendDataNotify: |
|
1260 { |
|
1261 TFLOGSTRING(" Notifying SendData") |
|
1262 TRAP(error, |
|
1263 iActionImplementer->ShowBIPNoteL( |
|
1264 ESendDataIdentier, *textHolder, iconBitmap, |
|
1265 selfExplanatoryIcon) |
|
1266 ); |
|
1267 break; |
|
1268 } |
|
1269 case ESatSReceiveDataNotify: |
|
1270 { |
|
1271 TFLOGSTRING(" Notifying ReceiveData") |
|
1272 TRAP(error, |
|
1273 iActionImplementer->ShowBIPNoteL( |
|
1274 EReceiveDataIdentifier, *textHolder, iconBitmap, |
|
1275 selfExplanatoryIcon) |
|
1276 ); |
|
1277 break; |
|
1278 } |
|
1279 case ESatSCloseChannelNotify: |
|
1280 { |
|
1281 TFLOGSTRING(" Notifying CloseChannel") |
|
1282 iActionImplementer->StopShowWaitNote(); |
|
1283 TRAP(error, |
|
1284 iActionImplementer->ShowBIPNoteL( |
|
1285 ECloseChannelIdentifier, *textHolder, iconBitmap, |
|
1286 selfExplanatoryIcon) |
|
1287 ); |
|
1288 break; |
|
1289 } |
|
1290 case ESatSMoSmControlNotify: |
|
1291 { |
|
1292 TFLOGSTRING(" Notifying MoSmControl") |
|
1293 TRAP(error, |
|
1294 iActionImplementer->MoSmControlL( |
|
1295 *textHolder, aAlphaIdStatus) |
|
1296 ); |
|
1297 iActionImplementer->SetCommandPending(EFalse); |
|
1298 break; |
|
1299 } |
|
1300 case ESatSCallControlNotify: |
|
1301 { |
|
1302 TFLOGSTRING(" Notifying CallControl") |
|
1303 iActionImplementer->DispatchTimer(iWait); |
|
1304 TRAP(error, |
|
1305 iActionImplementer->CallControlL( |
|
1306 *textHolder, aAlphaIdStatus) |
|
1307 ); |
|
1308 iActionImplementer->SetCommandPending(EFalse); |
|
1309 break; |
|
1310 } |
|
1311 case ESatSSendUssdNotify: // fall through |
|
1312 case ESatSSendSsNotify: |
|
1313 { |
|
1314 TFLOGSTRING(" Notifying SendSs / SendUssd") |
|
1315 iActionImplementer->StopShowWaitNote(); |
|
1316 TRAP(error, |
|
1317 if ((ESatAlphaIdNotNull == aAlphaIdStatus) || |
|
1318 (ESatAlphaIdNotProvided == aAlphaIdStatus)) |
|
1319 { |
|
1320 iActionImplementer->ShowSsWaitNoteL(*textHolder, |
|
1321 iconBitmap, selfExplanatoryIcon); |
|
1322 } |
|
1323 else |
|
1324 { |
|
1325 iActionImplementer->ShowWaitNoteWithoutDelayL(); |
|
1326 } |
|
1327 ); |
|
1328 break; |
|
1329 } |
|
1330 case ESatSSendDtmfNotify: |
|
1331 { |
|
1332 TFLOGSTRING(" Notifying SendDtmf") |
|
1333 iActionImplementer->StopShowWaitNote(); |
|
1334 TRAP(error, response = iActionImplementer->ShowDtmfWaitNoteL( |
|
1335 *textHolder, iconBitmap, selfExplanatoryIcon)); |
|
1336 break; |
|
1337 } |
|
1338 case ESatSSendSmsNotify: |
|
1339 { |
|
1340 TFLOGSTRING(" Notifying SendSms") |
|
1341 iActionImplementer->StopShowWaitNote(); |
|
1342 |
|
1343 if (KErrNone == error) |
|
1344 { |
|
1345 // Show Sms wait note |
|
1346 TRAP(error, |
|
1347 iActionImplementer->ShowSmsWaitNoteL(*textHolder, |
|
1348 iconBitmap, selfExplanatoryIcon)); |
|
1349 } |
|
1350 |
|
1351 break; |
|
1352 } |
|
1353 default: |
|
1354 { |
|
1355 TFLOGSTRING(" Unkown notification") |
|
1356 response = ESatFailure; |
|
1357 break; |
|
1358 } |
|
1359 } |
|
1360 } |
|
1361 |
|
1362 delete textHolder; |
|
1363 textHolder = NULL; |
|
1364 |
|
1365 if (KErrNone != error) |
|
1366 { |
|
1367 TFLOGSTRING2("SATAPP: CSatUiObserver::Notification error:%d", error) |
|
1368 response = ESatFailure; |
|
1369 } |
|
1370 else if (iActionImplementer->GetEndKey()) |
|
1371 { |
|
1372 TFLOGSTRING("SATAPP: CSatUiObserver::Notification terminated by user") |
|
1373 response = ESatSessionTerminatedByUser; |
|
1374 iActionImplementer->SetEndKey(EFalse); |
|
1375 } |
|
1376 else |
|
1377 { |
|
1378 TFLOGSTRING("SATAPP: CSatUiObserver::Notification success") |
|
1379 response = ESatSuccess; |
|
1380 } |
|
1381 |
|
1382 |
|
1383 TFLOGSTRING2("SATAPP: CSatUiObserver::Notification exiting, return: %d", \ |
|
1384 response) |
|
1385 return response; |
|
1386 } |
|
1387 |
|
1388 // ------------------------------------------------------------------------------------------------ |
|
1389 // CSatUiObserver::EventNotification |
|
1390 // (other items were commented in a header). |
|
1391 // ------------------------------------------------------------------------------------------------ |
|
1392 // |
|
1393 void CSatUiObserver::EventNotification( |
|
1394 const TSatSEvent aEventId, |
|
1395 const TSatSEventStatus /*aEventStatus*/, |
|
1396 const TInt /*aError*/) |
|
1397 { |
|
1398 TFLOGSTRING("SATAPP: CSatUiObserver::EventNotification calling") |
|
1399 |
|
1400 iActionImplementer->SetCommandPending(EFalse); |
|
1401 switch (aEventId) |
|
1402 { |
|
1403 case ESatSSmEndEvent: |
|
1404 { |
|
1405 TFLOGSTRING(" SmsEnd event") |
|
1406 iActionImplementer->StopShowWaitNote(); |
|
1407 break; |
|
1408 } |
|
1409 case ESatSClearScreenEvent: |
|
1410 { |
|
1411 TFLOGSTRING(" ClearScreen event") |
|
1412 iClearScreenEvent = ETrue; |
|
1413 iActionImplementer->ClearScreen(); |
|
1414 break; |
|
1415 } |
|
1416 case ESatSsEndEvent: |
|
1417 { |
|
1418 TFLOGSTRING(" Ss end event") |
|
1419 iActionImplementer->StopShowWaitNote(); |
|
1420 break; |
|
1421 } |
|
1422 case ESatSsErrorEvent: |
|
1423 { |
|
1424 TFLOGSTRING(" Notifying Ss error") |
|
1425 // If error occurred (and Alpha ID provided), notify user |
|
1426 TRAPD(err, iActionImplementer->ShowSsErrorNoteL()) |
|
1427 |
|
1428 if (err) |
|
1429 { |
|
1430 TFLOGSTRING(" Error Note could not be created!") |
|
1431 } |
|
1432 break; |
|
1433 } |
|
1434 case ESatSDtmfEndEvent: |
|
1435 { |
|
1436 TFLOGSTRING(" DTMF End event") |
|
1437 iActionImplementer->StopShowWaitNote(); |
|
1438 break; |
|
1439 } |
|
1440 case ESatSCloseSatUiAppEvent: |
|
1441 { |
|
1442 TFLOGSTRING(" Close UI event") |
|
1443 // Handle this similar way when End key is used |
|
1444 if (KSatActiveProfileOffline == ProfileState()) |
|
1445 { |
|
1446 iActionImplementer->SetEndKey(ETrue); |
|
1447 TRAP_IGNORE(iActionImplementer->ShowNotAvailableNoteL()) |
|
1448 } |
|
1449 iActionImplementer->CloseSatUI(); |
|
1450 break; |
|
1451 } |
|
1452 default: |
|
1453 { |
|
1454 TFLOGSTRING2(" Unknown event occured: %i", aEventId) |
|
1455 break; |
|
1456 } |
|
1457 } |
|
1458 |
|
1459 TFLOGSTRING("SATAPP: CSatUiObserver::EventNotification exiting") |
|
1460 } |
|
1461 |
|
1462 // ---------------------------------------------------------------------------- |
|
1463 // CSatUiObserver::DefaultAlphaIdL |
|
1464 // (other items were commented in a header). |
|
1465 // ---------------------------------------------------------------------------- |
|
1466 // |
|
1467 TInt CSatUiObserver::DefaultAlphaIdL( |
|
1468 const TSatSNotifyCommand aCommandId, |
|
1469 const TSatControlResult aControlResult) const |
|
1470 { |
|
1471 TFLOGSTRING("SATAPP: CSatUiObserver::DefaultAlphaIdL calling") |
|
1472 TInt resource(0); |
|
1473 |
|
1474 switch (aCommandId) |
|
1475 { |
|
1476 case ESatSSendDataNotify: // SendData |
|
1477 { |
|
1478 TFLOGSTRING(" SendData default") |
|
1479 //resource = R_QTN_SAT_CONF_SEND_DATA_BIP; |
|
1480 break; |
|
1481 } |
|
1482 |
|
1483 case ESatSReceiveDataNotify: // ReceiveData |
|
1484 { |
|
1485 TFLOGSTRING(" ReceiveData default") |
|
1486 //resource = R_QTN_SAT_CONF_RECEIVE_DATA_BIP; |
|
1487 break; |
|
1488 } |
|
1489 |
|
1490 case ESatSCloseChannelNotify: // CloseChannel |
|
1491 { |
|
1492 TFLOGSTRING(" CloseChannel default") |
|
1493 //resource = R_QTN_SAT_CONF_CLOSE_CHANNEL_BIP; |
|
1494 break; |
|
1495 } |
|
1496 |
|
1497 case ESatSMoSmControlNotify: // MoSmControl |
|
1498 { |
|
1499 if (ESatNotAllowed == aControlResult) |
|
1500 { |
|
1501 TFLOGSTRING(" MoSmcontrol Not allowed default") |
|
1502 //resource = R_QTN_SAT_MOSM_NOT_ALLOWED; |
|
1503 } |
|
1504 else if (ESatAllowedWithModifications == aControlResult) |
|
1505 { |
|
1506 TFLOGSTRING(" MoSmcontrol Modified default") |
|
1507 //resource = R_QTN_SAT_MOSM_MODIFIED; |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 TFLOGSTRING(" MoSmcontrol No default") |
|
1512 resource = 0; // Allowed, default alpha -> no info |
|
1513 } |
|
1514 break; |
|
1515 } |
|
1516 |
|
1517 case ESatSCallControlNotify: // CallControl |
|
1518 { |
|
1519 if (ESatNotAllowed == aControlResult) |
|
1520 { |
|
1521 TFLOGSTRING(" CallControl Not allowed default") |
|
1522 //resource = R_QTN_SAT_CC_NOT_ALLOWED; |
|
1523 } |
|
1524 else if (ESatAllowedWithModifications == aControlResult) |
|
1525 { |
|
1526 TFLOGSTRING(" CallControl Modified default") |
|
1527 //resource = R_QTN_SAT_CC_MODIFIED; |
|
1528 } |
|
1529 else |
|
1530 { |
|
1531 TFLOGSTRING(" CallControl No default") |
|
1532 resource = 0; // Allowed, default alpha -> no info |
|
1533 } |
|
1534 break; |
|
1535 } |
|
1536 |
|
1537 case ESatSSendSmsNotify: // SendSm |
|
1538 { |
|
1539 TFLOGSTRING(" SendSms default") |
|
1540 //resource = R_QTN_SAT_SENDING_SMS; |
|
1541 break; |
|
1542 } |
|
1543 |
|
1544 case ESatSSendDtmfNotify: // SendDtmf |
|
1545 { |
|
1546 TFLOGSTRING(" SendDTMF default") |
|
1547 //resource = R_QTN_SAT_NOTE_SENDING_DTMF_TEMPLATE; |
|
1548 break; |
|
1549 } |
|
1550 |
|
1551 default: |
|
1552 { |
|
1553 TFLOGSTRING2(" Unknown command id: %i", aCommandId) |
|
1554 User::Leave(KErrArgument); |
|
1555 } |
|
1556 } |
|
1557 |
|
1558 TFLOGSTRING2("SATAPP: CSatUiObserver::DefaultAlphaIdL exiting, resource: \ |
|
1559 %d", resource) |
|
1560 return resource; |
|
1561 } |
|
1562 |
|
1563 // ---------------------------------------------------------------------------- |
|
1564 // CSatUiObserver::FetchIcon |
|
1565 // Fetch the icon information. |
|
1566 // (other items were commented in a header). |
|
1567 // ---------------------------------------------------------------------------- |
|
1568 // |
|
1569 CFbsBitmap* CSatUiObserver::FetchIcon(const TUint8 /*aIconId*/, |
|
1570 const enum TIconCommand /*aIconCommand*/) |
|
1571 { |
|
1572 TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon called") |
|
1573 |
|
1574 CFbsBitmap* iconBitmap = NULL; |
|
1575 /* |
|
1576 TSize layoutSize(0, 0); |
|
1577 |
|
1578 // Set icon max size according the command |
|
1579 if (GetPopUpWindowIconSize(layoutSize, aIconCommand)) |
|
1580 { |
|
1581 TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon max size") |
|
1582 // Comment out icon related code, add qt icon support future |
|
1583 TRAPD(err, iconBitmap = iIconHandler->FetchIconL(iSatSession, |
|
1584 aIconId, layoutSize.iWidth, layoutSize.iHeight, iIconSupport)); |
|
1585 |
|
1586 if (err != KErrNone) |
|
1587 { |
|
1588 #if defined _DEBUG |
|
1589 _LIT(KFetchIcon, "SATAPP: CSatUiObserver::FetchIcon"); |
|
1590 User::Panic(KFetchIcon, err); |
|
1591 #endif |
|
1592 } |
|
1593 } |
|
1594 else |
|
1595 { |
|
1596 TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon not supported") |
|
1597 } |
|
1598 */ |
|
1599 TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon exit") |
|
1600 return iconBitmap; |
|
1601 } |
|
1602 |
|
1603 // ---------------------------------------------------------------------------- |
|
1604 // CSatUiObserver::GetPopUpWindowIconSize |
|
1605 // Get size for the icon in popup window. |
|
1606 // (other items were commented in a header). |
|
1607 // ---------------------------------------------------------------------------- |
|
1608 // |
|
1609 TBool CSatUiObserver::GetPopUpWindowIconSize(TSize& aSize, |
|
1610 const TIconCommand /*aIconCommand*/) |
|
1611 { |
|
1612 TFLOGSTRING("SATAPP: CSatUiObserver::GetPopUpWindowIconSize called") |
|
1613 |
|
1614 TRect rect(TSize(0, 0)); |
|
1615 TBool supported(ETrue); |
|
1616 // Comment out this code for no icon support in current qt satapp |
|
1617 /* TAknLayoutRect opLogoLayout; |
|
1618 |
|
1619 TFLOGSTRING2("SATAPP: CSatUiObserver::GetPopUpWindowIconSize, \ |
|
1620 aIconCommand: %i", aIconCommand) |
|
1621 // depending on the command, get correct layout and |
|
1622 // Calculate rectangle based on LAF specification. |
|
1623 switch (aIconCommand) |
|
1624 { |
|
1625 case EIconSetUpMenuContext: |
|
1626 { |
|
1627 opLogoLayout.LayoutRect(rect, |
|
1628 AknLayoutScalable_Avkon::context_pane_g1().LayoutLine()); |
|
1629 break; |
|
1630 } |
|
1631 case EIconSetUpMenuItems: |
|
1632 { |
|
1633 opLogoLayout.LayoutRect(rect, |
|
1634 AknLayout::List_pane_elements__single_graphic__Line_1()); |
|
1635 break; |
|
1636 } |
|
1637 case EIconDisplayText: |
|
1638 { |
|
1639 // layout borrowed from video |
|
1640 opLogoLayout.LayoutRect(rect, AknLayoutScalable_Avkon:: |
|
1641 popup_query_sat_info_window(0).LayoutLine()); |
|
1642 break; |
|
1643 } |
|
1644 case EIconPlayTone: |
|
1645 { |
|
1646 opLogoLayout.LayoutRect(rect, AknLayoutScalable_Avkon:: |
|
1647 popup_note_window_g1(0).LayoutLine()); |
|
1648 break; |
|
1649 } |
|
1650 case EIconConfirmCommand: // fall through |
|
1651 case EIconGetInput: // fall through |
|
1652 case EIconGetYesNo: // fall through |
|
1653 case EIconGetInkey: |
|
1654 { |
|
1655 opLogoLayout.LayoutRect(rect, AknLayout::Icon(0)); |
|
1656 break; |
|
1657 } |
|
1658 case EIconNotification: |
|
1659 { |
|
1660 opLogoLayout.LayoutRect(rect, AknLayout:: |
|
1661 Wait_or_progress_note_pop_up_window_elements_Line_1()); |
|
1662 break; |
|
1663 } |
|
1664 default: |
|
1665 { |
|
1666 TFLOGSTRING( |
|
1667 "SATAPP: CSatUiObserver::GetPopUpWindowIconSize not supported") |
|
1668 supported = EFalse; |
|
1669 break; |
|
1670 } |
|
1671 } |
|
1672 |
|
1673 aSize = opLogoLayout.Rect().Size(); |
|
1674 |
|
1675 // Layout for title icon gives incorrect width |
|
1676 // but since it is square height can be set to width |
|
1677 if (EIconSetUpMenuContext == aIconCommand) |
|
1678 { |
|
1679 aSize.iWidth = aSize.iHeight; |
|
1680 } |
|
1681 */ |
|
1682 TFLOGSTRING3("SATAPP: CSatUiObserver::GetPopUpWindowIconSize %dx%d exit", |
|
1683 aSize.iWidth, aSize.iHeight) |
|
1684 return supported; |
|
1685 } |
|
1686 |
|
1687 // ---------------------------------------------------------------------------- |
|
1688 // CSatUiObserver::GetScalableBitmap |
|
1689 // Creates scalable bitmap |
|
1690 // (other items were commented in a header). |
|
1691 // ---------------------------------------------------------------------------- |
|
1692 // |
|
1693 void CSatUiObserver::GetScalableBitmapL( |
|
1694 CFbsBitmap*& /*aBitMapToConvert*/, |
|
1695 const TIconCommand /*aIconCommand*/) |
|
1696 { |
|
1697 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called") |
|
1698 /* |
|
1699 TSize layoutSize(0, 0); |
|
1700 CFbsBitmap* bitmap = NULL; |
|
1701 |
|
1702 // If scalable icon is supported in current layout then |
|
1703 // makes the scalable icon. |
|
1704 if (GetPopUpWindowIconSize(layoutSize, aIconCommand)) |
|
1705 { |
|
1706 bitmap = new (ELeave) CFbsBitmap; |
|
1707 CleanupStack::PushL(bitmap); |
|
1708 // CAknIcon takes ownership of bitmaps. |
|
1709 CFbsBitmap* dupMain = new (ELeave) CFbsBitmap; |
|
1710 CleanupStack::PushL(dupMain); |
|
1711 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap duplicate original") |
|
1712 User::LeaveIfError( |
|
1713 dupMain->Duplicate(aBitMapToConvert->Handle())); |
|
1714 |
|
1715 //CAknIcon* bitmapIcon = CAknIcon::NewL(); |
|
1716 // Mask is not set because skins are not used. |
|
1717 // Ownership is transferred. |
|
1718 bitmapIcon->SetBitmap(dupMain); |
|
1719 CleanupStack::Pop(dupMain); |
|
1720 CleanupStack::PushL(bitmapIcon); |
|
1721 CAknIcon* scalableIcon = AknIconUtils::CreateIconL(bitmapIcon); |
|
1722 CleanupStack::Pop(bitmapIcon); |
|
1723 CleanupStack::PushL(scalableIcon); |
|
1724 |
|
1725 // fetch the size of icon |
|
1726 TSize iconSize = dupMain->SizeInPixels(); |
|
1727 |
|
1728 // At first we assume that width is scaled to layout maximum and |
|
1729 // thus height is set so that the ratio of the image remains correct |
|
1730 |
|
1731 TInt newHeight = |
|
1732 (layoutSize.iWidth * iconSize.iHeight) / iconSize.iWidth; |
|
1733 |
|
1734 // If the new height is larger than the height of the layout |
|
1735 // we scale height to maximum and set the width so that the ratio of |
|
1736 // the image remains correct |
|
1737 if (newHeight > layoutSize.iHeight) |
|
1738 { |
|
1739 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap \ |
|
1740 larger than layout height") |
|
1741 layoutSize.iWidth = |
|
1742 (layoutSize.iHeight * iconSize.iWidth) / iconSize.iHeight; |
|
1743 } |
|
1744 // If the new height is smaller or the same as the height of the |
|
1745 // layout, the image is scaled according to it |
|
1746 else |
|
1747 { |
|
1748 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap \ |
|
1749 smaller than layout height") |
|
1750 layoutSize.iHeight = newHeight; |
|
1751 } |
|
1752 |
|
1753 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap resize scaled icon") |
|
1754 AknIconUtils::SetSize(scalableIcon->Bitmap(), layoutSize); |
|
1755 |
|
1756 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap duplicate scaled") |
|
1757 User::LeaveIfError(bitmap->Duplicate( |
|
1758 scalableIcon->Bitmap()->Handle())); |
|
1759 |
|
1760 CleanupStack::PopAndDestroy(scalableIcon); |
|
1761 |
|
1762 // Uses scaled icon if scalable bitmap is supported. |
|
1763 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap Show Scaled") |
|
1764 delete aBitMapToConvert; |
|
1765 aBitMapToConvert = bitmap; |
|
1766 CleanupStack::Pop(bitmap); |
|
1767 } |
|
1768 */ |
|
1769 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit") |
|
1770 } |
|
1771 |
|
1772 // ---------------------------------------------------------------------------- |
|
1773 // CSatUiObserver::GetScalableBitmap |
|
1774 // Handles scalable bitmap |
|
1775 // (other items were commented in a header). |
|
1776 // ---------------------------------------------------------------------------- |
|
1777 // |
|
1778 void CSatUiObserver::GetScalableBitmap( |
|
1779 CFbsBitmap*& /*aBitMapToConvert*/, |
|
1780 const TIconCommand /*aIconCommand*/, |
|
1781 TBool& /*aRequestedIconDisplayed*/) |
|
1782 { |
|
1783 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called") |
|
1784 /* |
|
1785 if (aBitMapToConvert) |
|
1786 { |
|
1787 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap bitmap \ |
|
1788 to convert") |
|
1789 // Scale icon |
|
1790 TRAPD(err, GetScalableBitmapL(aBitMapToConvert, aIconCommand);); |
|
1791 |
|
1792 if (KErrNoMemory == err) |
|
1793 { |
|
1794 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap memory \ |
|
1795 low") |
|
1796 // Memory low, command is done without icon |
|
1797 delete aBitMapToConvert; |
|
1798 aBitMapToConvert = NULL; |
|
1799 aRequestedIconDisplayed = EFalse; |
|
1800 } |
|
1801 else |
|
1802 { |
|
1803 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap have \ |
|
1804 memory") |
|
1805 aRequestedIconDisplayed = ETrue; |
|
1806 } |
|
1807 } |
|
1808 else |
|
1809 { |
|
1810 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap no bitmap") |
|
1811 // Icon not received |
|
1812 aRequestedIconDisplayed = EFalse; |
|
1813 } |
|
1814 */ |
|
1815 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit") |
|
1816 } |
|
1817 |
|
1818 // ---------------------------------------------------------------------------- |
|
1819 // CSatUiObserver::GetScalableBitmap |
|
1820 // Handles scalable bitmap |
|
1821 // (other items were commented in a header). |
|
1822 // ---------------------------------------------------------------------------- |
|
1823 // |
|
1824 void CSatUiObserver::GetScalableBitmap( |
|
1825 CFbsBitmap*& /*aBitMapToConvert*/, |
|
1826 const TIconCommand /*aIconCommand*/) |
|
1827 { |
|
1828 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called") |
|
1829 /* |
|
1830 if (aBitMapToConvert) |
|
1831 { |
|
1832 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap bitmap \ |
|
1833 to convert") |
|
1834 // Scale icon |
|
1835 TRAPD(err, GetScalableBitmapL(aBitMapToConvert, aIconCommand);); |
|
1836 |
|
1837 if (KErrNoMemory == err) |
|
1838 { |
|
1839 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap memory \ |
|
1840 low") |
|
1841 // Memory low, command is done without icon |
|
1842 delete aBitMapToConvert; |
|
1843 aBitMapToConvert = NULL; |
|
1844 } |
|
1845 } |
|
1846 */ |
|
1847 TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit") |
|
1848 } |
|
1849 |
|
1850 // ---------------------------------------------------------------------------- |
|
1851 // CSatUiObserver::ProfileState |
|
1852 // Get the profile status |
|
1853 // (other items were commented in a header). |
|
1854 // ---------------------------------------------------------------------------- |
|
1855 // |
|
1856 TInt CSatUiObserver::ProfileState() |
|
1857 { |
|
1858 TFLOGSTRING("SATAPP: CSatUiObserver::ProfileState called") |
|
1859 TInt profileId(0); |
|
1860 CRepository* cr (NULL); |
|
1861 |
|
1862 TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine)); |
|
1863 if ((KErrNone == err) && cr) |
|
1864 { |
|
1865 TFLOGSTRING("SATAPP: CSatUiObserver::ProfileState no err") |
|
1866 // Get the ID of the currently active profile: |
|
1867 cr->Get(KProEngActiveProfile, profileId); |
|
1868 delete cr; |
|
1869 } |
|
1870 else |
|
1871 { |
|
1872 TFLOGSTRING2("SATAPP: CSatUiObserver::ProfileState CR failed: %i", err) |
|
1873 } |
|
1874 |
|
1875 TFLOGSTRING2("SATAPP: CSatUiObserver::ProfileState exit value: %d", |
|
1876 profileId) |
|
1877 |
|
1878 return profileId; |
|
1879 } |
|
1880 |
|
1881 // End of File |