phonebookui/pbkcommonui/src/cntactionlauncher.cpp
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
--- a/phonebookui/pbkcommonui/src/cntactionlauncher.cpp	Tue Jul 06 14:05:47 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntactionlauncher.cpp	Wed Aug 18 09:39:00 2010 +0300
@@ -49,6 +49,36 @@
                 this, SLOT(progress(QContactAction::State)));
         executed = mContactAction->invokeAction( aContact, aDetail );
         }
+    else
+        {
+        progress(QContactAction::FinishedWithErrorState);
+        }
+    
+    return executed;
+    }
+
+bool CntActionLauncher::execute( QContact aContact, QContactDetail aDetail, QVariantMap aParameters )
+    {
+    bool executed = false;
+    QList<QContactActionDescriptor> all = QContactAction::actionDescriptors(mAction, "symbian");
+    mContactAction = QContactAction::action( all.first() );
+    if ( mContactAction )
+        {
+        if (aContact.preferredDetail(mAction).isEmpty() && (mAction == "call" || mAction == "message" || mAction == "email"))
+            {
+            aContact.setPreferredDetail(mAction, aDetail);
+            //return value will be ignored because we cannot do anything if it fails.
+            mContactManager->saveContact(&aContact);
+            }
+        
+        connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)),
+                this, SLOT(progress(QContactAction::State)));
+        executed = mContactAction->invokeAction( aContact, aDetail, aParameters );
+        }
+    else
+        {
+        progress(QContactAction::FinishedWithErrorState);
+        }
     
     return executed;
     }
@@ -67,6 +97,10 @@
                 this, SLOT(progress(QContactAction::State)));
         executed = mContactAction->invokeAction( aContact, aDetail );
     }
+    else
+    {
+        progress(QContactAction::FinishedWithErrorState);
+    }
     return executed;
 }