122 mProgressTimer = new QTimer(this); |
123 mProgressTimer = new QTimer(this); |
123 mProgressTimer->setSingleShot(true); |
124 mProgressTimer->setSingleShot(true); |
124 connect(mProgressTimer, SIGNAL(timeout()),this, SLOT(updateSpinningIndicator())); |
125 connect(mProgressTimer, SIGNAL(timeout()),this, SLOT(updateSpinningIndicator())); |
125 |
126 |
126 mMaptile = new CntMapTileService; |
127 mMaptile = new CntMapTileService; |
127 //Connect for maptile status evenet |
128 if( mMaptile->isLocationFeatureEnabled() ) |
128 bool ret = QObject::connect( mMaptile, SIGNAL(maptileFetchingStatusUpdate(int, |
129 { |
|
130 //Connect for maptile status evenet |
|
131 QObject::connect( mMaptile, SIGNAL(maptileFetchingStatusUpdate(int, |
129 int,int)),this,SLOT(mapTileStatusReceived(int,int,int))); |
132 int,int)),this,SLOT(mapTileStatusReceived(int,int,int))); |
|
133 } |
130 } |
134 } |
131 |
135 |
132 /*! |
136 /*! |
133 Destructor |
137 Destructor |
134 */ |
138 */ |
313 // details |
320 // details |
314 else |
321 else |
315 { |
322 { |
316 //map support (image only) |
323 //map support (image only) |
317 if (pos >= CntContactCardDataItem::EAddress && pos <= CntContactCardDataItem::EAddressWork && !dataItem->icon().isNull()) |
324 if (pos >= CntContactCardDataItem::EAddress && pos <= CntContactCardDataItem::EAddressWork && !dataItem->icon().isNull()) |
318 { |
325 { |
319 HbLabel* iconLabel = new HbLabel(mView); |
326 int addressType = CntMapTileService::AddressPreference; |
320 iconLabel->setIcon(dataItem->icon()); |
|
321 |
327 |
322 int width = dataItem->icon().width(); |
328 if( pos == CntContactCardDataItem::EAddressHome ) |
323 int height = dataItem->icon().height(); |
329 { |
324 |
330 addressType = CntMapTileService::AddressHome; |
325 //HbLabel setPreferredSize is not working properly, |
331 } |
326 //so added minimum , maximum size to fix the issue |
332 else if( pos == CntContactCardDataItem::EAddressWork ) |
327 iconLabel->setPreferredSize(QSizeF(width,height)); |
333 { |
328 iconLabel->setMinimumSize(QSizeF(width, height)); |
334 addressType = CntMapTileService::AddressWork; |
329 iconLabel->setMaximumSize(QSizeF(width, height)); |
335 } |
330 iconLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, |
336 |
331 QSizePolicy::Fixed)); |
337 HbLabel* maptileLabel = loadMaptileLabel( addressType ); |
332 mContainerLayout->addItem(iconLabel); |
338 setMaptileLabel( maptileLabel, dataItem->icon() ); |
|
339 mContainerLayout->addItem( maptileLabel ); |
|
340 mMaptileLabelList.insert( addressType, maptileLabel ); |
333 } |
341 } |
334 //other details |
342 //other details |
335 else |
343 else |
336 { |
344 { |
337 CntContactCardDetailItem* item = new CntContactCardDetailItem(index, mContainerWidget, false); |
345 CntContactCardDetailItem* item = new CntContactCardDetailItem(index, mContainerWidget, false); |
454 |
462 |
455 if( mAddressList[index]->mDetailItem != NULL ) |
463 if( mAddressList[index]->mDetailItem != NULL ) |
456 { |
464 { |
457 if( mAddressList[index]->maptileStatus == CntMapTileService::MapTileFetchingCompleted ) |
465 if( mAddressList[index]->maptileStatus == CntMapTileService::MapTileFetchingCompleted ) |
458 { |
466 { |
459 //Empty icon. Clear the search stop icon |
467 |
460 HbIcon icon; |
468 //Read the maptile path and update the image |
461 mAddressList[index]->mDetailItem->setSecondaryIconItem( icon ); |
|
462 |
|
463 QString imagePath; |
469 QString imagePath; |
464 |
470 mMaptile->getMapTileImage( |
465 //Read the maptile path and update the image |
471 contactId, sourceAddressType, imagePath, mView->mainWindow()->orientation() ); |
466 mMaptile->getMapTileImage( contactId, sourceAddressType, imagePath ); |
472 |
467 if( !imagePath.isEmpty() ) |
473 if( !imagePath.isEmpty() ) |
468 { |
474 { |
|
475 //Empty icon. Clear the inprogress icon |
|
476 HbIcon emptyIcon; |
|
477 mAddressList[index]->mDetailItem->setSecondaryIconItem( emptyIcon ); |
|
478 |
469 HbIcon icon( imagePath ); |
479 HbIcon icon( imagePath ); |
470 |
480 |
471 HbLabel* iconLabel = new HbLabel(mView); |
481 HbLabel* maptileLabel = loadMaptileLabel( sourceAddressType ); |
472 iconLabel->setIcon(icon); |
482 setMaptileLabel( maptileLabel, icon ); |
473 |
483 mMaptileLabelList.insert( sourceAddressType, maptileLabel ); |
474 int width = icon.width(); |
|
475 int height = icon.height(); |
|
476 |
|
477 //HbLabel setPreferredSize is not working properly, |
|
478 //so added minimum , maximum size to fix the issue |
|
479 iconLabel->setPreferredSize(QSizeF(width,height)); |
|
480 iconLabel->setMinimumSize(QSizeF(width, height)); |
|
481 iconLabel->setMaximumSize(QSizeF(width, height)); |
|
482 iconLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, |
|
483 QSizePolicy::Fixed)); |
|
484 |
484 |
485 //find the index of the item and insert maptile in the next index |
485 //find the index of the item and insert maptile in the next index |
486 for( int itemIndex = 0 ; itemIndex < mContainerLayout->count(); itemIndex++ ) |
486 for( int itemIndex = 0 ; itemIndex < mContainerLayout->count(); itemIndex++ ) |
487 { |
487 { |
488 if( mContainerLayout->itemAt(itemIndex) == mAddressList[index]->mDetailItem ) |
488 if( mContainerLayout->itemAt(itemIndex) == mAddressList[index]->mDetailItem ) |
489 { |
489 { |
490 mContainerLayout->insertItem( itemIndex+1, iconLabel ); |
490 mContainerLayout->insertItem( itemIndex+1, maptileLabel ); |
491 break; |
491 break; |
492 } |
492 } |
493 } |
493 } |
494 |
494 |
495 } |
495 } |
|
496 else |
|
497 { |
|
498 //Maptile image not available. Show the search stop icon |
|
499 setMaptileSearchStopIcon( index ); |
|
500 } |
496 } |
501 } |
497 else |
502 else |
498 { |
503 { |
499 //Maptile fetching failed. Show the search stop icon |
504 //Maptile fetching failed. Show the search stop icon |
500 QString iconName(CNT_MAPTILE_SEARCH_STOP_ICON); |
505 setMaptileSearchStopIcon( index ); |
501 HbIcon icon(iconName); |
|
502 mAddressList[index]->mDetailItem->setSecondaryIconItem( icon ); |
|
503 bool visible = mAddressList[index]->mDetailItem->isVisible(); |
|
504 mAddressList[index]->mDetailItem->update(); |
|
505 |
|
506 } |
506 } |
507 |
507 |
508 delete mAddressList[index]; |
508 delete mAddressList[index]; |
509 mAddressList.removeAt(index); |
509 mAddressList.removeAt(index); |
510 } |
510 } |
531 mAddressList[index]->maptileStatus = status; |
545 mAddressList[index]->maptileStatus = status; |
532 } |
546 } |
533 } |
547 } |
534 |
548 |
535 updateSpinningIndicator(); |
549 updateSpinningIndicator(); |
|
550 } |
|
551 |
|
552 /* |
|
553 * Updates correct maptile image when screen orientation changes. |
|
554 */ |
|
555 void CntContactCardViewPrivate::updateMaptileImage() |
|
556 { |
|
557 //If there is no maptile displayed, return immediately |
|
558 if( mMaptileLabelList.count() > 0 ) |
|
559 { |
|
560 QContactLocalId contactId = mContact->id().localId(); |
|
561 |
|
562 QList<QContactAddress> addressDetails = mContact->details<QContactAddress>(); |
|
563 |
|
564 //address |
|
565 QString contextHome(QContactAddress::ContextHome.operator QString()); |
|
566 QString contextWork(QContactAddress::ContextWork.operator QString()); |
|
567 CntMapTileService::ContactAddressType sourceAddressType |
|
568 = CntMapTileService::AddressPreference; |
|
569 |
|
570 QString imagePath; |
|
571 |
|
572 for ( int i = 0; i < addressDetails.count(); i++ ) |
|
573 { |
|
574 if ( !addressDetails[i].contexts().isEmpty() && |
|
575 addressDetails[i].contexts().at(0) == contextHome ) |
|
576 { |
|
577 sourceAddressType = CntMapTileService::AddressHome; |
|
578 } |
|
579 else if ( !addressDetails[i].contexts().isEmpty() && |
|
580 addressDetails[i].contexts().at(0) == contextWork ) |
|
581 { |
|
582 sourceAddressType = CntMapTileService::AddressWork; |
|
583 } |
|
584 |
|
585 int status = mMaptile->getMapTileImage( |
|
586 contactId, |
|
587 sourceAddressType, |
|
588 imagePath, |
|
589 mView->mainWindow()->orientation() ); |
|
590 if( !imagePath.isEmpty() ) |
|
591 { |
|
592 HbIcon icon( imagePath ); |
|
593 HbLabel* label = mMaptileLabelList.value( sourceAddressType ); |
|
594 if( label ) |
|
595 { |
|
596 setMaptileLabel( label, icon ); |
|
597 } |
|
598 } |
|
599 } |
|
600 } |
|
601 } |
|
602 |
|
603 |
|
604 /* |
|
605 * Asscoiate the maptile label widget with maptile image |
|
606 */ |
|
607 void CntContactCardViewPrivate::setMaptileLabel( HbLabel*& mapLabel, const HbIcon& icon ) |
|
608 { |
|
609 mapLabel->clear(); |
|
610 mapLabel->setIcon( icon ); |
|
611 |
|
612 int width = icon.width(); |
|
613 int height = icon.height(); |
|
614 |
|
615 //HbLabel setPreferredSize is not working properly, |
|
616 //so added minimum , maximum size to fix the issue |
|
617 mapLabel->setPreferredSize(QSizeF(width,height)); |
|
618 mapLabel->setMinimumSize(QSizeF(width, height)); |
|
619 mapLabel->setMaximumSize(QSizeF(width, height)); |
|
620 mapLabel->setSizePolicy(QSizePolicy( QSizePolicy::Fixed, |
|
621 QSizePolicy::Fixed)); |
|
622 } |
|
623 |
|
624 /* |
|
625 * Load the maptile label based on the address type |
|
626 */ |
|
627 HbLabel* CntContactCardViewPrivate::loadMaptileLabel( int addressType ) |
|
628 { |
|
629 HbLabel* maptileLabel = NULL ; |
|
630 |
|
631 if( addressType == CntMapTileService::AddressPreference ) |
|
632 { |
|
633 maptileLabel = static_cast<HbLabel*>(document()->findWidget(QString("maptilePreferenceWidget"))); |
|
634 } |
|
635 else if( addressType == CntMapTileService::AddressHome ) |
|
636 { |
|
637 maptileLabel = static_cast<HbLabel*>(document()->findWidget(QString("maptileHomeWidget"))); |
|
638 } |
|
639 else if( addressType == CntMapTileService::AddressWork ) |
|
640 { |
|
641 maptileLabel = static_cast<HbLabel*>(document()->findWidget(QString("maptileWorkWidget"))); |
|
642 } |
|
643 |
|
644 return maptileLabel; |
536 } |
645 } |
537 |
646 |
538 void CntContactCardViewPrivate::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error) |
647 void CntContactCardViewPrivate::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error) |
539 { |
648 { |
540 CNT_ENTRY |
649 CNT_ENTRY |
541 |
650 |
542 Q_UNUSED(data); |
651 Q_UNUSED(data); |
543 Q_UNUSED(id); |
652 Q_UNUSED(id); |
544 if (!error) |
653 if (!error) |
545 { |
654 { |
546 QIcon qicon(pixmap); |
655 HbIcon icon(pixmap); |
547 HbIcon icon(qicon); |
|
548 mHeadingItem->setIcon(icon); |
656 mHeadingItem->setIcon(icon); |
549 mVCardIcon = new HbIcon(qicon); |
657 mVCardIcon = new HbIcon(pixmap); |
550 mImageLabel->clear(); |
658 mImageLabel->clear(); |
551 mImageLabel->setIcon(icon); |
659 mImageLabel->setIcon(icon); |
552 } |
660 } |
553 |
661 |
554 CNT_EXIT |
662 CNT_EXIT |
724 CntContactCardDetailItem *item = qobject_cast<CntContactCardDetailItem*>(sender()); |
833 CntContactCardDetailItem *item = qobject_cast<CntContactCardDetailItem*>(sender()); |
725 int index = item->index(); |
834 int index = item->index(); |
726 QString action = mDataContainer->dataItem(index)->action(); |
835 QString action = mDataContainer->dataItem(index)->action(); |
727 // Check if action is internal |
836 // Check if action is internal |
728 QList<QContactActionDescriptor> actionDescriptors = QContactAction::actionDescriptors(action, "symbian", 1); |
837 QList<QContactActionDescriptor> actionDescriptors = QContactAction::actionDescriptors(action, "symbian", 1); |
729 if(0 < actionDescriptors.count()) |
838 if (0 < actionDescriptors.count()) |
730 { |
839 { |
731 // These actions are considered internal(vendor=symbian and version=1) |
840 // These actions are considered internal(vendor=symbian and version=1) |
732 executeAction(*mContact, mDataContainer->dataItem(index)->detail(), action); |
841 executeAction(*mContact, mDataContainer->dataItem(index)->detail(), action, item); |
733 } |
842 } |
734 else |
843 else |
735 { |
844 { |
736 //Handle dynamic actions differently |
845 //Handle dynamic actions differently |
737 executeDynamicAction(*mContact, mDataContainer->dataItem(index)->detail(), mDataContainer->dataItem(index)->actionDescriptor()); |
846 executeDynamicAction(*mContact, mDataContainer->dataItem(index)->detail(), mDataContainer->dataItem(index)->actionDescriptor()); |
739 } |
848 } |
740 |
849 |
741 /*! |
850 /*! |
742 Execute the call / message / email action |
851 Execute the call / message / email action |
743 */ |
852 */ |
744 void CntContactCardViewPrivate::executeAction(QContact& aContact, QContactDetail aDetail, QString aAction) |
853 void CntContactCardViewPrivate::executeAction(QContact& aContact, const QContactDetail& aDetail, const QString& aAction, CntContactCardDetailItem* aItem) |
745 { |
854 { |
746 CntActionLauncher* other = new CntActionLauncher( aAction ); |
855 CntActionLauncher* other = new CntActionLauncher(*contactManager(), aAction); |
747 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
856 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
748 other->execute(aContact, aDetail); |
857 if (aItem && aContact.preferredDetail(aAction).isEmpty()) |
|
858 { |
|
859 setPreferredAction(aAction, aDetail, aItem); |
|
860 } |
|
861 other->execute(aContact, aDetail); |
|
862 } |
|
863 |
|
864 |
|
865 /*! |
|
866 Execute the call / message / email action |
|
867 */ |
|
868 void CntContactCardViewPrivate::executeAction(QContact& aContact, const QContactDetail& aDetail, const QString& aAction) |
|
869 { |
|
870 //TODO: need refactoring |
|
871 CntContactCardDetailItem* detailItem = NULL; |
|
872 for (int index = 0; index < mDataContainer->itemCount(); index++) |
|
873 { |
|
874 QContactDetail detail = mDataContainer->dataItem(index)->detail(); |
|
875 QString action = mDataContainer->dataItem(index)->action(); |
|
876 if (detail == aDetail && action == aAction) |
|
877 { |
|
878 detailItem = static_cast<CntContactCardDetailItem*>(mContainerLayout->itemAt(index)); |
|
879 } |
|
880 } |
|
881 executeAction(aContact, aDetail, aAction, detailItem); |
|
882 mAcceptSendKey=true; |
749 } |
883 } |
750 |
884 |
751 /*! |
885 /*! |
752 Execute dynamic action |
886 Execute dynamic action |
753 */ |
887 */ |
754 void CntContactCardViewPrivate::executeDynamicAction(QContact& aContact, QContactDetail aDetail, QContactActionDescriptor aActionDescriptor) |
888 void CntContactCardViewPrivate::executeDynamicAction(QContact& aContact, QContactDetail aDetail, QContactActionDescriptor aActionDescriptor) |
755 { |
889 { |
756 CntActionLauncher* other = new CntActionLauncher( ); |
890 CntActionLauncher* other = new CntActionLauncher(*contactManager()); |
757 connect(other, SIGNAL(actionExecuted(CntAction*)), this, SLOT(actionExecuted(CntAction*))); |
891 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
758 other->execute(aContact, aDetail, aActionDescriptor); |
892 other->execute(aContact, aDetail, aActionDescriptor); |
759 } |
893 } |
760 |
894 |
761 void CntContactCardViewPrivate::actionExecuted(CntActionLauncher* aAction) |
895 void CntContactCardViewPrivate::actionExecuted(CntActionLauncher* aAction) |
762 { |
896 { |
763 aAction->deleteLater(); |
897 aAction->deleteLater(); |
764 } |
|
765 |
|
766 /*! |
|
767 Set selected detail as preferred for selected action |
|
768 */ |
|
769 void CntContactCardViewPrivate::setPreferredAction(const QString &aAction, const QContactDetail &aDetail) |
|
770 { |
|
771 mContact->setPreferredDetail(aAction, aDetail); |
|
772 contactManager()->saveContact(mContact); |
|
773 } |
898 } |
774 |
899 |
775 /*! |
900 /*! |
776 Item specific menu |
901 Item specific menu |
777 */ |
902 */ |
891 |
1016 |
892 QString name = aAction->objectName(); |
1017 QString name = aAction->objectName(); |
893 |
1018 |
894 if ( name == "communicationAction" ) |
1019 if ( name == "communicationAction" ) |
895 { |
1020 { |
896 executeAction( *mContact, detail, action ); |
1021 executeAction(*mContact, detail, action, item); |
897 } |
1022 } |
898 |
1023 |
899 if ( name == "videoCommunicationAction" ) |
1024 if ( name == "videoCommunicationAction" ) |
900 { |
1025 { |
901 //service name latter on should come from service table. |
1026 //service name latter on should come from service table. |
902 executeAction( *mContact, detail, "videocall" ); |
1027 executeAction(*mContact, detail, "videocall", item); |
903 } |
1028 } |
904 if ( name == "dynamicAction" ) |
1029 if ( name == "dynamicAction" ) |
905 { |
1030 { |
906 executeDynamicAction(*mContact, detail, mDataContainer->dataItem(index)->actionDescriptor()); |
1031 executeDynamicAction(*mContact, detail, mDataContainer->dataItem(index)->actionDescriptor()); |
907 } |
1032 } |
908 |
1033 |
909 if ( name == "preferredAction" ) |
1034 if ( name == "preferredAction" ) |
910 { |
1035 { |
911 setPreferredAction(action, detail); |
1036 setPreferredAction(action, detail, item); |
912 |
1037 } |
913 if (mPreferredItems.contains(action)) |
1038 } |
914 { |
1039 |
915 CntContactCardDetailItem *oldItem = mPreferredItems.value(action); |
1040 /*! |
916 mDataContainer->dataItem(oldItem->index())->setSecondaryIcon(HbIcon()); |
1041 Set selected detail as preferred for selected action in detail item |
917 oldItem->setDetails(mDataContainer->dataItem(oldItem->index())); |
1042 */ |
918 } |
1043 void CntContactCardViewPrivate::setPreferredAction(const QString &aAction, const QContactDetail &aDetail, CntContactCardDetailItem *aDetailItem) |
919 |
1044 { |
920 mDataContainer->dataItem(item->index())->setSecondaryIcon(HbIcon("qtg_mono_favourites")); |
1045 if (aAction == "call" || aAction == "message" || aAction == "email") |
921 item->setDetails(mDataContainer->dataItem(item->index())); |
1046 { |
922 |
1047 mContact->setPreferredDetail(aAction, aDetail); |
923 mPreferredItems.insert(action, item); |
1048 contactManager()->saveContact(mContact); |
924 } |
1049 if (mPreferredItems.contains(aAction)) |
925 } |
1050 { |
|
1051 CntContactCardDetailItem *oldItem = mPreferredItems.value(aAction); |
|
1052 mDataContainer->dataItem(oldItem->index())->setSecondaryIcon(HbIcon()); |
|
1053 oldItem->setDetails(mDataContainer->dataItem(oldItem->index())); |
|
1054 } |
|
1055 |
|
1056 mDataContainer->dataItem(aDetailItem->index())->setSecondaryIcon(HbIcon("qtg_mono_favourites")); |
|
1057 aDetailItem->setDetails(mDataContainer->dataItem(aDetailItem->index())); |
|
1058 |
|
1059 mPreferredItems.insert(aAction, aDetailItem); |
|
1060 } |
|
1061 } |
|
1062 |
926 |
1063 |
927 void CntContactCardViewPrivate::handleSendBusinessCard( HbAction* aAction ) |
1064 void CntContactCardViewPrivate::handleSendBusinessCard( HbAction* aAction ) |
928 { |
1065 { |
929 Q_UNUSED(aAction); |
1066 Q_UNUSED(aAction); |
930 qDebug() << "CntContactCardViewPrivate::handleSendBusinessCard - IN"; |
1067 qDebug() << "CntContactCardViewPrivate::handleSendBusinessCard - IN"; |
1097 } |
1237 } |
1098 } |
1238 } |
1099 |
1239 |
1100 void CntContactCardViewPrivate::sendKeyPressed() |
1240 void CntContactCardViewPrivate::sendKeyPressed() |
1101 { |
1241 { |
1102 QContactDetail preferredDetail = mContact->preferredDetail("call"); |
1242 int count = 0; |
1103 if (!preferredDetail.isEmpty()) |
1243 for (int index = 0; index < mDataContainer->itemCount(); index++) |
1104 { |
1244 { |
1105 executeAction(*mContact, preferredDetail, "call"); |
1245 CntContactCardDataItem* dataItem = mDataContainer->dataItem(index); |
1106 } |
1246 if (dataItem->action().compare("call", Qt::CaseInsensitive) == 0) |
1107 else |
1247 { |
1108 { |
1248 count++; |
1109 if(!mSendKeyListModel) |
1249 } |
1110 { |
1250 } |
1111 mSendKeyListModel = new QStandardItemModel(); |
1251 if (!count) |
1112 } |
1252 { |
1113 mSendKeyListModel->clear(); |
1253 XQServiceRequest snd("com.nokia.services.logsservices.starter", "start(int,bool)", false); |
1114 for (int index = 0; index < mDataContainer->itemCount(); index++) |
1254 snd << 0; // all calls |
1115 { |
1255 snd << true; // show dialpad |
1116 CntContactCardDataItem* dataItem = mDataContainer->dataItem(index); |
1256 snd.send(); |
1117 if (dataItem->action().compare("call", Qt::CaseInsensitive) == 0) |
1257 } |
1118 { |
1258 else |
1119 QStandardItem *labelItem = new QStandardItem(); |
1259 { |
1120 QStringList textList; |
1260 QContactDetail preferredDetail = mContact->preferredDetail("call"); |
1121 textList << dataItem->titleText() << dataItem->valueText(); |
1261 if (!preferredDetail.isEmpty()) |
1122 labelItem->setData(textList, Qt::DisplayRole); |
1262 { |
1123 labelItem->setData(dataItem->icon(), Qt::DecorationRole); |
1263 executeAction(*mContact, preferredDetail, "call", NULL); |
1124 labelItem->setData(index, Qt::UserRole); |
1264 } |
1125 mSendKeyListModel->appendRow(labelItem); |
1265 else if (count == 1 ) |
1126 } |
1266 { |
1127 } |
1267 mContact->setPreferredDetail("call", mContact->details<QContactPhoneNumber>().first()); |
1128 |
1268 executeAction( *mContact, mContact->details<QContactPhoneNumber>().first(), "call", NULL); |
1129 if (mSendKeyListModel->rowCount() == 0) |
1269 } |
1130 { |
1270 else if(count >= 2 && mAcceptSendKey) |
1131 XQServiceRequest snd("com.nokia.services.logsservices.starter", "start(int,bool)", false); |
1271 { |
1132 snd << 0; // all calls |
|
1133 snd << true; // show dialpad |
|
1134 snd.send(); |
|
1135 } |
|
1136 else if (mSendKeyListModel->rowCount() ==1 ) |
|
1137 { |
|
1138 QContactDetail detail = mDataContainer->dataItem(0)->detail(); |
|
1139 executeAction( *mContact, detail, "call" ); |
|
1140 } |
|
1141 else if (mSendKeyListModel->rowCount() >= 2 && mAcceptSendKey) |
|
1142 { |
|
1143 mAcceptSendKey = false; |
1272 mAcceptSendKey = false; |
|
1273 CntActionPopup *actionPopup = new CntActionPopup(mContact); |
|
1274 actionPopup->showActionPopup("call"); |
|
1275 connect( actionPopup, SIGNAL(executeContactAction(QContact&, QContactDetail, QString)), this, |
|
1276 SLOT(executeAction(QContact&, QContactDetail, QString))); |
|
1277 connect( actionPopup, SIGNAL(actionPopupCancelPressed()), this, |
|
1278 SLOT(sendKeyCancelSlot())); |
1144 |
1279 |
1145 // Instantiate a dialog |
1280 } |
1146 mSendKeyPopup = new HbSelectionDialog(); |
1281 } |
1147 mSendKeyPopup->clearActions(); |
1282 } |
1148 mSendKeyPopup->setAttribute(Qt::WA_DeleteOnClose, true); |
1283 |
1149 mSendKeyPopup->setDismissPolicy(HbPopup::NoDismiss); |
1284 void CntContactCardViewPrivate::sendKeyCancelSlot() |
1150 mSendKeyPopup->setTimeout(HbPopup::NoTimeout); |
1285 { |
1151 mSendKeyPopup->setModal(true); |
|
1152 |
|
1153 HbListView* listView = new HbListView(mSendKeyPopup); |
|
1154 listView->setModel(mSendKeyListModel); |
|
1155 listView->setScrollingStyle(HbScrollArea::PanWithFollowOn); |
|
1156 listView->setFrictionEnabled(true); |
|
1157 |
|
1158 connect(listView, SIGNAL(activated (const QModelIndex&)), this, |
|
1159 SLOT(launchSendKeyAction(const QModelIndex&))); |
|
1160 |
|
1161 QString contactName = mContact->displayLabel(); |
|
1162 |
|
1163 HbLabel *headingText = new HbLabel(mSendKeyPopup); |
|
1164 headingText->setPlainText(contactName); |
|
1165 |
|
1166 mSendKeyPopup->setHeadingWidget(headingText); |
|
1167 mSendKeyPopup->setContentWidget(listView); |
|
1168 |
|
1169 HbAction *cancelAction = new HbAction(hbTrId("txt_phob_button_cancel"), mSendKeyPopup); |
|
1170 mSendKeyPopup->addAction(cancelAction); |
|
1171 |
|
1172 // Launch dialog asyncronously |
|
1173 mSendKeyPopup->open(this, SLOT(sendKeyDialogSlot(HbAction*))); |
|
1174 } |
|
1175 } |
|
1176 } |
|
1177 |
|
1178 void CntContactCardViewPrivate::sendKeyDialogSlot(HbAction* action) |
|
1179 { |
|
1180 Q_UNUSED(action); |
|
1181 mAcceptSendKey = true; |
1286 mAcceptSendKey = true; |
1182 } |
1287 } |
1183 |
|
1184 void CntContactCardViewPrivate::launchSendKeyAction(const QModelIndex &index) |
|
1185 { |
|
1186 mAcceptSendKey = true; |
|
1187 mSendKeyPopup->close(); |
|
1188 if (index.isValid()) |
|
1189 { |
|
1190 int row = index.row(); |
|
1191 int selectedDetail = mSendKeyListModel->item(index.row())->data(Qt::UserRole).toInt(); |
|
1192 executeAction(*mContact, mDataContainer->dataItem(selectedDetail)->detail(), "call"); |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 // end of file |
1288 // end of file |