74
|
1 |
/*!
|
|
2 |
* Copyright (c) 2009 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: Phone UI's symbian adapter for Qt view.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "phonecallheadermanager.h"
|
|
19 |
#include "phonecallheaderutil.h"
|
|
20 |
#include "phoneuiqtviewif.h"
|
|
21 |
#include "phonebubblewrapper.h"
|
|
22 |
#include "tphonecmdparaminteger.h"
|
|
23 |
#include "tphonecmdparamboolean.h"
|
|
24 |
#include "tphonecmdparamaudioavailability.h"
|
|
25 |
#include "tphonecmdparamaudiooutput.h"
|
|
26 |
#include "tphonecmdparamcallstatedata.h"
|
|
27 |
#include "tphonecmdparamcallheaderdata.h"
|
|
28 |
#include "tphonecmdparamemergencycallheaderdata.h"
|
|
29 |
#include "tphonecmdparamstring.h"
|
|
30 |
#include "phonerssbase.h"
|
|
31 |
#include "cphonemediatorfactory.h"
|
|
32 |
#include "cphonemediatorsender.h"
|
|
33 |
#include "phoneviewcommanddefinitions.h"
|
76
|
34 |
#include "qtphonelog.h"
|
74
|
35 |
|
|
36 |
#include <bubblemanagerif.h>
|
|
37 |
#include <pevirtualengine.h>
|
|
38 |
#include <mpeengineinfo.h>
|
|
39 |
|
|
40 |
|
|
41 |
//CONSTANTS
|
|
42 |
|
|
43 |
|
|
44 |
inline Qt::TextElideMode clipToElide(
|
76
|
45 |
PhoneCallHeaderUtil::ClippingDirection clip)
|
74
|
46 |
{
|
76
|
47 |
return clip == PhoneCallHeaderUtil::ELeft ?
|
74
|
48 |
Qt::ElideLeft : Qt::ElideRight;
|
|
49 |
}
|
|
50 |
|
|
51 |
PhoneCallHeaderManager::PhoneCallHeaderManager(PhoneBubbleWrapper &bubbleWrapper,
|
|
52 |
PhoneUIQtViewIF &view, QObject *parent) :
|
|
53 |
QObject(parent),
|
|
54 |
m_bubbleWrapper(bubbleWrapper),
|
|
55 |
m_view(view),
|
|
56 |
m_callHeaderUtil(0),
|
|
57 |
m_resourceAdapter(0)
|
|
58 |
{
|
|
59 |
|
|
60 |
}
|
|
61 |
|
|
62 |
PhoneCallHeaderManager::~PhoneCallHeaderManager ()
|
|
63 |
{
|
|
64 |
delete m_callHeaderUtil;
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
void PhoneCallHeaderManager::setEngineInfo(MPEEngineInfo* engineInfo)
|
|
70 |
{
|
|
71 |
m_engineInfo = engineInfo;
|
|
72 |
}
|
|
73 |
|
|
74 |
void PhoneCallHeaderManager::createCallHeader(
|
|
75 |
int callId)
|
|
76 |
{
|
76
|
77 |
PHONE_TRACE
|
74
|
78 |
m_bubbleWrapper.bubbleManager().startChanges ();
|
|
79 |
|
|
80 |
if (m_bubbleWrapper.bubbleManager().isConferenceExpanded())
|
|
81 |
{
|
|
82 |
m_bubbleWrapper.bubbleManager().setExpandedConferenceCallHeader(false);
|
|
83 |
}
|
|
84 |
|
|
85 |
int bubble = m_bubbleWrapper.createCallHeader(callId);
|
76
|
86 |
|
|
87 |
setCommonCallHeaderData(callId, bubble);
|
74
|
88 |
|
76
|
89 |
const TDesC& callerImage(callHeaderUtil()->CallerImage(callId));
|
|
90 |
if (callerImage.Length()) {
|
74
|
91 |
QString imagePath =
|
76
|
92 |
QString::fromUtf16(callerImage.Ptr(), callerImage.Length());
|
74
|
93 |
m_bubbleWrapper.bubbleManager().setCallObjectImage(bubble,imagePath);
|
|
94 |
} else {
|
|
95 |
m_bubbleWrapper.bubbleManager().setCallObjectFromTheme(bubble);
|
|
96 |
}
|
|
97 |
m_bubbleWrapper.bubbleManager().endChanges ();
|
|
98 |
|
76
|
99 |
sendVideoCallData(callId);
|
74
|
100 |
}
|
|
101 |
|
|
102 |
void PhoneCallHeaderManager::createEmergencyCallHeader(int callId)
|
|
103 |
{
|
|
104 |
m_bubbleWrapper.bubbleManager().startChanges ();
|
|
105 |
int bubble = m_bubbleWrapper.createCallHeader (callId);
|
|
106 |
m_bubbleWrapper.setLabel(bubble, callHeaderUtil()->AttemptingEmergencyText());
|
|
107 |
m_bubbleWrapper.setCli (bubble, callHeaderUtil()->EmergencyHeaderText(), Qt::ElideRight);
|
|
108 |
m_bubbleWrapper.setState(callId, bubble, EPEStateDialing);
|
76
|
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);
|
74
|
113 |
m_bubbleWrapper.bubbleManager().endChanges ();
|
|
114 |
|
|
115 |
}
|
|
116 |
|
|
117 |
void PhoneCallHeaderManager::removeCallHeader(int callId)
|
|
118 |
{
|
|
119 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
120 |
int bubble = m_bubbleWrapper.bubbles().value(callId, -1);
|
|
121 |
if ( bubble != -1 ) {
|
|
122 |
m_view.clearBubbleCommands(bubble);
|
|
123 |
m_view.removeExpandAction(bubble);
|
|
124 |
m_bubbleWrapper.removeCallHeader(callId);
|
|
125 |
}
|
|
126 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
127 |
}
|
|
128 |
|
76
|
129 |
void PhoneCallHeaderManager::updateCallHeader(int callId)
|
74
|
130 |
{
|
|
131 |
int bubble = m_bubbleWrapper.bubbleId(callId);
|
|
132 |
if ( -1 != bubble ) {
|
|
133 |
m_bubbleWrapper.bubbleManager ().startChanges ();
|
76
|
134 |
setCommonCallHeaderData(callId, bubble);
|
74
|
135 |
m_bubbleWrapper.bubbleManager().endChanges ();
|
|
136 |
}
|
|
137 |
}
|
|
138 |
|
|
139 |
void PhoneCallHeaderManager::handleCipheringInfoChange(int callId)
|
|
140 |
{
|
76
|
141 |
PHONE_TRACE
|
74
|
142 |
if (callId == KPEConferenceCallID) {
|
|
143 |
bool secure(true);
|
|
144 |
for (int i=0; i<m_bubbleWrapper.conferenceCallList().count(); i++) {
|
|
145 |
if ( false == m_engineInfo->IsSecureCall(m_bubbleWrapper.conferenceCallList().at(i)) ) {
|
|
146 |
secure = false;
|
|
147 |
break;
|
|
148 |
}
|
|
149 |
}
|
|
150 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
151 |
m_bubbleWrapper.setCiphering(m_bubbleWrapper.bubbleId(callId),
|
|
152 |
m_engineInfo->SecureSpecified(),
|
|
153 |
secure);
|
|
154 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
155 |
} else {
|
|
156 |
int bubble = m_bubbleWrapper.bubbleId(callId);
|
|
157 |
if ( -1 != bubble ) {
|
|
158 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
159 |
m_bubbleWrapper.setCiphering(bubble,
|
|
160 |
m_engineInfo->SecureSpecified(),
|
|
161 |
m_engineInfo->IsSecureCall(callId));
|
|
162 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
163 |
}
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
170 |
void PhoneCallHeaderManager::createConferenceBubble(int callId)
|
|
171 |
{
|
|
172 |
m_bubbleWrapper.bubbleManager().startChanges();
|
76
|
173 |
|
|
174 |
PhoneCallHeaderUtil::ClippingDirection clipping;
|
|
175 |
TBuf<KCntMaxTextFieldLength> cliText;
|
|
176 |
callHeaderUtil()->GetCli(callId, cliText, clipping);
|
74
|
177 |
int bubble = m_bubbleWrapper.createConferenceBubble(
|
76
|
178 |
callId,
|
|
179 |
callHeaderUtil()->CallState(callId),
|
|
180 |
callHeaderUtil()->LabelText(callId),
|
|
181 |
cliText );
|
74
|
182 |
|
|
183 |
m_bubbleWrapper.setServiceId(callId, m_engineInfo->ServiceId(callId));
|
|
184 |
m_bubbleWrapper.setCiphering(bubble, m_engineInfo->SecureSpecified(), m_engineInfo->IsSecureCall(callId));
|
|
185 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
186 |
}
|
|
187 |
|
|
188 |
|
|
189 |
void PhoneCallHeaderManager::removeConferenceBubble()
|
|
190 |
{
|
|
191 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
192 |
m_view.removeExpandAction(m_bubbleWrapper.bubbleId(KConferenceCallId));
|
|
193 |
m_view.clearParticipantListActions();
|
|
194 |
m_bubbleWrapper.removeConferenceBubble();
|
|
195 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
196 |
}
|
|
197 |
|
|
198 |
void PhoneCallHeaderManager::removeCallFromConference(int callId)
|
|
199 |
{
|
|
200 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
201 |
m_bubbleWrapper.removeCallFromConference(callId);
|
|
202 |
int bubbleId = m_bubbleWrapper.bubbles().value(callId);
|
|
203 |
m_view.clearBubbleCommands(bubbleId);
|
|
204 |
m_view.removeExpandAction(bubbleId);
|
|
205 |
m_bubbleWrapper.removeCallHeader(callId);
|
|
206 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
207 |
}
|
|
208 |
|
|
209 |
|
|
210 |
void PhoneCallHeaderManager::setPrivateFromConference(int callId)
|
|
211 |
{
|
|
212 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
213 |
m_bubbleWrapper.bubbleManager().setExpandedConferenceCallHeader(false);
|
|
214 |
m_bubbleWrapper.removeCallFromConference(callId);
|
|
215 |
m_view.clearBubbleCommands(m_bubbleWrapper.bubbles().value(callId));
|
|
216 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
217 |
}
|
|
218 |
|
|
219 |
|
|
220 |
void PhoneCallHeaderManager::setExpandedConferenceCallHeader()
|
|
221 |
{
|
|
222 |
int callId = -1;
|
|
223 |
|
|
224 |
if ( 1==m_bubbleWrapper.bubbles().keys().size()
|
|
225 |
|| (1<m_bubbleWrapper.bubbles().keys().size()
|
|
226 |
&& false == m_bubbleWrapper.callStates().values().contains(EPEStateRinging)
|
|
227 |
&& false == m_bubbleWrapper.callStates().values().contains(EPEStateDialing)
|
|
228 |
&& false == m_bubbleWrapper.callStates().values().contains(EPEStateConnecting)
|
|
229 |
&& false == m_bubbleWrapper.callStates().values().contains(EPEStateHeldConference))) {
|
|
230 |
|
|
231 |
int bubbleId = m_bubbleWrapper.bubbleManager().expandedBubble();
|
|
232 |
callId = m_bubbleWrapper.callIdByBubbleId(bubbleId);
|
|
233 |
}
|
|
234 |
|
|
235 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
236 |
m_bubbleWrapper.bubbleManager().setExpandedConferenceCallHeader(
|
|
237 |
(KConferenceCallId == callId));
|
|
238 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
239 |
}
|
|
240 |
|
|
241 |
|
|
242 |
void PhoneCallHeaderManager::removeAllCallHeaders()
|
|
243 |
{
|
76
|
244 |
PHONE_TRACE
|
74
|
245 |
if (m_bubbleWrapper.conferenceCallList().size()) {
|
|
246 |
removeConferenceBubble();
|
|
247 |
}
|
|
248 |
|
|
249 |
QList<int> callIds = m_bubbleWrapper.bubbles().keys();
|
|
250 |
|
|
251 |
for (int i=0; i<callIds.size(); ++i) {
|
|
252 |
int callId = callIds.at(i);
|
|
253 |
if (KEmergencyCallId != callId) {
|
|
254 |
m_bubbleWrapper.bubbleManager().startChanges();
|
|
255 |
int bubble = m_bubbleWrapper.bubbles().value(callId);
|
|
256 |
m_view.clearBubbleCommands(bubble);
|
|
257 |
m_view.removeExpandAction(bubble);
|
|
258 |
m_bubbleWrapper.removeCallHeader (callId);
|
|
259 |
m_bubbleWrapper.bubbleManager().endChanges();
|
|
260 |
}
|
|
261 |
}
|
|
262 |
}
|
|
263 |
|
|
264 |
// ---------------------------------------------------------------------------
|
|
265 |
// PhoneCallHeaderUtil::IsVoiceCall
|
|
266 |
// ---------------------------------------------------------------------------
|
|
267 |
//
|
76
|
268 |
bool PhoneCallHeaderManager::isVoiceCall(int callId)
|
74
|
269 |
{
|
76
|
270 |
return callHeaderUtil()->IsVoiceCall(callId);
|
74
|
271 |
}
|
|
272 |
|
|
273 |
|
76
|
274 |
|
|
275 |
void PhoneCallHeaderManager::setCommonCallHeaderData(int callId, int bubble)
|
74
|
276 |
{
|
76
|
277 |
m_bubbleWrapper.setState(callId, bubble,
|
|
278 |
callHeaderUtil()->CallState(callId));
|
|
279 |
|
|
280 |
PhoneCallHeaderUtil::ClippingDirection cliClip;
|
|
281 |
PhoneCallHeaderUtil::ClippingDirection secondaryCliClip;
|
|
282 |
TBuf<KCntMaxTextFieldLength> cliText;
|
|
283 |
TBuf<KCntMaxTextFieldLength> secondaryCliText;
|
|
284 |
|
|
285 |
callHeaderUtil()->GetCliTexts(callId, cliText,
|
|
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));
|
74
|
303 |
}
|
|
304 |
|
76
|
305 |
void PhoneCallHeaderManager::sendVideoCallData(int callId)
|
74
|
306 |
{
|
76
|
307 |
TPhoneCmdParamCallHeaderData callHeaderParam;
|
|
308 |
|
|
309 |
PhoneCallHeaderUtil::ClippingDirection clipping;
|
|
310 |
TBuf<KCntMaxTextFieldLength> cliText;
|
|
311 |
callHeaderUtil()->GetCli(callId, cliText, clipping);
|
|
312 |
TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection clip =
|
|
313 |
clipping == PhoneCallHeaderUtil::ERight ?
|
|
314 |
TPhoneCmdParamCallHeaderData::ERight :
|
|
315 |
TPhoneCmdParamCallHeaderData::ELeft;
|
|
316 |
|
|
317 |
callHeaderParam.SetCLIText(cliText, clip);
|
|
318 |
callHeaderParam.SetCallState(callHeaderUtil()->CallState(callId));
|
|
319 |
callHeaderParam.SetCallType(callHeaderUtil()->CallType(callId));
|
|
320 |
callHeaderParam.SetRemotePhoneNumber(
|
|
321 |
callHeaderUtil()->RemotePhoneNumber(callId));
|
|
322 |
|
|
323 |
CPhoneMediatorFactory::Instance()->Sender()->
|
|
324 |
SendEvent(EPhoneViewCreateCallHeader, callId, callHeaderParam);
|
74
|
325 |
}
|
|
326 |
|
|
327 |
PhoneCallHeaderUtil *PhoneCallHeaderManager::callHeaderUtil()
|
|
328 |
{
|
|
329 |
if (!m_callHeaderUtil) {
|
|
330 |
m_callHeaderUtil = new PhoneCallHeaderUtil(*m_engineInfo);
|
|
331 |
}
|
|
332 |
|
|
333 |
return m_callHeaderUtil;
|
|
334 |
}
|
|
335 |
|
|
336 |
|