equal
deleted
inserted
replaced
21 #include "MVPbkViewContact.h" |
21 #include "MVPbkViewContact.h" |
22 #include "MVPbkContactViewBase.h" |
22 #include "MVPbkContactViewBase.h" |
23 #include "MPbk2ContactNameFormatter.h" |
23 #include "MPbk2ContactNameFormatter.h" |
24 #include "MPbk2FilteredViewStack.h" |
24 #include "MPbk2FilteredViewStack.h" |
25 |
25 |
|
26 #include <MVPbkBaseContactFieldCollection.h> |
|
27 #include <MVPbkContactFieldTextData.h> |
|
28 #include <MVPbkBaseContactField.h> |
|
29 |
|
30 |
26 #include <MPbk2ContactViewSupplier.h> |
31 #include <MPbk2ContactViewSupplier.h> |
27 #include <MPbk2ApplicationServices.h> |
32 #include <MPbk2ApplicationServices.h> |
28 #include <MPbk2AppUi.h> |
33 #include <MPbk2AppUi.h> |
29 #include <CPbk2StoreConfiguration.h> |
34 #include <CPbk2StoreConfiguration.h> |
30 #include <MPbk2ContactNameFormatter2.h> |
35 #include <MPbk2ContactNameFormatter2.h> |
39 const TInt KAdaptiveSearchRefineStep = 25; |
44 const TInt KAdaptiveSearchRefineStep = 25; |
40 const TInt KContactFormattingFlags = MPbk2ContactNameFormatter::EPreserveLeadingSpaces | |
45 const TInt KContactFormattingFlags = MPbk2ContactNameFormatter::EPreserveLeadingSpaces | |
41 MPbk2ContactNameFormatter::EReplaceNonGraphicChars | |
46 MPbk2ContactNameFormatter::EReplaceNonGraphicChars | |
42 MPbk2ContactNameFormatter::EDisableCompanyNameSeparator; |
47 MPbk2ContactNameFormatter::EDisableCompanyNameSeparator; |
43 |
48 |
|
49 namespace { |
|
50 enum TNameOrder |
|
51 { |
|
52 ETopContactOrderNumber = 0, //TC control data, not shown |
|
53 ENameFirstPart, //Contact name data |
|
54 ENameSecondPart, //Contact name data |
|
55 ENameCompanyPart //to support Company name |
|
56 }; |
|
57 } // namespace |
44 |
58 |
45 NONSHARABLE_CLASS(CPbk2AdaptiveGrid) : public CBase |
59 NONSHARABLE_CLASS(CPbk2AdaptiveGrid) : public CBase |
46 { |
60 { |
47 HBufC* iFindText; |
61 HBufC* iFindText; |
48 HBufC* iKeyMap; |
62 HBufC* iKeyMap; |
247 } |
261 } |
248 } |
262 } |
249 else if ( titleLength ) |
263 else if ( titleLength ) |
250 { |
264 { |
251 title = iNameFormatter.GetContactTitleL( contact.Fields(), KContactFormattingFlags ); |
265 title = iNameFormatter.GetContactTitleL( contact.Fields(), KContactFormattingFlags ); |
|
266 |
|
267 // In FDN, the number will be displayed in the list if the contact is no name. |
|
268 // If it is, set the search string as NULL. |
|
269 if ( IsActualTitleEmpty( contact ) ) |
|
270 { |
|
271 delete title; |
|
272 title = NULL; |
|
273 } |
252 } |
274 } |
253 |
275 |
254 if ( !title ) |
276 if ( !title ) |
255 { |
277 { |
256 title = HBufC::NewL( titleLength ); |
278 title = HBufC::NewL( titleLength ); |
748 else |
770 else |
749 { |
771 { |
750 return EFalse; |
772 return EFalse; |
751 } |
773 } |
752 } |
774 } |
|
775 |
|
776 TBool CPbk2AdaptiveSearchGridFiller::IsActualTitleEmpty( const MVPbkViewContact& aContact ) |
|
777 { |
|
778 TBool result = ETrue; |
|
779 const TInt fieldCount = aContact.Fields().FieldCount(); |
|
780 for ( TInt i = ENameFirstPart; i <= ENameSecondPart && i < fieldCount; ++i) |
|
781 { |
|
782 const MVPbkBaseContactField& field = aContact.Fields().FieldAt( i ); |
|
783 if ( iNameFormatter.IsTitleField( field ) ) |
|
784 { |
|
785 const MVPbkContactFieldData& fieldData = field.FieldData(); |
|
786 if ( fieldData.DataType() == EVPbkFieldStorageTypeText ) |
|
787 { |
|
788 const TDesC& fieldText = MVPbkContactFieldTextData::Cast( fieldData ).Text(); |
|
789 TInt length = fieldText.Length(); |
|
790 |
|
791 if ( length > 0 ) |
|
792 { |
|
793 TInt firstNonSpaceChar = 0; |
|
794 while ( firstNonSpaceChar < length |
|
795 && TChar( fieldText[firstNonSpaceChar] ).IsSpace() ) |
|
796 { |
|
797 ++firstNonSpaceChar; |
|
798 } |
|
799 if ( firstNonSpaceChar != length ) |
|
800 { |
|
801 result = EFalse; |
|
802 break; |
|
803 } |
|
804 } |
|
805 } |
|
806 } |
|
807 } |
|
808 return result; |
|
809 } |
753 // End of File |
810 // End of File |