equal
deleted
inserted
replaced
60 //--------------------------------------------------------------- |
60 //--------------------------------------------------------------- |
61 // MsgContactCardWidget::MsgContactCardWidget |
61 // MsgContactCardWidget::MsgContactCardWidget |
62 // @see header |
62 // @see header |
63 //--------------------------------------------------------------- |
63 //--------------------------------------------------------------- |
64 MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) : |
64 MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) : |
65 HbWidget(parent), mIgnoreEvents(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL), |
65 HbWidget(parent), mAvatarIconItem(NULL), mPresenceIconItem(NULL), |
66 mAddressTextItem(NULL), mThumbnailManager(NULL) |
66 mAddressTextItem(NULL), mThumbnailManager(NULL) |
67 { |
67 { |
68 init(); |
68 init(); |
69 } |
69 } |
70 |
70 |
142 { |
142 { |
143 ConvergedMessageAddressList addresses; |
143 ConvergedMessageAddressList addresses; |
144 QStandardItemModel* msgModel = ConversationsEngine::instance()->getConversationsModel(); |
144 QStandardItemModel* msgModel = ConversationsEngine::instance()->getConversationsModel(); |
145 const int rowCnt = msgModel->rowCount(); |
145 const int rowCnt = msgModel->rowCount(); |
146 QModelIndex index = msgModel->index(rowCnt-1, 0); |
146 QModelIndex index = msgModel->index(rowCnt-1, 0); |
147 ConvergedMessageAddress* address = new ConvergedMessageAddress( |
147 QString addr = index.data(ConversationAddress).toString(); |
148 index.data(ConversationAddress).toString()); |
148 ConvergedMessageAddress* address = new ConvergedMessageAddress(addr); |
|
149 // resolve contact |
149 QString displayname; |
150 QString displayname; |
150 QString addr; |
151 int count; |
151 ConversationsEngine::instance()->getContactDetails( |
152 int retval = MsgContactHandler::resolveContactDisplayName( |
152 ConversationsEngine::instance()->getCurrentConversationId(), |
153 addr, displayname, count); |
153 displayname, |
154 if(retval != -1) |
154 addr); |
155 { |
155 address->setAlias(displayname); |
156 address->setAlias(displayname); |
|
157 } |
156 addresses.append(address); |
158 addresses.append(address); |
157 return addresses; |
159 return addresses; |
158 } |
160 } |
159 |
161 |
160 //--------------------------------------------------------------- |
162 //--------------------------------------------------------------- |
291 // MsgContactCardWidget::handleLongTap |
293 // MsgContactCardWidget::handleLongTap |
292 // @see header file |
294 // @see header file |
293 //--------------------------------------------------------------- |
295 //--------------------------------------------------------------- |
294 void MsgContactCardWidget::handleLongTap(const QPointF &position) |
296 void MsgContactCardWidget::handleLongTap(const QPointF &position) |
295 { |
297 { |
296 // Check if events need to be ignored/accepted |
|
297 if (mIgnoreEvents) { |
|
298 return; |
|
299 } |
|
300 |
|
301 if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) { |
298 if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) { |
302 HbMenu* contextMenu = new HbMenu(); |
299 HbMenu* contextMenu = new HbMenu(); |
303 contextMenu->setDismissPolicy(HbPopup::TapAnywhere); |
300 contextMenu->setDismissPolicy(HbPopup::TapAnywhere); |
304 contextMenu->setAttribute(Qt::WA_DeleteOnClose, true); |
301 contextMenu->setAttribute(Qt::WA_DeleteOnClose, true); |
305 contextMenu->setPreferredPos(position); |
302 contextMenu->setPreferredPos(position); |
323 // @see header |
320 // @see header |
324 //--------------------------------------------------------------- |
321 //--------------------------------------------------------------- |
325 void MsgContactCardWidget::handleShortTap(const QPointF &position) |
322 void MsgContactCardWidget::handleShortTap(const QPointF &position) |
326 { |
323 { |
327 this->ungrabGesture(Qt::TapGesture); |
324 this->ungrabGesture(Qt::TapGesture); |
328 |
|
329 // Check if events need to be ignored/accepted |
|
330 if (mIgnoreEvents) { |
|
331 return; |
|
332 } |
|
333 |
325 |
334 int contactId = resolveContactId(mContactNumber); |
326 int contactId = resolveContactId(mContactNumber); |
335 if(contactId > 0) |
327 if(contactId > 0) |
336 { |
328 { |
337 //resolved contact open contact card. |
329 //resolved contact open contact card. |
452 QList<QContactAvatar> avatarDetails = matchingContacts.at(0).details<QContactAvatar> (); |
444 QList<QContactAvatar> avatarDetails = matchingContacts.at(0).details<QContactAvatar> (); |
453 |
445 |
454 if (!avatarDetails.isEmpty()) { |
446 if (!avatarDetails.isEmpty()) { |
455 mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString()); |
447 mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString()); |
456 } |
448 } |
|
449 else { |
|
450 //Set default avatar since avtar is deleted |
|
451 setAvatar(HbIcon(DEFAULT_AVATAR_ICON)); |
|
452 } |
457 } |
453 } |
|
454 else { |
|
455 //case for deletion from contact card widget |
|
456 //set the default number as address |
|
457 setAddress(mContactNumber); |
|
458 //Set default avatar since contact is deleted |
|
459 setAvatar(HbIcon(DEFAULT_AVATAR_ICON)); |
|
460 } |
458 |
461 |
459 // Get the new conversation id. |
462 // Get the new conversation id. |
460 qint64 convId = ConversationsEngine::instance()->getConversationIdFromAddress( |
463 qint64 convId = ConversationsEngine::instance()->getConversationIdFromAddress( |
461 mContactNumber); |
464 mContactNumber); |
462 emit conversationIdChanged(convId); |
465 emit conversationIdChanged(convId); |
513 setAvatar(HbIcon(DEFAULT_AVATAR_ICON)); |
516 setAvatar(HbIcon(DEFAULT_AVATAR_ICON)); |
514 } |
517 } |
515 } |
518 } |
516 |
519 |
517 //--------------------------------------------------------------- |
520 //--------------------------------------------------------------- |
518 // MsgContactCardWidget::ignoreSignals |
|
519 // @see header |
|
520 //--------------------------------------------------------------- |
|
521 void MsgContactCardWidget::ignoreSignals(bool yes) |
|
522 { |
|
523 mIgnoreEvents = yes; |
|
524 } |
|
525 |
|
526 //--------------------------------------------------------------- |
|
527 // MsgContactCardWidget::regrabGesture |
521 // MsgContactCardWidget::regrabGesture |
528 // @see header file |
522 // @see header file |
529 //--------------------------------------------------------------- |
523 //--------------------------------------------------------------- |
530 void MsgContactCardWidget::regrabGesture() |
524 void MsgContactCardWidget::regrabGesture() |
531 { |
525 { |