43 } |
44 } |
44 |
45 |
45 /*! |
46 /*! |
46 Constructor |
47 Constructor |
47 */ |
48 */ |
48 CntContactCardDataContainer::CntContactCardDataContainer(QContact* contact, QObject *parent, bool myCard, CntMapTileService* maptile) : |
49 CntContactCardDataContainer::CntContactCardDataContainer( |
|
50 QContact* contact, QObject *parent, bool myCard, CntMapTileService* maptile, Qt::Orientations orientation ) : |
49 mContact(contact), |
51 mContact(contact), |
50 mSeparatorIndex(-1), |
52 mSeparatorIndex(-1), |
51 mLocationFeatureEnabled(false), |
53 mLocationFeatureEnabled(false), |
52 mMaptileInterface(maptile) |
54 mMaptileInterface(maptile), |
|
55 mOrientation( orientation ) |
53 { |
56 { |
54 Q_UNUSED(parent); |
57 Q_UNUSED(parent); |
55 if (contact->type() == QContactType::TypeGroup) |
58 if (contact->type() == QContactType::TypeGroup) |
56 { |
59 { |
57 initializeGroupData(); |
60 initializeGroupData(); |
196 dataItem->setIcon(HbIcon(mStringMapper.getContactCardIconString(url.definitionName(), context))); |
199 dataItem->setIcon(HbIcon(mStringMapper.getContactCardIconString(url.definitionName(), context))); |
197 dataItem->setContactDetail(url); |
200 dataItem->setContactDetail(url); |
198 mDataItemList.append(dataItem); |
201 mDataItemList.append(dataItem); |
199 } |
202 } |
200 } |
203 } |
201 |
204 QList<QContactDetail> allDetails = mContact->details(); |
|
205 |
202 if(!myCard && extendedActions.count()) |
206 if(!myCard && extendedActions.count()) |
203 { |
207 { |
204 // Do not create actions for details in my card |
208 // Do not create actions for details in my card |
205 for (int i = 0; i < details.count(); i++) |
209 for (int i = 0; i < allDetails.count(); i++) |
206 { |
210 { |
207 for(int j = 0; j < extendedActions.count(); j++) |
211 for(int j = 0; j < extendedActions.count(); j++) |
208 { |
212 { |
209 QList<QContactActionDescriptor> actionDescriptors = QContactAction::actionDescriptors(extendedActions[j]); |
213 QList<QContactActionDescriptor> actionDescriptors = QContactAction::actionDescriptors(extendedActions[j]); |
210 for(int l = 0; l < actionDescriptors.count(); l++) |
214 for(int l = 0; l < actionDescriptors.count(); l++) |
211 { |
215 { |
212 // Different implementations(vendor, version) for same actions handled in loop |
216 // Different implementations(vendor, version) for same actions handled in loop |
213 QContactAction* contactAction = QContactAction::action(actionDescriptors.at(l)); |
217 QContactAction* contactAction = QContactAction::action(actionDescriptors.at(l)); |
214 if(contactAction->isDetailSupported(details[i], *mContact)) |
218 if(contactAction->isDetailSupported(allDetails[i], *mContact)) |
215 { |
219 { |
216 const QContactDetail detail = details.at(i); |
220 const QContactDetail detail = allDetails.at(i); |
217 QVariantMap map = contactAction->metaData(); |
221 QVariantMap map = contactAction->metaData(); |
218 if(map.contains(KCntUiActionMetaTitleText) || map.contains(KCntUiActionMetaTitleTextDetail)) |
222 if(map.contains(KCntUiActionMetaTitleText) || map.contains(KCntUiActionMetaTitleTextDetail)) |
219 { |
223 { |
220 // Actions without title text and title text detail are considered to be non UI items |
224 // Actions without title text and title text detail are considered to be non UI items |
221 //action description |
225 //action description |
438 |
442 |
439 QContactLocalId contactId = mContact->id().localId(); |
443 QContactLocalId contactId = mContact->id().localId(); |
440 |
444 |
441 //Get the maptile image path |
445 //Get the maptile image path |
442 int status = mMaptileInterface->getMapTileImage( |
446 int status = mMaptileInterface->getMapTileImage( |
443 contactId, sourceAddressType, imageFile ); |
447 contactId, sourceAddressType, imageFile, mOrientation ); |
444 |
448 |
445 if( status == CntMapTileService::MapTileFetchingInProgress || status == |
449 if( status == CntMapTileService::MapTileFetchingInProgress || status == |
446 CntMapTileService::MapTileFetchingNetworkError ) |
450 CntMapTileService::MapTileFetchingNetworkError ) |
447 { |
451 { |
448 //Load the progress indicator icon |
452 //Load the progress indicator icon |
487 QList<QContactOrganization> organizationDetails = mContact->details<QContactOrganization>(); |
491 QList<QContactOrganization> organizationDetails = mContact->details<QContactOrganization>(); |
488 for (int i = 0; i < organizationDetails.count(); i++) |
492 for (int i = 0; i < organizationDetails.count(); i++) |
489 { |
493 { |
490 CntContactCardDataItem* dataItem = new CntContactCardDataItem(hbTrId("txt_phob_formlabel_company_details"), CntContactCardDataItem::ECompanyDetails, false); |
494 CntContactCardDataItem* dataItem = new CntContactCardDataItem(hbTrId("txt_phob_formlabel_company_details"), CntContactCardDataItem::ECompanyDetails, false); |
491 QStringList companyList; |
495 QStringList companyList; |
492 companyList << organizationDetails[i].title() << organizationDetails[i].name() << organizationDetails[i].department(); |
496 if (!organizationDetails[i].title().isEmpty()) |
493 dataItem->setValueText(companyList.join(" ").trimmed()); |
497 companyList.append(organizationDetails[i].title()); |
494 dataItem->setContactDetail(organizationDetails[i]); |
498 if (!organizationDetails[i].name().isEmpty()) |
495 addSeparator(itemCount()); |
499 companyList.append(organizationDetails[i].name()); |
496 mDataItemList.append(dataItem); |
500 if (!organizationDetails[i].department().isEmpty()) |
|
501 companyList.append(organizationDetails[i].department()); |
|
502 if (companyList.count()>0) |
|
503 { |
|
504 dataItem->setValueText(companyList.join(" ").trimmed()); |
|
505 dataItem->setContactDetail(organizationDetails[i]); |
|
506 addSeparator(itemCount()); |
|
507 mDataItemList.append(dataItem); |
|
508 } |
|
509 } |
|
510 |
|
511 //assistant name |
|
512 for (int i = 0; i < organizationDetails.count(); i++) |
|
513 { |
|
514 QString assistant = organizationDetails[i].assistantName(); |
|
515 if (!assistant.isEmpty()) |
|
516 { |
|
517 CntContactCardDataItem* dataItem = new CntContactCardDataItem(hbTrId("txt_phob_formlabel_assistant"), CntContactCardDataItem::EAssistantName, false); |
|
518 dataItem->setValueText(assistant); |
|
519 dataItem->setContactDetail(organizationDetails[i]); |
|
520 addSeparator(itemCount()); |
|
521 mDataItemList.append(dataItem); |
|
522 } |
497 } |
523 } |
498 |
524 |
499 //birthday |
525 //birthday |
500 QList<QContactBirthday> birthdayDetails = mContact->details<QContactBirthday>(); |
526 QList<QContactBirthday> birthdayDetails = mContact->details<QContactBirthday>(); |
501 for (int i = 0; i < birthdayDetails.count(); i++) |
527 for (int i = 0; i < birthdayDetails.count(); i++) |
523 for (int i = 0; i < ringtoneDetails.count(); i++) |
549 for (int i = 0; i < ringtoneDetails.count(); i++) |
524 { |
550 { |
525 if (!ringtoneDetails.at(i).audioRingtoneUrl().isEmpty()) |
551 if (!ringtoneDetails.at(i).audioRingtoneUrl().isEmpty()) |
526 { |
552 { |
527 CntContactCardDataItem* dataItem = new CntContactCardDataItem(hbTrId("txt_phob_formlabel_ringing_tone"), CntContactCardDataItem::ERingtone, false); |
553 CntContactCardDataItem* dataItem = new CntContactCardDataItem(hbTrId("txt_phob_formlabel_ringing_tone"), CntContactCardDataItem::ERingtone, false); |
528 dataItem->setValueText(ringtoneDetails[i].audioRingtoneUrl().toString()); |
554 QFileInfo ringtoneFileInfo(ringtoneDetails[i].audioRingtoneUrl().toString()); |
|
555 QString ringtoneFileName = ringtoneFileInfo.fileName(); |
|
556 dataItem->setValueText(ringtoneFileName); |
529 dataItem->setContactDetail(ringtoneDetails[i]); |
557 dataItem->setContactDetail(ringtoneDetails[i]); |
530 addSeparator(itemCount()); |
558 addSeparator(itemCount()); |
531 mDataItemList.append(dataItem); |
559 mDataItemList.append(dataItem); |
532 break; |
560 break; |
533 } |
561 } |