148 const TInt count = iFieldMapper.FieldCount(); |
148 const TInt count = iFieldMapper.FieldCount(); |
149 result = DoCalculateMaxTitleLength |
149 result = DoCalculateMaxTitleLength |
150 (aFormattingFlags, ENameCompanyPart+1, count-1); // zero-based |
150 (aFormattingFlags, ENameCompanyPart+1, count-1); // zero-based |
151 } |
151 } |
152 |
152 |
|
153 if ( !result || aFormattingFlags & MPbk2ContactNameFormatter::EDisableCompanyNameSeparator ) |
|
154 { |
|
155 return result; |
|
156 } |
153 return result+1; // for seperator "," |
157 return result+1; // for seperator "," |
154 } |
158 } |
155 // ----------------------------------------------------------------------------- |
159 // ----------------------------------------------------------------------------- |
156 // CPbk2ContactNameFormatter::GetContactTitleWithCompanyNameL |
160 // CPbk2ContactNameFormatter::GetContactTitleWithCompanyNameL |
157 // ----------------------------------------------------------------------------- |
161 // ----------------------------------------------------------------------------- |
215 |
223 |
216 //try to add company name to the end of title |
224 //try to add company name to the end of title |
217 //third field is expected to be company name |
225 //third field is expected to be company name |
218 if ( IsCompanyNameField() ) |
226 if ( IsCompanyNameField() ) |
219 { |
227 { |
220 aTitle.Append(KSeparator); |
228 if ( !( aFormattingFlags & MPbk2ContactNameFormatter::EDisableCompanyNameSeparator) ) |
|
229 { |
|
230 aTitle.Append(KSeparator); |
|
231 } |
221 DoGetContactTitle(aTitle, EPreserveLeadingSpaces, |
232 DoGetContactTitle(aTitle, EPreserveLeadingSpaces, |
222 ENameCompanyPart, ENameCompanyPart); |
233 ENameCompanyPart, ENameCompanyPart); |
223 } |
234 } |
224 } |
235 } |
225 else |
236 else |
248 // Simply uses GetContactTitle as the defined functionality is the same |
259 // Simply uses GetContactTitle as the defined functionality is the same |
249 GetContactTitle( aContactFields, aTitle, aFormattingFlags ); |
260 GetContactTitle( aContactFields, aTitle, aFormattingFlags ); |
250 } |
261 } |
251 |
262 |
252 // ----------------------------------------------------------------------------- |
263 // ----------------------------------------------------------------------------- |
|
264 // CPbk2ContactNameFormatter::TitleWithCompanyNameFieldsLC |
|
265 // ----------------------------------------------------------------------------- |
|
266 // |
|
267 CVPbkBaseContactFieldTypeListIterator* |
|
268 CPbk2ContactNameFormatter::TitleWithCompanyNameFieldsLC( |
|
269 CVPbkFieldTypeRefsList& aFieldTypeList, |
|
270 const MVPbkBaseContactFieldCollection& aContactFields ) |
|
271 { |
|
272 |
|
273 TitleFieldsL( aFieldTypeList, aContactFields, ENameFirstPart, ENameCompanyPart); |
|
274 |
|
275 return CVPbkBaseContactFieldTypeListIterator::NewLC( |
|
276 aFieldTypeList, |
|
277 aContactFields); |
|
278 |
|
279 } |
|
280 // ----------------------------------------------------------------------------- |
253 // CPbk2ContactNameFormatter::ActualTitleFieldsLC |
281 // CPbk2ContactNameFormatter::ActualTitleFieldsLC |
254 // See function CPbk2ContactNameFormatter::GetContactTitle. |
282 // See function CPbk2ContactNameFormatter::GetContactTitle. |
255 // ----------------------------------------------------------------------------- |
283 // ----------------------------------------------------------------------------- |
256 // |
284 // |
257 CVPbkBaseContactFieldTypeListIterator* |
285 CVPbkBaseContactFieldTypeListIterator* |
258 CPbk2ContactNameFormatter::ActualTitleFieldsLC( |
286 CPbk2ContactNameFormatter::ActualTitleFieldsLC( |
259 CVPbkFieldTypeRefsList& aFieldTypeList, |
287 CVPbkFieldTypeRefsList& aFieldTypeList, |
260 const MVPbkBaseContactFieldCollection& aContactFields) |
288 const MVPbkBaseContactFieldCollection& aContactFields) |
261 { |
289 { |
|
290 |
|
291 TitleFieldsL( aFieldTypeList, aContactFields, ENameFirstPart, ENameSecondPart); |
|
292 |
|
293 return CVPbkBaseContactFieldTypeListIterator::NewLC( |
|
294 aFieldTypeList, |
|
295 aContactFields); |
|
296 } |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CPbk2ContactNameFormatter::TitleFieldsL |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 void CPbk2ContactNameFormatter::TitleFieldsL( CVPbkFieldTypeRefsList& aFieldTypeList, |
|
302 const MVPbkBaseContactFieldCollection& aContactFields, |
|
303 const TInt aStartingPosition, const TInt aEndingPosition ) |
|
304 { |
262 aFieldTypeList.Reset(); |
305 aFieldTypeList.Reset(); |
263 |
306 |
264 SetFieldMapper( aContactFields ); |
307 SetFieldMapper( aContactFields ); |
265 |
308 |
266 DoAppendNonEmptyTitleFieldTypesL( |
309 DoAppendNonEmptyTitleFieldTypesL( |
267 aFieldTypeList, |
310 aFieldTypeList, |
268 ENameFirstPart, |
311 aStartingPosition, |
269 ENameSecondPart); |
312 aEndingPosition); |
270 |
313 |
271 if( aFieldTypeList.FieldTypeCount() == 0 ) |
314 if( aFieldTypeList.FieldTypeCount() == 0 ) |
272 { |
315 { |
273 const TInt count = iFieldMapper.FieldCount(); |
316 const TInt count = iFieldMapper.FieldCount(); |
274 DoAppendNonEmptyTitleFieldTypesL( |
317 DoAppendNonEmptyTitleFieldTypesL( |
275 aFieldTypeList, |
318 aFieldTypeList, |
276 ENameSecondPart+1, |
319 aEndingPosition+1, |
277 count-1); |
320 count-1); |
278 } |
321 } |
279 |
322 } |
280 return CVPbkBaseContactFieldTypeListIterator::NewLC( |
|
281 aFieldTypeList, |
|
282 aContactFields); |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
323 // ----------------------------------------------------------------------------- |
286 // CPbk2ContactNameFormatter::MaxTitleLength |
324 // CPbk2ContactNameFormatter::MaxTitleLength |
287 // ----------------------------------------------------------------------------- |
325 // ----------------------------------------------------------------------------- |
288 // |
326 // |
289 TInt CPbk2ContactNameFormatter::MaxTitleLength |
327 TInt CPbk2ContactNameFormatter::MaxTitleLength |