creator/engine/src/creator_phonebookapi.cpp
changeset 48 da3ec8478e66
parent 35 98924d2efce9
--- a/creator/engine/src/creator_phonebookapi.cpp	Thu Sep 02 20:27:24 2010 +0300
+++ b/creator/engine/src/creator_phonebookapi.cpp	Fri Sep 17 08:29:47 2010 +0300
@@ -36,18 +36,17 @@
     // create a new contact item
     QContact store;
     quint32 id;
-    bool success = false;
     for(int i = 0 ; i < list.count() ; i++ )
     	{
 		QContactDetail cntdetail = list.at(i);
-		success = store.saveDetail(&cntdetail);
+		store.saveDetail(&cntdetail);
     	}
     /*foreach( QContactDetail cntdetail, list )
         {
-        success = store.saveDetail( &cntdetail );
+        store.saveDetail( &cntdetail );
         }
     */
-    success = mContactMngr->saveContact( &store );
+    mContactMngr->saveContact( &store );
     id = store.localId();
     return id;
     }
@@ -158,4 +157,33 @@
     {
     return mContactMngr->contact( contactId );
     }
+
+QString CCreatorPhonebookAPI::phoneNumber( const QContactLocalId& contactId )
+    {
+    QString strNumber;
+    QContact contact = mContactMngr->contact( contactId );
+    if( !contact.isEmpty() )
+        {
+        QContactPhoneNumber phoneNumber = static_cast<QContactPhoneNumber>( contact.detail( QContactPhoneNumber::DefinitionName ) );
+        strNumber = phoneNumber.number();
+        }
+    return strNumber;
+    }
+
+bool CCreatorPhonebookAPI::contactDetails( const QContactLocalId& contactId, QString& name, QString& phoneNumber, QString& email )
+    {
+    bool success(false);
+    QContact contact = mContactMngr->contact( contactId );
+    if( !contact.isEmpty() )
+        {
+        QContactPhoneNumber contactPhoneNumber = static_cast<QContactPhoneNumber>( contact.detail( QContactPhoneNumber::DefinitionName ) );
+        phoneNumber = contactPhoneNumber.number();
+        QContactEmailAddress contactEmailAddress = static_cast<QContactEmailAddress>( contact.detail( QContactEmailAddress::DefinitionName ) );
+        email = contactEmailAddress.emailAddress();
+        QContactDisplayLabel contactDisplayLabel = static_cast<QContactDisplayLabel>( contact.detail( QContactDisplayLabel::DefinitionName ) );
+        name = contactDisplayLabel.label();
+        success = true;
+        }
+    return success;
+    }
 // End of File