|
1 /* |
|
2 * Copyright (c) 2008 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 the class CFscActionUtils. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "emailtrace.h" |
|
21 #include <e32std.h> |
|
22 #include <e32property.h> |
|
23 #include <StringLoader.h> |
|
24 #include <commonphoneparser.h> |
|
25 #include <featmgr.h> |
|
26 #include <aknnotewrappers.h> |
|
27 #include <AknsSkinInstance.h> |
|
28 #include <AknsUtils.h> |
|
29 #include <eikapp.h> |
|
30 #include <apgcli.h> |
|
31 #include <centralrepository.h> |
|
32 #include <CoreApplicationUIsSDKCRKeys.h> |
|
33 #include <settingsinternalcrkeys.h> |
|
34 //<cmail> Header neither in Cmail nor in the platform |
|
35 //#include <crcseprofileregistry.h> |
|
36 //</cmail> |
|
37 #include <NetworkHandlingDomainPSKeys.h> |
|
38 #include <MVPbkStoreContact.h> |
|
39 #include <MVPbkStoreContactFieldCollection.h> |
|
40 #include <MVPbkStoreContactField.h> |
|
41 #include <MVPbkFieldType.h> |
|
42 #include <TVPbkFieldVersitProperty.h> |
|
43 #include <MVPbkContactFieldData.h> |
|
44 #include <MVPbkContactFieldTextData.h> |
|
45 //<cmail> |
|
46 #include "fscactionplugincrkeys.h" |
|
47 #include "fsccontactactionservicedefines.h" |
|
48 //</cmail> |
|
49 #include <FscActionUtils.rsg> |
|
50 #include <barsread.h> |
|
51 #include <Pbk2ContactNameFormatterFactory.h> |
|
52 #include <MPbk2ContactNameFormatter.h> |
|
53 #include <CPbk2SortOrderManager.h> |
|
54 #include <CVPbkContactManager.h> |
|
55 #include <MPbk2FieldProperty.h> |
|
56 #include <CVPbkFieldTypeSelector.h> |
|
57 #include <CVPbkFieldFilter.h> |
|
58 #include <commonphoneparser.h> |
|
59 #include <bautils.h> // Fix for EMZG-7M23KX |
|
60 //<cmail> hardcoded paths removal |
|
61 #include <data_caging_path_literals.hrh> |
|
62 //</cmail> |
|
63 |
|
64 #include "cfscactionutils.h" |
|
65 #include "cfsccontactaction.h" |
|
66 #include "mfscreasoncallback.h" |
|
67 #include <VPbkFieldType.hrh> |
|
68 #include "FscPresentationUtils.h" |
|
69 #include "CFscFieldPropertyArray.h" |
|
70 #include "TFscAddressSelectParams.h" |
|
71 #include "CFscAddressSelect.h" |
|
72 |
|
73 |
|
74 // CONSTANTS DECLARATIONS |
|
75 const TUid KPoCOmaServerUid = |
|
76 { |
|
77 0x102071C4 |
|
78 }; |
|
79 |
|
80 // Unnamed namespace |
|
81 namespace { |
|
82 // These values come from cfsccallpluginimpl.cpp |
|
83 const TInt KMaxConfIdLen = 32; |
|
84 const TInt KMaxConfPinLen = 32; |
|
85 } |
|
86 |
|
87 const TUint32 KPoCDefaultSettings = 0x199; |
|
88 |
|
89 const TInt KMaxLengthOfNumber = 100; |
|
90 |
|
91 //Fix for: ECWG-7QYAVS |
|
92 const TInt KMaxLengthOfName = 100; |
|
93 //end for fix |
|
94 |
|
95 _LIT( KSpace, " " ); |
|
96 //<cmail> hard coded path removed |
|
97 _LIT( KFscRscFileName, "fscactionutils.rsc" ); |
|
98 //</cmail> |
|
99 |
|
100 // ======== MEMBER FUNCTIONS ======== |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CFscActionUtils::NewL |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 CFscActionUtils* CFscActionUtils::NewL( CVPbkContactManager& aContactManager ) |
|
107 { |
|
108 FUNC_LOG; |
|
109 CFscActionUtils* self = CFscActionUtils::NewLC( aContactManager ); |
|
110 CleanupStack::Pop( self ); |
|
111 return self; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CFscActionUtils::NewLC |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CFscActionUtils* CFscActionUtils::NewLC( |
|
119 CVPbkContactManager& aContactManager ) |
|
120 { |
|
121 FUNC_LOG; |
|
122 CFscActionUtils* self = new ( ELeave ) CFscActionUtils( aContactManager ); |
|
123 CleanupStack::PushL( self ); |
|
124 self->ConstructL(); |
|
125 return self; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // CFscActionUtils::~CFscActionUtils |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 CFscActionUtils::~CFscActionUtils() |
|
133 { |
|
134 FUNC_LOG; |
|
135 delete iRep; |
|
136 if ( iRCSEProfileRegistry != NULL ) |
|
137 { |
|
138 //<cmail> |
|
139 //delete iRCSEProfileRegistry; |
|
140 //</cmail> |
|
141 } |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // CFscActionUtils::ContactManager |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 CVPbkContactManager& CFscActionUtils::ContactManager() |
|
149 { |
|
150 FUNC_LOG; |
|
151 return iContactManager; |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CFscActionUtils::ShowInfoNoteL |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 void CFscActionUtils::ShowInfoNoteL( TInt aNote, const HBufC* aContactName ) |
|
159 { |
|
160 FUNC_LOG; |
|
161 HBufC* noteText = NULL; |
|
162 |
|
163 // Fix for EMZG-7M23KX |
|
164 TInt offset = FindAndAddResourceFileL(); |
|
165 |
|
166 if ( aContactName ) |
|
167 { |
|
168 noteText = StringLoader::LoadL( aNote, *aContactName ); |
|
169 } |
|
170 else |
|
171 { |
|
172 noteText = StringLoader::LoadL( aNote ); |
|
173 } |
|
174 |
|
175 CleanupStack::PushL( noteText ); |
|
176 CAknInformationNote* infoNote = |
|
177 new ( ELeave ) CAknInformationNote( ETrue ); |
|
178 infoNote->ExecuteLD( *noteText ); |
|
179 CleanupStack::PopAndDestroy( noteText ); |
|
180 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CFscActionUtils::ShowInfoNoteL |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 void CFscActionUtils::ShowInfoNoteL( TInt aNote, TInt aCounter ) |
|
188 { |
|
189 FUNC_LOG; |
|
190 HBufC* noteText = NULL; |
|
191 |
|
192 // Fix for EMZG-7M23KX |
|
193 TInt offset = FindAndAddResourceFileL(); |
|
194 |
|
195 noteText = StringLoader::LoadL( aNote, aCounter ); |
|
196 |
|
197 CleanupStack::PushL( noteText ); |
|
198 CAknInformationNote* infoNote = |
|
199 new ( ELeave ) CAknInformationNote( ETrue ); |
|
200 infoNote->ExecuteLD( *noteText ); |
|
201 CleanupStack::PopAndDestroy( noteText ); |
|
202 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // CFscActionUtils::ShowCnfNoteL |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void CFscActionUtils::ShowCnfNoteL( TInt aNote, const HBufC* aName ) |
|
210 { |
|
211 FUNC_LOG; |
|
212 |
|
213 // Fix for EMZG-7M23KX |
|
214 TInt offset = FindAndAddResourceFileL(); |
|
215 |
|
216 HBufC* noteText = NULL; |
|
217 |
|
218 if ( aName ) |
|
219 { |
|
220 noteText = StringLoader::LoadL( aNote, *aName ); |
|
221 } |
|
222 else |
|
223 { |
|
224 noteText = StringLoader::LoadL( aNote ); |
|
225 } |
|
226 |
|
227 CleanupStack::PushL( noteText ); |
|
228 CAknConfirmationNote* cnfNote = |
|
229 new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
230 cnfNote->ExecuteLD( *noteText ); |
|
231 CleanupStack::PopAndDestroy( noteText ); |
|
232 |
|
233 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
234 |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // CFscActionUtils::ShowNumberMissingDialogL |
|
239 // --------------------------------------------------------------------------- |
|
240 // |
|
241 TInt CFscActionUtils::ShowNumberMissingNoteL( TInt aMissingCount, |
|
242 TInt aTotalCount, TInt aNote, TInt aDialog ) |
|
243 { |
|
244 FUNC_LOG; |
|
245 |
|
246 // Add two numbers aMissingCount and aTotalCount to queryText |
|
247 CArrayFix<TInt>* numbers = new( ELeave ) CArrayFixFlat<TInt>( 2 ); |
|
248 CleanupStack::PushL( numbers ); |
|
249 numbers->AppendL( aMissingCount ); |
|
250 numbers->AppendL( aTotalCount ); |
|
251 |
|
252 HBufC* queryText = StringLoader::LoadLC( aNote, *numbers ); |
|
253 |
|
254 CAknQueryDialog *queryDlg = new ( ELeave ) CAknQueryDialog(); |
|
255 CleanupStack::PushL( queryDlg ); |
|
256 queryDlg->SetPromptL( *queryText ); |
|
257 CleanupStack::Pop( queryDlg ); |
|
258 CleanupStack::PopAndDestroy( queryText ); |
|
259 CleanupStack::PopAndDestroy( numbers ); |
|
260 |
|
261 TInt ret = queryDlg->ExecuteLD( aDialog ); |
|
262 |
|
263 return ret; |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // CFscActionUtils::GetContactNameL |
|
268 // --------------------------------------------------------------------------- |
|
269 HBufC* CFscActionUtils::GetContactNameL( MVPbkStoreContact& aStoreContact ) |
|
270 { |
|
271 FUNC_LOG; |
|
272 HBufC* contactName = HBufC::NewLC( KMaxLengthOfName + 1 ); // one ' ' char |
|
273 |
|
274 // Search for the contact name |
|
275 // Fix for EMZG-7M23KX |
|
276 TInt offset = FindAndAddResourceFileL(); |
|
277 |
|
278 TResourceReader selectorReader; |
|
279 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, |
|
280 R_FSC_FIRST_NAME_SELECTOR ); |
|
281 |
|
282 CVPbkFieldTypeSelector* fieldTypeSelector = CVPbkFieldTypeSelector::NewL( |
|
283 selectorReader, iContactManager.FieldTypes() ); |
|
284 CleanupStack::PopAndDestroy(); // selectorReader |
|
285 |
|
286 CVPbkFieldFilter::TConfig config( |
|
287 const_cast<MVPbkStoreContactFieldCollection&> ( |
|
288 aStoreContact.Fields() ), fieldTypeSelector, NULL ); |
|
289 |
|
290 CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
291 TInt fieldCount = fieldFilter->FieldCount(); |
|
292 const MVPbkStoreContactField* field = NULL; |
|
293 if ( fieldCount == 1 ) |
|
294 { |
|
295 field = fieldFilter->FieldAtLC(0); |
|
296 contactName->Des().Append( |
|
297 MVPbkContactFieldTextData::Cast( |
|
298 field->FieldData() ).Text() ); |
|
299 CleanupStack::PopAndDestroy();//field |
|
300 } |
|
301 |
|
302 delete fieldFilter; |
|
303 delete fieldTypeSelector; |
|
304 |
|
305 // Search for the contact second name |
|
306 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, |
|
307 R_FSC_LAST_NAME_SELECTOR ); |
|
308 fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader, |
|
309 iContactManager.FieldTypes() ); |
|
310 CleanupStack::PopAndDestroy();//selectorReader |
|
311 config.iFieldSelector = fieldTypeSelector; |
|
312 |
|
313 fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
314 fieldCount = fieldFilter->FieldCount(); |
|
315 if ( fieldCount == 1 ) |
|
316 { |
|
317 field = fieldFilter->FieldAtLC(0); |
|
318 if ( contactName->Des().Length() > 0 ) |
|
319 { |
|
320 contactName->Des().Append( KSpace ); |
|
321 } |
|
322 contactName->Des().Append( |
|
323 MVPbkContactFieldTextData::Cast( |
|
324 field->FieldData() ).Text() ); |
|
325 CleanupStack::PopAndDestroy();//field |
|
326 } |
|
327 |
|
328 // If first or second name hasn't been found -> find company name |
|
329 if ( contactName->Des().Length() <= 0 ) |
|
330 { |
|
331 delete fieldFilter; |
|
332 delete fieldTypeSelector; |
|
333 |
|
334 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, |
|
335 R_FSC_COMPANY_NAME_SELECTOR ); |
|
336 fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader, |
|
337 iContactManager.FieldTypes() ); |
|
338 CleanupStack::PopAndDestroy();//selectorReader |
|
339 config.iFieldSelector = fieldTypeSelector; |
|
340 |
|
341 fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
342 fieldCount = fieldFilter->FieldCount(); |
|
343 if ( fieldCount == 1 ) |
|
344 { |
|
345 field = fieldFilter->FieldAtLC(0); |
|
346 contactName->Des().Append( |
|
347 MVPbkContactFieldTextData::Cast( |
|
348 field->FieldData() ).Text() ); |
|
349 CleanupStack::PopAndDestroy();//field |
|
350 } |
|
351 } |
|
352 // no first or second name, nor company name -> return "unnamed" string |
|
353 if ( contactName->Des().Length() <= 0 ) |
|
354 { |
|
355 //append (Unnamed) |
|
356 HBufC* unnamed = StringLoader::LoadL( R_QTN_FS_UNNAMED ); |
|
357 contactName->Des().Append( *unnamed ); |
|
358 delete unnamed; |
|
359 } |
|
360 |
|
361 delete fieldFilter; |
|
362 delete fieldTypeSelector; |
|
363 CleanupStack::Pop( contactName ); |
|
364 |
|
365 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
366 |
|
367 return contactName; |
|
368 } |
|
369 |
|
370 // --------------------------------------------------------------------------- |
|
371 // CFscActionUtils::OpenSelectDialogL |
|
372 // --------------------------------------------------------------------------- |
|
373 // |
|
374 MVPbkStoreContactField* CFscActionUtils::OpenSelectDialogL( TInt aResourceId, |
|
375 MVPbkStoreContact& aStoreContact ) |
|
376 { |
|
377 FUNC_LOG; |
|
378 // Create sort order manager |
|
379 CPbk2SortOrderManager* sortOrderManager = |
|
380 CPbk2SortOrderManager::NewL( iContactManager.FieldTypes() ); |
|
381 CleanupStack::PushL( sortOrderManager ); |
|
382 |
|
383 // Create name formatter |
|
384 MPbk2ContactNameFormatter* nameFormatter = |
|
385 Pbk2ContactNameFormatterFactory::CreateL( |
|
386 iContactManager.FieldTypes(), *sortOrderManager ); |
|
387 |
|
388 CFscFieldPropertyArray* fieldProperties = |
|
389 CFscFieldPropertyArray::NewL( iContactManager.FieldTypes() ); |
|
390 |
|
391 // Fix for EMZG-7M23KX |
|
392 TInt offset = FindAndAddResourceFileL(); |
|
393 |
|
394 // Create resource reader for new resource |
|
395 TResourceReader resReader; |
|
396 |
|
397 CCoeEnv::Static()->CreateResourceReaderLC( resReader, |
|
398 aResourceId ); |
|
399 |
|
400 TFscAddressSelectParams params( aStoreContact, iContactManager, |
|
401 *nameFormatter, *fieldProperties, resReader ); |
|
402 |
|
403 RVPbkContactFieldDefaultPriorities defaultPrioritiesArray; |
|
404 |
|
405 switch ( aResourceId ) |
|
406 { |
|
407 case R_FSC_PHONE_NUMBER_SELECT: |
|
408 { |
|
409 defaultPrioritiesArray.Append( EVPbkDefaultTypePhoneNumber ); |
|
410 // Launch call directly using default values. |
|
411 params.SetUseDefaultDirectly( ETrue ); |
|
412 break; |
|
413 } |
|
414 |
|
415 case R_FSC_VIDEO_NUMBER_SELECT: |
|
416 { |
|
417 defaultPrioritiesArray.Append( EVPbkDefaultTypeVideoNumber ); |
|
418 // Launch call directly using default values. |
|
419 params.SetUseDefaultDirectly( ETrue ); |
|
420 break; |
|
421 } |
|
422 |
|
423 case R_FSC_VOIP_SELECT: |
|
424 { |
|
425 defaultPrioritiesArray.Append( EVPbkDefaultTypeVoIP ); |
|
426 // Launch call directly using default values. |
|
427 params.SetUseDefaultDirectly( ETrue ); |
|
428 break; |
|
429 } |
|
430 |
|
431 case R_FSC_PTT_SELECT: |
|
432 { |
|
433 defaultPrioritiesArray.Append( EVPbkDefaultTypePOC ); |
|
434 // Launch call directly using default values. |
|
435 params.SetUseDefaultDirectly( ETrue ); |
|
436 break; |
|
437 } |
|
438 |
|
439 case R_FSC_MSG_SELECT: |
|
440 { |
|
441 defaultPrioritiesArray.Append( EVPbkDefaultTypeSms ); |
|
442 defaultPrioritiesArray.Append( EVPbkDefaultTypeMms ); |
|
443 // Fix for ELWG-7SPH5H |
|
444 params.SetUseDefaultDirectly( ETrue ); |
|
445 break; |
|
446 } |
|
447 |
|
448 case R_FSC_EMAIL_SELECT: |
|
449 { |
|
450 defaultPrioritiesArray.Append( EVPbkDefaultTypeEmail ); |
|
451 params.SetUseDefaultDirectly( ETrue ); |
|
452 break; |
|
453 } |
|
454 |
|
455 default: |
|
456 { |
|
457 User::Leave( KErrArgument ); |
|
458 break; |
|
459 } |
|
460 } |
|
461 |
|
462 params.SetDefaultPriorities( defaultPrioritiesArray ); |
|
463 |
|
464 // Create select dialog |
|
465 delete iAddressSelect; |
|
466 iAddressSelect = NULL; |
|
467 iAddressSelect = CFscAddressSelect::NewL( params ); |
|
468 // Run select dialog |
|
469 MVPbkStoreContactField* selectedField = iAddressSelect->ExecuteLD(); |
|
470 iAddressSelect = NULL; |
|
471 |
|
472 defaultPrioritiesArray.Close(); |
|
473 CleanupStack::PopAndDestroy(); //resReader |
|
474 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
475 delete fieldProperties; |
|
476 delete nameFormatter; |
|
477 CleanupStack::PopAndDestroy( sortOrderManager ); |
|
478 |
|
479 return selectedField; |
|
480 } |
|
481 |
|
482 // --------------------------------------------------------------------------- |
|
483 // CFscActionUtils::GetVoiceCallNumberL |
|
484 // --------------------------------------------------------------------------- |
|
485 // |
|
486 TInt CFscActionUtils::GetVoiceCallNumberL( MVPbkStoreContact& aStoreContact, |
|
487 TDes& aNumber ) |
|
488 { |
|
489 FUNC_LOG; |
|
490 aNumber.Zero(); |
|
491 |
|
492 if( !IsContactNumberAvailableL( aStoreContact, ETypeVoiceCallNumber ) ) |
|
493 { |
|
494 return KErrNotFound; |
|
495 } |
|
496 |
|
497 TInt ret = KErrNone; |
|
498 |
|
499 // open select dialog for voice call number |
|
500 MVPbkStoreContactField* selectedField = OpenSelectDialogL( |
|
501 R_FSC_PHONE_NUMBER_SELECT, aStoreContact ); |
|
502 |
|
503 // If select number dialog was cancelled, we will return KErrCancel |
|
504 if ( !selectedField ) |
|
505 { |
|
506 ret = KErrCancel; |
|
507 } |
|
508 else |
|
509 { |
|
510 // Else, copy phone number to the aNubmer argument |
|
511 TPtrC phoneNumberFieldData = MVPbkContactFieldTextData::Cast( |
|
512 selectedField->FieldData() ).Text(); |
|
513 |
|
514 // Copy number from selected field |
|
515 if ( phoneNumberFieldData.Length() ) |
|
516 { |
|
517 aNumber.Copy( phoneNumberFieldData ); |
|
518 } |
|
519 |
|
520 // Format phone number |
|
521 //Fix for: MHOA-7SQF6T |
|
522 CommonPhoneParser::ParsePhoneNumber( aNumber, |
|
523 CommonPhoneParser::EPlainPhoneNumber ); |
|
524 //end for fix |
|
525 } |
|
526 |
|
527 // Destroy objects |
|
528 delete selectedField; |
|
529 |
|
530 return ret; |
|
531 } |
|
532 |
|
533 // --------------------------------------------------------------------------- |
|
534 // CFscActionUtils::GetVideoCallNumberL |
|
535 // --------------------------------------------------------------------------- |
|
536 // |
|
537 TInt CFscActionUtils::GetVideoCallNumberL( MVPbkStoreContact& aStoreContact, |
|
538 TDes& aNumber ) |
|
539 { |
|
540 FUNC_LOG; |
|
541 |
|
542 if( !IsContactNumberAvailableL( aStoreContact, ETypeVideoCallNumber ) ) |
|
543 { |
|
544 return KErrNotFound; |
|
545 } |
|
546 |
|
547 aNumber.Zero(); |
|
548 TInt ret = KErrNone; |
|
549 |
|
550 // open select dialog for video call number |
|
551 MVPbkStoreContactField* selectedField = OpenSelectDialogL( |
|
552 R_FSC_VIDEO_NUMBER_SELECT, aStoreContact ); |
|
553 |
|
554 // If select number dialog was cancelled, we will return KErrCancel |
|
555 if ( !selectedField ) |
|
556 { |
|
557 ret = KErrCancel; |
|
558 } |
|
559 else |
|
560 { |
|
561 // Else, copy phone number to the aNubmer argument |
|
562 TPtrC phoneNumberFieldData = MVPbkContactFieldTextData::Cast( |
|
563 selectedField->FieldData() ).Text(); |
|
564 |
|
565 // Copy number from selected field |
|
566 if ( phoneNumberFieldData.Length() ) |
|
567 { |
|
568 aNumber.Copy( phoneNumberFieldData ); |
|
569 } |
|
570 |
|
571 // Format phone number |
|
572 //Fix for: MHOA-7SQF6T |
|
573 CommonPhoneParser::ParsePhoneNumber( aNumber, |
|
574 CommonPhoneParser::EPlainPhoneNumber ); |
|
575 //end for fix |
|
576 } |
|
577 |
|
578 // Destroy objects |
|
579 delete selectedField; |
|
580 |
|
581 return ret; |
|
582 } |
|
583 |
|
584 // --------------------------------------------------------------------------- |
|
585 // CFscActionUtils::GetVoipAddressL |
|
586 // --------------------------------------------------------------------------- |
|
587 // |
|
588 TInt CFscActionUtils::GetVoipAddressL( MVPbkStoreContact& aStoreContact, |
|
589 TDes& aVoipAddress ) |
|
590 { |
|
591 FUNC_LOG; |
|
592 |
|
593 if( !IsContactNumberAvailableL( aStoreContact, ETypeInternetTel ) ) |
|
594 { |
|
595 return KErrNotFound; |
|
596 } |
|
597 |
|
598 aVoipAddress.Zero(); |
|
599 TInt ret = KErrNone; |
|
600 |
|
601 // open select dialog for voip address |
|
602 MVPbkStoreContactField* selectedField = OpenSelectDialogL( |
|
603 R_FSC_VOIP_SELECT, aStoreContact ); |
|
604 |
|
605 // If select VOIP address dialog was cancelled, we will return KErrCancel |
|
606 if ( !selectedField ) |
|
607 { |
|
608 ret = KErrCancel; |
|
609 } |
|
610 else |
|
611 { |
|
612 // Copy VOIP address from selected field |
|
613 TPtrC voipAddress = MVPbkContactFieldTextData::Cast( |
|
614 selectedField->FieldData() ).Text(); |
|
615 |
|
616 if ( voipAddress.Length() ) |
|
617 { |
|
618 aVoipAddress.Copy( voipAddress ); |
|
619 } |
|
620 else |
|
621 { |
|
622 ret = KErrNotFound; |
|
623 } |
|
624 } |
|
625 |
|
626 // Format phone number |
|
627 //Fix for: MHOA-7SQF6T |
|
628 CommonPhoneParser::ParsePhoneNumber( aVoipAddress, |
|
629 CommonPhoneParser::EPlainPhoneNumber ); |
|
630 //end for fix |
|
631 |
|
632 // Destroy objects |
|
633 delete selectedField; |
|
634 |
|
635 return ret; |
|
636 } |
|
637 |
|
638 // --------------------------------------------------------------------------- |
|
639 // CFscActionUtils::GetConfInfoL |
|
640 // --------------------------------------------------------------------------- |
|
641 // |
|
642 TInt CFscActionUtils::GetConfInfoL( MVPbkStoreContact& aStoreContact, |
|
643 TDes& aConfNum, TDes& aConfId, TDes& aConfPin ) |
|
644 { |
|
645 FUNC_LOG; |
|
646 aConfNum.Zero(); |
|
647 aConfId.Zero(); |
|
648 aConfPin.Zero(); |
|
649 |
|
650 if( !IsContactNumberAvailableL( aStoreContact, ETypeConfNumber ) ) |
|
651 { |
|
652 return KErrNotFound; |
|
653 } |
|
654 |
|
655 TInt ret = KErrNone; |
|
656 |
|
657 // Search for conference number |
|
658 // Fix for EMZG-7M23KX |
|
659 TInt offset = FindAndAddResourceFileL(); |
|
660 TResourceReader selectorReader; |
|
661 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, |
|
662 R_FSC_CONF_NUMBER_SELECTOR ); |
|
663 |
|
664 CVPbkFieldTypeSelector* fieldTypeSelector = CVPbkFieldTypeSelector::NewL( |
|
665 selectorReader, iContactManager.FieldTypes() ); |
|
666 CleanupStack::PopAndDestroy(); // selectorReader |
|
667 |
|
668 CVPbkFieldFilter::TConfig config( |
|
669 const_cast<MVPbkStoreContactFieldCollection&> ( |
|
670 aStoreContact.Fields() ), fieldTypeSelector, NULL ); |
|
671 |
|
672 CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
673 TInt fieldCount = fieldFilter->FieldCount(); |
|
674 const MVPbkStoreContactField* field = NULL; |
|
675 if ( fieldCount == 1 ) |
|
676 { |
|
677 field = fieldFilter->FieldAtLC(0); |
|
678 aConfNum.Append( MVPbkContactFieldTextData::Cast( |
|
679 field->FieldData() ).Text() ); |
|
680 CleanupStack::PopAndDestroy();//field |
|
681 } |
|
682 |
|
683 delete fieldFilter; |
|
684 fieldFilter = NULL; |
|
685 delete fieldTypeSelector; |
|
686 fieldTypeSelector = NULL; |
|
687 |
|
688 // if conference number field exists but no number set |
|
689 if ( !( CommonPhoneParser::IsValidPhoneNumber( aConfNum, |
|
690 CommonPhoneParser::EContactCardNumber ) ) ) |
|
691 { |
|
692 return KErrNotFound; |
|
693 } |
|
694 |
|
695 // Search for conference id |
|
696 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, |
|
697 R_FSC_CONF_ID_SELECTOR ); |
|
698 |
|
699 fieldTypeSelector = CVPbkFieldTypeSelector::NewL( |
|
700 selectorReader, iContactManager.FieldTypes() ); |
|
701 CleanupStack::PopAndDestroy(); // selectorReader |
|
702 config.iFieldSelector = fieldTypeSelector; |
|
703 |
|
704 fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
705 fieldCount = fieldFilter->FieldCount(); |
|
706 field = NULL; |
|
707 |
|
708 if ( fieldCount == 1 ) |
|
709 { |
|
710 field = fieldFilter->FieldAtLC(0); |
|
711 const TDesC& confIdData = MVPbkContactFieldTextData::Cast( |
|
712 field->FieldData() ).Text(); |
|
713 if ( confIdData.Length() <= KMaxConfIdLen ) |
|
714 { |
|
715 aConfId.Append( confIdData ); |
|
716 } |
|
717 else |
|
718 { |
|
719 aConfId = KNullDesC; |
|
720 } |
|
721 CleanupStack::PopAndDestroy();//field |
|
722 if ( !( CommonPhoneParser::IsValidPhoneNumber( aConfId, |
|
723 CommonPhoneParser::EContactCardNumber ) ) ) |
|
724 { |
|
725 aConfId = KNullDesC; |
|
726 } |
|
727 } |
|
728 |
|
729 delete fieldFilter; |
|
730 fieldFilter = NULL; |
|
731 delete fieldTypeSelector; |
|
732 fieldTypeSelector = NULL; |
|
733 |
|
734 // Search for conference id |
|
735 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, |
|
736 R_FSC_CONF_PIN_SELECTOR ); |
|
737 |
|
738 fieldTypeSelector = CVPbkFieldTypeSelector::NewL( |
|
739 selectorReader, iContactManager.FieldTypes() ); |
|
740 CleanupStack::PopAndDestroy(); // selectorReader |
|
741 config.iFieldSelector = fieldTypeSelector; |
|
742 |
|
743 fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
744 fieldCount = fieldFilter->FieldCount(); |
|
745 field = NULL; |
|
746 if ( fieldCount == 1 ) |
|
747 { |
|
748 field = fieldFilter->FieldAtLC(0); |
|
749 const TDesC& confPinData = MVPbkContactFieldTextData::Cast( |
|
750 field->FieldData() ).Text(); |
|
751 if ( confPinData.Length() <= KMaxConfPinLen ) |
|
752 { |
|
753 aConfPin.Append( confPinData ); |
|
754 } |
|
755 else |
|
756 { |
|
757 aConfPin = KNullDesC; |
|
758 } |
|
759 CleanupStack::PopAndDestroy();//field |
|
760 if ( !( CommonPhoneParser::IsValidPhoneNumber( aConfPin, |
|
761 CommonPhoneParser::EContactCardNumber ) ) ) |
|
762 { |
|
763 aConfPin = KNullDesC; |
|
764 } |
|
765 } |
|
766 |
|
767 delete fieldFilter; |
|
768 fieldFilter = NULL; |
|
769 delete fieldTypeSelector; |
|
770 fieldTypeSelector = NULL; |
|
771 |
|
772 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
773 |
|
774 |
|
775 return ret; |
|
776 } |
|
777 |
|
778 // --------------------------------------------------------------------------- |
|
779 // CFscActionUtils::GetPocAddressL |
|
780 // --------------------------------------------------------------------------- |
|
781 // |
|
782 TInt CFscActionUtils::GetPocAddressL( MVPbkStoreContact& aStoreContact, |
|
783 TDes& aPocAddress ) |
|
784 { |
|
785 FUNC_LOG; |
|
786 |
|
787 if( !IsContactNumberAvailableL( aStoreContact, ETypePttNumber ) ) |
|
788 { |
|
789 return KErrNotFound; |
|
790 } |
|
791 |
|
792 aPocAddress.Zero(); |
|
793 TInt ret = KErrNone; |
|
794 |
|
795 // open select dialog for poc address |
|
796 MVPbkStoreContactField* selectedField = OpenSelectDialogL( |
|
797 R_FSC_PTT_SELECT, aStoreContact ); |
|
798 |
|
799 // If select POC address dialog was cancelled, we will return KErrCancel |
|
800 if ( !selectedField ) |
|
801 { |
|
802 ret = KErrCancel; |
|
803 } |
|
804 else |
|
805 { |
|
806 // Else, copy POC address to the aPocAddress argument |
|
807 TPtrC pocAddress = MVPbkContactFieldTextData::Cast( |
|
808 selectedField->FieldData() ).Text(); |
|
809 |
|
810 // Copy POC address from selected field |
|
811 if ( pocAddress.Length() ) |
|
812 { |
|
813 aPocAddress.Copy( pocAddress ); |
|
814 } |
|
815 else |
|
816 { |
|
817 ret = KErrNotFound; |
|
818 } |
|
819 } |
|
820 |
|
821 // Destroy objects |
|
822 delete selectedField; |
|
823 |
|
824 return ret; |
|
825 } |
|
826 |
|
827 // --------------------------------------------------------------------------- |
|
828 // CFscActionUtils::GetEmailAddressL |
|
829 // --------------------------------------------------------------------------- |
|
830 // |
|
831 TInt CFscActionUtils::GetMessageAddressL( MVPbkStoreContact& aStoreContact, |
|
832 TDes& aMsgAddress ) |
|
833 { |
|
834 FUNC_LOG; |
|
835 |
|
836 if( !IsContactNumberAvailableL( aStoreContact, ETypeMsgAddress ) ) |
|
837 { |
|
838 return KErrNotFound; |
|
839 } |
|
840 |
|
841 aMsgAddress.Zero(); |
|
842 |
|
843 TInt ret = KErrNone; |
|
844 |
|
845 // open select dialog for message address |
|
846 MVPbkStoreContactField* selectedField = OpenSelectDialogL( |
|
847 R_FSC_MSG_SELECT, aStoreContact ); |
|
848 |
|
849 // If select message address dialog was cancelled, |
|
850 // we will return KErrCancel |
|
851 if ( !selectedField ) |
|
852 { |
|
853 ret = KErrCancel; |
|
854 } |
|
855 else |
|
856 { |
|
857 // Copy message address from selected field |
|
858 TPtrC msgAddress = MVPbkContactFieldTextData::Cast( |
|
859 selectedField->FieldData() ).Text(); |
|
860 |
|
861 if ( msgAddress.Length() ) |
|
862 { |
|
863 aMsgAddress.Copy( msgAddress ); |
|
864 } |
|
865 else |
|
866 { |
|
867 ret = KErrNotFound; |
|
868 } |
|
869 } |
|
870 |
|
871 // Destroy objects |
|
872 delete selectedField; |
|
873 |
|
874 return ret; |
|
875 } |
|
876 |
|
877 // --------------------------------------------------------------------------- |
|
878 // CFscActionUtils::GetEmailAddressL |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 TInt CFscActionUtils::GetEmailAddressL( MVPbkStoreContact& aStoreContact, |
|
882 TDes& aEmailAddress ) |
|
883 { |
|
884 FUNC_LOG; |
|
885 |
|
886 if( !IsContactNumberAvailableL( aStoreContact, ETypeEmailAddress ) ) |
|
887 { |
|
888 return KErrNotFound; |
|
889 } |
|
890 |
|
891 aEmailAddress.Zero(); |
|
892 |
|
893 TInt ret = KErrNone; |
|
894 |
|
895 // open select dialog for email address |
|
896 MVPbkStoreContactField* selectedField = OpenSelectDialogL( |
|
897 R_FSC_EMAIL_SELECT, aStoreContact ); |
|
898 |
|
899 // If select email address dialog was cancelled, we will return KErrCancel |
|
900 if ( !selectedField ) |
|
901 { |
|
902 ret = KErrCancel; |
|
903 } |
|
904 else |
|
905 { |
|
906 // Copy email address from selected field |
|
907 TPtrC emailAddress = MVPbkContactFieldTextData::Cast( |
|
908 selectedField->FieldData() ).Text(); |
|
909 |
|
910 if ( emailAddress.Length() ) |
|
911 { |
|
912 aEmailAddress.Copy( emailAddress ); |
|
913 } |
|
914 else |
|
915 { |
|
916 ret = KErrNotFound; |
|
917 } |
|
918 } |
|
919 |
|
920 // Destroy objects |
|
921 delete selectedField; |
|
922 |
|
923 return ret; |
|
924 } |
|
925 |
|
926 // --------------------------------------------------------------------------- |
|
927 // CFscActionUtils::RemoveInvalidChar |
|
928 // --------------------------------------------------------------------------- |
|
929 // |
|
930 void CFscActionUtils::RemoveInvalidChar( const TDesC& aNumber, |
|
931 const TDesC& aValidChars, TDes& aOutNumber ) |
|
932 { |
|
933 FUNC_LOG; |
|
934 for ( TInt ii = 0; ii < aNumber.Length(); ++ii ) |
|
935 { |
|
936 TChar ch = aNumber[ ii ]; |
|
937 if ( aValidChars.Locate( ch ) != KErrNotFound ) |
|
938 { |
|
939 aOutNumber.Append( ch ); |
|
940 } |
|
941 } |
|
942 } |
|
943 |
|
944 // --------------------------------------------------------------------------- |
|
945 // CFscActionUtils::IsContactNumberAvailableL |
|
946 // --------------------------------------------------------------------------- |
|
947 // |
|
948 TBool CFscActionUtils::IsContactNumberAvailableL( |
|
949 MVPbkStoreContact& aStoreContact, TContactNumberType aContactNumberType ) |
|
950 { |
|
951 FUNC_LOG; |
|
952 |
|
953 TBool available( EFalse ); |
|
954 |
|
955 // Search for the contact name |
|
956 // Fix for EMZG-7M23KX |
|
957 TInt offset = FindAndAddResourceFileL(); |
|
958 |
|
959 TResourceReader selectorReader; |
|
960 CVPbkFieldTypeSelector* fieldTypeSelector = NULL; |
|
961 CVPbkFieldFilter* fieldFilter = NULL; |
|
962 TInt fieldCount = 0; |
|
963 TInt selector = 0; |
|
964 |
|
965 switch ( aContactNumberType ) |
|
966 { |
|
967 case ETypeVoiceCallNumber: |
|
968 { |
|
969 selector = R_FSC_PHONENUMBER_SELECTOR; |
|
970 } |
|
971 break; |
|
972 |
|
973 case ETypeVideoCallNumber: |
|
974 { |
|
975 selector = R_FSC_VIDEO_SELECTOR; |
|
976 } |
|
977 break; |
|
978 |
|
979 case ETypeConfNumber: |
|
980 { |
|
981 selector = R_FSC_CONF_NUMBER_SELECTOR; |
|
982 } |
|
983 break; |
|
984 |
|
985 case ETypeInternetTel: |
|
986 { |
|
987 selector = R_FSC_VOIP_SELECTOR; |
|
988 } |
|
989 break; |
|
990 |
|
991 case ETypePttNumber: |
|
992 { |
|
993 selector = R_FSC_PTT_SELECTOR; |
|
994 } |
|
995 break; |
|
996 |
|
997 case ETypeMsgAddress: |
|
998 { |
|
999 selector = R_FSC_MSG_SELECTOR; |
|
1000 } |
|
1001 break; |
|
1002 |
|
1003 case ETypeAudioAddress: |
|
1004 { |
|
1005 selector = R_FSC_MSG_SELECTOR; |
|
1006 } |
|
1007 break; |
|
1008 |
|
1009 case ETypeEmailAddress: |
|
1010 { |
|
1011 selector = R_FSC_EMAIL_SELECTOR; |
|
1012 } |
|
1013 break; |
|
1014 |
|
1015 default: |
|
1016 { |
|
1017 break; |
|
1018 } |
|
1019 } |
|
1020 |
|
1021 if ( selector ) |
|
1022 { |
|
1023 CCoeEnv::Static()->CreateResourceReaderLC( selectorReader, selector ); |
|
1024 |
|
1025 fieldTypeSelector = CVPbkFieldTypeSelector::NewL( selectorReader, |
|
1026 iContactManager.FieldTypes() ); |
|
1027 CleanupStack::PopAndDestroy(); // selectorReader |
|
1028 |
|
1029 CVPbkFieldFilter::TConfig config( |
|
1030 const_cast<MVPbkStoreContactFieldCollection&> ( |
|
1031 aStoreContact.Fields() ), fieldTypeSelector, NULL); |
|
1032 |
|
1033 fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
1034 fieldCount = fieldFilter->FieldCount(); |
|
1035 |
|
1036 if ( fieldCount ) |
|
1037 { |
|
1038 if ( selector == R_FSC_CONF_NUMBER_SELECTOR ) |
|
1039 { |
|
1040 TBuf<KMaxLengthOfNumber> confNum; |
|
1041 const MVPbkStoreContactField* field = NULL; |
|
1042 field = fieldFilter->FieldAtLC(0); |
|
1043 confNum.Append( MVPbkContactFieldTextData::Cast( |
|
1044 field->FieldData() ).Text() ); |
|
1045 CleanupStack::PopAndDestroy();//field |
|
1046 |
|
1047 if ( CommonPhoneParser::IsValidPhoneNumber( confNum, |
|
1048 CommonPhoneParser::EContactCardNumber ) ) |
|
1049 { |
|
1050 available = ETrue; |
|
1051 } |
|
1052 } |
|
1053 else |
|
1054 { |
|
1055 available = ETrue; |
|
1056 } |
|
1057 } |
|
1058 |
|
1059 delete fieldFilter; |
|
1060 delete fieldTypeSelector; |
|
1061 } |
|
1062 |
|
1063 CCoeEnv::Static()->DeleteResourceFile( offset ); |
|
1064 |
|
1065 return available; |
|
1066 } |
|
1067 |
|
1068 // --------------------------------------------------------------------------- |
|
1069 // CFscActionUtils::Is3GNetworkAvailable |
|
1070 // --------------------------------------------------------------------------- |
|
1071 // |
|
1072 TBool CFscActionUtils::Is3GNetworkAvailable() |
|
1073 { |
|
1074 FUNC_LOG; |
|
1075 TInt err = KErrNone; |
|
1076 TBool available( EFalse ); |
|
1077 |
|
1078 TInt networkMode = ENWNetworkModeGsm; |
|
1079 err = RProperty::Get( KPSUidNetworkInfo, KNWTelephonyNetworkMode, |
|
1080 networkMode ); |
|
1081 |
|
1082 if ( err == KErrNone && networkMode == ENWNetworkModeWcdma ) |
|
1083 { |
|
1084 available = FeatureManager::FeatureSupported( |
|
1085 KFeatureIdProtocolWcdma ); |
|
1086 } |
|
1087 |
|
1088 return available; |
|
1089 } |
|
1090 |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // CFscActionUtils::IsOfflineModeL |
|
1093 // --------------------------------------------------------------------------- |
|
1094 // |
|
1095 TBool CFscActionUtils::IsOfflineModeL() |
|
1096 { |
|
1097 FUNC_LOG; |
|
1098 TBool mode( EFalse ); |
|
1099 TInt status = ECoreAppUIsNetworkConnectionAllowed; |
|
1100 |
|
1101 CRepository* cenRep = CRepository::NewL( KCRUidCoreApplicationUIs ); |
|
1102 if ( cenRep ) |
|
1103 { |
|
1104 cenRep->Get( KCoreAppUIsNetworkConnectionAllowed, status ); |
|
1105 } |
|
1106 delete cenRep; |
|
1107 |
|
1108 if ( status == ECoreAppUIsNetworkConnectionNotAllowed ) |
|
1109 { |
|
1110 mode = ETrue; |
|
1111 } |
|
1112 |
|
1113 return mode; |
|
1114 } |
|
1115 |
|
1116 // --------------------------------------------------------------------------- |
|
1117 // CFscActionUtils::IsPttConfiguredL |
|
1118 // --------------------------------------------------------------------------- |
|
1119 // |
|
1120 TBool CFscActionUtils::IsPttConfiguredL() |
|
1121 { |
|
1122 FUNC_LOG; |
|
1123 |
|
1124 TBool result = EFalse; |
|
1125 |
|
1126 // Check configuration status from cenrep. |
|
1127 // If configuration status can not be found EFalse is returned. |
|
1128 CRepository* cenRep= NULL; |
|
1129 TRAPD( err, cenRep = CRepository::NewL( KPoCOmaServerUid ) ) ; |
|
1130 if ( err == KErrNone ) |
|
1131 { |
|
1132 TInt settingsId; |
|
1133 TInt err = cenRep->Get( KPoCDefaultSettings, settingsId ); |
|
1134 if ( err == KErrNone ) |
|
1135 { |
|
1136 result = (settingsId != KErrNotFound ); |
|
1137 } |
|
1138 delete cenRep; |
|
1139 } |
|
1140 |
|
1141 return result; |
|
1142 } |
|
1143 |
|
1144 // --------------------------------------------------------------------------- |
|
1145 // CFscActionUtils::IsVoipConfiguredL |
|
1146 // --------------------------------------------------------------------------- |
|
1147 // |
|
1148 TBool CFscActionUtils::IsVoipConfiguredL() |
|
1149 { |
|
1150 FUNC_LOG; |
|
1151 |
|
1152 TBool configured = EFalse; |
|
1153 if ( iRCSEProfileRegistry != NULL ) |
|
1154 { |
|
1155 RArray<TUint32> ids; |
|
1156 CleanupClosePushL( ids ); |
|
1157 //<cmail> |
|
1158 //iRCSEProfileRegistry->GetAllIdsL( ids ); |
|
1159 //</cmail> |
|
1160 configured = ids.Count() > 0; |
|
1161 CleanupStack::PopAndDestroy( &ids ); |
|
1162 } |
|
1163 |
|
1164 return configured; |
|
1165 } |
|
1166 |
|
1167 // --------------------------------------------------------------------------- |
|
1168 // CFscActionUtils::SkinIconL |
|
1169 // --------------------------------------------------------------------------- |
|
1170 // |
|
1171 CGulIcon* CFscActionUtils::SkinIconL( TAknsItemID aItemId, |
|
1172 const TDesC& aFilename, TInt aFileBitmapId, TInt aFileMaskId ) |
|
1173 { |
|
1174 FUNC_LOG; |
|
1175 CGulIcon* returnIcon( NULL ); |
|
1176 CFbsBitmap* bitmap( NULL ); |
|
1177 CFbsBitmap* mask( NULL ); |
|
1178 |
|
1179 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1180 AknsUtils::CreateIconL( skin, aItemId, bitmap, mask, aFilename, |
|
1181 aFileBitmapId, aFileMaskId ); |
|
1182 |
|
1183 CleanupStack::PushL( mask ); |
|
1184 CleanupStack::PushL( bitmap ); |
|
1185 returnIcon = CGulIcon::NewL( bitmap, mask ); |
|
1186 CleanupStack::Pop( bitmap ); |
|
1187 CleanupStack::Pop( mask ); |
|
1188 |
|
1189 return returnIcon; |
|
1190 } |
|
1191 |
|
1192 // --------------------------------------------------------------------------- |
|
1193 // CFscActionUtils::ActionPriority |
|
1194 // --------------------------------------------------------------------------- |
|
1195 // |
|
1196 TInt CFscActionUtils::ActionPriority( TUint32 aActionPriorityCrKey, |
|
1197 TInt aDefaultPriority ) |
|
1198 { |
|
1199 FUNC_LOG; |
|
1200 TInt result; |
|
1201 TInt error = KErrNotFound; |
|
1202 |
|
1203 if ( iRep != NULL ) |
|
1204 { |
|
1205 // Get() returns KErrNone if successful |
|
1206 error = iRep->Get( aActionPriorityCrKey, result ); |
|
1207 } |
|
1208 |
|
1209 if ( error ) |
|
1210 { |
|
1211 result = aDefaultPriority; |
|
1212 } |
|
1213 |
|
1214 return result; |
|
1215 } |
|
1216 |
|
1217 // --------------------------------------------------------------------------- |
|
1218 // CFscActionUtils::CreateActionL |
|
1219 // --------------------------------------------------------------------------- |
|
1220 // |
|
1221 CFscContactAction* CFscActionUtils::CreateActionL( |
|
1222 MFscReasonCallback& aReasonCallback, TUid aContactActionUid, |
|
1223 TUint64 aActionType, TInt aActionMenuTextResourceId, CGulIcon* aIcon ) |
|
1224 { |
|
1225 FUNC_LOG; |
|
1226 CFscContactAction* contactAction = CFscContactAction::NewL( |
|
1227 aReasonCallback, aContactActionUid, aActionType, |
|
1228 aActionMenuTextResourceId, aIcon ); |
|
1229 |
|
1230 return contactAction; |
|
1231 } |
|
1232 |
|
1233 // --------------------------------------------------------------------------- |
|
1234 // CFscActionUtils::CFscActionUtils |
|
1235 // --------------------------------------------------------------------------- |
|
1236 // |
|
1237 CFscActionUtils::CFscActionUtils( CVPbkContactManager& aContactManager ) : |
|
1238 iContactManager( aContactManager ) |
|
1239 { |
|
1240 FUNC_LOG; |
|
1241 } |
|
1242 |
|
1243 // --------------------------------------------------------------------------- |
|
1244 // CFscActionUtils::ConstructL |
|
1245 // --------------------------------------------------------------------------- |
|
1246 // |
|
1247 void CFscActionUtils::ConstructL() |
|
1248 { |
|
1249 FUNC_LOG; |
|
1250 TRAP_IGNORE( iRep = CRepository::NewL( KCRUidFsContactActionService ) ); |
|
1251 |
|
1252 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
1253 { |
|
1254 //<cmail> |
|
1255 //TRAP_IGNORE( iRCSEProfileRegistry = CRCSEProfileRegistry::NewL() ); |
|
1256 //</cmail> |
|
1257 } |
|
1258 |
|
1259 //<cmail> |
|
1260 iRCSEProfileRegistry = NULL; |
|
1261 //</cmail> |
|
1262 |
|
1263 } |
|
1264 |
|
1265 // --------------------------------------------------------------------------- |
|
1266 // CFscActionUtils::GetFileDir |
|
1267 // --------------------------------------------------------------------------- |
|
1268 // |
|
1269 TPtrC CFscActionUtils::GetFileDirL( const TDesC& aFilePath ) |
|
1270 { |
|
1271 FUNC_LOG; |
|
1272 if ( iLetterDrive.Size() == 0 ) |
|
1273 { |
|
1274 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
|
1275 const TUid applUid = eikonEnv->EikAppUi()->Application()->AppDllUid(); |
|
1276 RApaLsSession ls; |
|
1277 TApaAppInfo appInfo; |
|
1278 User::LeaveIfError( ls.Connect() ); |
|
1279 User::LeaveIfError( ls.GetAppInfo( appInfo, applUid ) ); |
|
1280 // Extract application drive, path, name and extension |
|
1281 const TFileName appFullName = appInfo.iFullName; |
|
1282 ls.Close(); |
|
1283 TParse appNameParse; |
|
1284 User::LeaveIfError( appNameParse.Set( appFullName, NULL, NULL ) ); |
|
1285 iLetterDrive = appNameParse.Drive(); |
|
1286 } |
|
1287 TFileName fileName; |
|
1288 fileName.Append( iLetterDrive ); |
|
1289 fileName.Append( aFilePath ); |
|
1290 |
|
1291 return fileName; |
|
1292 } |
|
1293 |
|
1294 // Fix for EMZG-7M23KX |
|
1295 // --------------------------------------------------------------------------- |
|
1296 // CFscActionUtils::FindAndAddResourceFileL |
|
1297 // --------------------------------------------------------------------------- |
|
1298 // |
|
1299 TInt CFscActionUtils::FindAndAddResourceFileL() |
|
1300 { |
|
1301 FUNC_LOG; |
|
1302 //<cmail> hardcoded removed |
|
1303 TFileName resourceFileName( KDC_RESOURCE_FILES_DIR ); |
|
1304 resourceFileName.Append(KFscRscFileName); |
|
1305 //</cmail> |
|
1306 BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName ); |
|
1307 TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName ); |
|
1308 |
|
1309 return offset; |
|
1310 } |
|
1311 // --------------------------------------------------------------------------- |
|
1312 // CFscActionUtils::CloseSelectDialogL |
|
1313 // --------------------------------------------------------------------------- |
|
1314 // |
|
1315 void CFscActionUtils::CloseSelectDialogL() |
|
1316 { |
|
1317 FUNC_LOG; |
|
1318 if ( iAddressSelect ) |
|
1319 { |
|
1320 iAddressSelect->AttemptExitL( EFalse ); |
|
1321 } |
|
1322 } |
|
1323 |
|
1324 |
|
1325 // ======== GLOBAL FUNCTIONS ======== |
|
1326 |