|
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 Bottom |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleManager.h" //for enumerations |
|
21 #include "BMBubbleOutlookBottom.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 |
|
37 // ========================= MEMBER FUNCTIONS ================================ |
|
38 |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CBubbleOutlookBottom::CBubbleOutlookBottom |
|
42 // |
|
43 // |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CBubbleOutlookBottom::CBubbleOutlookBottom( CBubbleManager& aBubbleManager ) |
|
47 : CBubbleOutlookTwoLined( aBubbleManager ) |
|
48 { |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CBubbleOutlookBottom::ConstructL |
|
53 // |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void CBubbleOutlookBottom::ConstructL() |
|
57 { |
|
58 CBubbleOutlookTwoLined::ConstructL(); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CBubbleOutlookBottom::~CBubbleOutlookBottom |
|
63 // |
|
64 // |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CBubbleOutlookBottom::~CBubbleOutlookBottom() |
|
68 { |
|
69 Reset(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CBubbleOutlookBottom::ReadBubbleHeader |
|
74 // |
|
75 // |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CBubbleOutlookBottom::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
79 { |
|
80 iHeader = &aHeader; |
|
81 |
|
82 iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue ); |
|
83 |
|
84 if ( !iCallObjectDisplay ) |
|
85 { |
|
86 GetCall1BubbleBitmaps(); |
|
87 } |
|
88 |
|
89 CBubbleOutlookTwoLined::ReadBubbleHeader( aHeader ); |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CBubbleOutlookBottom::SizeChanged |
|
94 // called by framwork when the view size is changed |
|
95 // |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CBubbleOutlookBottom::SizeChanged() |
|
99 { |
|
100 if( !iHeader ) |
|
101 { |
|
102 return; |
|
103 } |
|
104 |
|
105 AknsUtils::RegisterControlPosition( this ); |
|
106 |
|
107 if ( !iCallObjectDisplay ) |
|
108 { |
|
109 DoCall1Layout(); |
|
110 } |
|
111 else |
|
112 { |
|
113 TRAPD( err, DoCall2LayoutL() ); |
|
114 if ( err ) |
|
115 { |
|
116 iBubble->SetPicture( NULL, NULL ); |
|
117 |
|
118 // Prepare frame for dynamic draw |
|
119 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
120 AknsDrawUtils::PrepareFrame( skin, |
|
121 iOuterRect, |
|
122 iInnerRect, |
|
123 iFrameId, |
|
124 KAknsIIDDefault ); |
|
125 } |
|
126 } |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CBubbleOutlookBottom::PositionChanged |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 void CBubbleOutlookBottom::PositionChanged() |
|
134 { |
|
135 AknsUtils::RegisterControlPosition( this ); |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CBubbleOutlookBottom::DoCall1Layout |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 void CBubbleOutlookBottom::DoCall1Layout() |
|
143 { |
|
144 // Deprecated |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CBubbleOutlookBottom::DoCall2Layout |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void CBubbleOutlookBottom::DoCall2LayoutL() |
|
152 { |
|
153 iBubble->SetPictureOwnedExternally( EFalse ); |
|
154 iBubble->SetPicture( NULL, NULL ); |
|
155 |
|
156 const TRect rect = Rect(); |
|
157 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
158 switch ( callState ) |
|
159 { |
|
160 case CBubbleManager::EWaiting: |
|
161 case CBubbleManager::EIncoming: |
|
162 case CBubbleManager::EOutgoing: |
|
163 case CBubbleManager::EAlerting: |
|
164 case CBubbleManager::EAlertToDisconnected: |
|
165 { |
|
166 /////////////////////////////////////////////////////////////////// |
|
167 // Incoming call layout for single call |
|
168 /////////////////////////////////////////////////////////////////// |
|
169 |
|
170 TAknLayoutRect bubbleRect; |
|
171 bubbleRect.LayoutRect( |
|
172 rect, |
|
173 BubbleLayout2::popup_call2_audio_in_background(1) ); |
|
174 |
|
175 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
176 TRect outerRect; |
|
177 TRect innerRect; |
|
178 BubbleLayout2::RectFrameInnerOuterRects( frameRect, |
|
179 outerRect, |
|
180 innerRect); |
|
181 |
|
182 iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ? |
|
183 KAknsIIDQsnFrCall2RectDisconn : |
|
184 KAknsIIDQsnFrCall2Rect; |
|
185 |
|
186 // for possible frame draw |
|
187 iOuterRect = outerRect; |
|
188 iOuterRect.Move( Rect().iTl ); |
|
189 iInnerRect = innerRect; |
|
190 iInnerRect.Move( Rect().iTl ); |
|
191 |
|
192 // Call indicator |
|
193 BubbleUtils::LayoutCustomElement( |
|
194 iBigCallIndicator, |
|
195 rect, |
|
196 BubbleLayout2::popup_call2_audio_in_call_waiting_icon(1) ); |
|
197 |
|
198 // Ciphering off |
|
199 BubbleUtils::LayoutControl( |
|
200 iCyphOffImage, |
|
201 rect, |
|
202 BubbleLayout2::popup_call2_audio_in_ciphering_icon(1) ); |
|
203 |
|
204 // Number type icon |
|
205 BubbleUtils::LayoutCustomElement( |
|
206 iNumberType, |
|
207 rect, |
|
208 BubbleLayout2::popup_call2_audio_in_call_number_type_icon(1) ); |
|
209 |
|
210 // Text line 1 |
|
211 BubbleUtils::LayoutLabel( |
|
212 iTextLine1, |
|
213 rect, |
|
214 BubbleLayout2::popup_call2_audio_in_call_text_1(1) ); |
|
215 |
|
216 // Smaller rect for text if brand image exists |
|
217 if ( iBrandImage ) |
|
218 { |
|
219 // Text line 2 |
|
220 BubbleUtils::LayoutLabel( |
|
221 iTextLine2, |
|
222 rect, |
|
223 BubbleLayout2::popup_call2_audio_in_call_text_2(9) ); |
|
224 |
|
225 //Brand image |
|
226 BubbleUtils::LayoutCustomElement( |
|
227 iBrandImage, |
|
228 rect, |
|
229 BubbleLayout2::popup_call2_audio_in_brand_image(3) ); |
|
230 } |
|
231 else |
|
232 { |
|
233 // Text line 2 |
|
234 BubbleUtils::LayoutLabel( |
|
235 iTextLine2, |
|
236 rect, |
|
237 BubbleLayout2::popup_call2_audio_in_call_text_2(1) ); |
|
238 } |
|
239 |
|
240 // Build call object bubble |
|
241 iBubble->SetRect( bubbleRect.Rect() ); |
|
242 |
|
243 BubbleUtils::PrepareBubbleImageL( |
|
244 iFrameId, |
|
245 outerRect, |
|
246 innerRect, |
|
247 iBubble ); |
|
248 |
|
249 if ( iHeader->CallObjectImage() && |
|
250 !iHeader->CallObjectText().Length() ) |
|
251 { |
|
252 // Add transparency |
|
253 BubbleUtils::AddTransparencyToBubbleImageL( |
|
254 KAknsIIDQsnFrCall2RectCoMask, // gradient tp mask |
|
255 outerRect, |
|
256 innerRect, |
|
257 iBubble ); |
|
258 } |
|
259 |
|
260 break; |
|
261 } |
|
262 case CBubbleManager::EDisconnected: |
|
263 case CBubbleManager::EActive: |
|
264 case CBubbleManager::EOnHold: |
|
265 { |
|
266 /////////////////////////////////////////////////////////////////// |
|
267 // First call layout for single call |
|
268 /////////////////////////////////////////////////////////////////// |
|
269 |
|
270 TAknLayoutRect bubbleRect; |
|
271 bubbleRect.LayoutRect( |
|
272 rect, |
|
273 BubbleLayout2::popup_call2_audio_first_call_background(14) ); |
|
274 |
|
275 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
276 TRect outerRect; |
|
277 TRect innerRect; |
|
278 BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, |
|
279 outerRect, |
|
280 innerRect); |
|
281 |
|
282 TAknsItemID coMaskFrameId; |
|
283 if ( callState == CBubbleManager::EOnHold ) |
|
284 { |
|
285 iFrameId = KAknsIIDQsnFrCall2Bubble; |
|
286 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask; |
|
287 } |
|
288 else if ( callState == CBubbleManager::EDisconnected ) |
|
289 { |
|
290 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn; |
|
291 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask; |
|
292 } |
|
293 else |
|
294 { |
|
295 iFrameId = KAknsIIDQsnFrCall2BubbleFirst; |
|
296 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask; |
|
297 } |
|
298 |
|
299 // for possible frame draw |
|
300 iOuterRect = outerRect; |
|
301 iOuterRect.Move( Rect().iTl ); |
|
302 iInnerRect = innerRect; |
|
303 iInnerRect.Move( Rect().iTl ); |
|
304 |
|
305 // Call icon |
|
306 BubbleUtils::LayoutCustomElement( |
|
307 iSmallCallIndication, |
|
308 rect, |
|
309 BubbleLayout2::popup_call2_audio_first_call_status_icon(13) ); |
|
310 |
|
311 // Ciphering off |
|
312 BubbleUtils::LayoutControl( |
|
313 iCyphOffImage, |
|
314 rect, |
|
315 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(12) ); |
|
316 |
|
317 // Call type pane |
|
318 BubbleUtils::LayoutCallTypeIndicators( |
|
319 rect, |
|
320 BubbleLayout2::popup_call2_audio_first_call_type_icon(12), |
|
321 iTypeIndication1, // Data/Fax |
|
322 iTypeIndication2 ); // ALS line 2 |
|
323 |
|
324 // Text line 1 |
|
325 BubbleUtils::LayoutLabel( |
|
326 iTextLine1, |
|
327 rect, |
|
328 BubbleLayout2::popup_call2_audio_first_call_cli_text(16) ); |
|
329 |
|
330 // Smaller rect for text if bran image exists |
|
331 if ( iBrandImage ) |
|
332 { |
|
333 // Text line 2 - call state |
|
334 BubbleUtils::LayoutLabel( |
|
335 iTextLine2, |
|
336 rect, |
|
337 BubbleLayout2::popup_call2_audio_first_call_state_text(16) ); |
|
338 |
|
339 // Text line 2 - call timer |
|
340 BubbleUtils::LayoutLabel( |
|
341 iTimerCost, |
|
342 rect, |
|
343 BubbleLayout2::popup_call2_audio_first_call_state_text(17) ); |
|
344 |
|
345 //Brand image |
|
346 BubbleUtils::LayoutCustomElement( |
|
347 iBrandImage, |
|
348 rect, |
|
349 BubbleLayout2::popup_call2_audio_first_brand_image(1) ); |
|
350 } |
|
351 else |
|
352 { |
|
353 // Text line 2 - call state |
|
354 BubbleUtils::LayoutLabel( |
|
355 iTextLine2, |
|
356 rect, |
|
357 BubbleLayout2::popup_call2_audio_first_call_state_text(12) ); |
|
358 // Text line 2 - call timer |
|
359 BubbleUtils::LayoutLabel( |
|
360 iTimerCost, |
|
361 rect, |
|
362 BubbleLayout2::popup_call2_audio_first_call_state_text(13) ); |
|
363 } |
|
364 |
|
365 // Build call object bubble |
|
366 iBubble->SetRect( bubbleRect.Rect() ); |
|
367 |
|
368 BubbleUtils::PrepareBubbleImageL( |
|
369 iFrameId, |
|
370 outerRect, |
|
371 innerRect, |
|
372 iBubble ); |
|
373 |
|
374 // Add transparency |
|
375 BubbleUtils::AddTransparencyToBubbleImageL( |
|
376 coMaskFrameId, |
|
377 outerRect, |
|
378 innerRect, |
|
379 iBubble ); |
|
380 |
|
381 |
|
382 break; |
|
383 } |
|
384 default: |
|
385 break; |
|
386 } |
|
387 } |
|
388 |
|
389 // --------------------------------------------------------------------------- |
|
390 // CBubbleOutlookBottom::GetCall1BubbleBitmaps |
|
391 // --------------------------------------------------------------------------- |
|
392 // |
|
393 void CBubbleOutlookBottom::GetCall1BubbleBitmaps() |
|
394 { |
|
395 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
396 |
|
397 TInt bubblePicture = KErrNotFound; |
|
398 TInt bubblePictureMask = KErrNotFound; |
|
399 |
|
400 // set call indications and bubble |
|
401 switch ( callState ) |
|
402 { |
|
403 case CBubbleManager::EWaiting: |
|
404 case CBubbleManager::EIncoming: |
|
405 case CBubbleManager::EOutgoing: |
|
406 case CBubbleManager::EAlerting: |
|
407 bubblePicture = EQgn_graf_call_rec_big; |
|
408 bubblePictureMask = EQgn_graf_call_rec_big_mask; |
|
409 break; |
|
410 case CBubbleManager::EAlertToDisconnected: |
|
411 bubblePicture = EQgn_graf_call_rec_big_disconn; |
|
412 bubblePictureMask = EQgn_graf_call_rec_big_disconn_mask; |
|
413 break; |
|
414 case CBubbleManager::EActive: |
|
415 bubblePicture = EQgn_graf_call_first_one_active; |
|
416 bubblePictureMask = EQgn_graf_call_first_one_active_mask; |
|
417 break; |
|
418 case CBubbleManager::EOnHold: |
|
419 bubblePicture = EQgn_graf_call_first_one_held; |
|
420 bubblePictureMask = EQgn_graf_call_first_one_held_mask; |
|
421 break; |
|
422 case CBubbleManager::EDisconnected: |
|
423 bubblePicture = EQgn_graf_call_first_one_disconn; |
|
424 bubblePictureMask = EQgn_graf_call_first_one_disconn_mask; |
|
425 break; |
|
426 case CBubbleManager::ENone: |
|
427 default: |
|
428 bubblePicture = KErrNotFound; |
|
429 bubblePictureMask = KErrNotFound; |
|
430 break; |
|
431 } |
|
432 |
|
433 if ( bubblePicture != KErrNotFound ) |
|
434 { |
|
435 if ( bubblePictureMask == KErrNotFound ) |
|
436 { |
|
437 iBubbleManager.ImageManager().SetBitmapToImage( |
|
438 iBubble, (TBMIcons) bubblePicture ); |
|
439 } |
|
440 else |
|
441 { |
|
442 iBubbleManager.ImageManager().SetBitmapToImage( |
|
443 iBubble, |
|
444 (TBMIcons) bubblePicture , |
|
445 (TBMIcons) bubblePictureMask); |
|
446 } |
|
447 } |
|
448 |
|
449 } |
|
450 |
|
451 // End of File |