phonebookui/pbkcommonui/src/cntnamesview_p.cpp
changeset 50 77bc263e1626
parent 47 7cbcb2896f0e
child 53 e6aff7b69165
equal deleted inserted replaced
49:74b30151afd6 50:77bc263e1626
   142 
   142 
   143 CntNamesViewPrivate::~CntNamesViewPrivate()
   143 CntNamesViewPrivate::~CntNamesViewPrivate()
   144 {
   144 {
   145     CNT_ENTRY
   145     CNT_ENTRY
   146     
   146     
       
   147     delete mFetchView;
       
   148     mFetchView = NULL;
       
   149     
   147     delete mListModel;
   150     delete mListModel;
   148     mListModel = NULL;
   151     mListModel = NULL;
   149 
   152 
   150     delete mLoader;
   153     delete mLoader;
   151     mLoader = NULL;
   154     mLoader = NULL;
   210     if (aArgs.value(ESelectedAction) == CNT_CREATE_ACTION || aArgs.value(ESelectedAction) == CNT_EDIT_ACTION)
   213     if (aArgs.value(ESelectedAction) == CNT_CREATE_ACTION || aArgs.value(ESelectedAction) == CNT_EDIT_ACTION)
   211     {
   214     {
   212         setScrollPosition(aArgs.value(ESelectedContact).value<QContact>().localId());
   215         setScrollPosition(aArgs.value(ESelectedContact).value<QContact>().localId());
   213     }
   216     }
   214    
   217    
       
   218     if ( aArgs.value( EFinder ).toString() == "show" )
       
   219     {
       
   220         showFinder();
       
   221     }
       
   222 
   215     CNT_EXIT
   223     CNT_EXIT
   216 }
   224 }
   217 
   225 
   218 void CntNamesViewPrivate::deactivate()
   226 void CntNamesViewPrivate::deactivate()
   219 {
   227 {
   220     CNT_ENTRY
   228     CNT_ENTRY
   221     
   229     
   222     if (!(mView->visibleItems() & Hb::AllItems))
   230     // in UTs there is no mainwindow and therefore calling HbView::visibleItems() would cause a crash
   223     {
   231     if (mView->mainWindow() != NULL)
   224         hideFinder();
   232     {
       
   233         if (!(mView->visibleItems() & Hb::AllItems))
       
   234         {
       
   235             hideFinder();
       
   236         }
   225     }
   237     }
   226 
   238 
   227     delete mMenuBuilder;
   239     delete mMenuBuilder;
   228     mMenuBuilder = NULL;
   240     mMenuBuilder = NULL;
   229     
   241     
   396 {
   408 {
   397     CNT_ENTRY
   409     CNT_ENTRY
   398     
   410     
   399     QContactManager* manager = mViewManager->contactManager( SYMBIAN_BACKEND );
   411     QContactManager* manager = mViewManager->contactManager( SYMBIAN_BACKEND );
   400     QString name = manager->synthesizedDisplayLabel(aContact);
   412     QString name = manager->synthesizedDisplayLabel(aContact);
       
   413     if (name.isEmpty())
       
   414     {
       
   415         name = hbTrId("txt_phob_list_unnamed");
       
   416     }
   401     
   417     
   402     mHandledContactId = aContact.localId();
   418     mHandledContactId = aContact.localId();
   403     
   419     
   404     HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)),
   420     HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)),
   405             hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"));
   421             HbMessageBox::Delete | HbMessageBox::Cancel);
   406     
   422     
   407     CNT_EXIT
   423     CNT_EXIT
   408 }
   424 }
   409 
   425 
   410 void CntNamesViewPrivate::deleteMultipleContacts()
   426 void CntNamesViewPrivate::deleteMultipleContacts()
   512     aAction->deleteLater();
   528     aAction->deleteLater();
   513 
   529 
   514     CNT_EXIT
   530     CNT_EXIT
   515 }
   531 }
   516 
   532 
   517 void CntNamesViewPrivate::handleDeleteContact( HbAction* aAction )
   533 void CntNamesViewPrivate::handleDeleteContact( int aAction )
   518 {
   534 {
   519     CNT_ENTRY
   535     CNT_ENTRY
   520     
   536     
   521     HbMessageBox *note = static_cast<HbMessageBox*>(sender());
   537     if (aAction == HbMessageBox::Delete)
   522     
       
   523     if (note && aAction == note->actions().first())
       
   524     {
   538     {
   525         mViewManager->contactManager( SYMBIAN_BACKEND )->removeContact(mHandledContactId);
   539         mViewManager->contactManager( SYMBIAN_BACKEND )->removeContact(mHandledContactId);
   526     }
   540     }
   527     
   541     
   528     mHandledContactId = 0;
   542     mHandledContactId = 0;