diff -r 96df3ab41000 -r 8db05346071b locationpickerservice/src/locationpickersearchview.cpp --- a/locationpickerservice/src/locationpickersearchview.cpp Wed Jun 23 18:07:15 2010 +0300 +++ b/locationpickerservice/src/locationpickersearchview.cpp Tue Jul 06 14:10:28 2010 +0300 @@ -42,7 +42,8 @@ mEmptyLabel(NULL), mVerticalLayout(NULL), mDocumentLoader(aLoader), - mLongPressMenu(NULL) + mLongPressMenu(NULL), + mSelectAction(NULL) { } @@ -53,7 +54,6 @@ { delete mProxyModel; delete mEmptyLabel; - delete mLongPressMenu; } // ---------------------------------------------------- @@ -86,7 +86,7 @@ mListView->setItemPrototype( hbListItem ); // Create the proxy model. - mProxyModel = new LocationPickerProxyModel( Qt ::Vertical ); + mProxyModel = new LocationPickerProxyModel(); mProxyModel->setSourceModel(mModel); mListView->setModel(mProxyModel); @@ -172,7 +172,6 @@ aValue = var.toUInt(); } - // ----------------------------------------------------------------------------- // LocationPickerSearchView::launchPopUpMenu() // ----------------------------------------------------------------------------- @@ -180,10 +179,11 @@ { mLongPressMenu = new HbMenu(); mLongPressMenu->setTimeout(HbMenu::NoTimeout); - HbAction* selectAction = mLongPressMenu->addAction(hbTrId("Select")); + mSelectAction = mLongPressMenu->addAction(hbTrId("Select")); mIndex = aItem->modelIndex(); - connect(selectAction, SIGNAL(triggered()),this, SLOT(handleLongPress())); + connect(mSelectAction, SIGNAL(triggered()),this, SLOT(handleLongPress())); mLongPressMenu->setPreferredPos(aPoint); + connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu())); mLongPressMenu->open(); } @@ -194,3 +194,14 @@ { handleActivated(mIndex); } + +// ----------------------------------------------------------------------------- +// LocationPickerSearchView::deleteMenu() +// ----------------------------------------------------------------------------- +void LocationPickerSearchView::deleteMenu() +{ + mLongPressMenu->deleteLater(); + mLongPressMenu = NULL; + mSelectAction->deleteLater(); + mSelectAction = NULL; +}