phonebookui/pbkcommonui/src/cntgroupactionsview.cpp
changeset 53 e6aff7b69165
parent 50 77bc263e1626
child 54 47627ab5d7a4
equal deleted inserted replaced
51:81c360d47083 53:e6aff7b69165
   123         mView->setNavigationAction(mSoftkey);   
   123         mView->setNavigationAction(mSoftkey);   
   124     
   124     
   125     mGroupContact = new QContact(aArgs.value(ESelectedGroupContact).value<QContact>());
   125     mGroupContact = new QContact(aArgs.value(ESelectedGroupContact).value<QContact>());
   126     mViewManager = aMgr;
   126     mViewManager = aMgr;
   127 
   127 
   128     QString groupName = mGroupContact->displayLabel();
   128     QContactName contactName = mGroupContact->detail( QContactName::DefinitionName );
       
   129     QString groupName = contactName.value( QContactName::FieldCustomLabel );        
   129     if (groupName.isEmpty())
   130     if (groupName.isEmpty())
   130     {
   131     {
   131         groupName = hbTrId("txt_phob_list_unnamed");
   132         groupName = hbTrId("txt_phob_list_unnamed");
   132     }
   133     }
   133     
   134     
   192 void CntGroupActionsView::listItemSelected(const QModelIndex &index)
   193 void CntGroupActionsView::listItemSelected(const QModelIndex &index)
   193 {
   194 {
   194     if (index.isValid()) {
   195     if (index.isValid()) {
   195         //reset flags
   196         //reset flags
   196         mPopupCount=0;
   197         mPopupCount=0;
   197         mActionParams.clear();
   198         mEmailActionParams.clear();
       
   199         mMessageActionParams.clear();
   198         
   200         
   199         QString action = mModel->item(index.row())->data(Qt::UserRole+1).toString();
   201         QString action = mModel->item(index.row())->data(Qt::UserRole+1).toString();
   200         
   202         
   201         //conference call
   203         //conference call
   202         if (action.compare("call", Qt::CaseInsensitive) == 0 ) {
   204         if (action.compare("call", Qt::CaseInsensitive) == 0 ) {
   217                 QContactDetail preferredDetail = contact.preferredDetail(action);
   219                 QContactDetail preferredDetail = contact.preferredDetail(action);
   218                 //use preferred detail if exits
   220                 //use preferred detail if exits
   219                 if (!preferredDetail.isEmpty()) {
   221                 if (!preferredDetail.isEmpty()) {
   220                     if(action.compare("message", Qt::CaseInsensitive) == 0) {
   222                     if(action.compare("message", Qt::CaseInsensitive) == 0) {
   221                         QContactPhoneNumber phoneNumber = contact.detail<QContactPhoneNumber>();
   223                         QContactPhoneNumber phoneNumber = contact.detail<QContactPhoneNumber>();
   222                         mActionParams.append(phoneNumber.number());
   224                         mMessageActionParams.insert(phoneNumber.number(),QVariant(contact.displayLabel()));
   223                     }
   225                     }
   224                     else {
   226                     else {
   225                         QContactEmailAddress email = contact.detail<QContactEmailAddress>();
   227                         QContactEmailAddress email = contact.detail<QContactEmailAddress>();
   226                         mActionParams.append(email.emailAddress());
   228                         mEmailActionParams.append(email.emailAddress());
   227                     }
   229                     }
   228                 }
   230                 }
   229                 else {
   231                 else {
   230                     CntActionPopup *actionPopup = new CntActionPopup(&contact);
   232                     CntActionPopup *actionPopup = new CntActionPopup(&contact);
   231                     if(actionPopup->showActionPopup(action)) {
   233                     if(actionPopup->showActionPopup(action)) {
   243             }
   245             }
   244             //no popup dialog, execute action
   246             //no popup dialog, execute action
   245             if (mPopupCount==0) {
   247             if (mPopupCount==0) {
   246                 QVariantMap map;
   248                 QVariantMap map;
   247                 QVariant params;
   249                 QVariant params;
   248                 params.setValue(mActionParams);
   250                 if (action.compare("message", Qt::CaseInsensitive) == 0) {
       
   251                     params.setValue(mMessageActionParams);
       
   252                 }
       
   253                 else if (action.compare("email", Qt::CaseInsensitive) == 0) {
       
   254                     params.setValue(mEmailActionParams);
       
   255                 }
   249                 map.insert(action,params);
   256                 map.insert(action,params);
   250                 CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action);
   257                 CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action);
   251                 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
   258                 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
   252                 other->execute(*mGroupContact, QContactDetail(), map);
   259                 other->execute(*mGroupContact, QContactDetail(), map);
   253             }
   260             }
   259 {
   266 {
   260     Q_UNUSED(contact);
   267     Q_UNUSED(contact);
   261     
   268     
   262     if (action.compare("message", Qt::CaseInsensitive) == 0) {
   269     if (action.compare("message", Qt::CaseInsensitive) == 0) {
   263         QContactPhoneNumber phoneNumber = static_cast<QContactPhoneNumber>(detail);
   270         QContactPhoneNumber phoneNumber = static_cast<QContactPhoneNumber>(detail);
   264         mActionParams.append(phoneNumber.number());
   271         mMessageActionParams.insert(phoneNumber.number(),QVariant(contact.displayLabel()));
   265     }
   272     }
   266     else if (action.compare("email", Qt::CaseInsensitive) == 0) {
   273     else if (action.compare("email", Qt::CaseInsensitive) == 0) {
   267         QContactEmailAddress email = static_cast<QContactEmailAddress>(detail);
   274         QContactEmailAddress email = static_cast<QContactEmailAddress>(detail);
   268         mActionParams.append(email.emailAddress());
   275         mEmailActionParams.append(email.emailAddress());
   269     }
   276     }
   270     
   277     
   271     //actionpopup executed, decrement counter
   278     //actionpopup executed, decrement counter
   272     mPopupCount--;
   279     mPopupCount--;
   273     if (mPopupCount==0) {
   280     if (mPopupCount==0) {
   274         QVariantMap map;
   281         QVariantMap map;
   275         QVariant params;
   282         QVariant params;
   276         params.setValue(mActionParams);
   283         if (action.compare("message", Qt::CaseInsensitive) == 0) {
       
   284             params.setValue(mMessageActionParams);
       
   285         }
       
   286         else if (action.compare("email", Qt::CaseInsensitive) == 0) {
       
   287             params.setValue(mEmailActionParams);
       
   288         }
   277         map.insert(action,params);
   289         map.insert(action,params);
   278         
   290         
   279         CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action);
   291         CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action);
   280         connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
   292         connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*)));
   281         other->execute(*mGroupContact, QContactDetail(), map);
   293         other->execute(*mGroupContact, QContactDetail(), map);