locationpickerservice/src/locationpickerview.cpp
changeset 41 b3dd5ec3089d
parent 35 59575560d1e6
--- a/locationpickerservice/src/locationpickerview.cpp	Thu Sep 02 20:20:42 2010 +0300
+++ b/locationpickerservice/src/locationpickerview.cpp	Mon Oct 04 00:10:56 2010 +0300
@@ -76,7 +76,8 @@
             QString("ascendingAction")));
     mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
             QString("descendingAction")));
-    if( !mAllAction || !mCollectionAction || !mSearchAction || !mAscendingAction || !mDescendingAction )
+    if( !mAllAction || !mCollectionAction || !mSearchAction ||
+    	 !mAscendingAction || !mDescendingAction )
     {
         qFatal("Error Reading Docml");
     }
@@ -176,7 +177,8 @@
     connect(mSearchAction, SIGNAL(triggered()), this,
             SLOT(searchTabTriggered()));
     // connect the signal of the list activated to a slot.
-    connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
+    connect(mListView, SIGNAL(activated(const QModelIndex &)), 
+    this, SLOT(handleActivated(const QModelIndex &)));
     connect(mListView,SIGNAL(longPressed(HbAbstractViewItem*, const QPointF &)),this,
             SLOT(launchPopUpMenu(HbAbstractViewItem*, const QPointF &)));
     //set widget according to orientation
@@ -216,7 +218,8 @@
             SLOT(orientationChanged(Qt::Orientation)));
 
     mWidget->setAcceptTouchEvents(true);
-    connect(mWidget, SIGNAL(activated(const QModelIndex &)),this, SLOT(handleActivated(const QModelIndex &)));
+    connect(mWidget, SIGNAL(activated(const QModelIndex &)),
+    this, SLOT(handleActivated(const QModelIndex &)));
     connect(mWidget, SIGNAL(longPressed(const QModelIndex &, const QPointF &)),this, 
             SLOT(launchPopUpMenu(const QModelIndex &, const QPointF &)));
     mWidget->setLongPressEnabled(true);
@@ -284,7 +287,8 @@
         break;
         case ELocationPickerCollectionListContent:
         {
-            mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem);
+            mListView->setModel(mLocationPickerCollectionListContent->getStandardModel()
+            ,mListItem);
             mCollectionAction->setChecked(true);
             mAllAction->setChecked(false);
             if(mAscendingAction->isEnabled())
@@ -502,6 +506,11 @@
 // -----------------------------------------------------------------------------
 void LocationPickerView::searchTabTriggered()
 {
+    if (mCollectionContent)
+    {
+        delete mCollectionContent;
+        mCollectionContent = NULL;
+    }
     mWidget->hide();
     emit switchToSearchView();
 }
@@ -611,7 +620,7 @@
     mLongPressMenu = new HbMenu();
     mLongPressMenu->setTimeout(HbMenu::NoTimeout);
     connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
-    mSelectAction  = mLongPressMenu->addAction(hbTrId("txt_lint_list_select"));
+    mSelectAction  = mLongPressMenu->addAction(hbTrId("txt_lint_menu_select"));
     if( mViewType == ELocationPickerCollectionContent || mViewType == ELocationPickerContent )
     {
         mDetailsAction  = mLongPressMenu->addAction(hbTrId("txt_lint_menu_details"));
@@ -631,7 +640,7 @@
     mLongPressMenu = new HbMenu();
     mLongPressMenu->setTimeout(HbMenu::NoTimeout);
     connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
-    mSelectAction  = mLongPressMenu->addAction(hbTrId("txt_lint_list_select"));
+    mSelectAction  = mLongPressMenu->addAction(hbTrId("txt_lint_menu_select"));
     mIndex = aIndex;
     connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
     mLongPressMenu->setPreferredPos(aPoint);
@@ -693,8 +702,10 @@
     }
     else
     {
-        adressDetail = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+3).toStringList();
-        iconName =  mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+1).toString();
+        adressDetail = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+3).
+        	toStringList();
+        iconName =  mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+1).
+        	toString();
     }
     if(iconName.isEmpty())
     {
@@ -757,7 +768,8 @@
         mEmptyLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
         mEmptyLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary));
         mEmptyLabel->setAlignment(Qt::AlignCenter);
-        mLinerLayout->removeItem(mListView);
+        mListView->reset();
+        mLinerLayout->removeItem(mListView);        
         mListView->hide();
         mWidget->setVisible(false);
         mLinerLayout->insertItem(0, mEmptyLabel);