messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    19 
    19 
    20 // SYSTEM INCLUDES
    20 // SYSTEM INCLUDES
    21 #include <HbStyle>
    21 #include <HbStyle>
    22 #include <HbIconItem>
    22 #include <HbIconItem>
    23 #include <HbTextItem>
    23 #include <HbTextItem>
    24 #include <HbFrameDrawer>
    24 #include <HbTapGesture>
    25 //#include <HbGesture>
    25 #include <HbInstantFeedback>
    26 //#include <HbGestureSceneFilter>
       
    27 #include <HbWidgetFeedback>
       
    28 #include <HbFrameItem>
    26 #include <HbFrameItem>
    29 #include <qcontactphonenumber.h>
    27 #include <qcontactphonenumber.h>
    30 #include <qcontactavatar.h>
    28 #include <qcontactavatar.h>
    31 #include <xqaiwrequest.h>
    29 #include <xqaiwrequest.h>
    32 #include <xqappmgr.h>
    30 #include <xqappmgr.h>
    33 #include <XQServiceRequest.h>
    31 #include <xqservicerequest.h>
    34 #include <cntservicescontact.h>
    32 #include <cntservicescontact.h>
    35 #include <QGraphicsSceneMouseEvent>
    33 #include <QGraphicsSceneMouseEvent>
    36 #include <HbMenu>
    34 #include <HbMenu>
    37 #include <HbMainWindow>
       
    38 #include <thumbnailmanager_qt.h>
    35 #include <thumbnailmanager_qt.h>
       
    36 #include <QTimer>
    39 
    37 
    40 #include <ccsdefs.h>
    38 #include <ccsdefs.h>
    41 
    39 
    42 // USER INCLUDES
    40 // USER INCLUDES
    43 #include "conversationsenginedefines.h"
    41 #include "conversationsenginedefines.h"
    44 #include "debugtraces.h"
       
    45 #include "conversationsengine.h"
    42 #include "conversationsengine.h"
    46 #include "convergedmessage.h"
    43 #include "convergedmessage.h"
    47 #include "msgcontacthandler.h"
    44 #include "msgcontacthandler.h"
    48 
    45 
    49 // LOCAL CONSTANTS
    46 // LOCAL CONSTANTS
    50 const QString DEFAULT_AVATAR_ICON("qtg_large_avatar");
    47 const QString DEFAULT_AVATAR_ICON("qtg_large_avatar");
    51 const QString BT_ICON("qtg_large_bluetooth");
    48 const QString BT_ICON("qtg_large_bluetooth");
    52 const QString BACKGROUND_FRAME_NORMAL("qtg_fr_groupbox");
    49 const QString BG_FRAME_NORMAL("qtg_fr_groupbox_normal");
    53 const QString GROUPBOX_BG_FRAME_PRESSED("qtg_fr_groupbox_pressed");
    50 const QString BG_FRAME_PRESSED("qtg_fr_groupbox_pressed");
    54 
       
    55 
    51 
    56 // LOCALIZATION CONSTANTS
    52 // LOCALIZATION CONSTANTS
    57 #define LOC_RECEIVED_FILES hbTrId("txt_messaging_title_received_files")
    53 #define LOC_RECEIVED_FILES hbTrId("txt_messaging_title_received_files")
    58 #define LOC_MENU_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
    54 #define LOC_MENU_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info")
    59 #define LOC_COMMON_MENU_CALL hbTrId("txt_common_menu_call_verb")
    55 #define LOC_COMMON_MENU_CALL hbTrId("txt_common_menu_call_verb")
    60 #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
    56 #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
    61 
    57 
    62 // LOCAL FUNCTIONS
    58 // LOCAL FUNCTIONS
    63 
    59 
    64 //---------------------------------------------------------------
    60 //---------------------------------------------------------------
    65 // MsgContactCardWidget::MsgContactCardWidget
    61 // MsgContactCardWidget::MsgContactCardWidget
    66 // @see header
    62 // @see header
    67 //---------------------------------------------------------------
    63 //---------------------------------------------------------------
    68 MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) :
    64 MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) :
    69     HbWidget(parent), mMenuShown(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL),
    65     HbWidget(parent), mIgnoreEvents(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL),
    70         mAddressTextItem(NULL),mThumbnailManager(NULL)
    66         mAddressTextItem(NULL), mThumbnailManager(NULL)
    71 {
    67 {
    72     init();
    68     init();
    73     setBackGround(BACKGROUND_FRAME_NORMAL);
       
    74     connectSignals(true);
       
    75 
       
    76     connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(initGesture()));
       
    77 }
    69 }
    78 
    70 
    79 //---------------------------------------------------------------
    71 //---------------------------------------------------------------
    80 // MsgContactCardWidget::~MsgContactCardWidget
    72 // MsgContactCardWidget::~MsgContactCardWidget
    81 // @see header
    73 // @see header
    82 //---------------------------------------------------------------
    74 //---------------------------------------------------------------
    83 MsgContactCardWidget::~MsgContactCardWidget()
    75 MsgContactCardWidget::~MsgContactCardWidget()
    84 {
    76 {
    85   /*  if (mGestureFilter) {
       
    86         removeSceneEventFilter(mGestureFilter);
       
    87     }*/
       
    88 }
    77 }
    89 
    78 
    90 //---------------------------------------------------------------
    79 //---------------------------------------------------------------
    91 // MsgContactCardWidget::init
    80 // MsgContactCardWidget::init
    92 // @see header
    81 // @see header
    93 //---------------------------------------------------------------
    82 //---------------------------------------------------------------
    94 void MsgContactCardWidget::init()
    83 void MsgContactCardWidget::init()
    95 {
    84 {
       
    85     this->setProperty("state", "normal");
       
    86     this->grabGesture(Qt::TapGesture);
       
    87 
       
    88     HbFrameItem *frameItem = new HbFrameItem(BG_FRAME_NORMAL, HbFrameDrawer::NinePieces, this);
       
    89     this->setBackgroundItem(frameItem);
       
    90 
    96     mAvatarIconItem = new HbIconItem(this);
    91     mAvatarIconItem = new HbIconItem(this);
    97     HbStyle::setItemName(mAvatarIconItem, "avatar");
    92     HbStyle::setItemName(mAvatarIconItem, "avatar");
    98 
    93 
    99     mPresenceIconItem = new HbIconItem(this);
    94     mPresenceIconItem = new HbIconItem(this);
   100     HbStyle::setItemName(mPresenceIconItem, "presence");
    95     HbStyle::setItemName(mPresenceIconItem, "presence");
   144 // @see header
   139 // @see header
   145 //---------------------------------------------------------------
   140 //---------------------------------------------------------------
   146 ConvergedMessageAddressList MsgContactCardWidget::address()
   141 ConvergedMessageAddressList MsgContactCardWidget::address()
   147 {
   142 {
   148     ConvergedMessageAddressList addresses;
   143     ConvergedMessageAddressList addresses;
   149     QModelIndex index = ConversationsEngine::instance()->getConversationsModel()->index(0, 0);
   144     QStandardItemModel* msgModel = ConversationsEngine::instance()->getConversationsModel();
       
   145     const int rowCnt = msgModel->rowCount();
       
   146     QModelIndex index = msgModel->index(rowCnt-1, 0);
   150     ConvergedMessageAddress* address = new ConvergedMessageAddress(
   147     ConvergedMessageAddress* address = new ConvergedMessageAddress(
   151         index.data(ConversationAddress).toString());
   148         index.data(ConversationAddress).toString());
   152     address->setAlias(mAddress);
   149     QString displayname;
       
   150     QString addr;
       
   151     ConversationsEngine::instance()->getContactDetails(
       
   152             ConversationsEngine::instance()->getCurrentConversationId(),
       
   153             displayname,
       
   154             addr);
       
   155     address->setAlias(displayname);
   153     addresses.append(address);
   156     addresses.append(address);
   154     return addresses;
   157     return addresses;
   155 }
   158 }
   156 
   159 
   157 //---------------------------------------------------------------
   160 //---------------------------------------------------------------
   192         }
   195         }
   193 
   196 
   194         setAddress(contactName);
   197         setAddress(contactName);
   195 
   198 
   196         // Set Avatar
   199         // Set Avatar
   197         QList<QContact> contactList = 
   200         QList<QContact> contactList = MsgContactHandler::findContactList(mContactNumber);
   198                 MsgContactHandler::findContactList(mContactNumber);
   201 
   199         
       
   200         if (!contactList.isEmpty()) {
   202         if (!contactList.isEmpty()) {
   201             QList<QContactAvatar> avatarDetails = 
   203             QList<QContactAvatar> avatarDetails = contactList.at(0).details<QContactAvatar> ();
   202                     contactList.at(0).details<QContactAvatar> ();
   204 
   203             
       
   204             if (!avatarDetails.isEmpty()) {
   205             if (!avatarDetails.isEmpty()) {
   205                 mThumbnailManager->getThumbnail(
   206                 mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString());
   206                         avatarDetails.at(0).imageUrl().toString());
       
   207             }
   207             }
   208         }
   208         }
   209 
   209 
   210         // Set default avatar till actual is set.
   210         // Set default avatar till actual is set.
   211         setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
   211         setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
   221     setAddress("");
   221     setAddress("");
   222     setAvatar(HbIcon());
   222     setAvatar(HbIcon());
   223 }
   223 }
   224 
   224 
   225 //---------------------------------------------------------------
   225 //---------------------------------------------------------------
   226 // MsgContactCardWidget::initGesture
   226 // MsgContactCardWidget::gestureEvent
   227 // @see header file
   227 // @see header file
   228 //---------------------------------------------------------------
   228 //---------------------------------------------------------------
   229 void MsgContactCardWidget::initGesture()
   229 void MsgContactCardWidget::gestureEvent(QGestureEvent *event)
   230 {
   230 {
   231     // Create gesture filter
   231     HbTapGesture *tapGesture = qobject_cast<HbTapGesture*> (event->gesture(Qt::TapGesture));
   232   /*  QGraphicsScene* sc = this->scene();
   232     if (tapGesture) {
   233     mGestureFilter = new HbGestureSceneFilter(Qt::LeftButton, this);
   233         switch (tapGesture->state()) {
   234 
   234         case Qt::GestureStarted:
   235     // Add gestures for longpress
   235         {
   236     HbGesture* gestureLongpressed = new HbGesture(HbGesture::longpress, 5);
   236             // Trigger haptic feedback.
   237 
   237             HbInstantFeedback::play(HbFeedback::Basic);
   238     mGestureFilter->addGesture(gestureLongpressed);
   238             setPressed(true);
   239 
   239             break;
   240     connect(gestureLongpressed, SIGNAL(longPress(QPointF)), this, SLOT(handleLongPress(QPointF)));
   240         }
   241 
   241         case Qt::GestureUpdated:
   242     //install gesture filter.
   242         {
   243     this->installSceneEventFilter(mGestureFilter);
   243             if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) {
   244 
   244                 // Handle longtap.
   245     disconnect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(initGesture()));*/
   245                 setPressed(false);
   246 }
   246                 handleLongTap(tapGesture->scenePosition());
   247 
   247             }
   248 //---------------------------------------------------------------
   248             break;
   249 // MsgContactCardWidget::mousePressEvent
   249         }
       
   250         case Qt::GestureFinished:
       
   251         {
       
   252             HbInstantFeedback::play(HbFeedback::Basic);
       
   253             if (HbTapGesture::Tap == tapGesture->tapStyleHint()) {
       
   254                 // Handle short tap.
       
   255                 setPressed(false);
       
   256                 handleShortTap(tapGesture->scenePosition());
       
   257             }
       
   258             break;
       
   259         }
       
   260         case Qt::GestureCanceled:
       
   261         {
       
   262             HbInstantFeedback::play(HbFeedback::Basic);
       
   263             setPressed(false);
       
   264             break;
       
   265         }
       
   266         }
       
   267     }
       
   268     else {
       
   269         HbWidget::gestureEvent(event);
       
   270     }
       
   271 }
       
   272 
       
   273 //---------------------------------------------------------------
       
   274 // MsgContactCardWidget::setPressed
   250 // @see header file
   275 // @see header file
   251 //---------------------------------------------------------------
   276 //---------------------------------------------------------------
   252 void MsgContactCardWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
   277 void MsgContactCardWidget::setPressed(bool pressed)
   253 {
   278 {
   254     mMenuShown = false;
   279     HbFrameItem *frameItem = static_cast<HbFrameItem *> (this->backgroundItem());
   255 
   280     if (pressed) {
   256     HbWidgetFeedback::triggered(this, Hb::InstantPressed);
   281         this->setProperty("state", "pressed");
   257 
   282         frameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_PRESSED);
   258     setBackGround(GROUPBOX_BG_FRAME_PRESSED);
   283     }
   259 
   284     else {
   260     event->accept();
   285         this->setProperty("state", "normal");
   261 }
   286         frameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_NORMAL);
   262 
   287     }
   263 //---------------------------------------------------------------
   288 }
   264 // MsgContactCardWidget::mouseReleaseEvent
   289 
       
   290 //---------------------------------------------------------------
       
   291 // MsgContactCardWidget::handleLongTap
   265 // @see header file
   292 // @see header file
   266 //---------------------------------------------------------------
   293 //---------------------------------------------------------------
   267 void MsgContactCardWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
   294 void MsgContactCardWidget::handleLongTap(const QPointF &position)
   268 {
   295 {
   269     setBackGround(BACKGROUND_FRAME_NORMAL);
   296     // Check if events need to be ignored/accepted
   270 
   297     if (mIgnoreEvents) {
   271     if (this->rect().contains(event->pos()) && !mMenuShown) {
   298         return;
   272         HbWidgetFeedback::triggered(this, Hb::InstantClicked);
   299     }
   273         emit clicked();
   300 
   274     }
       
   275 
       
   276     event->accept();
       
   277 }
       
   278 
       
   279 //---------------------------------------------------------------
       
   280 // MsgContactCardWidget::setBackGround
       
   281 // @see header file
       
   282 //---------------------------------------------------------------
       
   283 void MsgContactCardWidget::setBackGround(const QString& bg)
       
   284 {
       
   285     HbFrameItem* backGround = new HbFrameItem(this);
       
   286     backGround->frameDrawer().setFrameGraphicsName(bg);
       
   287     backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
   288     this->setBackgroundItem(backGround);
       
   289     this->repolish();
       
   290 }
       
   291 
       
   292 //---------------------------------------------------------------
       
   293 // MsgContactCardWidget::handleLongPress
       
   294 // @see header file
       
   295 //---------------------------------------------------------------
       
   296 void MsgContactCardWidget::handleLongPress(QPointF position)
       
   297 {
       
   298     if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) {
   301     if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) {
   299         HbMenu* contextMenu = new HbMenu();
   302         HbMenu* contextMenu = new HbMenu();
   300         contextMenu->setDismissPolicy(HbPopup::TapAnywhere);
   303         contextMenu->setDismissPolicy(HbPopup::TapAnywhere);
   301         contextMenu->setAttribute(Qt::WA_DeleteOnClose, true);
   304         contextMenu->setAttribute(Qt::WA_DeleteOnClose, true);
   302         contextMenu->setPreferredPos(position);
   305         contextMenu->setPreferredPos(position);   
   303 
       
   304         contextMenu->addAction(LOC_MENU_CONTACT_INFO, this, SLOT(openContactInfo()));
       
   305         contextMenu->addAction(LOC_COMMON_MENU_CALL, this, SLOT(call()));
       
   306 
   306 
   307         //If contact doesn't exist in phonebook then add another menu item "Save to Contacts"
   307         //If contact doesn't exist in phonebook then add another menu item "Save to Contacts"
   308         int contactId = resolveContactId(mContactNumber);
   308         int contactId = resolveContactId(mContactNumber);
   309         if (contactId < 0) {
   309         if (contactId < 0) {
   310             contextMenu->addAction(LOC_SAVETO_CONTACTS, this, SLOT(addToContacts()));
   310             contextMenu->addAction(LOC_SAVETO_CONTACTS, this, SLOT(addToContacts()));
   311         }
   311         }
       
   312         else{
       
   313             contextMenu->addAction(LOC_MENU_CONTACT_INFO, this, SLOT(openContactInfo()));
       
   314         }
       
   315         contextMenu->addAction(LOC_COMMON_MENU_CALL, this, SLOT(call()));
   312 
   316 
   313         contextMenu->show();
   317         contextMenu->show();
   314 
   318     }
   315         mMenuShown = true;
   319 }
   316     }
   320 
   317 }
   321 //---------------------------------------------------------------
   318 
   322 // MsgContactCardWidget::handleShortTap
   319 //---------------------------------------------------------------
   323 // @see header
   320 // MsgContactCardWidget::overrideFeedback
   324 //---------------------------------------------------------------
   321 // @see header file
   325 void MsgContactCardWidget::handleShortTap(const QPointF &position)
   322 //---------------------------------------------------------------
   326 {
   323 /*HbFeedback::InstantEffect MsgContactCardWidget::overrideFeedback(Hb::InstantInteraction interaction) const
   327     this->ungrabGesture(Qt::TapGesture);
   324 {
   328     
   325     switch (interaction) {
   329     // Check if events need to be ignored/accepted
   326     case Hb::InstantPressed:
   330     if (mIgnoreEvents) {
   327     case Hb::InstantClicked:
   331         return;
   328         return HbFeedback::Basic;   
   332     }
   329     default:
   333     
   330         return HbFeedback::None;
   334     int contactId = resolveContactId(mContactNumber);
   331     }
   335     if(contactId > 0)
   332 }*/
   336     {
       
   337         //resolved contact open contact card.
       
   338         openContactInfo();
       
   339     }
       
   340     else
       
   341     {
       
   342         //unresolved contact show longpress options menu.
       
   343         handleLongTap(position);
       
   344     }
       
   345     
       
   346     //fire timer to regrab gesture after some delay.
       
   347     QTimer::singleShot(300,this,SLOT(regrabGesture()));    
       
   348 }
   333 
   349 
   334 //---------------------------------------------------------------
   350 //---------------------------------------------------------------
   335 // MsgContactCardWidget::openContactInfo
   351 // MsgContactCardWidget::openContactInfo
   336 // @see header
   352 // @see header
   337 //---------------------------------------------------------------
   353 //---------------------------------------------------------------
   367         // Result handlers
   383         // Result handlers
   368         connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
   384         connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
   369         connect(request, SIGNAL(requestError(const QVariant&)), this,
   385         connect(request, SIGNAL(requestError(const QVariant&)), this,
   370             SLOT(handleError(const QVariant&)));
   386             SLOT(handleError(const QVariant&)));
   371 
   387 
       
   388         //disbale subscritption for the CV events
       
   389         ConversationsEngine::instance()->disableRegisterationForCVEvents();
       
   390                 
   372         request->setArguments(args);
   391         request->setArguments(args);
   373         request->send();
   392         request->send();
   374         delete request;
   393         delete request;
   375     }
   394     }
   376 }
   395 }
   380 // @see header
   399 // @see header
   381 //---------------------------------------------------------------
   400 //---------------------------------------------------------------
   382 int MsgContactCardWidget::resolveContactId(const QString& value)
   401 int MsgContactCardWidget::resolveContactId(const QString& value)
   383 {
   402 {
   384     QString displayLabel;
   403     QString displayLabel;
   385     
   404 
   386     return MsgContactHandler::resolveContactDisplayName(
   405     int count;
   387             value, 
   406     return MsgContactHandler::resolveContactDisplayName(value, displayLabel, count);
   388             displayLabel,
       
   389             0);    
       
   390 }
   407 }
   391 
   408 
   392 //---------------------------------------------------------------
   409 //---------------------------------------------------------------
   393 // MsgContactCardWidget::call
   410 // MsgContactCardWidget::call
   394 // @see header
   411 // @see header
   395 //---------------------------------------------------------------
   412 //---------------------------------------------------------------
   396 void MsgContactCardWidget::call()
   413 void MsgContactCardWidget::call()
   397 {
   414 {
   398     //Launch dialer service     
   415     //Launch dialer service     
   399     QString serviceName("com.nokia.services.telephony");
   416     QString serviceName("com.nokia.symbian.ICallDial");
   400     QString operation("dial(QString)");
   417     QString operation("dial(QString)");
   401 
   418 
   402     XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName, operation, false);
   419     XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName, operation, false);
   403 
   420 
   404     connect(serviceRequest, SIGNAL(requestCompleted(QVariant)), this,
   421     connect(serviceRequest, SIGNAL(requestCompleted(QVariant)), this,
   414 // MsgContactCardWidget::addToContacts
   431 // MsgContactCardWidget::addToContacts
   415 // @see header
   432 // @see header
   416 //---------------------------------------------------------------
   433 //---------------------------------------------------------------
   417 void MsgContactCardWidget::addToContacts()
   434 void MsgContactCardWidget::addToContacts()
   418 {
   435 {
       
   436     openContactInfo();
   419 }
   437 }
   420 
   438 
   421 //---------------------------------------------------------------
   439 //---------------------------------------------------------------
   422 // MsgContactCardWidget::handleOk
   440 // MsgContactCardWidget::handleOk
   423 // @see header
   441 // @see header
   424 //---------------------------------------------------------------
   442 //---------------------------------------------------------------
   425 void MsgContactCardWidget::handleOk(const QVariant& result)
   443 void MsgContactCardWidget::handleOk(const QVariant& result)
   426 {
   444 {
   427     Q_UNUSED(result)
   445     Q_UNUSED(result)
   428 
   446 
   429     QList<QContact> matchingContacts = 
   447     QList<QContact> matchingContacts = MsgContactHandler::findContactList(mContactNumber);
   430             MsgContactHandler::findContactList(mContactNumber);
       
   431 
   448 
   432     if (!matchingContacts.isEmpty()) {
   449     if (!matchingContacts.isEmpty()) {
   433         setAddress(matchingContacts.at(0).displayLabel());
   450         setAddress(matchingContacts.at(0).displayLabel());
   434         
   451 
   435         QList<QContactAvatar> avatarDetails = 
   452         QList<QContactAvatar> avatarDetails = matchingContacts.at(0).details<QContactAvatar> ();
   436                 matchingContacts.at(0).details<QContactAvatar> ();
   453 
   437         
       
   438         if (!avatarDetails.isEmpty()) {
   454         if (!avatarDetails.isEmpty()) {
   439             mThumbnailManager->getThumbnail(
   455             mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString());
   440                     avatarDetails.at(0).imageUrl().toString());
   456         }
   441         }
   457 	}
   442     }
   458 	
       
   459 	// Get the new conversation id.
       
   460     qint64 convId = ConversationsEngine::instance()->getConversationIdFromAddress(
       
   461                 mContactNumber);
       
   462     emit conversationIdChanged(convId);
       
   463             
       
   464     ConversationsEngine::instance(
       
   465                     )->emitOpenConversationViewIdUpdate(convId);
       
   466     
   443 }
   467 }
   444 
   468 
   445 //---------------------------------------------------------------
   469 //---------------------------------------------------------------
   446 // MsgContactCardWidget::handleError
   470 // MsgContactCardWidget::handleError
   447 // @see header
   471 // @see header
   448 //---------------------------------------------------------------
   472 //---------------------------------------------------------------
   449 void MsgContactCardWidget::handleError(int errorCode, const QString& errorMessage)
   473 void MsgContactCardWidget::handleError(int errorCode, const QString& errorMessage)
   450 {
   474 {
   451     Q_UNUSED(errorMessage)
   475     Q_UNUSED(errorMessage)
   452     Q_UNUSED(errorCode)
   476     Q_UNUSED(errorCode)    
       
   477     
       
   478     //unblock the cv events in case of contacts save error
       
   479     ConversationsEngine::instance(
       
   480                         )->emitOpenConversationViewIdUpdate(
       
   481                                 ConversationsEngine::instance(
       
   482                                         )->getCurrentConversationId(
       
   483                                                 ));
   453 }
   484 }
   454 
   485 
   455 //---------------------------------------------------------------
   486 //---------------------------------------------------------------
   456 // MsgContactCardWidget::onServiceRequestCompleted
   487 // MsgContactCardWidget::onServiceRequestCompleted
   457 // @see header
   488 // @see header
   480     }
   511     }
   481     else {
   512     else {
   482         setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
   513         setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
   483     }
   514     }
   484 }
   515 }
   485 //---------------------------------------------------------------
   516 
   486 // MsgContactCardWidget::connectSignals
   517 //---------------------------------------------------------------
   487 // @see header
   518 // MsgContactCardWidget::ignoreSignals
   488 //---------------------------------------------------------------
   519 // @see header
   489 void MsgContactCardWidget::connectSignals(bool yes)
   520 //---------------------------------------------------------------
   490 {
   521 void MsgContactCardWidget::ignoreSignals(bool yes)
   491     if (yes) {
   522 {
   492         connect(this, SIGNAL(clicked()), this, SLOT(openContactInfo()));
   523     mIgnoreEvents = yes;
   493     }
   524 }
   494     else {
   525 
   495         disconnect(this, SIGNAL(clicked()), this, SLOT(openContactInfo()));
   526 //---------------------------------------------------------------
   496     }
   527 // MsgContactCardWidget::regrabGesture
       
   528 // @see header file
       
   529 //---------------------------------------------------------------
       
   530 void MsgContactCardWidget::regrabGesture()
       
   531 {
       
   532     this->grabGesture(Qt::TapGesture);
   497 }
   533 }
   498 // EOF
   534 // EOF