|
1 /* |
|
2 * Copyright (c) 2002 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 Top Right |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleManager.h" //for enumerations |
|
21 #include "BMBubbleOutlookTopRight.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 |
|
29 #include <eiklabel.h> |
|
30 #include <eikimage.h> |
|
31 #include <eikenv.h> |
|
32 #include <AknsUtils.h> |
|
33 #include <AknsDrawUtils.h> |
|
34 |
|
35 // ========================= MEMBER FUNCTIONS ================================ |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CBubbleOutlookTopRight::CBubbleOutlookTopRight |
|
40 // |
|
41 // |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 CBubbleOutlookTopRight::CBubbleOutlookTopRight( CBubbleManager& aBubbleManager ) |
|
45 : CBubbleOutlookOneLined( aBubbleManager ) |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CBubbleOutlookTopRight::ConstructL |
|
52 // |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CBubbleOutlookTopRight::ConstructL() |
|
56 { |
|
57 CBubbleOutlookOneLined::ConstructL( ); |
|
58 } |
|
59 |
|
60 // Destructor |
|
61 CBubbleOutlookTopRight::~CBubbleOutlookTopRight() |
|
62 { |
|
63 |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CBubbleOutlookTopRight::ReadBubbleHeader |
|
68 // |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CBubbleOutlookTopRight::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
73 { |
|
74 iHeader = &aHeader; |
|
75 |
|
76 iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue ); |
|
77 |
|
78 if ( !iCallObjectDisplay ) |
|
79 { |
|
80 GetCall1BubbleBitmaps(); |
|
81 } |
|
82 |
|
83 CBubbleOutlookOneLined::ReadBubbleHeader( aHeader ); |
|
84 } |
|
85 |
|
86 |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CBubbleOutlookTopRight::SizeChanged |
|
90 // called by framwork when the view size is changed |
|
91 // |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CBubbleOutlookTopRight::SizeChanged() |
|
95 { |
|
96 if( !iHeader ) |
|
97 { |
|
98 return; |
|
99 } |
|
100 |
|
101 AknsUtils::RegisterControlPosition( this ); |
|
102 |
|
103 if ( !iCallObjectDisplay ) |
|
104 { |
|
105 DoCall1Layout(); |
|
106 } |
|
107 else |
|
108 { |
|
109 TRAPD( err, DoCall2LayoutL() ); |
|
110 if ( err ) |
|
111 { |
|
112 iBubble->SetPicture( NULL, NULL ); |
|
113 |
|
114 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
115 AknsDrawUtils::PrepareFrame( skin, |
|
116 iOuterRect, |
|
117 iInnerRect, |
|
118 iFrameId, |
|
119 KAknsIIDDefault ); |
|
120 } |
|
121 } |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CBubbleOutlookTopRight::DoCall1Layout |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CBubbleOutlookTopRight::DoCall1Layout() |
|
129 { |
|
130 // Deprecated |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CBubbleOutlookTopRight::DoCall2Layout |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CBubbleOutlookTopRight::DoCall2LayoutL() |
|
138 { |
|
139 iBubble->SetPictureOwnedExternally( EFalse ); |
|
140 iBubble->SetPicture( NULL, NULL ); |
|
141 |
|
142 const TRect rect = Rect(); |
|
143 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
144 switch ( callState ) |
|
145 { |
|
146 case CBubbleManager::EWaiting: |
|
147 case CBubbleManager::EIncoming: |
|
148 case CBubbleManager::EOutgoing: |
|
149 case CBubbleManager::EAlerting: |
|
150 case CBubbleManager::EAlertToDisconnected: |
|
151 { |
|
152 /////////////////////////////////////////////////////////////////// |
|
153 // Outgoing call layout. Two calls and number entry. |
|
154 /////////////////////////////////////////////////////////////////// |
|
155 |
|
156 TAknLayoutRect bubbleRect; |
|
157 bubbleRect.LayoutRect( |
|
158 rect, |
|
159 BubbleLayout2::popup_call2_audio_out_background(1) ); |
|
160 |
|
161 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
162 TRect outerRect; |
|
163 TRect innerRect; |
|
164 BubbleLayout2::RectFrameInnerOuterRects( frameRect, |
|
165 outerRect, |
|
166 innerRect); |
|
167 |
|
168 iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ? |
|
169 KAknsIIDQsnFrCall2RectDisconn : |
|
170 KAknsIIDQsnFrCall2Rect; |
|
171 |
|
172 iOuterRect = outerRect; |
|
173 iOuterRect.Move( Rect().iTl ); |
|
174 iInnerRect = innerRect; |
|
175 iInnerRect.Move( Rect().iTl ); |
|
176 |
|
177 // Call icon |
|
178 BubbleUtils::LayoutCustomElement( |
|
179 iSmallCallIndication, |
|
180 rect, |
|
181 BubbleLayout2::popup_call2_audio_out_call_waiting_icon(2) ); |
|
182 |
|
183 // Ciphering off |
|
184 BubbleUtils::LayoutControl( |
|
185 iCyphOffImage, |
|
186 rect, |
|
187 BubbleLayout2::popup_call2_audio_out_ciphering_icon(2) ); |
|
188 |
|
189 // Call type pane |
|
190 BubbleUtils::LayoutCallTypeIndicators( |
|
191 rect, |
|
192 BubbleLayout2::popup_call2_audio_second_call_type_icon(0), |
|
193 iTypeIndication1, // Data/Fax |
|
194 iTypeIndication2 ); // ALS line 2 |
|
195 |
|
196 // Text |
|
197 BubbleUtils::LayoutLabel( |
|
198 iTextLine1, |
|
199 rect, |
|
200 BubbleLayout2::popup_call2_audio_out_call_text_1(2) ); |
|
201 |
|
202 // Create call object bitmaps |
|
203 iBubble->SetRect( bubbleRect.Rect() ); |
|
204 |
|
205 BubbleUtils::PrepareBubbleImageL( |
|
206 iFrameId, |
|
207 outerRect, |
|
208 innerRect, |
|
209 iBubble ); |
|
210 |
|
211 break; |
|
212 } |
|
213 case CBubbleManager::EDisconnected: |
|
214 case CBubbleManager::EActive: |
|
215 case CBubbleManager::EOnHold: |
|
216 { |
|
217 /////////////////////////////////////////////////////////////////// |
|
218 // Second call layout. Two calls and number entry. |
|
219 /////////////////////////////////////////////////////////////////// |
|
220 |
|
221 // Create bubble image |
|
222 TAknLayoutRect bubbleRect; |
|
223 bubbleRect.LayoutRect( |
|
224 rect, |
|
225 BubbleLayout2::popup_call2_audio_second_call_background(0) ); |
|
226 |
|
227 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
228 TRect outerRect; |
|
229 TRect innerRect; |
|
230 BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, |
|
231 outerRect, |
|
232 innerRect); |
|
233 |
|
234 if ( callState == CBubbleManager::EOnHold ) |
|
235 { |
|
236 iFrameId = KAknsIIDQsnFrCall2Bubble; |
|
237 } |
|
238 else if ( callState == CBubbleManager::EDisconnected ) |
|
239 { |
|
240 iFrameId = KAknsIIDQsnFrCall2BubbleSecondDisconn; |
|
241 } |
|
242 else |
|
243 { |
|
244 iFrameId = KAknsIIDQsnFrCall2BubbleSecond; |
|
245 } |
|
246 |
|
247 iOuterRect = outerRect; |
|
248 iOuterRect.Move( Rect().iTl ); |
|
249 iInnerRect = innerRect; |
|
250 iInnerRect.Move( Rect().iTl ); |
|
251 |
|
252 // Call icon |
|
253 BubbleUtils::LayoutCustomElement( |
|
254 iSmallCallIndication, |
|
255 rect, |
|
256 BubbleLayout2::popup_call2_audio_second_call_status_icon(11) ); |
|
257 |
|
258 // Ciphering off |
|
259 BubbleUtils::LayoutControl( |
|
260 iCyphOffImage, |
|
261 rect, |
|
262 BubbleLayout2::popup_call2_audio_second_call_cyphering_icon(11) ); |
|
263 |
|
264 |
|
265 // Call type pane |
|
266 BubbleUtils::LayoutCallTypeIndicators( |
|
267 rect, |
|
268 BubbleLayout2::popup_call2_audio_second_call_type_icon(11), |
|
269 iTypeIndication1, // Data/Fax |
|
270 iTypeIndication2 ); // ALS line 2 |
|
271 |
|
272 // Text line 1 |
|
273 BubbleUtils::LayoutLabel( |
|
274 iTextLine1, |
|
275 rect, |
|
276 BubbleLayout2::popup_call2_audio_second_call_cli_text(13) ); |
|
277 |
|
278 // Create bubble |
|
279 iBubble->SetRect( bubbleRect.Rect() ); |
|
280 |
|
281 BubbleUtils::PrepareBubbleImageL( |
|
282 iFrameId, |
|
283 outerRect, |
|
284 innerRect, |
|
285 iBubble ); |
|
286 |
|
287 break; |
|
288 } |
|
289 case CBubbleManager::ENone: |
|
290 default: |
|
291 break; |
|
292 } |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CBubbleOutlookTopRight::GetCall1BubbleBitmaps |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 void CBubbleOutlookTopRight::GetCall1BubbleBitmaps() |
|
300 { |
|
301 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
302 |
|
303 TInt bubblePicture = KErrNotFound; |
|
304 TInt bubblePictureMask = KErrNotFound; |
|
305 |
|
306 // set call indications and bubble |
|
307 switch ( callState ) |
|
308 { |
|
309 case CBubbleManager::EAlertToDisconnected: |
|
310 bubblePicture = EQgn_graf_call_rec_small_right_disconn; |
|
311 bubblePictureMask = EQgn_graf_call_rec_small_right_disconn_mask; |
|
312 break; |
|
313 case CBubbleManager::EOutgoing: |
|
314 case CBubbleManager::EWaiting: |
|
315 case CBubbleManager::EAlerting: |
|
316 bubblePicture = EQgn_graf_call_rec_small_right; |
|
317 bubblePictureMask = EQgn_graf_call_rec_small_right_mask; |
|
318 break; |
|
319 case CBubbleManager::EActive: |
|
320 bubblePicture = EQgn_graf_call_second_three_active; |
|
321 bubblePictureMask = EQgn_graf_call_second_three_active_mask; |
|
322 break; |
|
323 case CBubbleManager::EOnHold: |
|
324 bubblePicture = EQgn_graf_call_second_three_held; |
|
325 bubblePictureMask = EQgn_graf_call_second_three_held_mask; |
|
326 break; |
|
327 case CBubbleManager::EDisconnected: |
|
328 bubblePicture = EQgn_graf_call_second_three_disconn; |
|
329 bubblePictureMask = EQgn_graf_call_second_three_disconn_mask; |
|
330 break; |
|
331 default: |
|
332 bubblePicture = KErrNotFound; |
|
333 bubblePictureMask = KErrNotFound; |
|
334 break; |
|
335 } |
|
336 |
|
337 if ( bubblePicture != KErrNotFound ) |
|
338 { |
|
339 if ( bubblePictureMask == KErrNotFound ) |
|
340 { |
|
341 iBubbleManager.ImageManager().SetBitmapToImage( |
|
342 iBubble, (TBMIcons) bubblePicture ); |
|
343 } |
|
344 else |
|
345 { |
|
346 iBubbleManager.ImageManager().SetBitmapToImage( |
|
347 iBubble, |
|
348 (TBMIcons) bubblePicture , |
|
349 (TBMIcons) bubblePictureMask); |
|
350 } |
|
351 } |
|
352 |
|
353 } |
|
354 |
|
355 // End of File |