messagingapp/msgui/msgapp/src/msgserviceinterface.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
--- a/messagingapp/msgui/msgapp/src/msgserviceinterface.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msgserviceinterface.cpp	Fri May 14 15:49:35 2010 +0300
@@ -17,15 +17,11 @@
  */
 
 //TODO: to be deprecated
-#include <qtcontactsglobal.h>
-#include "qcontactdetailfilter.h"
-#include "qcontactdetail.h"
-#include "qtcontacts.h" 
 #include "convergedmessageaddress.h"
 
 #include "msgserviceinterface.h"
 #include "msgviewmanager.h"
-//INCLUDES
+#include "msgcontacthandler.h"
 
 MsgServiceInterface::MsgServiceInterface(QObject* parent, MsgViewManager* manager)
 :XQServiceProvider( QLatin1String("com.nokia.services.hbserviceprovider.conversationview"),parent),
@@ -90,28 +86,20 @@
     mViewManager->openEditor(number,resolvedName);
     }
 
-bool MsgServiceInterface::resolveContact(const ConvergedMessageAddress &address,
-        ContactDetail &contactDetail)
-    {
-    QContactManager* mPhonebookManager = new QContactManager("symbian");
-    QContactDetailFilter phoneFilter;
-    phoneFilter.setDetailDefinitionName(
-            QContactPhoneNumber::DefinitionName, 
-            QContactPhoneNumber::FieldNumber);
-    phoneFilter.setValue(address.address());
-    phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+bool MsgServiceInterface::resolveContact(
+                                         const ConvergedMessageAddress &address,
+                                         ContactDetail &contactDetail)
+{
+    QString displayLabel = QString("");
+    int localId =
+            MsgContactHandler::resolveContactDisplayName(address.address(),
+                                                         displayLabel,
+                                                         0);
 
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts = mPhonebookManager->contacts(
-            phoneFilter,
-            sortOrder,
-            QStringList());
-
-    if ( matchingContacts.count() > 0 ) {       
-        // Fill the contact details
-        QContact match = matchingContacts.at(0);                   
-        contactDetail.contactId = match.localId();
-        contactDetail.displayName = match.displayLabel();   
+    if (localId != -1)
+    {
+        contactDetail.contactId = localId;
+        contactDetail.displayName = displayLabel;
         return true;
     }