|
1 /* |
|
2 * Copyright (c) 2008-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 which takes care of placing the correct texts in the header |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "ccappcommlauncherheaders.h" |
|
19 #include "cmscontact.h" |
|
20 #include <Pbk2PresentationUtils.h> |
|
21 #include <Pbk2Presentation.rsg> |
|
22 #include <RPbk2LocalizedResourceFile.h> |
|
23 #include <Pbk2DataCaging.hrh> |
|
24 |
|
25 const TInt KContactTypeNotSet = -1; |
|
26 |
|
27 namespace { |
|
28 |
|
29 /// These enumerations must have same values as in the specification |
|
30 /// and in the qtn_phob_name_order. These are different compared to |
|
31 /// TPbk2NameOrderInCenRep because TPbk2NameOrderInCenRep values |
|
32 /// must be same as in old PbkEng TPbkNameOrder to keep data compatibility |
|
33 /// of the CenRep. |
|
34 enum TPbk2NameOrderInUiSpecification |
|
35 { |
|
36 EPbk2UiSpecFirstNameLastName, |
|
37 EPbk2UiSpecLastNameFirstName |
|
38 }; |
|
39 |
|
40 #ifdef _DEBUG |
|
41 |
|
42 enum TPanicCode |
|
43 { |
|
44 EPanicInvalidNameConfiguration |
|
45 }; |
|
46 |
|
47 void Panic(TPanicCode aReason) |
|
48 { |
|
49 _LIT(KPanicText, "CPbk2SortOrderManagerImpl"); |
|
50 User::Panic(KPanicText,aReason); |
|
51 } |
|
52 |
|
53 #endif // _DEBUG |
|
54 |
|
55 /** |
|
56 * Gets a digit from a descriptor. |
|
57 * |
|
58 * @param aReaderToBuf Resource reader pointed to a descriptor resource. |
|
59 * @return The digit. |
|
60 */ |
|
61 TInt GetDigitFromDescriptorL( TResourceReader& aReaderToBuf ) |
|
62 { |
|
63 HBufC* orderBuf = aReaderToBuf.ReadHBufCL(); |
|
64 CleanupStack::PushL( orderBuf ); |
|
65 |
|
66 // The setting should be 1 digit |
|
67 __ASSERT_DEBUG( orderBuf->Length() == 1, |
|
68 Panic( EPanicInvalidNameConfiguration ) ); |
|
69 |
|
70 TInt result = KErrNotFound; |
|
71 TPtrC ptr( orderBuf->Des() ); |
|
72 if ( ptr.Length() > 0 && TChar(ptr[0]).IsDigit() ) |
|
73 { |
|
74 result = TChar(ptr[0]).GetNumericValue(); |
|
75 } |
|
76 |
|
77 CleanupStack::PopAndDestroy( orderBuf ); |
|
78 return result; |
|
79 } |
|
80 } // namespace |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // NewL, two-phase construction |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 CCCAppCommLauncherHeaderTextOrder* CCCAppCommLauncherHeaderTextOrder::NewL() |
|
87 { |
|
88 CCCAppCommLauncherHeaderTextOrder* self= new (ELeave) CCCAppCommLauncherHeaderTextOrder(); |
|
89 CleanupStack::PushL(self); |
|
90 self->ConstructL(); |
|
91 CleanupStack::Pop(self); |
|
92 return self; |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // C++ (first phase) constructor |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 CCCAppCommLauncherHeaderTextOrder::CCCAppCommLauncherHeaderTextOrder() |
|
100 { |
|
101 for (TInt i=0; i < KCCAppCommLauncherHeaderTextOrderLastField - KCCAppCommLauncherHeaderTextOrderFirstField + 1; i++) |
|
102 { |
|
103 iGroupPriorities[i] = NULL; |
|
104 iIndividualPriorities[i] = NULL; |
|
105 } |
|
106 |
|
107 // Group 8 |
|
108 SetPriority(CCmsContactFieldItem::ECmsImpp, ETrue, 1); |
|
109 SetPriority(CCmsContactFieldItem::ECmsUrlGeneric, ETrue, 1); |
|
110 SetPriority(CCmsContactFieldItem::ECmsUrlHome, ETrue, 1); |
|
111 SetPriority(CCmsContactFieldItem::ECmsUrlWork, ETrue, 1); |
|
112 SetPriority(CCmsContactFieldItem::ECmsSipAddress, ETrue, 1); |
|
113 SetPriority(CCmsContactFieldItem::ECmsEmailGeneric, ETrue, 1); |
|
114 SetPriority(CCmsContactFieldItem::ECmsEmailHome, ETrue, 1); |
|
115 SetPriority(CCmsContactFieldItem::ECmsEmailWork, ETrue, 1); |
|
116 SetPriority(CCmsContactFieldItem::ECmsMobilePhoneGeneric, ETrue, 1); |
|
117 SetPriority(CCmsContactFieldItem::ECmsMobilePhoneHome, ETrue, 1); |
|
118 SetPriority(CCmsContactFieldItem::ECmsMobilePhoneWork, ETrue, 1); |
|
119 SetPriority(CCmsContactFieldItem::ECmsLandPhoneGeneric, ETrue, 1); |
|
120 SetPriority(CCmsContactFieldItem::ECmsLandPhoneHome, ETrue, 1); |
|
121 SetPriority(CCmsContactFieldItem::ECmsLandPhoneWork, ETrue, 1); |
|
122 SetPriority(CCmsContactFieldItem::ECmsVideoNumberGeneric, ETrue, 1); |
|
123 SetPriority(CCmsContactFieldItem::ECmsVideoNumberHome, ETrue, 1); |
|
124 SetPriority(CCmsContactFieldItem::ECmsVideoNumberWork, ETrue, 1); |
|
125 SetPriority(CCmsContactFieldItem::ECmsAssistantNumber, ETrue, 1); |
|
126 SetPriority(CCmsContactFieldItem::ECmsCarPhone, ETrue, 1); |
|
127 SetPriority(CCmsContactFieldItem::ECmsPagerNumber, ETrue, 1); |
|
128 SetPriority(CCmsContactFieldItem::ECmsPushToTalk, ETrue, 1); |
|
129 SetPriority(CCmsContactFieldItem::ECmsShareView, ETrue, 1); |
|
130 |
|
131 SetPriority(CCmsContactFieldItem::ECmsVoipNumberGeneric, ETrue, 1); |
|
132 |
|
133 SetPriority(CCmsContactFieldItem::ECmsImpp, EFalse, 1); |
|
134 |
|
135 SetPriority(CCmsContactFieldItem::ECmsUrlWork, EFalse, 2); |
|
136 SetPriority(CCmsContactFieldItem::ECmsUrlHome, EFalse, 3); |
|
137 SetPriority(CCmsContactFieldItem::ECmsUrlGeneric, EFalse, 4); |
|
138 |
|
139 SetPriority(CCmsContactFieldItem::ECmsSipAddress, EFalse, 5); |
|
140 SetPriority(CCmsContactFieldItem::ECmsShareView, EFalse, 6); |
|
141 SetPriority(CCmsContactFieldItem::ECmsPushToTalk, EFalse, 7); |
|
142 |
|
143 SetPriority(CCmsContactFieldItem::ECmsEmailWork, EFalse, 8); |
|
144 SetPriority(CCmsContactFieldItem::ECmsEmailHome, EFalse, 9); |
|
145 SetPriority(CCmsContactFieldItem::ECmsEmailGeneric, EFalse, 10); |
|
146 |
|
147 SetPriority(CCmsContactFieldItem::ECmsAssistantNumber, EFalse, 11); |
|
148 SetPriority(CCmsContactFieldItem::ECmsPagerNumber, EFalse, 12); |
|
149 SetPriority(CCmsContactFieldItem::ECmsVideoNumberWork, EFalse, 13); |
|
150 SetPriority(CCmsContactFieldItem::ECmsVideoNumberHome, EFalse, 14); |
|
151 SetPriority(CCmsContactFieldItem::ECmsVideoNumberGeneric, EFalse, 15); |
|
152 SetPriority(CCmsContactFieldItem::ECmsCarPhone, EFalse, 16); |
|
153 SetPriority(CCmsContactFieldItem::ECmsLandPhoneWork, EFalse, 17); |
|
154 SetPriority(CCmsContactFieldItem::ECmsLandPhoneHome, EFalse, 18); |
|
155 SetPriority(CCmsContactFieldItem::ECmsLandPhoneGeneric, EFalse, 19); |
|
156 SetPriority(CCmsContactFieldItem::ECmsMobilePhoneWork, EFalse, 20); |
|
157 SetPriority(CCmsContactFieldItem::ECmsMobilePhoneHome, EFalse, 21); |
|
158 SetPriority(CCmsContactFieldItem::ECmsMobilePhoneGeneric, EFalse, 22); |
|
159 |
|
160 |
|
161 // Group 7 |
|
162 SetPriority(CCmsContactFieldItem::ECmsLastName, ETrue, 2); |
|
163 SetPriority(CCmsContactFieldItem::ECmsMiddleName, ETrue, 2); |
|
164 SetPriority(CCmsContactFieldItem::ECmsFirstName, ETrue, 2); |
|
165 |
|
166 SetPriority(CCmsContactFieldItem::ECmsLastName, EFalse, 1); |
|
167 SetPriority(CCmsContactFieldItem::ECmsMiddleName, EFalse, 2); |
|
168 SetPriority(CCmsContactFieldItem::ECmsFirstName, EFalse, 3); |
|
169 |
|
170 |
|
171 // Group 6 |
|
172 SetPriority(CCmsContactFieldItem::ECmsAddrCountryGeneric, ETrue, 3); |
|
173 SetPriority(CCmsContactFieldItem::ECmsAddrRegionGeneric, ETrue, 3); |
|
174 SetPriority(CCmsContactFieldItem::ECmsAddrLocalGeneric, ETrue, 3); |
|
175 SetPriority(CCmsContactFieldItem::ECmsAddrStreetGeneric, ETrue, 3); |
|
176 |
|
177 SetPriority(CCmsContactFieldItem::ECmsAddrCountryGeneric, EFalse, 1); |
|
178 SetPriority(CCmsContactFieldItem::ECmsAddrRegionGeneric, EFalse, 2); |
|
179 SetPriority(CCmsContactFieldItem::ECmsAddrLocalGeneric, EFalse, 3); |
|
180 SetPriority(CCmsContactFieldItem::ECmsAddrStreetGeneric, EFalse, 4); |
|
181 |
|
182 |
|
183 // Group 5 |
|
184 SetPriority(CCmsContactFieldItem::ECmsAddrCountryWork, ETrue, 4); |
|
185 SetPriority(CCmsContactFieldItem::ECmsAddrRegionWork, ETrue, 4); |
|
186 SetPriority(CCmsContactFieldItem::ECmsAddrLocalWork, ETrue, 4); |
|
187 SetPriority(CCmsContactFieldItem::ECmsAddrStreetWork, ETrue, 4); |
|
188 |
|
189 SetPriority(CCmsContactFieldItem::ECmsAddrCountryWork, EFalse, 1); |
|
190 SetPriority(CCmsContactFieldItem::ECmsAddrRegionWork, EFalse, 2); |
|
191 SetPriority(CCmsContactFieldItem::ECmsAddrLocalWork, EFalse, 3); |
|
192 SetPriority(CCmsContactFieldItem::ECmsAddrStreetWork, EFalse, 4); |
|
193 |
|
194 |
|
195 // Group 4 |
|
196 SetPriority(CCmsContactFieldItem::ECmsAddrCountryHome, ETrue, 5); |
|
197 SetPriority(CCmsContactFieldItem::ECmsAddrRegionHome, ETrue, 5); |
|
198 SetPriority(CCmsContactFieldItem::ECmsAddrLocalHome, ETrue, 5); |
|
199 SetPriority(CCmsContactFieldItem::ECmsAddrStreetHome, ETrue, 5); |
|
200 |
|
201 SetPriority(CCmsContactFieldItem::ECmsAddrCountryHome, EFalse, 1); |
|
202 SetPriority(CCmsContactFieldItem::ECmsAddrRegionHome, EFalse, 2); |
|
203 SetPriority(CCmsContactFieldItem::ECmsAddrLocalHome, EFalse, 3); |
|
204 SetPriority(CCmsContactFieldItem::ECmsAddrStreetHome, EFalse, 4); |
|
205 |
|
206 |
|
207 // Group 3 (prio 6) |
|
208 SetPriority(CCmsContactFieldItem::ECmsDepartment, ETrue, 6); |
|
209 SetPriority(CCmsContactFieldItem::ECmsCompanyName, ETrue, 6); |
|
210 SetPriority(CCmsContactFieldItem::ECmsJobTitle, ETrue, 6); |
|
211 SetPriority(CCmsContactFieldItem::ECmsNickname, ETrue, 6); |
|
212 |
|
213 SetPriority(CCmsContactFieldItem::ECmsDepartment, EFalse, 1); |
|
214 SetPriority(CCmsContactFieldItem::ECmsCompanyName, EFalse, 2); |
|
215 SetPriority(CCmsContactFieldItem::ECmsJobTitle, EFalse, 3); |
|
216 SetPriority(CCmsContactFieldItem::ECmsNickname, EFalse, 4); |
|
217 |
|
218 |
|
219 // Group 1 (prio 7) |
|
220 SetPriority(CCmsContactFieldItem::ECmsNote, ETrue, 7); |
|
221 |
|
222 SetPriority(CCmsContactFieldItem::ECmsNote, EFalse, 1); |
|
223 |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // Helper function for reading a descriptor from repository |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 HBufC* GetStringFromRepoLC(CRepository* aRepository, TUint32 aKey) |
|
231 { |
|
232 HBufC* prioStr = HBufC::NewLC(NCentralRepositoryConstants::KMaxUnicodeStringLength); |
|
233 TInt trueLength = 0; |
|
234 TPtr ptr = prioStr->Des(); |
|
235 TInt error = aRepository->Get(aKey, ptr, trueLength); |
|
236 if (error == KErrOverflow) |
|
237 { |
|
238 CleanupStack::PopAndDestroy(prioStr); |
|
239 prioStr = HBufC::NewLC(trueLength); |
|
240 User::LeaveIfError(aRepository->Get(aKey, ptr)); |
|
241 } |
|
242 else if (error != KErrNone) |
|
243 { |
|
244 #ifdef _DEBUG |
|
245 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherHeaderTextOrder::getStringFromRepoLC - Header text priority variation error (repository field)")); |
|
246 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherHeaderTextOrder::getStringFromRepoLC - err: %d"), error ); |
|
247 CEikonEnv::Static()->InfoMsg(_L("Header text priority variation error. See logs.")); |
|
248 #endif//_DEBUG |
|
249 CleanupStack::PopAndDestroy(prioStr); |
|
250 return 0; |
|
251 } |
|
252 return prioStr; |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // ConstructL, second phase constructor |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 void CCCAppCommLauncherHeaderTextOrder::ConstructL() |
|
260 { |
|
261 for (TInt i = 0; i < KCCAppCommLauncherHeaderTextOrderLineCount; i++) |
|
262 { |
|
263 iHeaderRows.AppendL(0); |
|
264 iHeaderRowsClipped.AppendL(0); |
|
265 iHeaderTypes[i] = KContactTypeNotSet; |
|
266 } |
|
267 |
|
268 CRepository* prioOrderRepo = CRepository::NewLC(KCRUidCCACommLauncher); |
|
269 HBufC* prioStr = 0; |
|
270 |
|
271 HBufC* prioStr1 = GetStringFromRepoLC(prioOrderRepo, KHeaderGroupPriorities); |
|
272 User::LeaveIfNull(prioStr1); |
|
273 |
|
274 HBufC* prioStr2 = GetStringFromRepoLC(prioOrderRepo, KHeaderGroupPriorities2); |
|
275 if (prioStr2) |
|
276 { |
|
277 prioStr = HBufC::NewL(prioStr1->Length() + prioStr2->Length()); |
|
278 prioStr->Des().Append(*prioStr1); |
|
279 prioStr->Des().Append(*prioStr2); |
|
280 CleanupStack::PopAndDestroy(prioStr2); |
|
281 CleanupStack::PopAndDestroy(prioStr1); |
|
282 CleanupStack::PushL(prioStr); |
|
283 } |
|
284 else |
|
285 { |
|
286 prioStr = prioStr1; |
|
287 } |
|
288 |
|
289 |
|
290 TLex groupPrioLex(*prioStr); |
|
291 while (groupPrioLex.Offset() < prioStr->Length() - 1) |
|
292 { |
|
293 TPtrC nameToken = groupPrioLex.NextToken(); |
|
294 CCmsContactFieldItem::TCmsContactField type; |
|
295 if (MapStringToContactField(nameToken, type) == KErrNone) |
|
296 { |
|
297 TPtrC numToken = groupPrioLex.NextToken(); |
|
298 TPtrC numToken2 = groupPrioLex.NextToken(); |
|
299 TLex groupPrioNumLex(numToken); |
|
300 TLex individualPrioNumLex(numToken2); |
|
301 TInt priority = 0; |
|
302 if (groupPrioNumLex.Val(priority) == KErrNone) |
|
303 { |
|
304 SetPriority(type, ETrue, priority); |
|
305 } |
|
306 #ifdef _DEBUG_ |
|
307 else |
|
308 { |
|
309 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherHeaderTextOrder::ConstructL - Priority value is not a number: %S"), &numToken ); |
|
310 CEikonEnv::Static()->InfoMsg(_L("Header text priority variation error. See logs.")); |
|
311 } |
|
312 #endif //_DEBUG_ |
|
313 if (individualPrioNumLex.Val(priority) == KErrNone) |
|
314 { |
|
315 SetPriority(type, EFalse, priority); |
|
316 } |
|
317 #ifdef _DEBUG_ |
|
318 else |
|
319 { |
|
320 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherHeaderTextOrder::ConstructL - Priority value is not a number: %S"), &numToken ); |
|
321 CEikonEnv::Static()->InfoMsg(_L("Header text priority variation error. See logs.")); |
|
322 } |
|
323 #endif //_DEBUG_ |
|
324 } |
|
325 #ifdef _DEBUG |
|
326 else |
|
327 { |
|
328 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherHeaderTextOrder::ConstructL - Header text priority variation, field name not recognized)")); |
|
329 CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherHeaderTextOrder::ConstructL - field name: %S"), &nameToken ); |
|
330 } |
|
331 #endif //_DEBUG |
|
332 } |
|
333 CleanupStack::PopAndDestroy(prioStr); |
|
334 |
|
335 CleanupStack::PopAndDestroy(prioOrderRepo); |
|
336 |
|
337 // Open resource file for reading language specific default values |
|
338 RPbk2LocalizedResourceFile resFile; |
|
339 resFile.OpenLC( KPbk2RomFileDrive, |
|
340 KDC_RESOURCE_FILES_DIR, |
|
341 Pbk2PresentationUtils::PresentationResourceFile() ); |
|
342 |
|
343 // Read the name order value from the resource file |
|
344 TResourceReader reader; |
|
345 reader.SetBuffer( resFile.AllocReadLC( R_QTN_PHOB_NAME_ORDER ) ); |
|
346 TInt orderInResFile = GetDigitFromDescriptorL( reader ); |
|
347 CleanupStack::PopAndDestroy(); // reader |
|
348 |
|
349 CleanupStack::PopAndDestroy(); // resFile |
|
350 |
|
351 // Converting from TPbk2NameOrderInUiSpecification to TPbk2NameOrderInCenRep |
|
352 TInt orderInCenRep = EPbk2CenRepNameOrderUndefined; |
|
353 |
|
354 CRepository* sortOrderSettings = CRepository::NewLC(TUid::Uid(KCRUidPhonebook)); |
|
355 sortOrderSettings->Get(KPhonebookNameOrdering, orderInCenRep); |
|
356 |
|
357 switch ( orderInResFile ) |
|
358 { |
|
359 case EPbk2UiSpecLastNameFirstName: |
|
360 { |
|
361 orderInCenRep = EPbk2CenRepLastNameFirstName; |
|
362 break; |
|
363 } |
|
364 |
|
365 case EPbk2UiSpecFirstNameLastName: // FALL THROUGH |
|
366 |
|
367 // If the name order is not defined in the UI Specification, |
|
368 // and... |
|
369 default: |
|
370 { |
|
371 // ... also not defined in the CenRep, |
|
372 // then use the "First Name" "Last Name" order |
|
373 // for most number of languages. |
|
374 if ( EPbk2CenRepNameOrderUndefined == orderInCenRep ) |
|
375 { |
|
376 orderInCenRep = EPbk2CenRepFirstNameLastName; |
|
377 } |
|
378 break; |
|
379 } |
|
380 |
|
381 } // end switch |
|
382 |
|
383 if (orderInCenRep == EPbk2CenRepLastNameFirstName) |
|
384 { |
|
385 SetPriority(CCmsContactFieldItem::ECmsMiddleName, EFalse, 1); |
|
386 SetPriority(CCmsContactFieldItem::ECmsFirstName, EFalse, 2); |
|
387 SetPriority(CCmsContactFieldItem::ECmsLastName, EFalse, 3); |
|
388 } |
|
389 else |
|
390 { |
|
391 SetPriority(CCmsContactFieldItem::ECmsFirstName, EFalse, 3); |
|
392 SetPriority(CCmsContactFieldItem::ECmsMiddleName, EFalse, 2); |
|
393 SetPriority(CCmsContactFieldItem::ECmsLastName, EFalse, 1); |
|
394 } |
|
395 |
|
396 CleanupStack::PopAndDestroy(sortOrderSettings); |
|
397 } |
|
398 |
|
399 // --------------------------------------------------------------------------- |
|
400 // Destructor |
|
401 // --------------------------------------------------------------------------- |
|
402 // |
|
403 CCCAppCommLauncherHeaderTextOrder::~CCCAppCommLauncherHeaderTextOrder() |
|
404 { |
|
405 iHeaderRows.ResetAndDestroy(); |
|
406 iHeaderRowsClipped.ResetAndDestroy(); |
|
407 delete iCurrentDbName; |
|
408 } |
|
409 |
|
410 // --------------------------------------------------------------------------- |
|
411 // CCCAppCommLauncherHeaderTextOrder::SetPriority |
|
412 // --------------------------------------------------------------------------- |
|
413 // |
|
414 void CCCAppCommLauncherHeaderTextOrder::SetPriority(CCmsContactFieldItem::TCmsContactField aContactField, TBool aGroup, TInt aPriority) |
|
415 { |
|
416 if (aGroup) |
|
417 { |
|
418 iGroupPriorities[aContactField - KCCAppCommLauncherHeaderTextOrderFirstField] = aPriority; |
|
419 } |
|
420 else |
|
421 { |
|
422 iIndividualPriorities[aContactField - KCCAppCommLauncherHeaderTextOrderFirstField] = aPriority; |
|
423 } |
|
424 } |
|
425 |
|
426 // --------------------------------------------------------------------------- |
|
427 // CCCAppCommLauncherHeaderTextOrder::GetPriority |
|
428 // --------------------------------------------------------------------------- |
|
429 // |
|
430 TInt CCCAppCommLauncherHeaderTextOrder::GetPriority(CCmsContactFieldItem::TCmsContactField aContactField, TBool aGroup) |
|
431 { |
|
432 if (aGroup) |
|
433 { |
|
434 return iGroupPriorities[aContactField - KCCAppCommLauncherHeaderTextOrderFirstField]; |
|
435 } |
|
436 else |
|
437 { |
|
438 return iIndividualPriorities[aContactField - KCCAppCommLauncherHeaderTextOrderFirstField]; |
|
439 } |
|
440 } |
|
441 |
|
442 |
|
443 // --------------------------------------------------------------------------- |
|
444 // CCCAppCommLauncherHeaderTextOrder::GetTextForRow |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 const TDesC& CCCAppCommLauncherHeaderTextOrder::GetTextForRow(TInt aRow) |
|
448 { |
|
449 if (aRow >= 0 && aRow < iHeaderRowsClipped.Count() && aRow < iHeaderRows.Count()) |
|
450 { |
|
451 if (iHeaderRowsClipped[aRow]) |
|
452 { |
|
453 TPtr ptr(iHeaderRowsClipped[aRow]->Des()); |
|
454 // Replace characters that can not be displayed correctly. |
|
455 Pbk2PresentationUtils::ReplaceNonGraphicCharacters(ptr, ' '); |
|
456 return *iHeaderRowsClipped[aRow]; |
|
457 } |
|
458 else if (iHeaderRows[aRow]) |
|
459 { |
|
460 TPtr ptr(iHeaderRows[aRow]->Des()); |
|
461 Pbk2PresentationUtils::ReplaceNonGraphicCharacters(ptr, ' '); |
|
462 return *iHeaderRows[aRow]; |
|
463 } |
|
464 } |
|
465 return KNullDesC(); |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------------------------- |
|
469 // CCCAppCommLauncherHeaderTextOrder::SelectContactFieldL |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 void CCCAppCommLauncherHeaderTextOrder::SelectContactFieldL( |
|
473 const CCmsContactField& aContactField, |
|
474 TInt aTopGroupPriority) |
|
475 { |
|
476 CCmsContactFieldItem::TCmsContactField type = aContactField.Type(); |
|
477 const RPointerArray<CCmsContactFieldItem>& fields = aContactField.Items(); |
|
478 |
|
479 for (TInt i=0; i < fields.Count(); i++) |
|
480 { |
|
481 for (TInt i2 = 0; i2 < KCCAppCommLauncherHeaderTextOrderLineCount; i2++) |
|
482 { |
|
483 if ( GetPriority(type, ETrue) == aTopGroupPriority && |
|
484 (iHeaderTypes[i2] < 0 || GetPriority(type, EFalse) > GetPriority((CCmsContactFieldItem::TCmsContactField)iHeaderTypes[i2], EFalse)) ) |
|
485 { |
|
486 if(StrippedLengthL(*fields[i])) //Skip blank fields |
|
487 { |
|
488 TInt typeMem = KContactTypeNotSet; |
|
489 for (TInt i3 = i2; i3 < KCCAppCommLauncherHeaderTextOrderLineCount; i3++) |
|
490 { |
|
491 TInt typeTemp = iHeaderTypes[i3]; |
|
492 iHeaderTypes[i3] = typeMem; |
|
493 typeMem = typeTemp; |
|
494 } |
|
495 iHeaderTypes[i2] = type; |
|
496 break; |
|
497 } |
|
498 } |
|
499 } |
|
500 } |
|
501 } |
|
502 |
|
503 // --------------------------------------------------------------------------- |
|
504 // CCCAppCommLauncherHeaderTextOrder::ProcessContactFieldsL |
|
505 // --------------------------------------------------------------------------- |
|
506 // |
|
507 void CCCAppCommLauncherHeaderTextOrder::ProcessContactFieldsL( |
|
508 RArray<CCmsContactField> aCmsContactFields) |
|
509 { |
|
510 TInt topGroupPriority = 0; |
|
511 delete iCurrentDbName; |
|
512 iCurrentDbName = NULL; |
|
513 TInt count = aCmsContactFields.Count(); |
|
514 TInt i; |
|
515 |
|
516 //1. Get the topmost group of fields containing displayable sdata |
|
517 for(i=0; i < count ; i++ ) |
|
518 { |
|
519 for(TInt j=0; j < aCmsContactFields[i].Items().Count(); j++ ) |
|
520 { |
|
521 CCmsContactFieldItem::TCmsContactField type = aCmsContactFields[i].Type(); |
|
522 if(StrippedLengthL(aCmsContactFields[i].ItemL(j))) |
|
523 { |
|
524 if ( GetPriority(type, ETrue) > topGroupPriority ) |
|
525 { |
|
526 topGroupPriority = GetPriority(type, ETrue); |
|
527 } |
|
528 } |
|
529 } |
|
530 } |
|
531 |
|
532 //2. Select preferred fields from top group |
|
533 for(i=0; i < count ; i++ ) |
|
534 { |
|
535 SelectContactFieldL( aCmsContactFields[i], topGroupPriority ); |
|
536 } |
|
537 if (KCCAppCommLauncherHeaderTextOrderLineCount > 1 && iHeaderTypes[1] == KContactTypeNotSet) |
|
538 { |
|
539 iHeadersWrapped = ETrue; |
|
540 } |
|
541 |
|
542 //3. Process the selected fields |
|
543 for(i=0; i < count ; i++ ) |
|
544 { |
|
545 ProcessContactFieldL( aCmsContactFields[i] ); |
|
546 } |
|
547 } |
|
548 |
|
549 // --------------------------------------------------------------------------- |
|
550 // CCCAppCommLauncherHeaderTextOrder::ProcessContactFieldL |
|
551 // --------------------------------------------------------------------------- |
|
552 // |
|
553 void CCCAppCommLauncherHeaderTextOrder::ProcessContactFieldL(const CCmsContactField& aContactField) |
|
554 { |
|
555 for (TInt i = 0; i < KCCAppCommLauncherHeaderTextOrderLineCount; i++) |
|
556 { |
|
557 if (iHeaderRowsClipped[i]) |
|
558 { |
|
559 delete iHeaderRowsClipped[i]; |
|
560 iHeaderRowsClipped[i] = 0; |
|
561 } |
|
562 if (aContactField.Type() == iHeaderTypes[i] && !iHeaderRows[i]) |
|
563 { |
|
564 //Check is there anything from current database for this header row[i] |
|
565 TInt itemCountForDb = ItemCountForCurrentDbL( aContactField ); |
|
566 if(!itemCountForDb) |
|
567 { |
|
568 //nothing to show, skip this contact field |
|
569 break; |
|
570 } |
|
571 |
|
572 if (itemCountForDb > 1) |
|
573 { |
|
574 iHeadersWrapped = EFalse; |
|
575 |
|
576 HBufC* mem = 0; |
|
577 TInt typeMem = KContactTypeNotSet; |
|
578 for (TInt i2 = i + itemCountForDb-1; i2 < KCCAppCommLauncherHeaderTextOrderLineCount; i2++) |
|
579 { |
|
580 HBufC* temp = iHeaderRows[i2]; |
|
581 TInt typeTemp = iHeaderTypes[i2]; |
|
582 iHeaderRows[i2] = mem; |
|
583 iHeaderTypes[i2] = typeMem; |
|
584 mem = temp; |
|
585 typeMem = typeTemp; |
|
586 } |
|
587 delete mem; |
|
588 } |
|
589 for (unsigned i2 = i; i2 < KCCAppCommLauncherHeaderTextOrderLineCount && i2-i < itemCountForDb; i2++) |
|
590 { |
|
591 //Add only rows from current db |
|
592 TPtrC info = aContactField.ItemL(i2-i).Info(); |
|
593 if( iCurrentDbName && *iCurrentDbName == info ) |
|
594 { |
|
595 iHeaderRows[i2] = aContactField.ItemL(i2-i).Data().AllocL(); |
|
596 iHeaderTypes[i2] = aContactField.Type(); |
|
597 } |
|
598 } |
|
599 break; |
|
600 } |
|
601 } |
|
602 } |
|
603 |
|
604 // --------------------------------------------------------------------------- |
|
605 // CCCAppCommLauncherHeaderTextOrder::StrippedLengthL |
|
606 // --------------------------------------------------------------------------- |
|
607 // |
|
608 TInt CCCAppCommLauncherHeaderTextOrder::StrippedLengthL( |
|
609 const CCmsContactFieldItem& aCmsContactFieldItem) |
|
610 { |
|
611 HBufC* buf1 = aCmsContactFieldItem.Data().AllocLC(); |
|
612 TPtr buf1Ptr = buf1->Des(); |
|
613 buf1Ptr.TrimAll(); |
|
614 |
|
615 DeleteCharL(buf1Ptr, 0x000d); //KCarriageReturn = 0x000d |
|
616 DeleteCharL(buf1Ptr, 0x000a); //KLineFeed = 0x000a |
|
617 buf1Ptr.TrimAll(); //if any whitespace left after first trim... |
|
618 |
|
619 TInt strippedLength = buf1Ptr.Length(); |
|
620 CleanupStack::PopAndDestroy(buf1); |
|
621 return strippedLength; |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------------------------- |
|
625 // CCCAppCommLauncherHeaderTextOrder::ProcessContactFieldsL |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 void CCCAppCommLauncherHeaderTextOrder::DeleteCharL(TDes& aDest, TChar aChar) |
|
629 { |
|
630 TBuf<1> str; |
|
631 str.Append(aChar); |
|
632 |
|
633 TInt delPos = aDest.Find(str); |
|
634 while( delPos != KErrNotFound ) |
|
635 { |
|
636 aDest.Delete(delPos, 1); |
|
637 delPos = aDest.Find(str); |
|
638 } |
|
639 } |
|
640 |
|
641 // --------------------------------------------------------------------------- |
|
642 // CCCAppCommLauncherHeaderTextOrder::ItemCountForCurrentDbL |
|
643 // --------------------------------------------------------------------------- |
|
644 // |
|
645 TInt CCCAppCommLauncherHeaderTextOrder::ItemCountForCurrentDbL( |
|
646 const CCmsContactField& aContactField ) |
|
647 { |
|
648 TInt ret(0); |
|
649 |
|
650 for(TInt i=0; i < aContactField.ItemCount(); i++ ) |
|
651 { |
|
652 if( !iCurrentDbName ) |
|
653 { |
|
654 //From now on accept only data from this database |
|
655 iCurrentDbName = aContactField.ItemL(i).Info().AllocL(); |
|
656 } |
|
657 |
|
658 TPtrC info = aContactField.ItemL(i).Info(); |
|
659 if( *iCurrentDbName == info ) |
|
660 { |
|
661 ret++; |
|
662 } |
|
663 } |
|
664 return ret; |
|
665 } |
|
666 |
|
667 // --------------------------------------------------------------------------- |
|
668 // CCCAppCommLauncherHeaderTextOrder::Reset |
|
669 // --------------------------------------------------------------------------- |
|
670 // |
|
671 void CCCAppCommLauncherHeaderTextOrder::Reset() |
|
672 { |
|
673 for (TInt i = 0; i < KCCAppCommLauncherHeaderTextOrderLineCount; i++) |
|
674 { |
|
675 delete iHeaderRows[i]; |
|
676 iHeaderRows[i] = NULL; |
|
677 delete iHeaderRowsClipped[i]; |
|
678 iHeaderRowsClipped[i] = NULL; |
|
679 iHeaderTypes[i] = KContactTypeNotSet; |
|
680 } |
|
681 iHeadersWrapped = EFalse; |
|
682 } |
|
683 |
|
684 // --------------------------------------------------------------------------- |
|
685 // CCCAppCommLauncherHeaderTextOrder::ClipL |
|
686 // --------------------------------------------------------------------------- |
|
687 // |
|
688 void CCCAppCommLauncherHeaderTextOrder::ClipL(const CFont& aFont, TInt aLineWidth) |
|
689 { |
|
690 iHeaderRowsClipped.ResetAndDestroy(); |
|
691 if (iHeadersWrapped && iHeaderRows[0]) |
|
692 { |
|
693 HBufC* textTemp = HBufC::NewLC(iHeaderRows[0]->Length() + 1); |
|
694 CArrayFixFlat<TInt> * lineWidths = new (ELeave) CArrayFixFlat<TInt>(KCCAppCommLauncherHeaderTextOrderLineCount); |
|
695 CleanupStack::PushL(lineWidths); |
|
696 lineWidths->AppendL(aLineWidth); |
|
697 lineWidths->AppendL(aLineWidth); |
|
698 lineWidths->AppendL(aLineWidth); |
|
699 CArrayFixFlat<TPtrC>* lines = new (ELeave) CArrayFixFlat<TPtrC>(KCCAppCommLauncherHeaderTextOrderLineCount); |
|
700 CleanupStack::PushL(lines); |
|
701 TPtr ptr = textTemp->Des(); |
|
702 ptr.Copy(*iHeaderRows[0]); |
|
703 AknTextUtils::WrapToArrayAndClipL(ptr, *lineWidths, aFont, *lines); |
|
704 for (TInt i=0; i < KCCAppCommLauncherHeaderTextOrderLineCount; i++) |
|
705 { |
|
706 if (i < lines->Count()) |
|
707 { |
|
708 iHeaderRowsClipped.AppendL(lines->At(i).AllocL()); |
|
709 } |
|
710 else |
|
711 { |
|
712 iHeaderRowsClipped.AppendL(KNullDesC().AllocL()); |
|
713 } |
|
714 } |
|
715 CleanupStack::PopAndDestroy(3); |
|
716 } |
|
717 else |
|
718 { |
|
719 for (TInt i = 0; i < KCCAppCommLauncherHeaderTextOrderLineCount; i++) |
|
720 { |
|
721 iHeaderRowsClipped.AppendL(0); |
|
722 if (iHeaderRows[i]) |
|
723 { |
|
724 AknTextUtils::TClipDirection clipDirection = MapContactFieldToClipDirection((CCmsContactFieldItem::TCmsContactField)iHeaderTypes[i]); |
|
725 iHeaderRowsClipped[i] = iHeaderRows[i]->AllocL(); |
|
726 TPtr ptr = iHeaderRowsClipped[i]->Des(); |
|
727 AknTextUtils::ClipToFit(ptr, aFont, aLineWidth, clipDirection); |
|
728 } |
|
729 } |
|
730 } |
|
731 } |
|
732 |
|
733 // --------------------------------------------------------------------------- |
|
734 // CCCAppCommLauncherHeaderTextOrder::MapStringToContactField |
|
735 // --------------------------------------------------------------------------- |
|
736 // |
|
737 TInt CCCAppCommLauncherHeaderTextOrder::MapStringToContactField(const TDesC& aDesc, CCmsContactFieldItem::TCmsContactField& aType) |
|
738 { |
|
739 _LIT(KECmsLastName, "ECmsLastName"); |
|
740 _LIT(KECmsMiddleName, "ECmsMiddleName"); |
|
741 _LIT(KECmsFirstName, "ECmsFirstName"); |
|
742 _LIT(KECmsUndefined, "ECmsUndefined"); |
|
743 _LIT(KECmsPresenceData, "ECmsPresenceData"); |
|
744 _LIT(KECmsBrandedAvailability, "ECmsBrandedAvailability"); |
|
745 _LIT(KECmsThumbnailPic, "ECmsThumbnailPic"); |
|
746 _LIT(KECmsSipAddress, "ECmsSipAddress"); |
|
747 _LIT(KECmsLandPhoneHome, "ECmsLandPhoneHome"); |
|
748 _LIT(KECmsMobilePhoneHome, "ECmsMobilePhoneHome"); |
|
749 _LIT(KECmsFaxNumberHome, "ECmsFaxNumberHome"); |
|
750 _LIT(KECmsVideoNumberHome, "ECmsVideoNumberHome"); |
|
751 _LIT(KECmsVoipNumberHome, "ECmsVoipNumberHome"); |
|
752 _LIT(KECmsEmailHome, "ECmsEmailHome"); |
|
753 _LIT(KECmsUrlHome, "ECmsUrlHome"); |
|
754 _LIT(KECmsLandPhoneWork, "ECmsLandPhoneWork"); |
|
755 _LIT(KECmsMobilePhoneWork, "ECmsMobilePhoneWork"); |
|
756 _LIT(KECmsVideoNumberWork, "ECmsVideoNumberWork"); |
|
757 _LIT(KECmsFaxNumberWork, "ECmsFaxNumberWork"); |
|
758 _LIT(KECmsVoipNumberWork, "ECmsVoipNumberWork"); |
|
759 _LIT(KECmsEmailWork, "ECmsEmailWork"); |
|
760 _LIT(KECmsUrlWork, "ECmsUrlWork"); |
|
761 _LIT(KECmsEmailGeneric, "ECmsEmailGeneric"); |
|
762 _LIT(KECmsUrlGeneric, "ECmsUrlGeneric"); |
|
763 _LIT(KECmsLandPhoneGeneric, "ECmsLandPhoneGeneric"); |
|
764 _LIT(KECmsMobilePhoneGeneric, "ECmsMobilePhoneGeneric"); |
|
765 _LIT(KECmsVideoNumberGeneric, "ECmsVideoNumberGeneric"); |
|
766 _LIT(KECmsAddrLabelGeneric, "ECmsAddrLabelGeneric"); |
|
767 _LIT(KECmsAddrPOGeneric, "ECmsAddrPOGeneric"); |
|
768 _LIT(KECmsAddrExtGeneric, "ECmsAddrExtGeneric"); |
|
769 _LIT(KECmsAddrStreetGeneric, "ECmsAddrStreetGeneric"); |
|
770 _LIT(KECmsAddrLocalGeneric, "ECmsAddrLocalGeneric"); |
|
771 _LIT(KECmsAddrRegionGeneric, "ECmsAddrRegionGeneric"); |
|
772 _LIT(KECmsAddrPostcodeGeneric, "ECmsAddrPostcodeGeneric"); |
|
773 _LIT(KECmsAddrCountryGeneric, "ECmsAddrCountryGeneric"); |
|
774 _LIT(KECmsVoipNumberGeneric, "ECmsVoipNumberGeneric"); |
|
775 _LIT(KECmsAddrLabelHome, "ECmsAddrLabelHome"); |
|
776 _LIT(KECmsAddrPOHome, "ECmsAddrPOHome"); |
|
777 _LIT(KECmsAddrExtHome, "ECmsAddrExtHome"); |
|
778 _LIT(KECmsAddrStreetHome, "ECmsAddrStreetHome"); |
|
779 _LIT(KECmsAddrLocalHome, "ECmsAddrLocalHome"); |
|
780 _LIT(KECmsAddrRegionHome, "ECmsAddrRegionHome"); |
|
781 _LIT(KECmsAddrPostcodeHome, "ECmsAddrPostcodeHome"); |
|
782 _LIT(KECmsAddrCountryHome, "ECmsAddrCountryHome"); |
|
783 _LIT(KECmsAddrLabelWork, "ECmsAddrLabelWork"); |
|
784 _LIT(KECmsAddrPOWork, "ECmsAddrPOWork"); |
|
785 _LIT(KECmsAddrExtWork, "ECmsAddrExtWork"); |
|
786 _LIT(KECmsAddrStreetWork, "ECmsAddrStreetWork"); |
|
787 _LIT(KECmsAddrLocalWork, "ECmsAddrLocalWork"); |
|
788 _LIT(KECmsAddrRegionWork, "ECmsAddrRegionWork"); |
|
789 _LIT(KECmsAddrPostcodeWork, "ECmsAddrPostcodeWork"); |
|
790 _LIT(KECmsAddrCountryWork, "ECmsAddrCountryWork"); |
|
791 _LIT(KECmsImpp, "ECmsImpp"); |
|
792 _LIT(KECmsFullName, "ECmsFullName"); |
|
793 _LIT(KECmsNote, "ECmsNote"); |
|
794 _LIT(KECmsNickname, "ECmsNickname"); |
|
795 _LIT(KECmsJobTitle, "ECmsJobTitle"); |
|
796 _LIT(KECmsDepartment, "ECmsDepartment"); |
|
797 _LIT(KECmsBirthday, "ECmsBirthday"); |
|
798 _LIT(KECmsAnniversary, "ECmsAnniversary"); |
|
799 _LIT(KECmsCompanyName, "ECmsCompanyName"); |
|
800 _LIT(KECmsAssistantNumber, "ECmsAssistantNumber"); |
|
801 _LIT(KECmsCarPhone, "ECmsCarPhone"); |
|
802 _LIT(KECmsPagerNumber, "ECmsPagerNumber"); |
|
803 _LIT(KECmsPushToTalk, "ECmsPushToTalk"); |
|
804 _LIT(KECmsShareView, "ECmsShareView"); |
|
805 |
|
806 |
|
807 if (!aDesc.Compare(KECmsLastName)) |
|
808 aType = CCmsContactFieldItem::ECmsLastName; |
|
809 else if (!aDesc.Compare(KECmsMiddleName)) |
|
810 aType = CCmsContactFieldItem::ECmsMiddleName; |
|
811 else if (!aDesc.Compare(KECmsFirstName)) |
|
812 aType = CCmsContactFieldItem::ECmsFirstName; |
|
813 else if (!aDesc.Compare(KECmsUndefined)) |
|
814 aType = CCmsContactFieldItem::ECmsUndefined; |
|
815 else if (!aDesc.Compare(KECmsPresenceData)) |
|
816 aType = CCmsContactFieldItem::ECmsPresenceData; |
|
817 else if (!aDesc.Compare(KECmsBrandedAvailability)) |
|
818 aType = CCmsContactFieldItem::ECmsBrandedAvailability; |
|
819 else if (!aDesc.Compare(KECmsThumbnailPic)) |
|
820 aType = CCmsContactFieldItem::ECmsThumbnailPic; |
|
821 else if (!aDesc.Compare(KECmsSipAddress)) |
|
822 aType = CCmsContactFieldItem::ECmsSipAddress; |
|
823 else if (!aDesc.Compare(KECmsLandPhoneHome)) |
|
824 aType = CCmsContactFieldItem::ECmsLandPhoneHome; |
|
825 else if (!aDesc.Compare(KECmsMobilePhoneHome)) |
|
826 aType = CCmsContactFieldItem::ECmsMobilePhoneHome; |
|
827 else if (!aDesc.Compare(KECmsFaxNumberHome)) |
|
828 aType = CCmsContactFieldItem::ECmsFaxNumberHome; |
|
829 else if (!aDesc.Compare(KECmsVideoNumberHome)) |
|
830 aType = CCmsContactFieldItem::ECmsVideoNumberHome; |
|
831 else if (!aDesc.Compare(KECmsVoipNumberHome)) |
|
832 aType = CCmsContactFieldItem::ECmsVoipNumberHome; |
|
833 else if (!aDesc.Compare(KECmsEmailHome)) |
|
834 aType = CCmsContactFieldItem::ECmsEmailHome; |
|
835 else if (!aDesc.Compare(KECmsUrlHome)) |
|
836 aType = CCmsContactFieldItem::ECmsUrlHome; |
|
837 else if (!aDesc.Compare(KECmsLandPhoneWork)) |
|
838 aType = CCmsContactFieldItem::ECmsLandPhoneWork; |
|
839 else if (!aDesc.Compare(KECmsMobilePhoneWork)) |
|
840 aType = CCmsContactFieldItem::ECmsMobilePhoneWork; |
|
841 else if (!aDesc.Compare(KECmsVideoNumberWork)) |
|
842 aType = CCmsContactFieldItem::ECmsVideoNumberWork; |
|
843 else if (!aDesc.Compare(KECmsFaxNumberWork)) |
|
844 aType = CCmsContactFieldItem::ECmsFaxNumberWork; |
|
845 else if (!aDesc.Compare(KECmsVoipNumberWork)) |
|
846 aType = CCmsContactFieldItem::ECmsVoipNumberWork; |
|
847 else if (!aDesc.Compare(KECmsEmailWork)) |
|
848 aType = CCmsContactFieldItem::ECmsEmailWork; |
|
849 else if (!aDesc.Compare(KECmsUrlWork)) |
|
850 aType = CCmsContactFieldItem::ECmsUrlWork; |
|
851 else if (!aDesc.Compare(KECmsEmailGeneric)) |
|
852 aType = CCmsContactFieldItem::ECmsEmailGeneric; |
|
853 else if (!aDesc.Compare(KECmsUrlGeneric)) |
|
854 aType = CCmsContactFieldItem::ECmsUrlGeneric; |
|
855 else if (!aDesc.Compare(KECmsLandPhoneGeneric)) |
|
856 aType = CCmsContactFieldItem::ECmsLandPhoneGeneric; |
|
857 else if (!aDesc.Compare(KECmsMobilePhoneGeneric)) |
|
858 aType = CCmsContactFieldItem::ECmsMobilePhoneGeneric; |
|
859 else if (!aDesc.Compare(KECmsVideoNumberGeneric)) |
|
860 aType = CCmsContactFieldItem::ECmsVideoNumberGeneric; |
|
861 else if (!aDesc.Compare(KECmsAddrLabelGeneric)) |
|
862 aType = CCmsContactFieldItem::ECmsAddrLabelGeneric; |
|
863 else if (!aDesc.Compare(KECmsAddrPOGeneric)) |
|
864 aType = CCmsContactFieldItem::ECmsAddrPOGeneric; |
|
865 else if (!aDesc.Compare(KECmsAddrExtGeneric)) |
|
866 aType = CCmsContactFieldItem::ECmsAddrExtGeneric; |
|
867 else if (!aDesc.Compare(KECmsAddrStreetGeneric)) |
|
868 aType = CCmsContactFieldItem::ECmsAddrStreetGeneric; |
|
869 else if (!aDesc.Compare(KECmsAddrLocalGeneric)) |
|
870 aType = CCmsContactFieldItem::ECmsAddrLocalGeneric; |
|
871 else if (!aDesc.Compare(KECmsAddrRegionGeneric)) |
|
872 aType = CCmsContactFieldItem::ECmsAddrRegionGeneric; |
|
873 else if (!aDesc.Compare(KECmsAddrPostcodeGeneric)) |
|
874 aType = CCmsContactFieldItem::ECmsAddrPostcodeGeneric; |
|
875 else if (!aDesc.Compare(KECmsAddrCountryGeneric)) |
|
876 aType = CCmsContactFieldItem::ECmsAddrCountryGeneric; |
|
877 else if (!aDesc.Compare(KECmsVoipNumberGeneric)) |
|
878 aType = CCmsContactFieldItem::ECmsVoipNumberGeneric; |
|
879 else if (!aDesc.Compare(KECmsAddrLabelHome)) |
|
880 aType = CCmsContactFieldItem::ECmsAddrLabelHome; |
|
881 else if (!aDesc.Compare(KECmsAddrPOHome)) |
|
882 aType = CCmsContactFieldItem::ECmsAddrPOHome; |
|
883 else if (!aDesc.Compare(KECmsAddrExtHome)) |
|
884 aType = CCmsContactFieldItem::ECmsAddrExtHome; |
|
885 else if (!aDesc.Compare(KECmsAddrStreetHome)) |
|
886 aType = CCmsContactFieldItem::ECmsAddrStreetHome; |
|
887 else if (!aDesc.Compare(KECmsAddrLocalHome)) |
|
888 aType = CCmsContactFieldItem::ECmsAddrLocalHome; |
|
889 else if (!aDesc.Compare(KECmsAddrRegionHome)) |
|
890 aType = CCmsContactFieldItem::ECmsAddrRegionHome; |
|
891 else if (!aDesc.Compare(KECmsAddrPostcodeHome)) |
|
892 aType = CCmsContactFieldItem::ECmsAddrPostcodeHome; |
|
893 else if (!aDesc.Compare(KECmsAddrCountryHome)) |
|
894 aType = CCmsContactFieldItem::ECmsAddrCountryHome; |
|
895 |
|
896 else if (!aDesc.Compare(KECmsAddrLabelWork)) |
|
897 aType = CCmsContactFieldItem::ECmsAddrLabelWork; |
|
898 else if (!aDesc.Compare(KECmsAddrPOWork)) |
|
899 aType = CCmsContactFieldItem::ECmsAddrPOWork; |
|
900 else if (!aDesc.Compare(KECmsAddrExtWork)) |
|
901 aType = CCmsContactFieldItem::ECmsAddrExtWork; |
|
902 else if (!aDesc.Compare(KECmsAddrStreetWork)) |
|
903 aType = CCmsContactFieldItem::ECmsAddrStreetWork; |
|
904 else if (!aDesc.Compare(KECmsAddrLocalWork)) |
|
905 aType = CCmsContactFieldItem::ECmsAddrLocalWork; |
|
906 else if (!aDesc.Compare(KECmsAddrRegionWork)) |
|
907 aType = CCmsContactFieldItem::ECmsAddrRegionWork; |
|
908 else if (!aDesc.Compare(KECmsAddrPostcodeWork)) |
|
909 aType = CCmsContactFieldItem::ECmsAddrPostcodeWork; |
|
910 else if (!aDesc.Compare(KECmsAddrCountryWork)) |
|
911 aType = CCmsContactFieldItem::ECmsAddrCountryWork; |
|
912 |
|
913 else if (!aDesc.Compare(KECmsImpp)) |
|
914 aType = CCmsContactFieldItem::ECmsImpp; |
|
915 else if (!aDesc.Compare(KECmsFullName)) |
|
916 aType = CCmsContactFieldItem::ECmsFullName; |
|
917 else if (!aDesc.Compare(KECmsNote)) |
|
918 aType = CCmsContactFieldItem::ECmsNote; |
|
919 else if (!aDesc.Compare(KECmsNickname)) |
|
920 aType = CCmsContactFieldItem::ECmsNickname; |
|
921 else if (!aDesc.Compare(KECmsJobTitle)) |
|
922 aType = CCmsContactFieldItem::ECmsJobTitle; |
|
923 else if (!aDesc.Compare(KECmsDepartment)) |
|
924 aType = CCmsContactFieldItem::ECmsDepartment; |
|
925 else if (!aDesc.Compare(KECmsBirthday)) |
|
926 aType = CCmsContactFieldItem::ECmsBirthday; |
|
927 else if (!aDesc.Compare(KECmsAnniversary)) |
|
928 aType = CCmsContactFieldItem::ECmsAnniversary; |
|
929 else if (!aDesc.Compare(KECmsCompanyName)) |
|
930 aType = CCmsContactFieldItem::ECmsCompanyName; |
|
931 else if (!aDesc.Compare(KECmsAssistantNumber)) |
|
932 aType = CCmsContactFieldItem::ECmsAssistantNumber; |
|
933 else if (!aDesc.Compare(KECmsCarPhone)) |
|
934 aType = CCmsContactFieldItem::ECmsCarPhone; |
|
935 else if (!aDesc.Compare(KECmsPagerNumber)) |
|
936 aType = CCmsContactFieldItem::ECmsPagerNumber; |
|
937 else if (!aDesc.Compare(KECmsPushToTalk)) |
|
938 aType = CCmsContactFieldItem::ECmsPushToTalk; |
|
939 else if (!aDesc.Compare(KECmsShareView)) |
|
940 aType = CCmsContactFieldItem::ECmsShareView; |
|
941 else |
|
942 return KErrNotFound; |
|
943 return KErrNone; |
|
944 } |
|
945 |
|
946 // --------------------------------------------------------------------------- |
|
947 // CCCAppCommLauncherHeaderTextOrder::MapContactFieldToClipDirection |
|
948 // --------------------------------------------------------------------------- |
|
949 // |
|
950 AknTextUtils::TClipDirection CCCAppCommLauncherHeaderTextOrder::MapContactFieldToClipDirection(CCmsContactFieldItem::TCmsContactField aType) |
|
951 { |
|
952 switch (aType) |
|
953 { |
|
954 case CCmsContactFieldItem::ECmsMobilePhoneGeneric: |
|
955 case CCmsContactFieldItem::ECmsMobilePhoneWork: |
|
956 case CCmsContactFieldItem::ECmsMobilePhoneHome: |
|
957 case CCmsContactFieldItem::ECmsLandPhoneGeneric: |
|
958 case CCmsContactFieldItem::ECmsLandPhoneWork: |
|
959 case CCmsContactFieldItem::ECmsLandPhoneHome: |
|
960 case CCmsContactFieldItem::ECmsVideoNumberGeneric: |
|
961 case CCmsContactFieldItem::ECmsVideoNumberWork: |
|
962 case CCmsContactFieldItem::ECmsVideoNumberHome: |
|
963 case CCmsContactFieldItem::ECmsFaxNumberHome: |
|
964 case CCmsContactFieldItem::ECmsFaxNumberWork: |
|
965 case CCmsContactFieldItem::ECmsEmailGeneric: |
|
966 case CCmsContactFieldItem::ECmsEmailWork: |
|
967 case CCmsContactFieldItem::ECmsEmailHome: |
|
968 case CCmsContactFieldItem::ECmsVoipNumberGeneric: |
|
969 case CCmsContactFieldItem::ECmsVoipNumberHome: |
|
970 case CCmsContactFieldItem::ECmsVoipNumberWork: |
|
971 case CCmsContactFieldItem::ECmsSipAddress: |
|
972 case CCmsContactFieldItem::ECmsImpp: |
|
973 case CCmsContactFieldItem::ECmsAssistantNumber: |
|
974 case CCmsContactFieldItem::ECmsCarPhone: |
|
975 case CCmsContactFieldItem::ECmsPagerNumber: |
|
976 case CCmsContactFieldItem::ECmsPushToTalk: |
|
977 case CCmsContactFieldItem::ECmsShareView: |
|
978 return AknTextUtils::EClipFromBeginning; |
|
979 default: |
|
980 return AknTextUtils::EClipFromEnd; |
|
981 } |
|
982 } |