|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Outlook Middle |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleManager.h" //for enumerations |
|
21 #include "BMBubbleOutlookMiddle.h" |
|
22 #include "BMBubbleImageManager.h" |
|
23 #include "BMResourceManager.h" |
|
24 #include "BMBubbleHeader.h" |
|
25 #include "BMUtils.h" |
|
26 #include "BMLayout.h" |
|
27 #include "BMLayout2.h" |
|
28 #include "telbubblecustomelement.h" |
|
29 |
|
30 #include <eiklabel.h> |
|
31 #include <eikimage.h> |
|
32 #include <eikenv.h> |
|
33 #include <AknsUtils.h> |
|
34 #include <AknsDrawUtils.h> |
|
35 |
|
36 // ========================= MEMBER FUNCTIONS ================================ |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CBubbleOutlookMiddle::CBubbleOutlookMiddle |
|
40 // |
|
41 // |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 CBubbleOutlookMiddle::CBubbleOutlookMiddle( CBubbleManager& aBubbleManager ) |
|
45 : CBubbleOutlookTwoLined( aBubbleManager ) |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CBubbleOutlookMiddle::ConstructL |
|
51 // |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 void CBubbleOutlookMiddle::ConstructL() |
|
55 { |
|
56 iIsUnder = EFalse; |
|
57 CBubbleOutlookTwoLined::ConstructL( ); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CBubbleOutlookMiddle::~CBubbleOutlookMiddle |
|
62 // |
|
63 // |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CBubbleOutlookMiddle::~CBubbleOutlookMiddle() |
|
67 { |
|
68 Reset(); |
|
69 } |
|
70 |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CBubbleOutlookMiddle::Reset( ) |
|
74 // |
|
75 // |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CBubbleOutlookMiddle::Reset( ) |
|
79 { |
|
80 iIsUnder = EFalse; |
|
81 CBubbleOutlookTwoLined::Reset(); |
|
82 } |
|
83 |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CBubbleOutlookMiddle::ReadBubbleHeader |
|
87 // |
|
88 // |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CBubbleOutlookMiddle::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
92 { |
|
93 iHeader = &aHeader; |
|
94 |
|
95 iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue ); |
|
96 |
|
97 if ( !iCallObjectDisplay ) |
|
98 { |
|
99 GetCall1BubbleBitmaps(); |
|
100 } |
|
101 |
|
102 CBubbleOutlookTwoLined::ReadBubbleHeader( aHeader ); |
|
103 } |
|
104 |
|
105 |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CBubbleOutlookMiddle::SizeChanged |
|
109 // called by framwork when the view size is changed |
|
110 // |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 void CBubbleOutlookMiddle::SizeChanged() |
|
114 { |
|
115 if( !iHeader ) |
|
116 { |
|
117 return; |
|
118 } |
|
119 |
|
120 AknsUtils::RegisterControlPosition( this ); |
|
121 |
|
122 if ( !iCallObjectDisplay ) |
|
123 { |
|
124 DoCall1Layout(); |
|
125 } |
|
126 else |
|
127 { |
|
128 TRAPD( err, DoCall2LayoutL() ); |
|
129 if ( err ) |
|
130 { |
|
131 iBubble->SetPicture( NULL, NULL ); |
|
132 |
|
133 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
134 AknsDrawUtils::PrepareFrame( skin, |
|
135 iOuterRect, |
|
136 iInnerRect, |
|
137 iFrameId, |
|
138 KAknsIIDDefault ); |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // CBubbleOutlookMiddle::SetIsUnder |
|
146 // |
|
147 // |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 void CBubbleOutlookMiddle::SetIsUnder( const TBool& aIsUnder ) |
|
151 { |
|
152 iIsUnder = aIsUnder; |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CBubbleOutlookMiddle::DoCall1Layout |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 void CBubbleOutlookMiddle::DoCall1Layout() |
|
160 { |
|
161 // Deprecated |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CBubbleOutlookMiddle::DoCall2Layout |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void CBubbleOutlookMiddle::DoCall2LayoutL() |
|
169 { |
|
170 iBubble->SetPictureOwnedExternally( EFalse ); |
|
171 iBubble->SetPicture( NULL, NULL ); |
|
172 |
|
173 const TRect rect = Rect(); |
|
174 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
175 switch ( callState ) |
|
176 { |
|
177 case CBubbleManager::EWaiting: |
|
178 case CBubbleManager::EIncoming: |
|
179 case CBubbleManager::EOutgoing: |
|
180 case CBubbleManager::EAlerting: |
|
181 case CBubbleManager::EAlertToDisconnected: |
|
182 { |
|
183 /////////////////////////////////////////////////////////////////// |
|
184 // Incoming call layout. Number entry open. |
|
185 /////////////////////////////////////////////////////////////////// |
|
186 |
|
187 TAknLayoutRect bubbleRect; |
|
188 bubbleRect.LayoutRect( |
|
189 rect, |
|
190 BubbleLayout2::popup_call2_audio_in_background(5) ); |
|
191 |
|
192 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
193 TRect outerRect; |
|
194 TRect innerRect; |
|
195 BubbleLayout2::RectFrameInnerOuterRects( frameRect, |
|
196 outerRect, |
|
197 innerRect); |
|
198 |
|
199 iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ? |
|
200 KAknsIIDQsnFrCall2RectDisconn : |
|
201 KAknsIIDQsnFrCall2Rect; |
|
202 |
|
203 iOuterRect = outerRect; |
|
204 iOuterRect.Move( Rect().iTl ); |
|
205 iInnerRect = innerRect; |
|
206 iInnerRect.Move( Rect().iTl ); |
|
207 |
|
208 // Call indicator |
|
209 BubbleUtils::LayoutCustomElement( |
|
210 iBigCallIndicator, |
|
211 rect, |
|
212 BubbleLayout2::popup_call2_audio_out_call_waiting_icon(1) ); |
|
213 |
|
214 // Ciphering off |
|
215 BubbleUtils::LayoutControl( |
|
216 iCyphOffImage, |
|
217 rect, |
|
218 BubbleLayout2::popup_call2_audio_in_ciphering_icon(5) ); |
|
219 |
|
220 // Number type icon |
|
221 BubbleUtils::LayoutCustomElement( |
|
222 iNumberType, |
|
223 rect, |
|
224 BubbleLayout2::popup_call2_audio_in_call_number_type_icon(5) ); |
|
225 |
|
226 // Text line 1 |
|
227 BubbleUtils::LayoutLabel( |
|
228 iTextLine1, |
|
229 rect, |
|
230 BubbleLayout2::popup_call2_audio_in_call_text_1(5) ); |
|
231 |
|
232 // Smaller rect for text if brand image exists |
|
233 if ( iBrandImage ) |
|
234 { |
|
235 // Text line 2 |
|
236 BubbleUtils::LayoutLabel( |
|
237 iTextLine2, |
|
238 rect, |
|
239 BubbleLayout2::popup_call2_audio_in_call_text_2(9) ); |
|
240 |
|
241 //Brand image |
|
242 BubbleUtils::LayoutCustomElement( |
|
243 iBrandImage, |
|
244 rect, |
|
245 BubbleLayout2::popup_call2_audio_in_brand_image(4) ); |
|
246 } |
|
247 else |
|
248 { |
|
249 // Text line 2 |
|
250 BubbleUtils::LayoutLabel( |
|
251 iTextLine2, |
|
252 rect, |
|
253 BubbleLayout2::popup_call2_audio_in_call_text_2(5) ); |
|
254 } |
|
255 |
|
256 // Create call object bitmaps |
|
257 iBubble->SetRect( bubbleRect.Rect() ); |
|
258 |
|
259 BubbleUtils::PrepareBubbleImageL( |
|
260 iFrameId, |
|
261 outerRect, |
|
262 innerRect, |
|
263 iBubble ); |
|
264 |
|
265 break; |
|
266 } |
|
267 case CBubbleManager::EDisconnected: |
|
268 case CBubbleManager::EActive: |
|
269 case CBubbleManager::EOnHold: |
|
270 { |
|
271 /////////////////////////////////////////////////////////////////// |
|
272 // First call layout. Two calls. |
|
273 /////////////////////////////////////////////////////////////////// |
|
274 |
|
275 TAknLayoutRect bubbleRect; |
|
276 bubbleRect.LayoutRect( |
|
277 rect, |
|
278 BubbleLayout2::popup_call2_audio_first_call_background(13) ); |
|
279 |
|
280 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
281 TRect outerRect; |
|
282 TRect innerRect; |
|
283 BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, |
|
284 outerRect, |
|
285 innerRect); |
|
286 |
|
287 TAknsItemID coMaskFrameId; |
|
288 if ( callState == CBubbleManager::EOnHold ) |
|
289 { |
|
290 iFrameId = KAknsIIDQsnFrCall2Bubble; |
|
291 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask; |
|
292 } |
|
293 else if ( callState == CBubbleManager::EDisconnected ) |
|
294 { |
|
295 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn; |
|
296 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask; |
|
297 } |
|
298 else |
|
299 { |
|
300 iFrameId = KAknsIIDQsnFrCall2BubbleFirst; |
|
301 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask; |
|
302 } |
|
303 |
|
304 iOuterRect = outerRect; |
|
305 iOuterRect.Move( Rect().iTl ); |
|
306 iInnerRect = innerRect; |
|
307 iInnerRect.Move( Rect().iTl ); |
|
308 |
|
309 // Call icon |
|
310 BubbleUtils::LayoutCustomElement( |
|
311 iSmallCallIndication, |
|
312 rect, |
|
313 BubbleLayout2::popup_call2_audio_first_call_status_icon(12) ); |
|
314 |
|
315 // Ciphering off |
|
316 BubbleUtils::LayoutControl( |
|
317 iCyphOffImage, |
|
318 rect, |
|
319 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(11) ); |
|
320 |
|
321 // Call type pane |
|
322 BubbleUtils::LayoutCallTypeIndicators( |
|
323 rect, |
|
324 BubbleLayout2::popup_call2_audio_first_call_type_icon(11), |
|
325 iTypeIndication1, // Data/Fax |
|
326 iTypeIndication2 ); // ALS line 2 |
|
327 |
|
328 // Text line 1 |
|
329 BubbleUtils::LayoutLabel( |
|
330 iTextLine1, |
|
331 rect, |
|
332 BubbleLayout2::popup_call2_audio_first_call_cli_text(15) ); |
|
333 |
|
334 // Smaller rect for text if brand image exists |
|
335 if ( iBrandImage ) |
|
336 { |
|
337 // Text line 2 - call state |
|
338 BubbleUtils::LayoutLabel( |
|
339 iTextLine2, |
|
340 rect, |
|
341 BubbleLayout2::popup_call2_audio_first_call_state_text(16) ); |
|
342 |
|
343 // Text line 2 - call timer |
|
344 BubbleUtils::LayoutLabel( |
|
345 iTimerCost, |
|
346 rect, |
|
347 BubbleLayout2::popup_call2_audio_first_call_state_text(17) ); |
|
348 |
|
349 //Brand image |
|
350 BubbleUtils::LayoutCustomElement( |
|
351 iBrandImage, |
|
352 rect, |
|
353 BubbleLayout2::popup_call2_audio_first_brand_image(2) ); |
|
354 } |
|
355 else |
|
356 { |
|
357 // Text line 2 - call state |
|
358 BubbleUtils::LayoutLabel( |
|
359 iTextLine2, |
|
360 rect, |
|
361 BubbleLayout2::popup_call2_audio_first_call_state_text(12) ); |
|
362 |
|
363 // Text line 2 - call timer |
|
364 BubbleUtils::LayoutLabel( |
|
365 iTimerCost, |
|
366 rect, |
|
367 BubbleLayout2::popup_call2_audio_first_call_state_text(13) ); |
|
368 } |
|
369 |
|
370 // Create call object bitmaps |
|
371 iBubble->SetRect( bubbleRect.Rect() ); |
|
372 |
|
373 BubbleUtils::PrepareBubbleImageL( |
|
374 iFrameId, |
|
375 outerRect, |
|
376 innerRect, |
|
377 iBubble ); |
|
378 |
|
379 if ( iHeader->CallObjectImage() ) |
|
380 { |
|
381 BubbleUtils::PrepareCallObjectImageL( |
|
382 *iHeader, |
|
383 iBubbleManager.CallObjectImageIncallSize() ); |
|
384 |
|
385 TBool dimmed = !iBubbleManager.IsCallDroppedByEndKey( |
|
386 iHeader->CallState() ); |
|
387 |
|
388 TAknLayoutRect cliRect; |
|
389 cliRect.LayoutRect( |
|
390 frameRect, |
|
391 BubbleLayout2::popup_call2_bubble_pane_graphics_cli() ); |
|
392 |
|
393 // Combine image to bubble image |
|
394 BubbleUtils::PrepareCallObjectToBubbleImageL( |
|
395 iHeader->CallObjectImage(), |
|
396 iHeader->CallObjectImageMask(), |
|
397 cliRect.Rect(), |
|
398 coMaskFrameId, // gradient image mask |
|
399 outerRect, |
|
400 innerRect, |
|
401 iBubble, |
|
402 dimmed ); |
|
403 } |
|
404 break; |
|
405 } |
|
406 case CBubbleManager::ENone: |
|
407 default: |
|
408 break; |
|
409 } |
|
410 } |
|
411 |
|
412 // --------------------------------------------------------------------------- |
|
413 // CBubbleOutlookMiddle::GetCall1BubbleBitmaps |
|
414 // --------------------------------------------------------------------------- |
|
415 // |
|
416 void CBubbleOutlookMiddle::GetCall1BubbleBitmaps() |
|
417 { |
|
418 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
419 |
|
420 TInt bubblePicture = KErrNotFound; |
|
421 TInt bubblePictureMask = KErrNotFound; |
|
422 |
|
423 // set call bubble |
|
424 switch ( callState ) |
|
425 { |
|
426 case CBubbleManager::EWaiting: |
|
427 case CBubbleManager::EIncoming: |
|
428 case CBubbleManager::EOutgoing: |
|
429 case CBubbleManager::EAlerting: |
|
430 { |
|
431 bubblePicture = EQgn_graf_call_rec_big_left; |
|
432 bubblePictureMask = EQgn_graf_call_rec_big_left_mask; |
|
433 } |
|
434 break; |
|
435 case CBubbleManager::EAlertToDisconnected: |
|
436 { |
|
437 bubblePicture = EQgn_graf_call_rec_big_left_disconn; |
|
438 bubblePictureMask = EQgn_graf_call_rec_big_left_disconn_mask; |
|
439 } |
|
440 break; |
|
441 case CBubbleManager::EActive: |
|
442 { |
|
443 if ( iIsUnder ) |
|
444 { |
|
445 bubblePicture = EQgn_graf_call_first_wait_active; |
|
446 bubblePictureMask = EQgn_graf_call_first_wait_active_mask; |
|
447 } |
|
448 else |
|
449 { |
|
450 bubblePicture = EQgn_graf_call_first_two_active; |
|
451 bubblePictureMask = EQgn_graf_call_first_two_active_mask; |
|
452 } |
|
453 break; |
|
454 } |
|
455 case CBubbleManager::EOnHold: |
|
456 bubblePicture = EQgn_graf_call_first_two_held; |
|
457 bubblePictureMask = EQgn_graf_call_first_two_held_mask; |
|
458 break; |
|
459 case CBubbleManager::EDisconnected: |
|
460 if ( iIsUnder ) |
|
461 { |
|
462 bubblePicture = EQgn_graf_call_first_wait_disconn; |
|
463 bubblePictureMask = EQgn_graf_call_first_wait_disconn_mask; |
|
464 } |
|
465 else |
|
466 { |
|
467 bubblePicture = EQgn_graf_call_first_two_disconn; |
|
468 bubblePictureMask = EQgn_graf_call_first_two_disconn_mask; |
|
469 } |
|
470 break; |
|
471 case CBubbleManager::ENone: |
|
472 default: |
|
473 bubblePicture = KErrNotFound; |
|
474 bubblePictureMask = KErrNotFound; |
|
475 break; |
|
476 } |
|
477 |
|
478 if ( bubblePicture != KErrNotFound ) |
|
479 { |
|
480 if ( bubblePictureMask == KErrNotFound ) |
|
481 { |
|
482 iBubbleManager.ImageManager().SetBitmapToImage( iBubble, |
|
483 (TBMIcons) bubblePicture ); |
|
484 } |
|
485 else |
|
486 { |
|
487 iBubbleManager.ImageManager().SetBitmapToImage( iBubble, |
|
488 (TBMIcons) bubblePicture , |
|
489 (TBMIcons) bubblePictureMask); |
|
490 } |
|
491 } |
|
492 } |
|
493 |
|
494 // End of File |