phonebookui/pbkcommonui/src/cntcontactcardview_p.cpp
changeset 71 7cc7d74059f9
parent 65 ae724a111993
equal deleted inserted replaced
65:ae724a111993 71:7cc7d74059f9
    19 
    19 
    20 #include <QGraphicsLinearLayout>
    20 #include <QGraphicsLinearLayout>
    21 #include <QGraphicsSceneResizeEvent>
    21 #include <QGraphicsSceneResizeEvent>
    22 #include <QStringList>
    22 #include <QStringList>
    23 #include <QStandardItemModel>
    23 #include <QStandardItemModel>
    24 #include <QDebug>
       
    25 #include <QKeyEvent>
    24 #include <QKeyEvent>
    26 #include <QDir>
    25 #include <QDir>
    27 
    26 
    28 #include <cntservicescontact.h>
    27 #include <cntservicescontact.h>
    29 #include <qtcontacts.h>
    28 #include <qtcontacts.h>
       
    29 #include <hbapplication.h>
    30 #include <hbscrollarea.h>
    30 #include <hbscrollarea.h>
    31 #include <hblabel.h>
    31 #include <hblabel.h>
    32 #include <hbmenu.h>
    32 #include <hbmenu.h>
    33 #include <hbview.h>
    33 #include <hbview.h>
    34 #include <hbtoolbar.h>
    34 #include <hbtoolbar.h>
    68 #include "cntvcarddetailhandler.h"
    68 #include "cntvcarddetailhandler.h"
    69 #include "cntsavemanager.h"
    69 #include "cntsavemanager.h"
    70 #include <cntabstractengine.h>
    70 #include <cntabstractengine.h>
    71 #include <cntuicontactcardextension.h>
    71 #include <cntuicontactcardextension.h>
    72 
    72 
    73 #define CNT_MAPTILE_PROGRESS_TIMER  100 //100 msec
    73 #define CNT_MAPTILE_PROGRESS_TIMER  100 // 100 msec
    74 #define CNT_UNKNOWN_MAPTILE_STATUS  -1
    74 #define CNT_UNKNOWN_MAPTILE_STATUS   -1
       
    75 
       
    76 // A few list items (CntInitialPopulation) will be populated before the first view;
       
    77 // if there are more list items, they will be fetched and added one by one after the
       
    78 // first view has been shown to the user
       
    79 static const int CntListPopulationNotInProgress = -1;
       
    80 static const QEvent::Type ProcessPopulateListEvent = QEvent::User;
       
    81 static const int CntInitialPopulation = 8;
    75 
    82 
    76 const char *CNT_CONTACTCARDVIEW_XML = ":/xml/contacts_contactcard.docml";
    83 const char *CNT_CONTACTCARDVIEW_XML = ":/xml/contacts_contactcard.docml";
    77 const char *CNT_MAPTILE_INPROGRESS_ICON = "qtg_anim_small_loading_1";
    84 const char *CNT_MAPTILE_INPROGRESS_ICON = "qtg_anim_small_loading_1";
    78 const char *CNT_MAPTILE_SEARCH_STOP_ICON = "qtg_mono_search_stop";
    85 const char *CNT_MAPTILE_SEARCH_STOP_ICON = "qtg_mono_search_stop";
    79 /*!
    86 /*!
    81 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0)
    88 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0)
    82 */
    89 */
    83 CntContactCardViewPrivate::CntContactCardViewPrivate(bool isTemporary) :
    90 CntContactCardViewPrivate::CntContactCardViewPrivate(bool isTemporary) :
    84     QObject(),
    91     QObject(),
    85     mContainerLayout(NULL),
    92     mContainerLayout(NULL),
       
    93     mContainerWidget(NULL),
    86     mContact(NULL),
    94     mContact(NULL),
    87     mDataContainer(NULL),
    95     mDataContainer(NULL),
    88     mAvatar(NULL),
    96     mAvatar(NULL),
    89     mLoader(NULL),
    97     mLoader(NULL),
    90     mVCardIcon(NULL),
    98     mVCardIcon(NULL),
    92     mAcceptSendKey(true),
   100     mAcceptSendKey(true),
    93     mPresenceListener(NULL),
   101     mPresenceListener(NULL),
    94 	mIsTemporary(isTemporary),
   102 	mIsTemporary(isTemporary),
    95 	mIsExecutingAction(false),
   103 	mIsExecutingAction(false),
    96     mMyCardId(0),
   104     mMyCardId(0),
    97     mSaveManager(NULL)
   105     mSaveManager(NULL),
       
   106     mListPopulationProgress(CntListPopulationNotInProgress),
       
   107     mStopListPopulation(false)
    98 {
   108 {
    99     bool ok;
   109     bool ok;
   100     document()->load(CNT_CONTACTCARDVIEW_XML, &ok);
   110     document()->load(CNT_CONTACTCARDVIEW_XML, &ok);
   101     if (!ok) 
   111     if (!ok) 
   102     {
   112     {
   205 /*!
   215 /*!
   206 Activates a previous view
   216 Activates a previous view
   207 */
   217 */
   208 void CntContactCardViewPrivate::showPreviousView()
   218 void CntContactCardViewPrivate::showPreviousView()
   209 {
   219 {
       
   220     // stop list population, if it is still in progress
       
   221     mStopListPopulation = true;
       
   222 
   210     int returnValue = KCntServicesReturnValueContactNotModified;
   223     int returnValue = KCntServicesReturnValueContactNotModified;
       
   224 
   211     //save the contact if avatar has been changed.
   225     //save the contact if avatar has been changed.
   212     QContact contact = contactManager()->contact(mContact->localId());
   226     QContact contact = contactManager()->contact(mContact->localId());
   213     if ( contact != *mContact && contactManager()->error() == QContactManager::NoError)
   227     if ( contact != *mContact && contactManager()->error() == QContactManager::NoError)
   214     {
   228     {
   215         disconnect(contactManager(), SIGNAL(contactsRemoved(const QList<QContactLocalId>&)),
   229         disconnect(contactManager(), SIGNAL(contactsRemoved(const QList<QContactLocalId>&)),
   230 /*!
   244 /*!
   231 Activates the root view
   245 Activates the root view
   232 */
   246 */
   233 void CntContactCardViewPrivate::showRootView()
   247 void CntContactCardViewPrivate::showRootView()
   234 {
   248 {
       
   249     // stop list population, if it is still in progress
       
   250     mStopListPopulation = true;
       
   251 
   235     mViewManager->back( mArgs, true );
   252     mViewManager->back( mArgs, true );
   236 }
   253 }
   237 
   254 
   238 /*
   255 /*
   239 Activates a default view and setup name label texts
   256 Activates a default view and setup name label texts
   240 */
   257 */
   241 void CntContactCardViewPrivate::activate(const CntViewParameters aArgs)
   258 void CntContactCardViewPrivate::activate(const CntViewParameters aArgs)
   242 {   
   259 {   
   243     CNT_ENTRY
   260     CNT_ENTRY
   244     mArgs = aArgs;
   261     mArgs = aArgs;
   245             
   262 
   246     mViewManager = &mEngine->viewManager();
   263     mViewManager = &mEngine->viewManager();
   247     mThumbnailManager = &mEngine->thumbnailManager();
   264     mThumbnailManager = &mEngine->thumbnailManager();
   248     connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)),
   265     connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)),
   249             this, SLOT(thumbnailReady(QPixmap, void*, int, int)));
   266             this, SLOT(thumbnailReady(QPixmap, void*, int, int)));
   250        
   267        
   251     
       
   252     HbMainWindow* window = mView->mainWindow();
   268     HbMainWindow* window = mView->mainWindow();
   253     if (window)
   269     if (window)
   254     {
   270     {
   255         connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation)));
   271         connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation)));
   256         window->installEventFilter(this);
   272         window->installEventFilter(this);
   257         
   273         
   258         setOrientation(window->orientation());
   274         setOrientation(window->orientation());
   259     }
   275     }
   260     
   276 
   261     qApp->installEventFilter(this);
   277     qApp->installEventFilter(this);
   262         
   278         
   263     QContact contact = aArgs.value(ESelectedContact).value<QContact>();
   279     QContact contact = aArgs.value(ESelectedContact).value<QContact>();
   264     mContact = new QContact( contact );
   280     mContact = new QContact( contact );
   265     
   281     
   266     //my card
   282     //my card
   267     mMyCardId = contactManager()->selfContactId();
   283     mMyCardId = contactManager()->selfContactId();
   268     
   284     
   269     populateHeadingItem();
   285     populateHeadingItem();
       
   286 
   270     populateListItems();
   287     populateListItems();
   271     
   288     
   272     bool myCard = mContact->localId() == mMyCardId;
   289     bool myCard = mContact->localId() == mMyCardId;
   273     if (myCard)
   290     if (myCard)
   274     {
   291     {
   312     CNT_EXIT
   329     CNT_EXIT
   313 }
   330 }
   314 
   331 
   315 void CntContactCardViewPrivate::populateHeadingItem()
   332 void CntContactCardViewPrivate::populateHeadingItem()
   316 {
   333 {
       
   334     CNT_ENTRY
       
   335 
   317     Q_ASSERT(mHeadingItem != NULL && mContact != NULL);
   336     Q_ASSERT(mHeadingItem != NULL && mContact != NULL);
   318     
   337     
   319     mHeadingItem->setDetails(mContact);
   338     mHeadingItem->setDetails(mContact);
   320     
   339     
   321     bool myCard = mContact->localId() == mMyCardId;
   340     bool myCard = mContact->localId() == mMyCardId;
   331     {
   350     {
   332         mHeadingItem->ungrabGesture(Qt::TapGesture);
   351         mHeadingItem->ungrabGesture(Qt::TapGesture);
   333         mImageLabel->ungrabGesture(Qt::TapGesture);
   352         mImageLabel->ungrabGesture(Qt::TapGesture);
   334     }
   353     }
   335     
   354     
   336 
       
   337     bool online;
   355     bool online;
   338     mInitiialPrecenceData = mPresenceListener->initialPresences(*mContact, online);
   356     mInitiialPrecenceData = mPresenceListener->initialPresences(*mContact, online);
   339     mHeadingItem->setOnlineStatus(online);
   357     mHeadingItem->setOnlineStatus(online);
   340     
   358 
   341     if (!myCard)
   359     if (!myCard) {
   342     {
   360         bool setAsFavorite = CntFavourite::isMemberOfFavouriteGroup(contactManager(), mContact);
   343         bool setAsFavorite( false );
   361         mHeadingItem->setFavoriteStatus(setAsFavorite); // if contact is part of favourites group
   344         setAsFavorite = CntFavourite::isMemberOfFavouriteGroup( contactManager(), mContact );
       
   345         mHeadingItem->setFavoriteStatus( setAsFavorite ); // if contact is part of favourites group
       
   346         static_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible( !setAsFavorite );
   362         static_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible( !setAsFavorite );
   347         static_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible( setAsFavorite );
   363         static_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible( setAsFavorite );
   348     }
   364     }
   349     
   365     
   350     // avatar
   366     // avatar
   365                 mThumbnailManager->getThumbnail(ThumbnailManager::ThumbnailLarge, mAvatar->imageUrl().toString());
   381                 mThumbnailManager->getThumbnail(ThumbnailManager::ThumbnailLarge, mAvatar->imageUrl().toString());
   366             }
   382             }
   367             break;
   383             break;
   368         }
   384         }
   369     }
   385     }
   370     
   386 
       
   387     CNT_EXIT
   371 }
   388 }
   372 
   389 
   373 void CntContactCardViewPrivate::populateListItems()
   390 void CntContactCardViewPrivate::populateListItems()
   374 {
   391 {
       
   392     CNT_ENTRY
       
   393 
   375     Q_ASSERT(mContact != NULL && mScrollArea != NULL);
   394     Q_ASSERT(mContact != NULL && mScrollArea != NULL);
   376 
   395 
   377     // data container
   396     if (mListPopulationProgress == CntListPopulationNotInProgress) {
   378     if (!mDataContainer) {
   397         mListPopulationProgress = 0;
   379         mDataContainer = new CntContactCardDataContainer(
   398 
   380             mMaptile,
   399         if (!mDataContainer) {
   381             mEngine->extensionManager(),
   400             mDataContainer = new CntContactCardDataContainer(
   382             mView->mainWindow()->orientation() );
   401                 mMaptile,
   383     }
   402                 mEngine->extensionManager(),
   384     
   403                 mView->mainWindow()->orientation());
   385     // fill the data container with contact details
   404         }
   386     mDataContainer->setContactData(mContact);
   405 
   387     
   406         // fill the data container with contact details
   388     // scroll area + container widget
   407         mDataContainer->setContactData(mContact);
   389     QGraphicsWidget* containerWidget = mScrollArea->contentWidget();
   408         
   390     if (!containerWidget)
   409         // scroll area + container widget
   391     {
   410         mContainerWidget = mScrollArea->contentWidget();
   392         // initialize
   411         if (!mContainerWidget) {
   393         mScrollArea->setScrollDirections(Qt::Vertical);
   412             // initialize
   394         
   413             mScrollArea->setScrollDirections(Qt::Vertical);
   395         containerWidget = new QGraphicsWidget();
       
   396         mScrollArea->setContentWidget(containerWidget); // takes ownership.
       
   397             
   414             
   398         mContainerLayout = new QGraphicsLinearLayout(Qt::Vertical);
   415             mContainerWidget = new QGraphicsWidget();
   399         mContainerLayout->setContentsMargins(0, 0, 0, 0);
   416             mScrollArea->setContentWidget(mContainerWidget); // takes ownership. Old widget is deleted
   400         mContainerLayout->setSpacing(0);
   417                 
   401         mContainerLayout->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
   418             mContainerLayout = new QGraphicsLinearLayout(Qt::Vertical);
   402         
   419             mContainerLayout->setContentsMargins(0, 0, 0, 0);
   403         containerWidget->setLayout(mContainerLayout);   // takes ownership.
   420             mContainerLayout->setSpacing(0);
   404     } else {
   421             mContainerLayout->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
   405         // Already initialized
   422             
   406         Q_ASSERT(mContainerLayout != NULL);
   423             mContainerWidget->setLayout(mContainerLayout);   // takes ownership. Old layout is deleted
   407         
   424         } else {
   408         // Clear the container
   425             // Already initialized
   409         int count = mContainerLayout->count();
   426             Q_ASSERT(mContainerLayout != NULL);
   410         for (int i=0; i<count; i++) 
   427             
   411         {
   428             // Clear the container
   412             // do not delete items. They will be deleted automatically
   429             int count = mContainerLayout->count();
   413             mContainerLayout->removeAt(i);
   430             for (int i = 0; i < count; i++) {
   414         }
   431                 // do not delete items. They will be deleted automatically
   415     }
   432                 mContainerLayout->removeAt(i);
   416     
   433             }
   417     // Delete all the detail pointers if any
   434         }
   418     qDeleteAll(mDetailPtrs);
   435     
   419     mDetailPtrs.clear();
   436         // Delete all the detail pointers if any
   420     for(int index = 0; index < mDataContainer->itemCount(); index++)
   437         qDeleteAll(mDetailPtrs);
   421     {
   438         mDetailPtrs.clear();
   422         CntContactCardDataItem* dataItem = mDataContainer->dataItem(index);
   439     }
       
   440 
       
   441 
       
   442     do {
       
   443         if (mListPopulationProgress == mDataContainer->itemCount() || mStopListPopulation) {
       
   444             // population of the list has completed
       
   445             mListPopulationProgress = CntListPopulationNotInProgress;
       
   446             mStopListPopulation = false;
       
   447             return;
       
   448         }
       
   449 
       
   450         CntContactCardDataItem* dataItem = mDataContainer->dataItem(mListPopulationProgress);
   423         int pos = dataItem->position();
   451         int pos = dataItem->position();
   424         
   452 
   425         // communication methods
   453         // communication methods
   426         if (pos < CntContactCardDataItem::ESeparator && dataItem->isFocusable())
   454         if (pos < CntContactCardDataItem::ESeparator && dataItem->isFocusable())
   427         { 
   455         { 
   428             CntContactCardDetailItem* item = new CntContactCardDetailItem(index, containerWidget);
   456             CntContactCardDetailItem* item = new CntContactCardDetailItem(mListPopulationProgress, mContainerWidget);
   429             mDetailPtrs.append(item);
   457             mDetailPtrs.append(item);
   430 
   458 
   431             connect(item, SIGNAL(clicked()), this, SLOT(onItemActivated()));
   459             connect(item, SIGNAL(clicked()), this, SLOT(onItemActivated()));
   432             
   460             
   433             if (!mIsTemporary)
   461             if (!mIsTemporary)
   497                 mMaptileLabelList.insert( addressType, maptileLabel );
   525                 mMaptileLabelList.insert( addressType, maptileLabel );
   498             } 
   526             } 
   499             //other details
   527             //other details
   500             else
   528             else
   501             {
   529             {
   502                 CntContactCardDetailItem* item = new CntContactCardDetailItem(index, containerWidget, false);
   530                 CntContactCardDetailItem* item = new CntContactCardDetailItem(mListPopulationProgress, mContainerWidget, false);
   503                 mDetailPtrs.append(item);
   531                 mDetailPtrs.append(item);
   504                 
   532                 
   505                 //To check whether maptile status  icon is set with the address 
   533                 //To check whether maptile status  icon is set with the address 
   506                 if( ( dataItem->titleText() == hbTrId("txt_phob_formlabel_address") ||
   534                 if( ( dataItem->titleText() == hbTrId("txt_phob_formlabel_address") ||
   507                       dataItem->titleText() == hbTrId("txt_phob_formlabel_address_home")||  
   535                       dataItem->titleText() == hbTrId("txt_phob_formlabel_address_home")||  
   538                 }
   566                 }
   539                 item->setDetails(dataItem);
   567                 item->setDetails(dataItem);
   540                 mContainerLayout->addItem(item);
   568                 mContainerLayout->addItem(item);
   541             }
   569             }
   542         }
   570         }
   543     }
   571     
       
   572         ++mListPopulationProgress;
       
   573     } while (mListPopulationProgress < CntInitialPopulation);
       
   574 
       
   575     if (mListPopulationProgress <= CntInitialPopulation) {
       
   576         QObject::connect(mView->mainWindow(), SIGNAL(viewReady()), this, SLOT(populateListItems()));
       
   577     } else {
       
   578         HbApplication::instance()->postEvent(this, new QEvent(ProcessPopulateListEvent));
       
   579     }
       
   580 
       
   581     CNT_EXIT
   544 }
   582 }
   545 
   583 
   546 /*
   584 /*
   547     Connects the action with a slot and also sets the view as the parent for the action.
   585     Connects the action with a slot and also sets the view as the parent for the action.
   548  */
   586  */
   862 void CntContactCardViewPrivate::setAsFavorite()
   900 void CntContactCardViewPrivate::setAsFavorite()
   863 {
   901 {
   864     QContactId id = mContact->id();
   902     QContactId id = mContact->id();
   865     CntFavourite::addContactToFavouriteGroup( contactManager(), id );
   903     CntFavourite::addContactToFavouriteGroup( contactManager(), id );
   866     
   904     
       
   905     QContact c = contactManager()->contact(mContact->localId());
       
   906     
       
   907     delete mContact;
       
   908     mContact = NULL;
       
   909     
       
   910     mContact = new QContact(c);
       
   911     
   867     qobject_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible(true);
   912     qobject_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible(true);
   868     qobject_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible(false);
   913     qobject_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible(false);
   869     mHeadingItem->setFavoriteStatus(true);  
   914     mHeadingItem->setFavoriteStatus(true);  
   870 }
   915 }
   871 
   916 
   872 void CntContactCardViewPrivate::removeFromFavorite()
   917 void CntContactCardViewPrivate::removeFromFavorite()
   873 {
   918 {
   874     QContactId id = mContact->id();   
   919     QContactId id = mContact->id();   
   875     CntFavourite::removeContactFromFavouriteGroup( contactManager(), id );
   920     CntFavourite::removeContactFromFavouriteGroup( contactManager(), id );
       
   921     
       
   922     QContact c = contactManager()->contact(mContact->localId());
       
   923     
       
   924     delete mContact;
       
   925     mContact = NULL;
       
   926     
       
   927     mContact = new QContact(c);
   876 
   928 
   877     qobject_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible(false);
   929     qobject_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible(false);
   878     qobject_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible(true);
   930     qobject_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible(true);
   879     mHeadingItem->setFavoriteStatus(false); 
   931     mHeadingItem->setFavoriteStatus(false); 
   880 }
   932 }
  1293     QContact tmpContact( *mContact );
  1345     QContact tmpContact( *mContact );
  1294     foreach ( QContactAvatar a, tmpContact.details<QContactAvatar>() )
  1346     foreach ( QContactAvatar a, tmpContact.details<QContactAvatar>() )
  1295     {
  1347     {
  1296         tmpContact.removeDetail( &a );
  1348         tmpContact.removeDetail( &a );
  1297     }
  1349     }
       
  1350     
       
  1351     //temproral solution for a contact without name - add an empty name,
       
  1352     //so vcard construction doesn't fail
       
  1353     //TODO: use custom handler again when new QVersitContactExporterDetailHandlerV2
       
  1354     //(part of QtVersit) is available in the platform
       
  1355     QList<QContactName> names = tmpContact.details<QContactName>();
       
  1356     if (names.count() > 0)
       
  1357     {
       
  1358         QContactName name = names.at(0);
       
  1359         if (name.firstName().isEmpty() && name.lastName().isEmpty())
       
  1360         {
       
  1361             //empty first and last names - update with empty string
       
  1362             name.setFirstName(QString(""));
       
  1363             tmpContact.saveDetail(&name);
       
  1364         }
       
  1365     }
       
  1366     else
       
  1367     {
       
  1368         //no name detail - create one
       
  1369         QContactName name;
       
  1370         name.setFirstName(QString(""));
       
  1371         tmpContact.saveDetail(&name);
       
  1372     } //temproral solution for a contact without name - add an empty name,
       
  1373       //so vcard construction doesn't fail - end
       
  1374     
  1298     list.append( tmpContact );
  1375     list.append( tmpContact );
  1299     
  1376     
  1300     QString tempDir = QDir::tempPath().append("/tempcntvcard");
  1377     QString tempDir = QDir::tempPath().append("/tempcntvcard");
  1301     QDir dir(tempDir);
  1378     QDir dir(tempDir);
  1302            
  1379            
  1331     QString vCardPath = dir.absolutePath().append(QDir::separator());
  1408     QString vCardPath = dir.absolutePath().append(QDir::separator());
  1332     vCardPath.append(vCardName);
  1409     vCardPath.append(vCardName);
  1333     vCardPath = QDir::toNativeSeparators(vCardPath);
  1410     vCardPath = QDir::toNativeSeparators(vCardPath);
  1334     
  1411     
  1335     QVersitContactExporter exporter;
  1412     QVersitContactExporter exporter;
  1336     CntVCardDetailHandler hanlder;
  1413     //TODO: use custom handler again when new QVersitContactExporterDetailHandlerV2
  1337     exporter.setDetailHandler(&hanlder);
  1414     //(part of QtVersit) is available in the platform
       
  1415     //CntVCardDetailHandler hanlder;
       
  1416     //exporter.setDetailHandler(&hanlder);
  1338     // The vCard version needs to be 2.1 due to backward compatiblity when sending 
  1417     // The vCard version needs to be 2.1 due to backward compatiblity when sending 
  1339     if (exporter.exportContacts(list, QVersitDocument::VCard21Type))
  1418     if (exporter.exportContacts(list, QVersitDocument::VCard21Type))
  1340     {
  1419     {
  1341         CNT_LOG_ARGS("VCard21Type");
  1420         CNT_LOG_ARGS("VCard21Type");
  1342         QList<QVersitDocument> docs = exporter.documents();
  1421         QList<QVersitDocument> docs = exporter.documents();
  1355             if (!mShareUi) {
  1434             if (!mShareUi) {
  1356                 mShareUi = new ShareUi();
  1435                 mShareUi = new ShareUi();
  1357             }
  1436             }
  1358             QStringList l;
  1437             QStringList l;
  1359             l << vCardPath;
  1438             l << vCardPath;
  1360             mShareUi->send(l,false);
  1439             mShareUi->send(l, true);
  1361         }
  1440         }
  1362     }
  1441     }
  1363     
  1442     
  1364     CNT_EXIT
  1443     CNT_EXIT
  1365 }
  1444 }
  1451     return &mEngine->contactManager(SYMBIAN_BACKEND);
  1530     return &mEngine->contactManager(SYMBIAN_BACKEND);
  1452 }
  1531 }
  1453 
  1532 
  1454 bool CntContactCardViewPrivate::eventFilter(QObject *obj, QEvent *event)
  1533 bool CntContactCardViewPrivate::eventFilter(QObject *obj, QEvent *event)
  1455 {
  1534 {
       
  1535     if (event->type() == ProcessPopulateListEvent && obj == this) {
       
  1536         populateListItems();
       
  1537         return true;
       
  1538     }
       
  1539 
  1456     if (event->type() == QEvent::KeyPress && obj == mView->mainWindow())
  1540     if (event->type() == QEvent::KeyPress && obj == mView->mainWindow())
  1457     {
  1541     {
  1458         QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
  1542         QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
  1459         if (keyEvent->key() == Qt::Key_Yes)
  1543         if (keyEvent->key() == Qt::Key_Yes)
  1460         {
  1544         {