phonebookui/pbkcommonui/src/cntnamesview_p.cpp
changeset 50 77bc263e1626
parent 47 7cbcb2896f0e
child 53 e6aff7b69165
--- a/phonebookui/pbkcommonui/src/cntnamesview_p.cpp	Wed Jul 21 11:09:07 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntnamesview_p.cpp	Wed Jul 21 11:21:49 2010 +0300
@@ -144,6 +144,9 @@
 {
     CNT_ENTRY
     
+    delete mFetchView;
+    mFetchView = NULL;
+    
     delete mListModel;
     mListModel = NULL;
 
@@ -212,6 +215,11 @@
         setScrollPosition(aArgs.value(ESelectedContact).value<QContact>().localId());
     }
    
+    if ( aArgs.value( EFinder ).toString() == "show" )
+    {
+        showFinder();
+    }
+
     CNT_EXIT
 }
 
@@ -219,9 +227,13 @@
 {
     CNT_ENTRY
     
-    if (!(mView->visibleItems() & Hb::AllItems))
+    // in UTs there is no mainwindow and therefore calling HbView::visibleItems() would cause a crash
+    if (mView->mainWindow() != NULL)
     {
-        hideFinder();
+        if (!(mView->visibleItems() & Hb::AllItems))
+        {
+            hideFinder();
+        }
     }
 
     delete mMenuBuilder;
@@ -398,11 +410,15 @@
     
     QContactManager* manager = mViewManager->contactManager( SYMBIAN_BACKEND );
     QString name = manager->synthesizedDisplayLabel(aContact);
+    if (name.isEmpty())
+    {
+        name = hbTrId("txt_phob_list_unnamed");
+    }
     
     mHandledContactId = aContact.localId();
     
-    HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)),
-            hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"));
+    HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)),
+            HbMessageBox::Delete | HbMessageBox::Cancel);
     
     CNT_EXIT
 }
@@ -514,13 +530,11 @@
     CNT_EXIT
 }
 
-void CntNamesViewPrivate::handleDeleteContact( HbAction* aAction )
+void CntNamesViewPrivate::handleDeleteContact( int aAction )
 {
     CNT_ENTRY
     
-    HbMessageBox *note = static_cast<HbMessageBox*>(sender());
-    
-    if (note && aAction == note->actions().first())
+    if (aAction == HbMessageBox::Delete)
     {
         mViewManager->contactManager( SYMBIAN_BACKEND )->removeContact(mHandledContactId);
     }