author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:56:55 +0300 | |
branch | RCL_3 |
changeset 74 | 6b5524b4f673 |
parent 63 | f4a778e096c2 |
child 85 | 38bb213f60ba |
permissions | -rw-r--r-- |
63 | 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: Class for handling service logic. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <e32std.h> |
|
19 |
#include <s32mem.h> |
|
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
20 |
#include <spsettingsvoiputils.h> |
63 | 21 |
|
22 |
#include "ccacontactorserviceheaders.h" |
|
23 |
||
24 |
// ================= MEMBER FUNCTIONS ======================= |
|
25 |
// |
|
26 |
||
27 |
// -------------------------------------------------------------------------- |
|
28 |
// CCCAContactorServiceOperator::NewLC |
|
29 |
// -------------------------------------------------------------------------- |
|
30 |
// |
|
31 |
CCCAContactorServiceOperator* CCCAContactorServiceOperator::NewLC() |
|
32 |
{ |
|
33 |
CCCAContactorServiceOperator* self = new (ELeave) CCCAContactorServiceOperator(); |
|
34 |
CleanupStack::PushL(self); |
|
35 |
self->ConstructL(); |
|
36 |
return self; |
|
37 |
} |
|
38 |
||
39 |
// -------------------------------------------------------------------------- |
|
40 |
// CCCAContactorServiceOperator::NewL |
|
41 |
// -------------------------------------------------------------------------- |
|
42 |
// |
|
43 |
CCCAContactorServiceOperator* CCCAContactorServiceOperator::NewL() |
|
44 |
{ |
|
45 |
CCCAContactorServiceOperator* self = CCCAContactorServiceOperator::NewLC(); |
|
46 |
CleanupStack::Pop(self); |
|
47 |
return self; |
|
48 |
} |
|
49 |
||
50 |
// -------------------------------------------------------------------------- |
|
51 |
// CCCAContactorServiceOperator::~CCCAContactorServiceOperator |
|
52 |
// -------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
CCCAContactorServiceOperator::~CCCAContactorServiceOperator() |
|
55 |
{ |
|
56 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::~CCCAContactorServiceOperator")); |
|
57 |
||
58 |
delete iPopupHandler; |
|
59 |
} |
|
60 |
||
61 |
// -------------------------------------------------------------------------- |
|
62 |
// CCCAContactorServiceOperator::Execute |
|
63 |
// -------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
void CCCAContactorServiceOperator::Execute( |
|
66 |
const CCAContactorService::TCSParameter& aParameter) |
|
67 |
{ |
|
68 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::Execute")); |
|
69 |
||
70 |
iParameter = &aParameter; |
|
71 |
||
72 |
/** |
|
73 |
* LOGIC: |
|
74 |
* 1. Launch AIW popup |
|
75 |
* 2. Special cases: Find out serviceid for voip |
|
76 |
* 3. Launch communication service |
|
77 |
* |
|
78 |
* All actions are trapped here. |
|
79 |
*/ |
|
80 |
TDesC* result = NULL; |
|
81 |
TInt err( KErrNone ); |
|
82 |
TBool hasSelectedField( EFalse ); |
|
83 |
||
84 |
// Check use field control flag |
|
85 |
if (CCAContactorService::TCSParameter::EUseFieldParam & |
|
86 |
iParameter->iControlFlag) |
|
87 |
{ |
|
88 |
hasSelectedField = ETrue; |
|
89 |
} |
|
90 |
||
91 |
if ( !hasSelectedField ) |
|
92 |
{ |
|
93 |
TBool useDefaults = EFalse; |
|
94 |
||
95 |
// Check default control flag |
|
96 |
if (CCAContactorService::TCSParameter::EEnableDefaults & |
|
97 |
iParameter->iControlFlag) |
|
98 |
{ |
|
99 |
useDefaults = ETrue; |
|
100 |
} |
|
101 |
||
102 |
// Launch popup |
|
103 |
TRAP(err, result = &iPopupHandler->LaunchPopupL( |
|
104 |
iParameter->iContactLinkArray, |
|
105 |
CommunicationEnumMapper(iParameter->iCommTypeSelector), |
|
106 |
useDefaults)); |
|
107 |
||
108 |
if (result != NULL) |
|
109 |
{ |
|
110 |
isSelected = ETrue; |
|
111 |
} |
|
112 |
||
113 |
if (KErrNone != err) |
|
114 |
{ |
|
115 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ExecuteL: LaunchPopupL: Leaves %d."), err); |
|
116 |
return; |
|
117 |
} |
|
118 |
} |
|
119 |
else |
|
120 |
{ |
|
121 |
__ASSERT_ALWAYS (NULL != iParameter->iSelectedField, User::Leave (KErrArgument)); |
|
122 |
__ASSERT_ALWAYS (0 < iParameter->iSelectedField->Size(), User::Leave (KErrArgument)); |
|
123 |
result = iParameter->iSelectedField; |
|
124 |
} |
|
125 |
||
126 |
if (KErrNone != err) |
|
127 |
{ |
|
128 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ExecuteL: ResolveSpecialCasesL: Leaves %d."), err); |
|
129 |
return; |
|
130 |
} |
|
131 |
||
132 |
// Launch communication service |
|
133 |
TRAP(err, LaunchCommunicationMethodL(*result)); |
|
134 |
||
135 |
if (KErrNone != err) |
|
136 |
{ |
|
137 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ExecuteL: LaunchCommunicationMethodL: Leaves %d."), err); |
|
138 |
return; |
|
139 |
} |
|
140 |
||
141 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::Execute: Done.")); |
|
142 |
} |
|
143 |
||
144 |
||
145 |
TBool CCCAContactorServiceOperator::IsSelected() |
|
146 |
{ |
|
147 |
return isSelected; |
|
148 |
} |
|
149 |
// -------------------------------------------------------------------------- |
|
150 |
// CCCAContactorServiceOperator::CCCAContactorServiceOperator |
|
151 |
// -------------------------------------------------------------------------- |
|
152 |
// |
|
153 |
CCCAContactorServiceOperator::CCCAContactorServiceOperator(): |
|
154 |
isSelected(EFalse) |
|
155 |
{ |
|
156 |
} |
|
157 |
||
158 |
// -------------------------------------------------------------------------- |
|
159 |
// CCCAContactorServiceOperator::ConstructL |
|
160 |
// -------------------------------------------------------------------------- |
|
161 |
// |
|
162 |
void CCCAContactorServiceOperator::ConstructL() |
|
163 |
{ |
|
164 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ConstructL")); |
|
165 |
||
166 |
iPopupHandler = CCCAContactorPopupHandler::NewL(); |
|
167 |
||
168 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ConstructL: Done.")); |
|
169 |
} |
|
170 |
||
171 |
// -------------------------------------------------------------------------- |
|
172 |
// CCCAContactorServiceOperator::LaunchCommunicationMethodL |
|
173 |
// -------------------------------------------------------------------------- |
|
174 |
// |
|
175 |
void CCCAContactorServiceOperator::LaunchCommunicationMethodL( |
|
176 |
const TDesC& aFieldData) |
|
177 |
{ |
|
178 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::LaunchCommunicationMethodL")); |
|
179 |
||
180 |
__ASSERT_ALWAYS (NULL != &iParameter->iFullName, User::Leave (KErrArgument)); |
|
181 |
||
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
182 |
// If there is a default service, use the service |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
183 |
TUint serviceId = 0; |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
184 |
CSPSettingsVoIPUtils* spSettings = CSPSettingsVoIPUtils::NewLC(); |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
185 |
|
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
186 |
if ( ( iParameter->iCommTypeSelector == VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) && |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
187 |
( !spSettings->GetPreferredService( serviceId ) ) ) |
63 | 188 |
{ |
189 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ExecuteL: ExecuteServiceL with serviceid")); |
|
190 |
CCAContactor::ExecuteServiceL( |
|
191 |
iParameter->iCommTypeSelector, |
|
192 |
aFieldData, |
|
193 |
iParameter->iFullName, |
|
194 |
iParameter->iContactLinkArray, |
|
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
195 |
serviceId |
63 | 196 |
); |
197 |
} |
|
198 |
else |
|
199 |
{ |
|
200 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ExecuteL: ExecuteServiceL without serviceid")); |
|
201 |
CCAContactor::ExecuteServiceL( |
|
202 |
iParameter->iCommTypeSelector, |
|
203 |
aFieldData, |
|
204 |
iParameter->iFullName, |
|
205 |
iParameter->iContactLinkArray); |
|
74
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
206 |
} |
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
207 |
|
6b5524b4f673
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
208 |
CleanupStack::PopAndDestroy( spSettings ); |
63 | 209 |
|
210 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::LaunchCommunicationMethodL: Done.")); |
|
211 |
} |
|
212 |
||
213 |
// -------------------------------------------------------------------------- |
|
214 |
// CCCAContactorServiceOperator::CommunicationEnumMapper |
|
215 |
// -------------------------------------------------------------------------- |
|
216 |
// |
|
217 |
TAiwCommAddressSelectType CCCAContactorServiceOperator::CommunicationEnumMapper( |
|
218 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aCommTypeSelector) |
|
219 |
{ |
|
220 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::CommunicationEnumMapper")); |
|
221 |
||
222 |
TAiwCommAddressSelectType type; |
|
223 |
||
224 |
switch(aCommTypeSelector) |
|
225 |
{ |
|
226 |
case VPbkFieldTypeSelectorFactory::EEmptySelector: |
|
227 |
type = EAiwCommEmpty; |
|
228 |
break; |
|
229 |
||
230 |
case VPbkFieldTypeSelectorFactory::EVoiceCallSelector: |
|
231 |
type = EAiwCommVoiceCall; |
|
232 |
break; |
|
233 |
||
234 |
case VPbkFieldTypeSelectorFactory::EUniEditorSelector: |
|
235 |
type = EAiwCommUniEditor; |
|
236 |
break; |
|
237 |
||
238 |
case VPbkFieldTypeSelectorFactory::EEmailEditorSelector: |
|
239 |
type = EAiwCommEmailEditor; |
|
240 |
break; |
|
241 |
||
242 |
case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector: |
|
243 |
type = EAiwCommInstantMessaging; |
|
244 |
break; |
|
245 |
||
246 |
case VPbkFieldTypeSelectorFactory::EVOIPCallSelector: |
|
247 |
type = EAiwCommVOIPCall; |
|
248 |
break; |
|
249 |
||
250 |
case VPbkFieldTypeSelectorFactory::EURLSelector: |
|
251 |
type = EAiwCommURL; |
|
252 |
break; |
|
253 |
||
254 |
case VPbkFieldTypeSelectorFactory::EVideoCallSelector: |
|
255 |
type = EAiwCommVideoCall; |
|
256 |
break; |
|
257 |
||
258 |
default: |
|
259 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::CommunicationEnumMapper: default -> Empty mapped.")); |
|
260 |
type = EAiwCommEmpty; |
|
261 |
break; |
|
262 |
} |
|
263 |
||
264 |
CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::CommunicationEnumMapper: Done.")); |
|
265 |
||
266 |
return type; |
|
267 |
} |
|
268 |
||
269 |
// End of file |