29 #include "tphonecmdparamstring.h" |
29 #include "tphonecmdparamstring.h" |
30 #include "phonerssbase.h" |
30 #include "phonerssbase.h" |
31 #include "cphonemediatorfactory.h" |
31 #include "cphonemediatorfactory.h" |
32 #include "cphonemediatorsender.h" |
32 #include "cphonemediatorsender.h" |
33 #include "phoneviewcommanddefinitions.h" |
33 #include "phoneviewcommanddefinitions.h" |
|
34 #include "qtphonelog.h" |
34 |
35 |
35 #include <bubblemanagerif.h> |
36 #include <bubblemanagerif.h> |
36 #include <pevirtualengine.h> |
37 #include <pevirtualengine.h> |
37 #include <mpeengineinfo.h> |
38 #include <mpeengineinfo.h> |
38 |
39 |
39 |
40 |
40 //CONSTANTS |
41 //CONSTANTS |
41 |
42 |
42 |
43 |
43 inline Qt::TextElideMode clipToElide( |
44 inline Qt::TextElideMode clipToElide( |
44 TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection clip) |
45 PhoneCallHeaderUtil::ClippingDirection clip) |
45 { |
46 { |
46 return clip == TPhoneCmdParamCallHeaderData::ELeft ? |
47 return clip == PhoneCallHeaderUtil::ELeft ? |
47 Qt::ElideLeft : Qt::ElideRight; |
48 Qt::ElideLeft : Qt::ElideRight; |
48 } |
49 } |
49 |
50 |
50 PhoneCallHeaderManager::PhoneCallHeaderManager(PhoneBubbleWrapper &bubbleWrapper, |
51 PhoneCallHeaderManager::PhoneCallHeaderManager(PhoneBubbleWrapper &bubbleWrapper, |
51 PhoneUIQtViewIF &view, QObject *parent) : |
52 PhoneUIQtViewIF &view, QObject *parent) : |
71 } |
72 } |
72 |
73 |
73 void PhoneCallHeaderManager::createCallHeader( |
74 void PhoneCallHeaderManager::createCallHeader( |
74 int callId) |
75 int callId) |
75 { |
76 { |
76 TPhoneCmdParamCallHeaderData data; |
77 PHONE_TRACE |
77 |
|
78 if (isIncoming(callId)) { |
|
79 callHeaderUtil()->SetIncomingCallHeaderParams( |
|
80 callId, |
|
81 isWaitingCall(callId), |
|
82 isVideoCall(callId), |
|
83 &data ); |
|
84 } else { |
|
85 callHeaderUtil()->SetOutgoingCallHeaderParams( |
|
86 callId, |
|
87 &data); |
|
88 } |
|
89 |
|
90 m_bubbleWrapper.bubbleManager().startChanges (); |
78 m_bubbleWrapper.bubbleManager().startChanges (); |
91 |
79 |
92 if (m_bubbleWrapper.bubbleManager().isConferenceExpanded()) |
80 if (m_bubbleWrapper.bubbleManager().isConferenceExpanded()) |
93 { |
81 { |
94 m_bubbleWrapper.bubbleManager().setExpandedConferenceCallHeader(false); |
82 m_bubbleWrapper.bubbleManager().setExpandedConferenceCallHeader(false); |
95 } |
83 } |
96 |
84 |
97 int bubble = m_bubbleWrapper.createCallHeader(callId); |
85 int bubble = m_bubbleWrapper.createCallHeader(callId); |
98 m_bubbleWrapper.setState(callId, bubble, data.CallState ()); |
86 |
99 m_bubbleWrapper.setCli(bubble, data.CLIText(), clipToElide(data.CLITextClippingDirection())); |
87 setCommonCallHeaderData(callId, bubble); |
100 m_bubbleWrapper.setServiceId(callId, data.ServiceId()); |
88 |
101 m_bubbleWrapper.setSecondaryCli(bubble, data.CNAPText (), clipToElide(data.CNAPTextClippingDirection())); |
89 const TDesC& callerImage(callHeaderUtil()->CallerImage(callId)); |
102 m_bubbleWrapper.setLabel(bubble, data.LabelText ()); |
90 if (callerImage.Length()) { |
103 m_bubbleWrapper.setCallType(bubble, data.CallType ()); |
|
104 m_bubbleWrapper.setDivert(bubble, data.Diverted ()); |
|
105 m_bubbleWrapper.setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering()); |
|
106 |
|
107 if (data.Picture().Length()) { |
|
108 QString imagePath = |
91 QString imagePath = |
109 QString::fromUtf16(data.Picture().Ptr(),data.Picture().Length()); |
92 QString::fromUtf16(callerImage.Ptr(), callerImage.Length()); |
110 m_bubbleWrapper.bubbleManager().setCallObjectImage(bubble,imagePath); |
93 m_bubbleWrapper.bubbleManager().setCallObjectImage(bubble,imagePath); |
111 } else { |
94 } else { |
112 m_bubbleWrapper.bubbleManager().setCallObjectFromTheme(bubble); |
95 m_bubbleWrapper.bubbleManager().setCallObjectFromTheme(bubble); |
113 } |
96 } |
114 m_bubbleWrapper.bubbleManager().endChanges (); |
97 m_bubbleWrapper.bubbleManager().endChanges (); |
115 |
98 |
116 CPhoneMediatorFactory::Instance()->Sender()->SendEvent(EPhoneViewCreateCallHeader, callId, data); |
99 sendVideoCallData(callId); |
117 } |
100 } |
118 |
101 |
119 void PhoneCallHeaderManager::createEmergencyCallHeader(int callId) |
102 void PhoneCallHeaderManager::createEmergencyCallHeader(int callId) |
120 { |
103 { |
121 m_bubbleWrapper.bubbleManager().startChanges (); |
104 m_bubbleWrapper.bubbleManager().startChanges (); |
122 int bubble = m_bubbleWrapper.createCallHeader (callId); |
105 int bubble = m_bubbleWrapper.createCallHeader (callId); |
123 m_bubbleWrapper.setLabel(bubble, callHeaderUtil()->AttemptingEmergencyText()); |
106 m_bubbleWrapper.setLabel(bubble, callHeaderUtil()->AttemptingEmergencyText()); |
124 m_bubbleWrapper.setCli (bubble, callHeaderUtil()->EmergencyHeaderText(), Qt::ElideRight); |
107 m_bubbleWrapper.setCli (bubble, callHeaderUtil()->EmergencyHeaderText(), Qt::ElideRight); |
125 m_bubbleWrapper.setState(callId, bubble, EPEStateDialing); |
108 m_bubbleWrapper.setState(callId, bubble, EPEStateDialing); |
126 m_bubbleWrapper.setCiphering(bubble, m_engineInfo->SecureSpecified(), m_engineInfo->ServiceId(callId)); |
109 m_bubbleWrapper.setCallType(bubble, callHeaderUtil()->CallType(callId)); |
|
110 m_bubbleWrapper.setCiphering(bubble, callHeaderUtil()->SecureSpecified(), callHeaderUtil()->Ciphering(callId)); |
|
111 m_bubbleWrapper.bubbleManager().setCallFlag(bubble, BubbleManagerIF::EmergencyCall, true); |
|
112 m_bubbleWrapper.bubbleManager().setCallObjectFromTheme(bubble); |
127 m_bubbleWrapper.bubbleManager().endChanges (); |
113 m_bubbleWrapper.bubbleManager().endChanges (); |
128 |
114 |
129 } |
115 } |
130 |
116 |
131 void PhoneCallHeaderManager::removeCallHeader(int callId) |
117 void PhoneCallHeaderManager::removeCallHeader(int callId) |
138 m_bubbleWrapper.removeCallHeader(callId); |
124 m_bubbleWrapper.removeCallHeader(callId); |
139 } |
125 } |
140 m_bubbleWrapper.bubbleManager().endChanges(); |
126 m_bubbleWrapper.bubbleManager().endChanges(); |
141 } |
127 } |
142 |
128 |
143 void PhoneCallHeaderManager::updateCallHeaderState(int callId) |
129 void PhoneCallHeaderManager::updateCallHeader(int callId) |
144 { |
130 { |
145 |
|
146 int bubble = m_bubbleWrapper.bubbleId(callId); |
131 int bubble = m_bubbleWrapper.bubbleId(callId); |
147 if ( -1 != bubble ) { |
132 if ( -1 != bubble ) { |
148 m_bubbleWrapper.bubbleManager ().startChanges (); |
133 m_bubbleWrapper.bubbleManager ().startChanges (); |
149 m_bubbleWrapper.setState(callId, bubble, callHeaderUtil()->CallState(callId)); |
134 setCommonCallHeaderData(callId, bubble); |
150 m_bubbleWrapper.setLabel(bubble, callHeaderUtil()->LabelText(callId)); |
|
151 m_bubbleWrapper.setDivert(bubble, m_engineInfo->IncomingCallForwarded(callId)); |
|
152 m_bubbleWrapper.bubbleManager().endChanges (); |
135 m_bubbleWrapper.bubbleManager().endChanges (); |
153 } |
136 } |
154 } |
137 } |
155 |
138 |
156 void PhoneCallHeaderManager::updateCallHeaderRemoteInfo(int callId) |
|
157 { |
|
158 |
|
159 TPhoneCmdParamCallHeaderData data; |
|
160 |
|
161 int bubble = m_bubbleWrapper.bubbleId(callId); |
|
162 if ( -1 != bubble ) { |
|
163 callHeaderUtil()->UpdateCallHeaderInfo( |
|
164 callId, |
|
165 isWaitingCall(callId), |
|
166 isVideoCall(callId), |
|
167 &data ); |
|
168 |
|
169 m_bubbleWrapper.bubbleManager().startChanges(); |
|
170 m_bubbleWrapper.setCli(bubble, data.CLIText(), |
|
171 clipToElide(data.CLITextClippingDirection())); |
|
172 m_bubbleWrapper.setSecondaryCli(bubble, data.CNAPText (), |
|
173 clipToElide(data.CNAPTextClippingDirection())); |
|
174 m_bubbleWrapper.setDivert(bubble, m_engineInfo->IncomingCallForwarded(callId)); |
|
175 m_bubbleWrapper.bubbleManager().endChanges (); |
|
176 } |
|
177 |
|
178 } |
|
179 |
|
180 void PhoneCallHeaderManager::updateCallHeaderRemoteInfoAndLabel (int callId) |
|
181 { |
|
182 TPhoneCmdParamCallHeaderData data; |
|
183 |
|
184 int bubble = m_bubbleWrapper.bubbleId(callId); |
|
185 if ( -1 != bubble ) { |
|
186 callHeaderUtil()->UpdateCallHeaderInfo( |
|
187 callId, |
|
188 isWaitingCall(callId), |
|
189 isVideoCall(callId), |
|
190 &data ); |
|
191 |
|
192 m_bubbleWrapper.bubbleManager().startChanges (); |
|
193 m_bubbleWrapper.setCli(bubble, data.CLIText (), |
|
194 clipToElide(data.CLITextClippingDirection())); |
|
195 m_bubbleWrapper.setSecondaryCli(bubble, data.CNAPText (), |
|
196 clipToElide(data.CNAPTextClippingDirection())); |
|
197 m_bubbleWrapper.setLabel(bubble, data.LabelText ()); |
|
198 m_bubbleWrapper.setDivert(bubble, data.Diverted ()); |
|
199 m_bubbleWrapper.bubbleManager().endChanges (); |
|
200 } |
|
201 } |
|
202 |
|
203 void PhoneCallHeaderManager::handleCipheringInfoChange(int callId) |
139 void PhoneCallHeaderManager::handleCipheringInfoChange(int callId) |
204 { |
140 { |
|
141 PHONE_TRACE |
205 if (callId == KPEConferenceCallID) { |
142 if (callId == KPEConferenceCallID) { |
206 bool secure(true); |
143 bool secure(true); |
207 for (int i=0; i<m_bubbleWrapper.conferenceCallList().count(); i++) { |
144 for (int i=0; i<m_bubbleWrapper.conferenceCallList().count(); i++) { |
208 if ( false == m_engineInfo->IsSecureCall(m_bubbleWrapper.conferenceCallList().at(i)) ) { |
145 if ( false == m_engineInfo->IsSecureCall(m_bubbleWrapper.conferenceCallList().at(i)) ) { |
209 secure = false; |
146 secure = false; |
231 |
168 |
232 |
169 |
233 void PhoneCallHeaderManager::createConferenceBubble(int callId) |
170 void PhoneCallHeaderManager::createConferenceBubble(int callId) |
234 { |
171 { |
235 m_bubbleWrapper.bubbleManager().startChanges(); |
172 m_bubbleWrapper.bubbleManager().startChanges(); |
236 TBuf<KPhoneCallHeaderLabelMaxLength> conferenceText( KNullDesC ); |
173 |
237 callHeaderUtil()->LoadResource(conferenceText, EPhoneCLIConferenceCall); |
174 PhoneCallHeaderUtil::ClippingDirection clipping; |
|
175 TBuf<KCntMaxTextFieldLength> cliText; |
|
176 callHeaderUtil()->GetCli(callId, cliText, clipping); |
238 int bubble = m_bubbleWrapper.createConferenceBubble( |
177 int bubble = m_bubbleWrapper.createConferenceBubble( |
239 callId, callHeaderUtil()->CallState(callId), callHeaderUtil()->LabelText(callId), conferenceText); |
178 callId, |
|
179 callHeaderUtil()->CallState(callId), |
|
180 callHeaderUtil()->LabelText(callId), |
|
181 cliText ); |
240 |
182 |
241 m_bubbleWrapper.setServiceId(callId, m_engineInfo->ServiceId(callId)); |
183 m_bubbleWrapper.setServiceId(callId, m_engineInfo->ServiceId(callId)); |
242 m_bubbleWrapper.setCiphering(bubble, m_engineInfo->SecureSpecified(), m_engineInfo->IsSecureCall(callId)); |
184 m_bubbleWrapper.setCiphering(bubble, m_engineInfo->SecureSpecified(), m_engineInfo->IsSecureCall(callId)); |
243 m_bubbleWrapper.bubbleManager().endChanges(); |
185 m_bubbleWrapper.bubbleManager().endChanges(); |
244 } |
186 } |
320 |
263 |
321 // --------------------------------------------------------------------------- |
264 // --------------------------------------------------------------------------- |
322 // PhoneCallHeaderUtil::IsVoiceCall |
265 // PhoneCallHeaderUtil::IsVoiceCall |
323 // --------------------------------------------------------------------------- |
266 // --------------------------------------------------------------------------- |
324 // |
267 // |
325 bool PhoneCallHeaderManager::isVoiceCall(int callId) const |
268 bool PhoneCallHeaderManager::isVoiceCall(int callId) |
326 { |
269 { |
327 if( callId < 0 ) |
270 return callHeaderUtil()->IsVoiceCall(callId); |
328 { |
271 } |
329 return ( m_engineInfo->CallTypeCommand() |
272 |
330 == EPECallTypeCSVoice || |
273 |
331 m_engineInfo->CallTypeCommand() |
274 |
332 == EPECallTypeVoIP ); |
275 void PhoneCallHeaderManager::setCommonCallHeaderData(int callId, int bubble) |
333 } |
|
334 |
|
335 return ( m_engineInfo->CallType( callId ) |
|
336 == EPECallTypeCSVoice || |
|
337 m_engineInfo->CallType( callId ) |
|
338 == EPECallTypeVoIP ); |
|
339 } |
|
340 |
|
341 |
|
342 // --------------------------------------------------------------------------- |
|
343 // PhoneCallHeaderUtil::IsVideoCall |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 bool PhoneCallHeaderManager::isVideoCall(int callId) const |
|
347 { |
276 { |
348 if( callId < 0 ) |
277 m_bubbleWrapper.setState(callId, bubble, |
349 { |
278 callHeaderUtil()->CallState(callId)); |
350 return ( m_engineInfo->CallTypeCommand() |
279 |
351 == EPECallTypeVideo ); |
280 PhoneCallHeaderUtil::ClippingDirection cliClip; |
352 } |
281 PhoneCallHeaderUtil::ClippingDirection secondaryCliClip; |
353 return ( m_engineInfo->CallType( callId ) |
282 TBuf<KCntMaxTextFieldLength> cliText; |
354 == EPECallTypeVideo ); |
283 TBuf<KCntMaxTextFieldLength> secondaryCliText; |
355 } |
284 |
356 |
285 callHeaderUtil()->GetCliTexts(callId, cliText, |
357 bool PhoneCallHeaderManager::isIncoming(int callId) const |
286 cliClip, secondaryCliText, secondaryCliClip ); |
|
287 |
|
288 m_bubbleWrapper.setCli(bubble, cliText, clipToElide(cliClip)); |
|
289 m_bubbleWrapper.setSecondaryCli(bubble, |
|
290 secondaryCliText, clipToElide(secondaryCliClip)); |
|
291 |
|
292 m_bubbleWrapper.setServiceId(callId, callHeaderUtil()->ServiceId(callId)); |
|
293 m_bubbleWrapper.setLabel(bubble, callHeaderUtil()->LabelText(callId)); |
|
294 m_bubbleWrapper.setCallType(bubble, callHeaderUtil()->CallType(callId)); |
|
295 |
|
296 m_bubbleWrapper.bubbleManager().setCallFlag( |
|
297 bubble, BubbleManagerIF::EmergencyCall, callId == KEmergencyCallId); |
|
298 |
|
299 m_bubbleWrapper.setDivert(bubble, |
|
300 callHeaderUtil()->IsCallForwarded(callId)); |
|
301 m_bubbleWrapper.setCiphering(bubble, callHeaderUtil()->SecureSpecified(), |
|
302 callHeaderUtil()->Ciphering(callId)); |
|
303 } |
|
304 |
|
305 void PhoneCallHeaderManager::sendVideoCallData(int callId) |
358 { |
306 { |
359 return callId >= 0 && |
307 TPhoneCmdParamCallHeaderData callHeaderParam; |
360 m_engineInfo->CallState( callId ) == EPEStateRinging; |
308 |
361 } |
309 PhoneCallHeaderUtil::ClippingDirection clipping; |
362 |
310 TBuf<KCntMaxTextFieldLength> cliText; |
363 bool PhoneCallHeaderManager::isWaitingCall(int callId) const |
311 callHeaderUtil()->GetCli(callId, cliText, clipping); |
364 { |
312 TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection clip = |
365 bool waiting( EFalse ); |
313 clipping == PhoneCallHeaderUtil::ERight ? |
366 if ( callId >= 0 && |
314 TPhoneCmdParamCallHeaderData::ERight : |
367 m_engineInfo->CallState( callId ) == EPEStateRinging ) |
315 TPhoneCmdParamCallHeaderData::ELeft; |
368 { |
316 |
369 if( m_bubbleWrapper.activeCallCount() > 0 ) |
317 callHeaderParam.SetCLIText(cliText, clip); |
370 { |
318 callHeaderParam.SetCallState(callHeaderUtil()->CallState(callId)); |
371 waiting = ETrue; |
319 callHeaderParam.SetCallType(callHeaderUtil()->CallType(callId)); |
372 } |
320 callHeaderParam.SetRemotePhoneNumber( |
373 } |
321 callHeaderUtil()->RemotePhoneNumber(callId)); |
374 return waiting; |
322 |
|
323 CPhoneMediatorFactory::Instance()->Sender()-> |
|
324 SendEvent(EPhoneViewCreateCallHeader, callId, callHeaderParam); |
375 } |
325 } |
376 |
326 |
377 PhoneCallHeaderUtil *PhoneCallHeaderManager::callHeaderUtil() |
327 PhoneCallHeaderUtil *PhoneCallHeaderManager::callHeaderUtil() |
378 { |
328 { |
379 if (!m_callHeaderUtil) { |
329 if (!m_callHeaderUtil) { |