phonebookui/pbkcommonui/src/cnteditview_p.cpp
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
child 65 ae724a111993
equal deleted inserted replaced
47:7cbcb2896f0e 59:a642906a277a
    19 #include "cnteditviewlistmodel.h"
    19 #include "cnteditviewlistmodel.h"
    20 #include "cntdocumentloader.h"
    20 #include "cntdocumentloader.h"
    21 #include "cntdetailpopup.h"
    21 #include "cntdetailpopup.h"
    22 #include "cnteditviewheadingitem.h"
    22 #include "cnteditviewheadingitem.h"
    23 #include "cntimagelabel.h"
    23 #include "cntimagelabel.h"
       
    24 #include "cntsavemanager.h"
    24 #include "cntglobal.h"
    25 #include "cntglobal.h"
       
    26 #include "cntdebug.h"
    25 
    27 
    26 #include <qtcontacts.h>
    28 #include <qtcontacts.h>
    27 #include <hbdocumentloader.h>
    29 #include <hbdocumentloader.h>
    28 #include <thumbnailmanager_qt.h>
    30 #include <thumbnailmanager_qt.h>
    29 #include <hbabstractviewitem.h>
    31 #include <hbabstractviewitem.h>
    37 #include <hbframebackground.h>
    39 #include <hbframebackground.h>
    38 #include <hbparameterlengthlimiter.h>
    40 #include <hbparameterlengthlimiter.h>
    39 #include <hbdevicenotificationdialog.h>
    41 #include <hbdevicenotificationdialog.h>
    40 #include <xqaiwrequest.h>
    42 #include <xqaiwrequest.h>
    41 #include <xqaiwdecl.h>
    43 #include <xqaiwdecl.h>
    42 #include <QDir>
    44 #include <cntservicescontact.h>
       
    45 
       
    46 #include <QFileInfo>
       
    47 #include <QApplication>
       
    48 #include <QTimer>
    43 
    49 
    44 const char *CNT_EDIT_XML = ":/xml/contacts_ev.docml";
    50 const char *CNT_EDIT_XML = ":/xml/contacts_ev.docml";
    45 
    51 
    46 CntEditViewPrivate::CntEditViewPrivate() :
    52 CntEditViewPrivate::CntEditViewPrivate() :
    47 mModel( NULL ),
    53     mModel( NULL ),
    48 mImageLabel( NULL ),
    54     mImageLabel( NULL ),
    49 mThumbnailManager( NULL ),
    55     mThumbnailManager( NULL ),
    50 mContact( NULL ),
    56     mContact( NULL ),
    51 mReq(0),
    57     mReq(NULL),
    52 mMenu(NULL)
    58     mMenu(NULL),
       
    59     mSaveManager(NULL)
    53 {
    60 {
    54     mDocument = new CntDocumentLoader;
    61     mDocument = new CntDocumentLoader;
    55     
    62     
    56     bool ok;
    63     bool ok;
    57     mDocument->load( CNT_EDIT_XML, &ok );
    64     mDocument->load( CNT_EDIT_XML, &ok );
    91     connect( mImageLabel, SIGNAL(iconClicked()), this, SLOT(openImageEditor()) );
    98     connect( mImageLabel, SIGNAL(iconClicked()), this, SLOT(openImageEditor()) );
    92     connect( mHeading, SIGNAL(textClicked()), this, SLOT(openNameEditor()) );
    99     connect( mHeading, SIGNAL(textClicked()), this, SLOT(openNameEditor()) );
    93     connect( mHeading, SIGNAL(iconClicked()), this, SLOT(openImageEditor()) );
   100     connect( mHeading, SIGNAL(iconClicked()), this, SLOT(openImageEditor()) );
    94     connect( mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(activated(const QModelIndex&)) );
   101     connect( mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(activated(const QModelIndex&)) );
    95     connect( mListView, SIGNAL(longPressed(HbAbstractViewItem*,const QPointF&)), this, SLOT(longPressed(HbAbstractViewItem*,const QPointF&)) );
   102     connect( mListView, SIGNAL(longPressed(HbAbstractViewItem*,const QPointF&)), this, SLOT(longPressed(HbAbstractViewItem*,const QPointF&)) );
       
   103     
       
   104     // closing the application from task swapper or end key will cause the contact to be saved
       
   105     connect( qApp, SIGNAL(aboutToQuit()), this, SLOT(saveChanges()));
    96 }
   106 }
    97 
   107 
    98 CntEditViewPrivate::~CntEditViewPrivate()
   108 CntEditViewPrivate::~CntEditViewPrivate()
    99 {
   109 {
   100     mView->deleteLater();
   110     mView->deleteLater();
       
   111     
   101     delete mDocument;
   112     delete mDocument;
       
   113     mDocument = NULL;
   102     delete mModel;
   114     delete mModel;
       
   115     mModel = NULL;
   103     delete mContact;
   116     delete mContact;
       
   117     mContact = NULL;
   104     if (mMenu) 
   118     if (mMenu) 
   105     {
   119     {
   106         delete mMenu;
   120         delete mMenu;
       
   121         mMenu = NULL;
   107     }
   122     }
   108     delete mThumbnailManager;
   123     delete mThumbnailManager;
       
   124     mThumbnailManager = NULL;
       
   125     delete mSaveManager;
       
   126     mSaveManager = NULL;
   109 }
   127 }
   110 
   128 
   111 void CntEditViewPrivate::setOrientation(Qt::Orientation orientation)
   129 void CntEditViewPrivate::setOrientation(Qt::Orientation orientation)
   112 {
   130 {
   113     if (orientation == Qt::Vertical) 
   131     if (orientation == Qt::Vertical) 
   122     }
   140     }
   123 }
   141 }
   124 
   142 
   125 void CntEditViewPrivate::activate( CntAbstractViewManager* aMgr, const CntViewParameters aArgs )
   143 void CntEditViewPrivate::activate( CntAbstractViewManager* aMgr, const CntViewParameters aArgs )
   126 {
   144 {
       
   145     CNT_ENTRY
       
   146     
   127     mMgr = aMgr;
   147     mMgr = aMgr;
   128     mArgs = aArgs;
   148     mArgs = aArgs;
   129     
   149     
   130     if ( mView->navigationAction() != mSoftkey)
   150     if ( mView->navigationAction() != mSoftkey)
   131     {
   151     {
   148     mListView->setModel( mModel );
   168     mListView->setModel( mModel );
   149     
   169     
   150     QContactLocalId localId = mContact->localId();
   170     QContactLocalId localId = mContact->localId();
   151     QContactManager* cm = mMgr->contactManager(SYMBIAN_BACKEND);
   171     QContactManager* cm = mMgr->contactManager(SYMBIAN_BACKEND);
   152     QContactLocalId selfContactId = cm->selfContactId();
   172     QContactLocalId selfContactId = cm->selfContactId();
   153     mIsMyCard = ( localId == selfContactId && localId != 0 ) || myCard == "myCard";
   173     mIsMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty();
       
   174     
       
   175     if (mIsMyCard)
       
   176     {
       
   177         mSaveManager = new CntSaveManager(CntSaveManager::EMyCard);
       
   178     }
       
   179     else
       
   180     {
       
   181         mSaveManager = new CntSaveManager();
       
   182     }
   154     
   183     
   155     if ( mHeading )
   184     if ( mHeading )
   156         mHeading->setDetails( mContact, mIsMyCard );
   185         mHeading->setDetails( mContact, mIsMyCard );
   157 
   186 
   158     // if "MyCard", set slightly different heading and options menu
   187     // if "MyCard", set slightly different heading and options menu
   193     
   222     
   194     connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)),
   223     connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)),
   195             this, SLOT(thumbnailReady(QPixmap, void*, int, int)) );
   224             this, SLOT(thumbnailReady(QPixmap, void*, int, int)) );
   196 
   225 
   197     loadAvatar();
   226     loadAvatar();
       
   227     
       
   228     CNT_EXIT
   198 }
   229 }
   199 
   230 
   200 void CntEditViewPrivate::deactivate()
   231 void CntEditViewPrivate::deactivate()
   201 {   
   232 {   
   202 }
   233 }
   319 
   350 
   320 void CntEditViewPrivate::handleAddDetailItem(HbAction *aAction)
   351 void CntEditViewPrivate::handleAddDetailItem(HbAction *aAction)
   321 {
   352 {
   322     CntDetailPopup *popup = static_cast<CntDetailPopup*>(sender());
   353     CntDetailPopup *popup = static_cast<CntDetailPopup*>(sender());
   323     
   354     
   324     if (popup && aAction != popup->actions().first())
   355     if (popup && aAction != popup->actions().first() && popup->selectedItems().count())
   325     {
   356     {
   326         int id = popup->selectedDetail();
   357         int row = popup->selectedItems().first().toInt();
   327         
   358         QModelIndex index = popup->model()->index(row, 0);
       
   359         int id = popup->model()->data(index, Qt::UserRole).toInt();
       
   360 
   328         if (id != noView )
   361         if (id != noView )
   329         {
   362         {
   330             mArgs.insert(EViewId, id );
   363             mArgs.insert(EViewId, id );
   331 
   364 
   332             switch ( id )
   365             switch ( id )
   421 void CntEditViewPrivate::deleteContact()
   454 void CntEditViewPrivate::deleteContact()
   422 {
   455 {
   423     if ( mIsMyCard )
   456     if ( mIsMyCard )
   424     {
   457     {
   425         HbMessageBox::question(hbTrId("txt_phob_dialog_remove_all_personal_data_from_my_c"), this, 
   458         HbMessageBox::question(hbTrId("txt_phob_dialog_remove_all_personal_data_from_my_c"), this, 
   426                 SLOT(handleDeleteContact(HbAction*)), 
   459                 SLOT(handleDeleteContact(int)), 
   427                 hbTrId("txt_common_button_yes"), 
   460                 HbMessageBox::Yes | HbMessageBox::No);
   428                 hbTrId("txt_common_button_no"));
       
   429     }
   461     }
   430     else
   462     else
   431     {
   463     {
   432         QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND );
   464         QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND );
   433         QString name = cm->synthesizedDisplayLabel( *mContact );
   465         QString name = cm->synthesizedContactDisplayLabel( *mContact );
   434         HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)), 
   466         if (name.isEmpty())
   435                 hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"));
   467         {
   436     }
   468             name = hbTrId("txt_phob_list_unnamed");
   437 }
   469         }
   438 
   470         
   439 void CntEditViewPrivate::handleDeleteContact(HbAction *action)
   471         HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)), 
       
   472                 HbMessageBox::Delete | HbMessageBox::Cancel);
       
   473     }
       
   474 }
       
   475 
       
   476 void CntEditViewPrivate::handleDeleteContact(int action)
   440 {
   477 {
   441     Q_Q(CntEditView);
   478     Q_Q(CntEditView);
   442     
   479 
   443     HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
   480     if(action == HbMessageBox::Yes || action == HbMessageBox::Delete)
   444     if(dlg && action == dlg->actions().first())
       
   445     {
   481     {
   446         QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND );
   482         QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND );
   447 
   483 
       
   484         disconnect(cm, SIGNAL(contactsRemoved(const QList<QContactLocalId>&)),
       
   485                 this, SLOT(contactDeletedFromOtherSource(const QList<QContactLocalId>&)));
   448         emit q->contactRemoved(cm->removeContact( mContact->localId() ));
   486         emit q->contactRemoved(cm->removeContact( mContact->localId() ));
   449         
   487         
   450         mMgr->back( mArgs );
   488         mMgr->back( mArgs, true );
   451     }
   489     }
   452 }
   490 }
   453 
   491 
   454 void CntEditViewPrivate::discardChanges()
   492 void CntEditViewPrivate::discardChanges()
   455 {
   493 {
   457     
   495     
   458     emit q->changesDiscarded();
   496     emit q->changesDiscarded();
   459     
   497     
   460     // get a fresh one from backend.
   498     // get a fresh one from backend.
   461     QContactManager* mgr = mMgr->contactManager(SYMBIAN_BACKEND);
   499     QContactManager* mgr = mMgr->contactManager(SYMBIAN_BACKEND);
   462     mContact = new QContact(mgr->contact( mContact->localId() ));
   500     setSelectedContact( mgr->contact( mContact->localId()) );
   463     
   501     
   464     QVariant var;
   502     QVariant var;
   465     var.setValue(*mContact);
   503     var.setValue(*mContact);
   466     
   504     
   467     CntViewParameters viewParameters;
   505     CntViewParameters viewParameters;
   468     viewParameters.insert(ESelectedContact, var);
   506     viewParameters.insert(ESelectedContact, var);
   469             
   507     
   470     mMgr->back( viewParameters );
   508     if ( mArgs.value( EExtraAction ).toString() == CNT_ROOT_ACTION )
   471 }
   509     {
       
   510         mMgr->back( viewParameters, true );
       
   511     }
       
   512     else
       
   513     {
       
   514         mMgr->back( viewParameters );
       
   515     }
       
   516        
       
   517 }   
   472 
   518 
   473 void CntEditViewPrivate::saveChanges()
   519 void CntEditViewPrivate::saveChanges()
   474 {
   520 {
   475     Q_Q(CntEditView);
   521     Q_Q(CntEditView);
   476 
   522     
   477     QContactManager* mgr = mMgr->contactManager( SYMBIAN_BACKEND );
   523     QString name = mMgr->contactManager(SYMBIAN_BACKEND)->synthesizedContactDisplayLabel(*mContact);
   478     bool isSavedContact = mContact->localId() > 0;
   524     
   479     
   525     if (name.isEmpty())
   480     // if the contact is really changed or a new one
   526     {
   481     if ( (*mContact) != mgr->contact(mContact->localId()) || !isSavedContact )
   527         name = hbTrId("txt_phob_list_unnamed");
   482     {
   528     }
   483         int detailCount = mContact->details().count();
   529     
   484          
   530     CntSaveManager::CntSaveResult result = mSaveManager->saveContact(mContact, mMgr->contactManager(SYMBIAN_BACKEND));
   485         setPreferredDetails( mContact );
   531     
   486         
   532     QVariant var;
   487         // If its a new contact
   533     bool backToRoot(false);
   488         if ( !isSavedContact )
   534     
   489         {
   535     switch (result)
   490             if ( detailCount > 2 )
   536     {
   491             {
   537     case CntSaveManager::ESaved:
   492                 bool success = mgr->saveContact( mContact );
   538         emit q->contactUpdated(KCntServicesReturnValueContactSaved);
   493                 if ( success && mIsMyCard )
   539         HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contact_1_saved")).arg(name));
   494                 {
   540         var.setValue(*mContact);
   495                     mgr->setSelfContactId( mContact->localId() );
   541         mArgs.insert(ESelectedContact, var);
   496                 }
   542         mArgs.insert(ESelectedAction, CNT_CREATE_ACTION);
   497                 
   543         break;
   498                 QString name = mgr->synthesizedDisplayLabel( *mContact );
   544     case CntSaveManager::EUpdated:
   499                 if (name.isEmpty())
   545         emit q->contactUpdated(KCntServicesReturnValueContactSaved);
   500                 {
   546         HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contacts_1_updated")).arg(name));
   501                     name = hbTrId("txt_phob_dblist_unnamed");
   547         var.setValue(*mContact);
   502                 }
   548         mArgs.insert(ESelectedContact, var);
   503                 
   549         mArgs.insert(ESelectedAction, CNT_EDIT_ACTION);
   504                 if ( success )
   550         break;
   505                 {
   551     case CntSaveManager::EFailed:
   506                     emit q->contactUpdated(1);
   552         emit q->contactUpdated(KCntServicesReturnValueContactNotModified);
   507                     HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contact_1_saved")).arg(name));
   553         HbDeviceNotificationDialog::notification(QString(),hbTrId("SAVING FAILED!"));
   508                 }
   554         break;
   509                 else
   555     case CntSaveManager::EDeleted:
   510                 {
   556         emit q->contactRemoved(true);
   511                     emit q->contactUpdated(0);
   557         backToRoot = true;
   512                     //TODO: localization is missing
   558         break;
   513                     HbDeviceNotificationDialog::notification(QString(),qtTrId("SAVING FAILED!"));
   559     case CntSaveManager::ENothingDone:
   514                 }
   560     default:
   515                 
   561         emit q->contactUpdated(KCntServicesReturnValueContactNotModified);
   516                 QVariant var;
   562         break;
   517                 var.setValue(*mContact);
   563     }
   518                 mArgs.insert(ESelectedContact, var);
   564 
   519                 mArgs.insert(ESelectedAction, CNT_CREATE_ACTION);
   565     if ( mArgs.value( EExtraAction ).toString() == CNT_ROOT_ACTION )
   520             }
   566     {
   521             else
   567         backToRoot = true;
   522             {
   568     }
   523                 // nothing happened to the contact. Flags should be used
   569     
   524                 emit q->contactUpdated(-2);
   570     mMgr->back( mArgs, backToRoot );
   525             }
   571 }
   526         }
       
   527         else
       
   528         {
       
   529             // contact details has been cleared out.
       
   530             if ( detailCount <= 4 )
       
   531             {
       
   532                 // get the contact from database, it should have the name still in it,
       
   533                 // and show the delete notification to user
       
   534                 QContact c = mgr->contact( mContact->localId() );
       
   535                 
       
   536                 bool success = mgr->removeContact( mContact->localId() );
       
   537                 emit q->contactRemoved(success);
       
   538             }
       
   539             else
       
   540             {
       
   541                 bool success = mgr->saveContact(mContact);
       
   542                 
       
   543                 QString name = mgr->synthesizedDisplayLabel( *mContact );
       
   544                 if (name.isEmpty())
       
   545                 {
       
   546                     name = hbTrId("txt_phob_dblist_unnamed");
       
   547                 }
       
   548                 
       
   549                 if ( success )
       
   550                 {   
       
   551                     emit q->contactUpdated(1);
       
   552                     HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contacts_1_updated")).arg(name));
       
   553                     mArgs.insert(ESelectedAction, CNT_EDIT_ACTION);           
       
   554                 }
       
   555                 else
       
   556                 {
       
   557                     emit q->contactUpdated(0);
       
   558                     //TODO: localization is missing
       
   559                     HbDeviceNotificationDialog::notification(QString(),qtTrId("SAVING FAILED!"));
       
   560                 }
       
   561                 
       
   562                 QVariant var;
       
   563                 var.setValue(*mContact);
       
   564                 mArgs.insert(ESelectedContact, var);           
       
   565             }
       
   566         }
       
   567     }
       
   568     else
       
   569     {
       
   570         emit q->changesDiscarded();
       
   571     }
       
   572     
       
   573     mMgr->back( mArgs );
       
   574 }
       
   575 
       
   576 void CntEditViewPrivate::setPreferredDetails( QContact* aContact )
       
   577 {
       
   578     QList<QContactPhoneNumber> numberList( aContact->details<QContactPhoneNumber>() );
       
   579     //set preferred number for call if there is only one phone number
       
   580     if ( aContact->preferredDetail("call").isEmpty() && numberList.count() == 1 )
       
   581     {
       
   582         aContact->setPreferredDetail( "call", numberList.first() );
       
   583     }
       
   584     //set preferred number for message if there is only one mobile phone number
       
   585     if ( aContact->preferredDetail("message").isEmpty() && numberList.count() >= 1 )
       
   586     {
       
   587         int mobileNumbers = 0;
       
   588         int mobileNumberIndex = -1;
       
   589         for (int i = 0; i < numberList.count(); i++)
       
   590         {
       
   591             if (numberList.at(i).subTypes().count() && numberList.at(i).subTypes().first() == QContactPhoneNumber::SubTypeMobile)
       
   592             {
       
   593                 mobileNumbers++;
       
   594                 mobileNumberIndex = i;
       
   595             }      
       
   596         }
       
   597         if ( mobileNumbers == 1 )
       
   598         {
       
   599             aContact->setPreferredDetail( "message", numberList.at(mobileNumberIndex) );
       
   600         }
       
   601     }
       
   602     QList<QContactEmailAddress> emailList( aContact->details<QContactEmailAddress>() );
       
   603     //set preferred number for email if there is only one email address
       
   604     if ( aContact->preferredDetail("email").isEmpty() && emailList.count() == 1 )
       
   605     {
       
   606         aContact->setPreferredDetail( "email", emailList.first() );
       
   607     }   
       
   608 }
       
   609 
       
   610 
   572 
   611 void CntEditViewPrivate::openNameEditor()
   573 void CntEditViewPrivate::openNameEditor()
   612 {
   574 {
   613     QVariant var;
   575     QVariant var;
   614     var.setValue(*mContact);
   576     var.setValue(*mContact);
   668     {
   630     {
   669         HbIcon icon(pixmap);
   631         HbIcon icon(pixmap);
   670         mHeading->setIcon(icon);
   632         mHeading->setIcon(icon);
   671         
   633         
   672         mImageLabel->clear();
   634         mImageLabel->clear();
   673         mImageLabel->setIcon(icon);
   635         mImageLabel->setIcon(pixmap);
   674     }
   636     }
   675 }
   637 }
   676 
   638 
   677 HbMenu* CntEditViewPrivate::createPopup( const QModelIndex aIndex, CntEditViewItem* aDetail )
   639 HbMenu* CntEditViewPrivate::createPopup( const QModelIndex aIndex, CntEditViewItem* aDetail )
   678 {
   640 {
   742 }
   704 }
   743 
   705 
   744 void CntEditViewPrivate::addDetail( CntEditViewItem* aDetail )
   706 void CntEditViewPrivate::addDetail( CntEditViewItem* aDetail )
   745 {
   707 {
   746     QVariant id = aDetail->data( ERoleEditorViewId );
   708     QVariant id = aDetail->data( ERoleEditorViewId );
   747     CntViewParameters viewParameters;
   709     
   748     viewParameters.insert(EViewId, id.toInt());
   710     mArgs.insert(EViewId, id.toInt());
       
   711     mArgs.insert(ESelectedAction, CNT_ADD_ACTION );
   749     QVariant var;
   712     QVariant var;
   750     var.setValue(*mContact);
   713     var.setValue(*mContact);
   751     viewParameters.insert(ESelectedContact, var);
   714     
   752     viewParameters.insert(ESelectedAction, CNT_ADD_ACTION );
   715     mArgs.insert(ESelectedContact, var);
   753                                             
   716                                         
   754     mMgr->changeView( viewParameters );
   717     mMgr->changeView( mArgs );
   755 }
   718 }
   756 
   719 
   757 void CntEditViewPrivate::editDetail( CntEditViewItem* aDetail )
   720 void CntEditViewPrivate::editDetail( CntEditViewItem* aDetail )
   758 {
   721 {
   759     QVariant id = aDetail->data( ERoleEditorViewId );
   722     QVariant id = aDetail->data( ERoleEditorViewId );
   781     {
   744     {
   782         delete mContact;
   745         delete mContact;
   783         mContact = NULL;
   746         mContact = NULL;
   784     }
   747     }
   785     mContact = new QContact( aContact );
   748     mContact = new QContact( aContact );
   786     /*
   749     
   787     mListView->setModel( NULL );
   750     QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND );
   788     
   751     connect(cm, SIGNAL(contactsRemoved(const QList<QContactLocalId>&)), 
   789     if ( mModel )
   752         this, SLOT(contactDeletedFromOtherSource(const QList<QContactLocalId>&)), Qt::UniqueConnection);
   790     {
   753 }
   791         delete mModel;
   754 
   792         mModel = NULL;
   755 void CntEditViewPrivate::contactDeletedFromOtherSource(const QList<QContactLocalId>& contactIds)
   793     }
   756 {
   794     mModel = new CntEditViewListModel( mContact );
   757     CNT_ENTRY
   795     
   758     
   796     if ( mListView )
   759     if ( contactIds.contains(mContact->localId()) )
   797         mListView->setModel( mModel );
   760     {
   798         */
   761         // Do not switch to the previous view immediately. List views are
   799 }
   762         // not updated properly if this is not done in the event loop
       
   763         QTimer::singleShot(0, this, SLOT(showRootView()));
       
   764     }
       
   765     
       
   766     CNT_EXIT
       
   767 }
       
   768 
       
   769 void CntEditViewPrivate::showRootView()
       
   770 {
       
   771     CNT_ENTRY
       
   772     
       
   773     Q_Q(CntEditView);
       
   774     
       
   775     emit q->contactRemoved(true);
       
   776     mMgr->back( mArgs, true );
       
   777     
       
   778     CNT_EXIT
       
   779 }
       
   780 
   800 // End of File
   781 // End of File
   801 
   782