phonebookui/phonebookservices/src/cntservices.cpp
changeset 54 47627ab5d7a4
parent 53 e6aff7b69165
child 61 d30183af6ca6
--- a/phonebookui/phonebookservices/src/cntservices.cpp	Fri Jul 23 12:43:48 2010 +0300
+++ b/phonebookui/phonebookservices/src/cntservices.cpp	Thu Aug 05 14:31:09 2010 +0300
@@ -293,7 +293,7 @@
     CntViewParameters params;
     params.insert(EViewId, serviceEditView);
 
-    QContact contact = mViewManager->contactManager(SYMBIAN_BACKEND)->contact(contactId);
+    QContact contact = contactManager()->contact(contactId);
     QVariant varContact;
     varContact.setValue(contact);
     params.insert(ESelectedContact, varContact);
@@ -308,8 +308,7 @@
     CNT_ENTRY
     mCurrentProvider = &aServiceProvider;
 
-    QContactManager manager("symbian");
-    QContact contact = manager.contact(aContactId);
+    QContact contact = contactManager()->contact(aContactId);
 
     // Launch Contact Card view
     CntViewParameters params;
@@ -372,6 +371,23 @@
     CNT_EXIT
 }
 
+void CntServices::launchGroupMemberView(int aContactId,
+    CntAbstractServiceProvider& aServiceProvider )
+{
+    CNT_ENTRY
+    mCurrentProvider = &aServiceProvider;
+
+    QContact contact = contactManager()->contact(aContactId);
+
+    // Launch Group member view
+    CntViewParameters params;
+    params.insert(EViewId, serviceGroupMemberView);
+    QVariant var;
+    var.setValue(contact);
+    params.insert(ESelectedGroupContact, var);
+    mViewManager->changeView( params );
+    CNT_EXIT
+}
 
 void CntServices::setQuittable(bool quittable)
 {
@@ -411,7 +427,6 @@
 void CntServices::removeNotSupportedFields(QContact& contact)
 {
     CNT_ENTRY
-    QContactManager cm("symbian");
     QList<QContactDetail>   removeList;
     
     // Not all fields are supported in symbian back-end
@@ -449,7 +464,10 @@
                 if(phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeVoice)
                    || phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeMessagingCapable))
                 {
-                    detail.removeValue(QContactPhoneNumber::FieldSubTypes);
+                    // Default to subtype mobile
+                    QStringList l;
+                    l << QLatin1String(QContactPhoneNumber::SubTypeMobile);
+                    detail.setValue(QContactPhoneNumber::FieldSubTypes, l);
                     contact.saveDetail(&detail);
                 }
             }
@@ -509,9 +527,9 @@
 {
     CNT_ENTRY
     if (  mCurrentProvider )
-        {
+    {
         mCurrentProvider->CompleteServiceAndCloseApp( retValue );
-        }
+    }
     CNT_EXIT
 }
 
@@ -519,14 +537,21 @@
 {
     CNT_ENTRY
     if (  mCurrentProvider )
-        {
+    {
         // Complete the service with KCntServicesTerminated return value
         QVariant var(KCntServicesTerminated);
         mCurrentProvider->CompleteServiceAndCloseApp( var );
-        }
+    }
     CNT_EXIT
 }
 
+QContactManager* CntServices::contactManager()
+{
+    if ( mViewManager )
+        return mViewManager->contactManager(SYMBIAN_BACKEND);
+    return NULL;
+}
+
 Q_IMPLEMENT_USER_METATYPE(CntServicesContact)
 Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList)