phonebookui/pbkcommonui/src/cntmycardview.cpp
changeset 50 77bc263e1626
parent 47 7cbcb2896f0e
child 53 e6aff7b69165
--- a/phonebookui/pbkcommonui/src/cntmycardview.cpp	Wed Jul 21 11:09:07 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntmycardview.cpp	Wed Jul 21 11:21:49 2010 +0300
@@ -98,11 +98,6 @@
     {
         chooseButton->setEnabled(false);
     }
-    
-    if (!mFetchView) {
-        mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
-        connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleMultiCardSelection()));
-    }
 }
 
 void CntMyCardView::deactivate()
@@ -144,6 +139,10 @@
 void CntMyCardView::openMyCardSelectionView()
 {
     // Display a list of contacts to choose a mycard from.
+    if (!mFetchView) {
+        mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
+        connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleMultiCardSelection()));
+    }
     mFetchView->setDetails(hbTrId("txt_phob_title_select_contact"), "");
     QSet<QContactLocalId> emptyContactsSet;
     mFetchView->displayContacts(HbAbstractItemView::SingleSelection, emptyContactsSet);
@@ -163,6 +162,10 @@
         manager->setSelfContactId( contact.localId() );
         showPreviousView();
     }
+    else {
+        delete mFetchView;
+        mFetchView = NULL;
+    }
 }
 
 void CntMyCardView::removeFromGroup(const QContact* aContact)