|
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 break; |
|
242 } |
|
243 case CBubbleManager::EDisconnected: |
|
244 case CBubbleManager::EActive: |
|
245 case CBubbleManager::EOnHold: |
|
246 { |
|
247 /////////////////////////////////////////////////////////////////// |
|
248 // Second call layout. |
|
249 /////////////////////////////////////////////////////////////////// |
|
250 |
|
251 // Create bubble image |
|
252 TAknLayoutRect bubbleRect; |
|
253 bubbleRect.LayoutRect( |
|
254 rect, |
|
255 BubbleLayout2::popup_call2_audio_second_call_background(9) ); |
|
256 |
|
257 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
258 TRect outerRect; |
|
259 TRect innerRect; |
|
260 BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, |
|
261 outerRect, |
|
262 innerRect); |
|
263 |
|
264 if ( callState == CBubbleManager::EOnHold ) |
|
265 { |
|
266 iFrameId = KAknsIIDQsnFrCall2Bubble; |
|
267 } |
|
268 else if ( callState == CBubbleManager::EDisconnected ) |
|
269 { |
|
270 iFrameId = KAknsIIDQsnFrCall2BubbleSecondDisconn; |
|
271 } |
|
272 else |
|
273 { |
|
274 iFrameId = KAknsIIDQsnFrCall2BubbleSecond; |
|
275 } |
|
276 |
|
277 iOuterRect = outerRect; |
|
278 iOuterRect.Move( Rect().iTl ); |
|
279 iInnerRect = innerRect; |
|
280 iInnerRect.Move( Rect().iTl ); |
|
281 |
|
282 // Call icon |
|
283 BubbleUtils::LayoutCustomElement( |
|
284 iSmallCallIndication, |
|
285 rect, |
|
286 BubbleLayout2::popup_call2_audio_second_call_status_icon(9) ); |
|
287 |
|
288 // Ciphering off |
|
289 BubbleUtils::LayoutControl( |
|
290 iCyphOffImage, |
|
291 rect, |
|
292 BubbleLayout2::popup_call2_audio_second_call_cyphering_icon(9) ); |
|
293 |
|
294 // Call type pane |
|
295 BubbleUtils::LayoutCallTypeIndicators( |
|
296 rect, |
|
297 BubbleLayout2::popup_call2_audio_second_call_type_icon(9), |
|
298 iTypeIndication1, // Data/Fax |
|
299 iTypeIndication2 ); // ALS line 2 |
|
300 |
|
301 // Text line 1 |
|
302 BubbleUtils::LayoutLabel( |
|
303 iTextLine1, |
|
304 rect, |
|
305 BubbleLayout2::popup_call2_audio_second_call_cli_text(11) ); |
|
306 |
|
307 // Smaller rect for text if brand image exists |
|
308 if ( iBrandImage ) |
|
309 { |
|
310 // Text line 2 - call state |
|
311 BubbleUtils::LayoutLabel( |
|
312 iTextLine2, |
|
313 rect, |
|
314 BubbleLayout2::popup_call2_audio_second_call_state_text(5) ); |
|
315 |
|
316 // Text line 2 - call timer |
|
317 BubbleUtils::LayoutLabel( |
|
318 iTimerCost, |
|
319 rect, |
|
320 BubbleLayout2::popup_call2_audio_second_call_timer_text(5) ); |
|
321 |
|
322 //Brand image |
|
323 BubbleUtils::LayoutCustomElement( |
|
324 iBrandImage, |
|
325 rect, |
|
326 BubbleLayout2::popup_call2_audio_second_brand_image(0) ); |
|
327 } |
|
328 else |
|
329 { |
|
330 // Text line 2 - call state |
|
331 BubbleUtils::LayoutLabel( |
|
332 iTextLine2, |
|
333 rect, |
|
334 BubbleLayout2::popup_call2_audio_second_call_state_text(4) ); |
|
335 |
|
336 // Text line 2 - call timer |
|
337 BubbleUtils::LayoutLabel( |
|
338 iTimerCost, |
|
339 rect, |
|
340 BubbleLayout2::popup_call2_audio_second_call_timer_text(4) ); |
|
341 } |
|
342 |
|
343 // Create call object bitmaps |
|
344 iBubble->SetRect( bubbleRect.Rect() ); |
|
345 |
|
346 BubbleUtils::PrepareBubbleImageL( |
|
347 iFrameId, |
|
348 outerRect, |
|
349 innerRect, |
|
350 iBubble ); |
|
351 |
|
352 break; |
|
353 } |
|
354 case CBubbleManager::ENone: |
|
355 default: |
|
356 break; |
|
357 } |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // CBubbleOutlookBottomRight::GetCall1BubbleBitmaps |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 void CBubbleOutlookBottomRight::GetCall1BubbleBitmaps() |
|
365 { |
|
366 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
367 |
|
368 TInt bubblePicture = KErrNotFound; |
|
369 TInt bubblePictureMask = KErrNotFound; |
|
370 |
|
371 // set call indications and bubble |
|
372 switch ( callState ) |
|
373 { |
|
374 case CBubbleManager::EWaiting: |
|
375 case CBubbleManager::EIncoming: |
|
376 case CBubbleManager::EOutgoing: |
|
377 case CBubbleManager::EAlerting: |
|
378 bubblePicture = EQgn_graf_call_rec_big_right; |
|
379 bubblePictureMask = EQgn_graf_call_rec_big_right_mask; |
|
380 break; |
|
381 case CBubbleManager::EAlertToDisconnected: |
|
382 bubblePicture = EQgn_graf_call_rec_big_right_disconn; |
|
383 bubblePictureMask = EQgn_graf_call_rec_big_right_disconn_mask; |
|
384 break; |
|
385 case CBubbleManager::EActive: |
|
386 bubblePicture = EQgn_graf_call_second_two_active; |
|
387 bubblePictureMask = EQgn_graf_call_second_two_active_mask; |
|
388 break; |
|
389 case CBubbleManager::EOnHold: |
|
390 bubblePicture = EQgn_graf_call_second_two_held; |
|
391 bubblePictureMask = EQgn_graf_call_second_two_held_mask; |
|
392 break; |
|
393 case CBubbleManager::EDisconnected: |
|
394 bubblePicture = EQgn_graf_call_second_two_disconn; |
|
395 bubblePictureMask = EQgn_graf_call_second_two_disconn_mask; |
|
396 break; |
|
397 case CBubbleManager::ENone: |
|
398 default: |
|
399 bubblePicture = KErrNotFound; |
|
400 bubblePictureMask = KErrNotFound; |
|
401 break; |
|
402 } |
|
403 |
|
404 if ( bubblePicture != KErrNotFound ) |
|
405 { |
|
406 if ( bubblePictureMask == KErrNotFound ) |
|
407 { |
|
408 iBubbleManager.ImageManager().SetBitmapToImage( |
|
409 iBubble, (TBMIcons) bubblePicture ); |
|
410 } |
|
411 else |
|
412 { |
|
413 iBubbleManager.ImageManager().SetBitmapToImage( |
|
414 iBubble, |
|
415 (TBMIcons) bubblePicture , |
|
416 (TBMIcons) bubblePictureMask); |
|
417 } |
|
418 } |
|
419 |
|
420 } |
|
421 |
|
422 // End of File |