245 connect(mHeadingItem, SIGNAL(passShortPressed(const QPointF&)), this, SLOT(doChangeImage())); |
245 connect(mHeadingItem, SIGNAL(passShortPressed(const QPointF&)), this, SLOT(doChangeImage())); |
246 |
246 |
247 // presence listener |
247 // presence listener |
248 mPresenceListener = new CntPresenceListener(*mContact); |
248 mPresenceListener = new CntPresenceListener(*mContact); |
249 connect(mPresenceListener, SIGNAL(fullPresenceUpdated(bool)), mHeadingItem, SLOT(setOnlineStatus(bool))); |
249 connect(mPresenceListener, SIGNAL(fullPresenceUpdated(bool)), mHeadingItem, SLOT(setOnlineStatus(bool))); |
|
250 connect(mPresenceListener, SIGNAL(accountPresenceUpdated(const QString&, bool)), |
|
251 this, SLOT(updateItemPresence(const QString&, bool))); |
250 bool online; |
252 bool online; |
251 mPresenceListener->initialPresences(online); |
253 QMap<QString, bool> presences = mPresenceListener->initialPresences(online); |
252 mHeadingItem->setOnlineStatus(online); |
254 mHeadingItem->setOnlineStatus(online); |
253 |
255 |
254 mImageLabel = static_cast<CntImageLabel*>(document()->findWidget("cnt_contactcard_image")); |
256 mImageLabel = static_cast<CntImageLabel*>(document()->findWidget("cnt_contactcard_image")); |
255 connect(mImageLabel, SIGNAL(iconClicked()), this, SLOT(doChangeImage())); |
257 connect(mImageLabel, SIGNAL(iconClicked()), this, SLOT(doChangeImage())); |
256 connect(mImageLabel, SIGNAL(iconLongPressed(const QPointF&)), this, SLOT(drawMenu(const QPointF&))); |
258 connect(mImageLabel, SIGNAL(iconLongPressed(const QPointF&)), this, SLOT(drawMenu(const QPointF&))); |
299 |
301 |
300 if (mContact->isPreferredDetail(dataItem->action(), dataItem->detail())) |
302 if (mContact->isPreferredDetail(dataItem->action(), dataItem->detail())) |
301 { |
303 { |
302 dataItem->setSecondaryIcon(HbIcon("qtg_mono_favourites")); |
304 dataItem->setSecondaryIcon(HbIcon("qtg_mono_favourites")); |
303 mPreferredItems.insert(dataItem->action(), item); |
305 mPreferredItems.insert(dataItem->action(), item); |
|
306 } |
|
307 |
|
308 if (dataItem->detail().definitionName() == QContactOnlineAccount::DefinitionName) |
|
309 { |
|
310 for (int i = 0;i < presences.keys().count();i++) |
|
311 { |
|
312 QString fullAccount = presences.keys().at(i); |
|
313 QContactOnlineAccount account = dataItem->detail(); |
|
314 QString currentFullAccount = account.serviceProvider() + ':' + account.accountUri(); |
|
315 if (fullAccount == currentFullAccount) |
|
316 { |
|
317 if (presences.values().at(i)) |
|
318 { |
|
319 dataItem->setSecondaryIcon(HbIcon("qtg_small_online")); |
|
320 } |
|
321 mPresenceItems.insert(fullAccount, item); |
|
322 break; |
|
323 } |
|
324 } |
304 } |
325 } |
305 |
326 |
306 item->setDetails(dataItem); |
327 item->setDetails(dataItem); |
307 mContainerLayout->addItem(item); |
328 mContainerLayout->addItem(item); |
308 } |
329 } |
642 } |
663 } |
643 |
664 |
644 return maptileLabel; |
665 return maptileLabel; |
645 } |
666 } |
646 |
667 |
|
668 /* |
|
669 * Update the presence status icon of action item with the given accountUri |
|
670 */ |
|
671 void CntContactCardViewPrivate::updateItemPresence(const QString& accountUri, bool online) |
|
672 { |
|
673 CntContactCardDetailItem* item = mPresenceItems.value(accountUri); |
|
674 |
|
675 if (item) |
|
676 { |
|
677 if (online) |
|
678 { |
|
679 mDataContainer->dataItem(item->index())->setSecondaryIcon(HbIcon("qtg_small_online")); |
|
680 } |
|
681 else |
|
682 { |
|
683 mDataContainer->dataItem(item->index())->setSecondaryIcon(HbIcon()); |
|
684 } |
|
685 item->setDetails(mDataContainer->dataItem(item->index())); |
|
686 } |
|
687 } |
|
688 |
647 void CntContactCardViewPrivate::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error) |
689 void CntContactCardViewPrivate::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error) |
648 { |
690 { |
649 CNT_ENTRY |
691 CNT_ENTRY |
650 |
692 |
651 Q_UNUSED(data); |
693 Q_UNUSED(data); |
668 void CntContactCardViewPrivate::sendToHs() |
710 void CntContactCardViewPrivate::sendToHs() |
669 { |
711 { |
670 QVariantHash preferences; |
712 QVariantHash preferences; |
671 preferences["contactId"] = mContact->id().localId(); |
713 preferences["contactId"] = mContact->id().localId(); |
672 |
714 |
673 XQServiceRequest snd("com.nokia.services.hsapplication.IHomeScreenClient", |
715 XQServiceRequest snd("com.nokia.symbian.IHomeScreenClient", |
674 "addWidget(QString,QVariantHash)" |
716 "addWidget(QString,QVariantHash)" |
675 ,false); |
717 ,false); |
676 snd << QString("contactwidgethsplugin"); |
718 snd << QString("contactwidgethsplugin"); |
677 snd << preferences; |
719 snd << preferences; |
678 snd.send(); |
720 snd.send(); |
720 Delete contact |
762 Delete contact |
721 */ |
763 */ |
722 void CntContactCardViewPrivate::deleteContact() |
764 void CntContactCardViewPrivate::deleteContact() |
723 { |
765 { |
724 QString name = contactManager()->synthesizedDisplayLabel(*mContact); |
766 QString name = contactManager()->synthesizedDisplayLabel(*mContact); |
725 |
767 if (name.isEmpty()) |
726 HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)), |
768 { |
727 hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel")); |
769 name = hbTrId("txt_phob_list_unnamed"); |
|
770 } |
|
771 |
|
772 HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)), |
|
773 HbMessageBox::Delete | HbMessageBox::Cancel); |
728 } |
774 } |
729 |
775 |
730 /*! |
776 /*! |
731 Handle action for deleting a contact |
777 Handle action for deleting a contact |
732 */ |
778 */ |
733 void CntContactCardViewPrivate::handleDeleteContact(HbAction *action) |
779 void CntContactCardViewPrivate::handleDeleteContact(int action) |
734 { |
780 { |
735 HbMessageBox *note = static_cast<HbMessageBox*>(sender()); |
781 if (action == HbMessageBox::Delete) |
736 |
782 { |
737 if (note && action == note->actions().first()) |
783 contactManager()->removeContact(mContact->localId()); |
738 { |
784 emit backPressed(); |
739 contactManager()->removeContact(mContact->localId()); |
|
740 mViewManager->back( mArgs ); |
785 mViewManager->back( mArgs ); |
741 } |
786 } |
742 } |
787 } |
743 |
788 |
744 /*! |
789 /*! |