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