equal
deleted
inserted
replaced
19 |
19 |
20 #include <cntitem.h> |
20 #include <cntitem.h> |
21 #include <s32strm.h> |
21 #include <s32strm.h> |
22 #include <vprop.h> |
22 #include <vprop.h> |
23 #include <vcard.h> |
23 #include <vcard.h> |
|
24 #include <centralrepository.h> |
|
25 |
24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
25 #include "vcard3.h" |
27 #include "vcard3.h" |
26 #include "cntdb_internal.h" |
28 #include "cntdb_internal.h" |
27 #endif |
29 #endif |
28 #include <vtoken.h> |
30 #include <vtoken.h> |
29 #include "pbaplogeng.h" |
31 #include "pbaplogeng.h" |
30 #include "btaccesshostlog.h" |
32 #include "btaccesshostlog.h" |
31 |
33 |
|
34 /* These constants are properly defined in telconfigcrkeys.h, however we |
|
35 are not allowed to include that from here. As a temporary fix the constants |
|
36 from that file are re-defined here. */ |
|
37 const TUid KCRUidTelConfiguration = {0x102828B8}; |
|
38 const TUint32 KTelMatchDigits = 0x00000001; |
|
39 /* And similarly this constant is defined in ccsdefs.h */ |
|
40 const TInt KDefaultGsmNumberMatchLength = 7; |
32 |
41 |
33 //constants |
42 //constants |
34 _LIT8(KVersitTokenCALLDATETIME,"X-IRMC-CALL-DATETIME"); |
43 _LIT8(KVersitTokenCALLDATETIME,"X-IRMC-CALL-DATETIME"); |
35 _LIT8(KVersitParamMISSED,"MISSED"); |
44 _LIT8(KVersitParamMISSED,"MISSED"); |
36 _LIT8(KVersitParamRECEIVED,"RECEIVED"); |
45 _LIT8(KVersitParamRECEIVED,"RECEIVED"); |
57 void CPbapVCardExporterUtil::ConstructL() |
66 void CPbapVCardExporterUtil::ConstructL() |
58 { |
67 { |
59 LOG_FUNC |
68 LOG_FUNC |
60 CVersitTlsData::VersitTlsDataL(); |
69 CVersitTlsData::VersitTlsDataL(); |
61 User::LeaveIfError(iTzClient.Connect()); |
70 User::LeaveIfError(iTzClient.Connect()); |
|
71 |
|
72 // Read the amount of digits to be used in contact matching |
|
73 // The key is properly owned by PhoneApp, however we cannot include |
|
74 // that header file from here, so a temporary fix has been done to |
|
75 // use locally defined versions. If there is a problem here it is |
|
76 // likely because these values have gone out of sync. |
|
77 CRepository* repository = CRepository::NewLC(KCRUidTelConfiguration); |
|
78 if ( repository->Get(KTelMatchDigits, iMatchDigitCount) == KErrNone ) |
|
79 { |
|
80 // Min is 7 |
|
81 iMatchDigitCount = Max(iMatchDigitCount, KDefaultGsmNumberMatchLength); |
|
82 } |
|
83 else |
|
84 { |
|
85 iMatchDigitCount = KDefaultGsmNumberMatchLength; |
|
86 } |
|
87 CleanupStack::PopAndDestroy(repository); |
62 } |
88 } |
63 |
89 |
64 CPbapVCardExporterUtil::~CPbapVCardExporterUtil() |
90 CPbapVCardExporterUtil::~CPbapVCardExporterUtil() |
65 { |
91 { |
66 LOG_FUNC |
92 LOG_FUNC |
159 } |
185 } |
160 |
186 |
161 TContactItemId CPbapVCardExporterUtil::FindContactIdFromNumberL(const TDesC& aNumber) |
187 TContactItemId CPbapVCardExporterUtil::FindContactIdFromNumberL(const TDesC& aNumber) |
162 { |
188 { |
163 TContactItemId ret = KNullContactId; |
189 TContactItemId ret = KNullContactId; |
164 CContactItemFieldDef* fieldDef; |
190 CContactIdArray* contactIdArray = iDatabase.MatchPhoneNumberL(aNumber, iMatchDigitCount); |
165 fieldDef = new(ELeave) CContactItemFieldDef; |
|
166 CleanupStack::PushL(fieldDef); |
|
167 fieldDef->AppendL(KUidContactFieldPhoneNumber); |
|
168 CContactIdArray* contactIdArray = iDatabase.FindLC(aNumber, fieldDef); |
|
169 if (contactIdArray->Count() > 0) |
191 if (contactIdArray->Count() > 0) |
170 { |
192 { |
171 ret = (*contactIdArray)[0]; |
193 ret = (*contactIdArray)[0]; |
172 } |
194 } |
173 CleanupStack::PopAndDestroy(2); // contactIdArray, fieldDef |
195 delete contactIdArray; |
174 return ret; |
196 return ret; |
175 } |
197 } |
176 |
198 |
177 /** |
199 /** |
178 Writes a vCard to the stream containing only the mandatory properties defined in the PBAP specification |
200 Writes a vCard to the stream containing only the mandatory properties defined in the PBAP specification |