phonebookui/pbkcommonui/src/cntgroupactionsview.cpp
changeset 66 554fe4dbbb59
parent 61 d30183af6ca6
equal deleted inserted replaced
61:d30183af6ca6 66:554fe4dbbb59
   275 
   275 
   276 void CntGroupActionsView::executeAction(QContact& contact, QContactDetail detail, QString action)
   276 void CntGroupActionsView::executeAction(QContact& contact, QContactDetail detail, QString action)
   277 {
   277 {
   278     Q_UNUSED(contact);
   278     Q_UNUSED(contact);
   279     
   279     
   280     if (action.compare("message", Qt::CaseInsensitive) == 0) {
   280     if (action.compare("message", Qt::CaseInsensitive) == 0)
       
   281     {
   281         QContactPhoneNumber phoneNumber = static_cast<QContactPhoneNumber>(detail);
   282         QContactPhoneNumber phoneNumber = static_cast<QContactPhoneNumber>(detail);
   282         mMessageActionParams.insert(phoneNumber.number(),QVariant(contact.displayLabel()));
   283         mMessageActionParams.insert(phoneNumber.number(),QVariant(contact.displayLabel()));
   283     }
   284     }
   284     else if (action.compare("email", Qt::CaseInsensitive) == 0) {
   285     else if (action.compare("email", Qt::CaseInsensitive) == 0)
       
   286     {
   285         QContactEmailAddress email = static_cast<QContactEmailAddress>(detail);
   287         QContactEmailAddress email = static_cast<QContactEmailAddress>(detail);
   286         mEmailActionParams.append(email.emailAddress());
   288         mEmailActionParams.append(email.emailAddress());
   287     }
   289     }
   288     
   290     
   289     //actionpopup executed, decrement counter
   291     //actionpopup executed, decrement counter
   290     mPopupCount--;
   292     mPopupCount--;
   291     if (mPopupCount==0) {
   293     if (mPopupCount==0)
       
   294     {
   292         QVariantMap map;
   295         QVariantMap map;
   293         QVariant params;
   296         QVariant params;
   294         if (action.compare("message", Qt::CaseInsensitive) == 0) {
   297         if (action.compare("message", Qt::CaseInsensitive) == 0)
       
   298         {
   295             params.setValue(mMessageActionParams);
   299             params.setValue(mMessageActionParams);
   296         }
   300         }
   297         else if (action.compare("email", Qt::CaseInsensitive) == 0) {
   301         else if (action.compare("email", Qt::CaseInsensitive) == 0)
       
   302         {
   298             params.setValue(mEmailActionParams);
   303             params.setValue(mEmailActionParams);
   299         }
   304         }
   300         map.insert(action,params);
   305         map.insert(action,params);
   301         
   306 
   302         CntActionLauncher* other = new CntActionLauncher( mEngine->contactManager(SYMBIAN_BACKEND), action);
   307         CntActionLauncher* other = new CntActionLauncher( mEngine->contactManager(SYMBIAN_BACKEND), action);
   303         connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
   308         connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
   304         other->execute(*mGroupContact, QContactDetail(), map);
   309         other->execute(*mGroupContact, QContactDetail(), map);
   305         }
   310     }
   306 }
   311 }
   307 
   312 
   308 bool CntGroupActionsView::eventFilter(QObject *obj, QEvent *event)
   313 bool CntGroupActionsView::eventFilter(QObject *obj, QEvent *event)
   309 {
   314 {
   310     if (event->type() == QEvent::KeyPress && obj == mView->mainWindow())
   315     if (event->type() == QEvent::KeyPress && obj == mView->mainWindow())
   352 
   357 
   353 void CntGroupActionsView::actionCancelled()
   358 void CntGroupActionsView::actionCancelled()
   354 {
   359 {
   355     //actionpopup cancelled, decrement counter
   360     //actionpopup cancelled, decrement counter
   356     mPopupCount--;
   361     mPopupCount--;
       
   362     
       
   363     if (mPopupCount==0)
       
   364     {
       
   365         QVariantMap map;
       
   366         QVariant params;
       
   367         QString action;
       
   368         if (mMessageActionParams.count())
       
   369         {
       
   370             params.setValue(mMessageActionParams);
       
   371             action = "message";
       
   372         }
       
   373         else if (mEmailActionParams.count())
       
   374         {
       
   375             params.setValue(mEmailActionParams);
       
   376             action = "email";
       
   377         }
       
   378         else
       
   379         {
       
   380             return;
       
   381         }
       
   382         map.insert(action,params);
       
   383 
       
   384         CntActionLauncher* other = new CntActionLauncher( mEngine->contactManager(SYMBIAN_BACKEND), action);
       
   385         connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
       
   386         other->execute(*mGroupContact, QContactDetail(), map);
       
   387     }
   357 }
   388 }
   358 
   389 
   359 
   390 
   360 void CntGroupActionsView::actionExecuted(CntActionLauncher* aAction)
   391 void CntGroupActionsView::actionExecuted(CntActionLauncher* aAction)
   361 {
   392 {