|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Implementation of CBubbleOutlookOneLined class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleOutlookOneLined.h" |
|
21 #include "BMResourceManager.h" |
|
22 #include "BMBubbleHeader.h" |
|
23 #include "BMUtils.h" |
|
24 #include "BMCustomManager.h" |
|
25 #include "telbubbleanim.h" |
|
26 #include "BMLayout.h" |
|
27 |
|
28 #include <eiklabel.h> |
|
29 #include <eikimage.h> |
|
30 #include <featmgr.h> |
|
31 #include <AknsDrawUtils.h> |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ======================= |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CBubbleOutlookOneLined::CBubbleOutlookOneLined( ) |
|
37 // |
|
38 // |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CBubbleOutlookOneLined::CBubbleOutlookOneLined( |
|
42 CBubbleManager& aBubbleManager ) |
|
43 : CBubbleOutlook( aBubbleManager ) |
|
44 { |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CBubbleOutlookOneLined::ConstructL |
|
49 // |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void CBubbleOutlookOneLined::ConstructL() |
|
53 { |
|
54 |
|
55 iHeader = NULL; |
|
56 CBubbleOutlook::ConstructL( ); |
|
57 ActivateL(); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CBubbleOutlookOneLined::~CBubbleOutlookOneLined() |
|
62 // |
|
63 // |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CBubbleOutlookOneLined::~CBubbleOutlookOneLined() |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CBubbleOutlookOneLined::Reset |
|
73 // |
|
74 // |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 void CBubbleOutlookOneLined::Reset( ) |
|
78 { |
|
79 |
|
80 iBubbleManager.ResourceManager().ReleaseEikImage( iBubble ); |
|
81 iBubbleManager.CustomManager().ReleaseCustomElement( iSmallCallIndication ); |
|
82 iBubbleManager.ResourceManager().ReleaseEikImage( iTypeIndication1 ); |
|
83 iBubbleManager.ResourceManager().ReleaseEikImage( iTypeIndication2 ); |
|
84 iBubbleManager.ResourceManager().ReleaseEikImage( iCyphOffImage ); |
|
85 iBubbleManager.ResourceManager().ReleaseEikLabel( iTextLine1 ); |
|
86 |
|
87 iFullText1.Set( NULL , 0 ); |
|
88 iHeader = NULL; |
|
89 } |
|
90 |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CBubbleOutlookOneLined::ReadBubbleHeader |
|
94 // |
|
95 // |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CBubbleOutlookOneLined::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
99 { |
|
100 iHeader = &aHeader; |
|
101 |
|
102 CBubbleManager::TPhoneCallState callState = iHeader->CallState( ); |
|
103 |
|
104 // Set small call indication icon |
|
105 TInt defaultCallIndicator; |
|
106 iSmallCallIndication = |
|
107 iBubbleManager.CustomManager().ReserveCustomElement( |
|
108 aHeader, |
|
109 CTelBubbleCustomElement::ESmallCallIndicator, |
|
110 defaultCallIndicator ); |
|
111 |
|
112 // Number type not shown with custom call indicator |
|
113 if ( defaultCallIndicator ) |
|
114 { |
|
115 // Set the additional icons |
|
116 BubbleUtils::SetCallTypePane( |
|
117 *iHeader , |
|
118 iTypeIndication1, |
|
119 iTypeIndication2, |
|
120 iBubbleManager ); |
|
121 } |
|
122 |
|
123 // Set Cyph off image |
|
124 BubbleUtils::SetCyphOffImage( *iHeader, iCyphOffImage, iBubbleManager ); |
|
125 |
|
126 |
|
127 |
|
128 // Get texts and possible timer/cost string. |
|
129 // Reserved text buffer is KBubbleLabelMaxLength. If new text |
|
130 // is longer it panics. |
|
131 // It is enough if text is cropped to fit (eg. '...1234567890') |
|
132 |
|
133 switch ( callState ) |
|
134 { |
|
135 |
|
136 case CBubbleManager::EOnHold: |
|
137 case CBubbleManager::EDisconnected: |
|
138 case CBubbleManager::EActive: |
|
139 case CBubbleManager::EWaiting: |
|
140 case CBubbleManager::EOutgoing: |
|
141 case CBubbleManager::EAlertToDisconnected: |
|
142 case CBubbleManager::EAlerting: |
|
143 iTextLine1 = iBubbleManager.ResourceManager().ReserveEikLabel(); |
|
144 iFullText1.Set( iHeader->CLI() ); |
|
145 iText1ClipDirection = iHeader->CLIClipDirection( ); |
|
146 break; |
|
147 case CBubbleManager::EIncoming: |
|
148 case CBubbleManager::ENone: |
|
149 default: |
|
150 iFullText1.Set( NULL , 0 ); |
|
151 break; |
|
152 } |
|
153 } |
|
154 |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CBubbleOutlookOneLined::CountComponentControls() const |
|
158 // |
|
159 // |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 TInt CBubbleOutlookOneLined::CountComponentControls() const |
|
163 { |
|
164 TInt amount = 0; |
|
165 if ( iSmallCallIndication ) |
|
166 { |
|
167 amount++; |
|
168 } |
|
169 |
|
170 if ( iTypeIndication1 ) |
|
171 { |
|
172 amount++; |
|
173 } |
|
174 |
|
175 if ( iTypeIndication2 ) |
|
176 { |
|
177 amount++; |
|
178 } |
|
179 |
|
180 if ( iCyphOffImage ) |
|
181 { |
|
182 amount++; |
|
183 } |
|
184 |
|
185 if ( iTextLine1 ) |
|
186 { |
|
187 amount++; |
|
188 } |
|
189 return amount; |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // CBubbleOutlookOneLined::ComponentControl |
|
194 // |
|
195 // |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 CCoeControl* CBubbleOutlookOneLined::ComponentControl( TInt aIndex ) const |
|
199 { |
|
200 TInt amount = -1; |
|
201 // coverity[var_compare_op] |
|
202 if ( iSmallCallIndication ) |
|
203 { |
|
204 amount++; |
|
205 } |
|
206 |
|
207 if ( aIndex == amount ) |
|
208 { |
|
209 // coverity[var_deref_model] |
|
210 return iSmallCallIndication->Control(); |
|
211 } |
|
212 |
|
213 if ( iTypeIndication1 ) |
|
214 { |
|
215 amount++; |
|
216 } |
|
217 |
|
218 if ( aIndex == amount ) |
|
219 { |
|
220 return iTypeIndication1; |
|
221 } |
|
222 |
|
223 if ( iTypeIndication2 ) |
|
224 { |
|
225 amount++; |
|
226 } |
|
227 |
|
228 if ( aIndex == amount ) |
|
229 { |
|
230 return iTypeIndication2; |
|
231 } |
|
232 |
|
233 if ( iCyphOffImage ) |
|
234 { |
|
235 amount++; |
|
236 } |
|
237 |
|
238 if ( aIndex == amount ) |
|
239 { |
|
240 return iCyphOffImage; |
|
241 } |
|
242 |
|
243 if ( iTextLine1 ) |
|
244 { |
|
245 amount++; |
|
246 } |
|
247 |
|
248 if ( aIndex == amount ) |
|
249 { |
|
250 return iTextLine1; |
|
251 } |
|
252 |
|
253 return NULL; |
|
254 |
|
255 } |
|
256 |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // CBubbleOutlookOneLined::Draw |
|
260 // |
|
261 // |
|
262 // --------------------------------------------------------------------------- |
|
263 // |
|
264 void CBubbleOutlookOneLined::Draw( const TRect& /*aRect*/ ) const |
|
265 { |
|
266 |
|
267 // Check that proper call header is set |
|
268 if ( iHeader == NULL ) |
|
269 { |
|
270 return; |
|
271 } |
|
272 |
|
273 if ( !iHeader->IsUsed( ) || iHeader->IsInConference( ) ) |
|
274 { |
|
275 return; |
|
276 } |
|
277 |
|
278 |
|
279 // Set texts to fit. |
|
280 BubbleUtils::ClipToLabel( iFullText1 , iTextLine1 , iText1ClipDirection ); |
|
281 |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CBubbleOutlookOneLined::DrawTimerCostNow |
|
286 // |
|
287 // |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 void CBubbleOutlookOneLined::DrawTimerCostNow() |
|
291 { |
|
292 } |
|
293 |
|
294 // --------------------------------------------------------------------------- |
|
295 // CBubbleOutlookOneLined::DrawCLINow |
|
296 // |
|
297 // |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void CBubbleOutlookOneLined::DrawCLINow() |
|
301 { |
|
302 if ( iHeader == NULL ) |
|
303 { |
|
304 return; |
|
305 } |
|
306 |
|
307 iFullText1.Set( iHeader->CLI() ); |
|
308 |
|
309 CBubbleManager::TBubbleLabelString full = iHeader->CLI(); |
|
310 CBubbleManager::TPhoneClippingDirection clipDir = |
|
311 iHeader->CLIClipDirection(); |
|
312 |
|
313 // Set texts to fit. |
|
314 if ( full.Length() > 0 ) |
|
315 { |
|
316 BubbleUtils::ClipToLabel( full , iTextLine1 , clipDir ); |
|
317 BubbleUtils::AddTextToEikLabel( iTextLine1 , full ); |
|
318 } |
|
319 else |
|
320 { |
|
321 BubbleUtils::AddTextToEikLabel( iTextLine1 , KNullDesC ); |
|
322 } |
|
323 |
|
324 |
|
325 // First clear the area and then draw the new text |
|
326 DrawLabelNow( iTextLine1 ); |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // CBubbleOutlookOneLined::DrawBitmaps |
|
331 // |
|
332 // |
|
333 // --------------------------------------------------------------------------- |
|
334 // |
|
335 void CBubbleOutlookOneLined::DrawBitmaps( CBitmapContext& aGc ) const |
|
336 { |
|
337 // Check that proper call header is set |
|
338 if ( iHeader == NULL ) |
|
339 { |
|
340 return; |
|
341 } |
|
342 |
|
343 if ( !iHeader->IsUsed( ) || iHeader->IsInConference( ) ) |
|
344 { |
|
345 return; |
|
346 } |
|
347 |
|
348 if ( !iCallObjectDisplay ) |
|
349 { |
|
350 DrawCall1Bitmaps( aGc ); |
|
351 } |
|
352 else |
|
353 { |
|
354 DrawCall2Bitmaps( aGc ); |
|
355 } |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------------------------- |
|
359 // CBubbleOutlookOneLined::HandleAnimationStartL |
|
360 // |
|
361 // |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 void CBubbleOutlookOneLined::HandleAnimationStartL() const |
|
365 { |
|
366 if( iSmallCallIndication && |
|
367 iSmallCallIndication->ControlType() == CTelBubbleCustomElement::EBubbleAnimation ) |
|
368 { |
|
369 CTelBubbleAnim* anim = |
|
370 static_cast<CTelBubbleAnim*> ( iSmallCallIndication->Control() ); |
|
371 anim->StartAnimationL(); |
|
372 } |
|
373 |
|
374 } |
|
375 |
|
376 // --------------------------------------------------------------------------- |
|
377 // CBubbleOutlookOneLined::ReleaseBitmaps |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 void CBubbleOutlookOneLined::ReleaseBitmaps() |
|
381 { |
|
382 |
|
383 } |
|
384 |
|
385 // --------------------------------------------------------------------------- |
|
386 // CBubbleOutlookOneLined::RebuildBitmaps |
|
387 // --------------------------------------------------------------------------- |
|
388 // |
|
389 void CBubbleOutlookOneLined::RebuildBitmaps() |
|
390 { |
|
391 |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------------------------- |
|
395 // CBubbleOutlookOneLined::DrawCallHeaderText |
|
396 // --------------------------------------------------------------------------- |
|
397 // |
|
398 void CBubbleOutlookOneLined::DrawCallHeaderText() |
|
399 { |
|
400 } |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // CBubbleOutlookTwoLined::DrawCall1Bitmaps |
|
404 // --------------------------------------------------------------------------- |
|
405 // |
|
406 void CBubbleOutlookOneLined::DrawCall1Bitmaps( CBitmapContext& aGc ) const |
|
407 { |
|
408 |
|
409 aGc.SetBrushColor( AKN_LAF_COLOR( BubbleLayout::LayoutColourWhite() ) ); |
|
410 if ( !BubbleUtils::DrawMaskedImage( aGc , iBubble ) ) |
|
411 { |
|
412 BubbleUtils::DrawBackgroundRect( aGc, Rect() ); |
|
413 } |
|
414 } |
|
415 |
|
416 // --------------------------------------------------------------------------- |
|
417 // CBubbleOutlookTwoLined::DrawCall2Bitmaps |
|
418 // --------------------------------------------------------------------------- |
|
419 // |
|
420 void CBubbleOutlookOneLined::DrawCall2Bitmaps( CBitmapContext& aGc ) const |
|
421 { |
|
422 if ( iBubble->Bitmap() ) |
|
423 { |
|
424 BubbleUtils::DrawMaskedImage( aGc , iBubble ); |
|
425 } |
|
426 else |
|
427 { |
|
428 // Draw bubble frame |
|
429 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
430 if ( !AknsDrawUtils::DrawFrame( skin, |
|
431 (CWindowGc&) aGc, |
|
432 iOuterRect, |
|
433 iInnerRect, |
|
434 iFrameId, |
|
435 KAknsIIDDefault ) ) |
|
436 { |
|
437 BubbleUtils::DrawBackgroundRect( aGc, Rect() ); |
|
438 } |
|
439 } |
|
440 } |
|
441 |
|
442 // End of File |