|
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 break; |
|
250 } |
|
251 case CBubbleManager::EDisconnected: |
|
252 case CBubbleManager::EActive: |
|
253 case CBubbleManager::EOnHold: |
|
254 { |
|
255 /////////////////////////////////////////////////////////////////// |
|
256 // First call layout for single call |
|
257 /////////////////////////////////////////////////////////////////// |
|
258 |
|
259 TAknLayoutRect bubbleRect; |
|
260 bubbleRect.LayoutRect( |
|
261 rect, |
|
262 BubbleLayout2::popup_call2_audio_first_call_background(14) ); |
|
263 |
|
264 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
265 TRect outerRect; |
|
266 TRect innerRect; |
|
267 BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, |
|
268 outerRect, |
|
269 innerRect); |
|
270 |
|
271 if ( callState == CBubbleManager::EOnHold ) |
|
272 { |
|
273 iFrameId = KAknsIIDQsnFrCall2Bubble; |
|
274 } |
|
275 else if ( callState == CBubbleManager::EDisconnected ) |
|
276 { |
|
277 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn; |
|
278 } |
|
279 else |
|
280 { |
|
281 iFrameId = KAknsIIDQsnFrCall2BubbleFirst; |
|
282 } |
|
283 |
|
284 // for possible frame draw |
|
285 iOuterRect = outerRect; |
|
286 iOuterRect.Move( Rect().iTl ); |
|
287 iInnerRect = innerRect; |
|
288 iInnerRect.Move( Rect().iTl ); |
|
289 |
|
290 // Call icon |
|
291 BubbleUtils::LayoutCustomElement( |
|
292 iSmallCallIndication, |
|
293 rect, |
|
294 BubbleLayout2::popup_call2_audio_first_call_status_icon(13) ); |
|
295 |
|
296 // Ciphering off |
|
297 BubbleUtils::LayoutControl( |
|
298 iCyphOffImage, |
|
299 rect, |
|
300 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(12) ); |
|
301 |
|
302 // Call type pane |
|
303 BubbleUtils::LayoutCallTypeIndicators( |
|
304 rect, |
|
305 BubbleLayout2::popup_call2_audio_first_call_type_icon(12), |
|
306 iTypeIndication1, // Data/Fax |
|
307 iTypeIndication2 ); // ALS line 2 |
|
308 |
|
309 // Text line 1 |
|
310 BubbleUtils::LayoutLabel( |
|
311 iTextLine1, |
|
312 rect, |
|
313 BubbleLayout2::popup_call2_audio_first_call_cli_text(16) ); |
|
314 |
|
315 // Smaller rect for text if bran image exists |
|
316 if ( iBrandImage ) |
|
317 { |
|
318 // Text line 2 - call state |
|
319 BubbleUtils::LayoutLabel( |
|
320 iTextLine2, |
|
321 rect, |
|
322 BubbleLayout2::popup_call2_audio_first_call_state_text(16) ); |
|
323 |
|
324 // Text line 2 - call timer |
|
325 BubbleUtils::LayoutLabel( |
|
326 iTimerCost, |
|
327 rect, |
|
328 BubbleLayout2::popup_call2_audio_first_call_state_text(17) ); |
|
329 |
|
330 //Brand image |
|
331 BubbleUtils::LayoutCustomElement( |
|
332 iBrandImage, |
|
333 rect, |
|
334 BubbleLayout2::popup_call2_audio_first_brand_image(1) ); |
|
335 } |
|
336 else |
|
337 { |
|
338 // Text line 2 - call state |
|
339 BubbleUtils::LayoutLabel( |
|
340 iTextLine2, |
|
341 rect, |
|
342 BubbleLayout2::popup_call2_audio_first_call_state_text(12) ); |
|
343 // Text line 2 - call timer |
|
344 BubbleUtils::LayoutLabel( |
|
345 iTimerCost, |
|
346 rect, |
|
347 BubbleLayout2::popup_call2_audio_first_call_state_text(13) ); |
|
348 } |
|
349 |
|
350 // Build call object bubble |
|
351 iBubble->SetRect( bubbleRect.Rect() ); |
|
352 |
|
353 BubbleUtils::PrepareBubbleImageL( |
|
354 iFrameId, |
|
355 outerRect, |
|
356 innerRect, |
|
357 iBubble ); |
|
358 |
|
359 break; |
|
360 } |
|
361 default: |
|
362 break; |
|
363 } |
|
364 } |
|
365 |
|
366 // --------------------------------------------------------------------------- |
|
367 // CBubbleOutlookBottom::GetCall1BubbleBitmaps |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 void CBubbleOutlookBottom::GetCall1BubbleBitmaps() |
|
371 { |
|
372 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
373 |
|
374 TInt bubblePicture = KErrNotFound; |
|
375 TInt bubblePictureMask = KErrNotFound; |
|
376 |
|
377 // set call indications and bubble |
|
378 switch ( callState ) |
|
379 { |
|
380 case CBubbleManager::EWaiting: |
|
381 case CBubbleManager::EIncoming: |
|
382 case CBubbleManager::EOutgoing: |
|
383 case CBubbleManager::EAlerting: |
|
384 bubblePicture = EQgn_graf_call_rec_big; |
|
385 bubblePictureMask = EQgn_graf_call_rec_big_mask; |
|
386 break; |
|
387 case CBubbleManager::EAlertToDisconnected: |
|
388 bubblePicture = EQgn_graf_call_rec_big_disconn; |
|
389 bubblePictureMask = EQgn_graf_call_rec_big_disconn_mask; |
|
390 break; |
|
391 case CBubbleManager::EActive: |
|
392 bubblePicture = EQgn_graf_call_first_one_active; |
|
393 bubblePictureMask = EQgn_graf_call_first_one_active_mask; |
|
394 break; |
|
395 case CBubbleManager::EOnHold: |
|
396 bubblePicture = EQgn_graf_call_first_one_held; |
|
397 bubblePictureMask = EQgn_graf_call_first_one_held_mask; |
|
398 break; |
|
399 case CBubbleManager::EDisconnected: |
|
400 bubblePicture = EQgn_graf_call_first_one_disconn; |
|
401 bubblePictureMask = EQgn_graf_call_first_one_disconn_mask; |
|
402 break; |
|
403 case CBubbleManager::ENone: |
|
404 default: |
|
405 bubblePicture = KErrNotFound; |
|
406 bubblePictureMask = KErrNotFound; |
|
407 break; |
|
408 } |
|
409 |
|
410 if ( bubblePicture != KErrNotFound ) |
|
411 { |
|
412 if ( bubblePictureMask == KErrNotFound ) |
|
413 { |
|
414 iBubbleManager.ImageManager().SetBitmapToImage( |
|
415 iBubble, (TBMIcons) bubblePicture ); |
|
416 } |
|
417 else |
|
418 { |
|
419 iBubbleManager.ImageManager().SetBitmapToImage( |
|
420 iBubble, |
|
421 (TBMIcons) bubblePicture , |
|
422 (TBMIcons) bubblePictureMask); |
|
423 } |
|
424 } |
|
425 |
|
426 } |
|
427 |
|
428 // End of File |