phonebookui/pbkcommonui/src/cntactionlauncher.cpp
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
equal deleted inserted replaced
47:7cbcb2896f0e 59:a642906a277a
    47         
    47         
    48         connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)),
    48         connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)),
    49                 this, SLOT(progress(QContactAction::State)));
    49                 this, SLOT(progress(QContactAction::State)));
    50         executed = mContactAction->invokeAction( aContact, aDetail );
    50         executed = mContactAction->invokeAction( aContact, aDetail );
    51         }
    51         }
       
    52     else
       
    53         {
       
    54         progress(QContactAction::FinishedWithErrorState);
       
    55         }
       
    56     
       
    57     return executed;
       
    58     }
       
    59 
       
    60 bool CntActionLauncher::execute( QContact aContact, QContactDetail aDetail, QVariantMap aParameters )
       
    61     {
       
    62     bool executed = false;
       
    63     QList<QContactActionDescriptor> all = QContactAction::actionDescriptors(mAction, "symbian");
       
    64     mContactAction = QContactAction::action( all.first() );
       
    65     if ( mContactAction )
       
    66         {
       
    67         if (aContact.preferredDetail(mAction).isEmpty() && (mAction == "call" || mAction == "message" || mAction == "email"))
       
    68             {
       
    69             aContact.setPreferredDetail(mAction, aDetail);
       
    70             //return value will be ignored because we cannot do anything if it fails.
       
    71             mContactManager->saveContact(&aContact);
       
    72             }
       
    73         
       
    74         connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)),
       
    75                 this, SLOT(progress(QContactAction::State)));
       
    76         executed = mContactAction->invokeAction( aContact, aDetail, aParameters );
       
    77         }
       
    78     else
       
    79         {
       
    80         progress(QContactAction::FinishedWithErrorState);
       
    81         }
    52     
    82     
    53     return executed;
    83     return executed;
    54     }
    84     }
    55  
    85  
    56 /*!
    86 /*!
    65     {
    95     {
    66         connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)),
    96         connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)),
    67                 this, SLOT(progress(QContactAction::State)));
    97                 this, SLOT(progress(QContactAction::State)));
    68         executed = mContactAction->invokeAction( aContact, aDetail );
    98         executed = mContactAction->invokeAction( aContact, aDetail );
    69     }
    99     }
       
   100     else
       
   101     {
       
   102         progress(QContactAction::FinishedWithErrorState);
       
   103     }
    70     return executed;
   104     return executed;
    71 }
   105 }
    72 
   106 
    73 void CntActionLauncher::progress( QContactAction::State status )
   107 void CntActionLauncher::progress( QContactAction::State status )
    74     {
   108     {