phonebookui/pbkcommonui/src/cntmycardview.cpp
changeset 50 77bc263e1626
parent 47 7cbcb2896f0e
child 53 e6aff7b69165
equal deleted inserted replaced
49:74b30151afd6 50:77bc263e1626
    96 
    96 
    97     if (mViewManager->contactManager( SYMBIAN_BACKEND )->contactIds(filter).isEmpty())
    97     if (mViewManager->contactManager( SYMBIAN_BACKEND )->contactIds(filter).isEmpty())
    98     {
    98     {
    99         chooseButton->setEnabled(false);
    99         chooseButton->setEnabled(false);
   100     }
   100     }
   101     
       
   102     if (!mFetchView) {
       
   103         mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
       
   104         connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleMultiCardSelection()));
       
   105     }
       
   106 }
   101 }
   107 
   102 
   108 void CntMyCardView::deactivate()
   103 void CntMyCardView::deactivate()
   109 {
   104 {
   110 }
   105 }
   142 Opens the my card selection view
   137 Opens the my card selection view
   143 */
   138 */
   144 void CntMyCardView::openMyCardSelectionView()
   139 void CntMyCardView::openMyCardSelectionView()
   145 {
   140 {
   146     // Display a list of contacts to choose a mycard from.
   141     // Display a list of contacts to choose a mycard from.
       
   142     if (!mFetchView) {
       
   143         mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND ));
       
   144         connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleMultiCardSelection()));
       
   145     }
   147     mFetchView->setDetails(hbTrId("txt_phob_title_select_contact"), "");
   146     mFetchView->setDetails(hbTrId("txt_phob_title_select_contact"), "");
   148     QSet<QContactLocalId> emptyContactsSet;
   147     QSet<QContactLocalId> emptyContactsSet;
   149     mFetchView->displayContacts(HbAbstractItemView::SingleSelection, emptyContactsSet);
   148     mFetchView->displayContacts(HbAbstractItemView::SingleSelection, emptyContactsSet);
   150 }
   149 }
   151 
   150 
   160         QContact contact = manager->contact(selectedContactsList.front());
   159         QContact contact = manager->contact(selectedContactsList.front());
   161         removeFromGroup(&contact);
   160         removeFromGroup(&contact);
   162         
   161         
   163         manager->setSelfContactId( contact.localId() );
   162         manager->setSelfContactId( contact.localId() );
   164         showPreviousView();
   163         showPreviousView();
       
   164     }
       
   165     else {
       
   166         delete mFetchView;
       
   167         mFetchView = NULL;
   165     }
   168     }
   166 }
   169 }
   167 
   170 
   168 void CntMyCardView::removeFromGroup(const QContact* aContact)
   171 void CntMyCardView::removeFromGroup(const QContact* aContact)
   169 {
   172 {