equal
deleted
inserted
replaced
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
105 TUint64 aFilter) |
105 TUint64 aFilter) |
106 { |
106 { |
107 LOG_FUNC |
107 LOG_FUNC |
108 TContactItemId contactId = aLogEvent.Contact(); |
108 TContactItemId contactId = aLogEvent.Contact(); |
109 |
109 |
|
110 if (contactId == KNullContactId && aLogEvent.RemoteParty() != KNullDesC) |
|
111 { |
|
112 // The S60 phonebook uses the remote party for the name, so if there isn't a name |
|
113 // there won't be a contact, so we only look up the contact if there is a Remote Party |
|
114 contactId = FindContactIdFromNumberL(aLogEvent.Number()); |
|
115 } |
|
116 |
110 if (ContactExistsL(contactId)) |
117 if (ContactExistsL(contactId)) |
111 { |
118 { |
112 // store the log event, format and filter parameters to use in the callback |
119 // store the log event, format and filter parameters to use in the callback |
113 // from the contacts vCard converter |
120 // from the contacts vCard converter |
114 iLogEvent = &aLogEvent; |
121 iLogEvent = &aLogEvent; |
|
122 iLogEventContactId = contactId; |
115 iFormat = aFormat; |
123 iFormat = aFormat; |
116 iFilter = aFilter; |
124 iFilter = aFilter; |
117 |
125 |
118 CContactIdArray* contactIdArray = CContactIdArray::NewLC(); |
126 CContactIdArray* contactIdArray = CContactIdArray::NewLC(); |
119 contactIdArray->AddL(contactId); |
127 contactIdArray->AddL(contactId); |
146 } |
154 } |
147 |
155 |
148 vCard->ExternalizeL(aWriteStream); |
156 vCard->ExternalizeL(aWriteStream); |
149 CleanupStack::PopAndDestroy(vCard); |
157 CleanupStack::PopAndDestroy(vCard); |
150 } |
158 } |
|
159 } |
|
160 |
|
161 TContactItemId CPbapVCardExporterUtil::FindContactIdFromNumberL(const TDesC& aNumber) |
|
162 { |
|
163 TContactItemId ret = KNullContactId; |
|
164 CContactItemFieldDef* fieldDef; |
|
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) |
|
170 { |
|
171 ret = (*contactIdArray)[0]; |
|
172 } |
|
173 CleanupStack::PopAndDestroy(2); // contactIdArray, fieldDef |
|
174 return ret; |
151 } |
175 } |
152 |
176 |
153 /** |
177 /** |
154 Writes a vCard to the stream containing only the mandatory properties defined in the PBAP specification |
178 Writes a vCard to the stream containing only the mandatory properties defined in the PBAP specification |
155 with all properties set to empty (null) values |
179 with all properties set to empty (null) values |
179 */ |
203 */ |
180 void CPbapVCardExporterUtil::AddIntraContactPropertiesL(const TContactItemId& aContactId, |
204 void CPbapVCardExporterUtil::AddIntraContactPropertiesL(const TContactItemId& aContactId, |
181 CArrayPtr<CParserProperty>* aPropertyList) |
205 CArrayPtr<CParserProperty>* aPropertyList) |
182 { |
206 { |
183 LOG_FUNC |
207 LOG_FUNC |
184 if(iLogEvent && iLogEvent->Contact() == aContactId) |
208 if(iLogEvent && iLogEventContactId == aContactId) |
185 { |
209 { |
186 CParserProperty* property; |
210 CParserProperty* property; |
187 |
211 |
188 // add mandatory TEL property using number from log event |
212 // add mandatory TEL property using number from log event |
189 property = DesPropertyL(KVersitTokenTEL, iLogEvent->Number()); |
213 property = DesPropertyL(KVersitTokenTEL, iLogEvent->Number()); |