equal
deleted
inserted
replaced
18 #include "univiewerfeeder_p.h" |
18 #include "univiewerfeeder_p.h" |
19 // SYSTEM INCLUDES |
19 // SYSTEM INCLUDES |
20 #include <msvstd.h> |
20 #include <msvstd.h> |
21 #include <s60qconversions.h> |
21 #include <s60qconversions.h> |
22 #include <msvids.h> |
22 #include <msvids.h> |
23 #include <qtcontactsglobal.h> |
|
24 #include "qtcontacts.h" |
|
25 #include "qcontactdetailfilter.h" |
|
26 |
23 |
27 // USER INCLUDES |
24 // USER INCLUDES |
28 #include "nativemessageconsts.h" |
25 #include "nativemessageconsts.h" |
29 #include "univiewerfeeder.h" |
26 #include "univiewerfeeder.h" |
30 #include "unidatamodelloader.h" |
27 #include "unidatamodelloader.h" |
|
28 #include "msgcontacthandler.h" |
31 #include "debugtraces.h" |
29 #include "debugtraces.h" |
32 |
30 |
33 // --------------------------------------------------------------------------- |
31 // --------------------------------------------------------------------------- |
34 // UniViewerFeederPrivate::UniViewerFeederPrivate |
32 // UniViewerFeederPrivate::UniViewerFeederPrivate |
35 // @see header file |
33 // @see header file |
267 ConvergedMessageAddressList UniViewerFeederPrivate::toAddressList() |
265 ConvergedMessageAddressList UniViewerFeederPrivate::toAddressList() |
268 { |
266 { |
269 QString alias = QString(); |
267 QString alias = QString(); |
270 for (int i = 0; i < mToAddressList.count(); ++i) |
268 for (int i = 0; i < mToAddressList.count(); ++i) |
271 { |
269 { |
272 GetNameFromContacts(mToAddressList.at(i)->address(), alias); |
270 MsgContactHandler::resolveContactDisplayName( |
|
271 mToAddressList.at(i)->address(), |
|
272 alias, |
|
273 0); |
273 mToAddressList.at(i)->setAlias(alias); |
274 mToAddressList.at(i)->setAlias(alias); |
274 alias.clear(); |
275 alias.clear(); |
275 } |
276 } |
276 return mToAddressList; |
277 return mToAddressList; |
277 } |
278 } |
283 ConvergedMessageAddressList UniViewerFeederPrivate::ccAddressList() |
284 ConvergedMessageAddressList UniViewerFeederPrivate::ccAddressList() |
284 { |
285 { |
285 QString alias = QString(); |
286 QString alias = QString(); |
286 for (int i = 0; i < mCcAddressList.count(); ++i) |
287 for (int i = 0; i < mCcAddressList.count(); ++i) |
287 { |
288 { |
288 GetNameFromContacts(mCcAddressList.at(i)->address(), alias); |
289 MsgContactHandler::resolveContactDisplayName( |
|
290 mToAddressList.at(i)->address(), |
|
291 alias, |
|
292 0); |
289 mCcAddressList.at(i)->setAlias(alias); |
293 mCcAddressList.at(i)->setAlias(alias); |
290 alias.clear(); |
294 alias.clear(); |
291 |
295 |
292 } |
296 } |
293 return mCcAddressList; |
297 return mCcAddressList; |
307 // @see header file |
311 // @see header file |
308 // --------------------------------------------------------------------------- |
312 // --------------------------------------------------------------------------- |
309 void UniViewerFeederPrivate::fromAddressAndAlias(QString& from, QString& alias) |
313 void UniViewerFeederPrivate::fromAddressAndAlias(QString& from, QString& alias) |
310 { |
314 { |
311 mPluginInterface->fromAddress(from); |
315 mPluginInterface->fromAddress(from); |
312 GetNameFromContacts(from, alias); |
316 MsgContactHandler::resolveContactDisplayName( |
|
317 from, |
|
318 alias, |
|
319 0); |
313 } |
320 } |
314 |
321 |
315 // --------------------------------------------------------------------------- |
322 // --------------------------------------------------------------------------- |
316 // UniViewerFeederPrivate::clearContent |
323 // UniViewerFeederPrivate::clearContent |
317 // @see header file |
324 // @see header file |
330 } |
337 } |
331 |
338 |
332 mCcAddressList.clear(); |
339 mCcAddressList.clear(); |
333 } |
340 } |
334 |
341 |
335 // --------------------------------------------------------------------------- |
|
336 // UniViewerFeederPrivate::GetNameFromContacts |
|
337 // @see header file |
|
338 //---------------------------------------------------------------------------- |
|
339 int UniViewerFeederPrivate::GetNameFromContacts(const QString& address, |
|
340 QString& alias) |
|
341 { |
|
342 QContactManager contactManager("symbian"); |
|
343 //set filter |
|
344 QContactDetailFilter phoneFilter; |
|
345 phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName, |
|
346 QContactPhoneNumber::FieldNumber); |
|
347 phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); |
|
348 |
|
349 phoneFilter.setValue(address); // this is the phone number to be resolved |
|
350 |
|
351 QList<QContactSortOrder> sortOrder; |
|
352 QList<QContact> matchingContacts = |
|
353 contactManager.contacts(phoneFilter, |
|
354 sortOrder, |
|
355 QStringList()); |
|
356 |
|
357 int count = 0; |
|
358 if (matchingContacts.count() > 0) |
|
359 { |
|
360 QContact match = matchingContacts.at(0); |
|
361 |
|
362 QString displayLabel = match.displayLabel(); |
|
363 |
|
364 if (displayLabel != "Unnamed") |
|
365 { |
|
366 alias.append(displayLabel); |
|
367 } |
|
368 |
|
369 QList<QContactPhoneNumber> numbers = |
|
370 match.details<QContactPhoneNumber> (); |
|
371 count = numbers.count(); |
|
372 |
|
373 } |
|
374 |
|
375 return count; |
|
376 } |
|
377 |
|
378 // EOF |
342 // EOF |