diff options
-rw-r--r-- | fpicker/source/office/PlacesListBox.cxx | 29 | ||||
-rw-r--r-- | fpicker/source/office/PlacesListBox.hxx | 8 |
2 files changed, 31 insertions, 6 deletions
diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index c763b1d913f4..f8e438d65d67 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -38,9 +38,10 @@ using rtl::OUString; -PlacesListBox_Impl::PlacesListBox_Impl( Window* pParent, const rtl::OUString& rTitle ) : +PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const rtl::OUString& rTitle ) : SvHeaderTabListBox( pParent, WB_TABSTOP | WB_NOINITIALSELECTION ), - mpHeaderBar( NULL ) + mpHeaderBar( NULL ), + mpParent( pParent ) { Size aBoxSize = pParent->GetSizePixel( ); mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); @@ -63,6 +64,13 @@ PlacesListBox_Impl::PlacesListBox_Impl( Window* pParent, const rtl::OUString& rT PlacesListBox_Impl::~PlacesListBox_Impl( ) { delete mpHeaderBar; + mpParent = NULL; +} + +void PlacesListBox_Impl::MouseButtonUp( const MouseEvent& rMEvt ) +{ + SvHeaderTabListBox::MouseButtonUp( rMEvt ); + mpParent->updateView( ); } PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId ) : @@ -71,7 +79,8 @@ PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTit mpDlg( pFileDlg ), mpImpl( NULL ), mnNbEditables( 0 ), - mbUpdated( false ) + mbUpdated( false ), + mbSelectionChanged( false ) { mpImpl = new PlacesListBox_Impl( this, rTitle ); @@ -149,8 +158,7 @@ IMPL_LINK( PlacesListBox, Selection, void* , EMPTYARG ) sal_uInt32 nSelected = mpImpl->GetCurrRow(); PlacePtr pPlace = maPlaces[nSelected]; - mpDlg->OpenURL_Impl( pPlace->GetUrl() ); - + mbSelectionChanged = true; if(pPlace->IsEditable()) mpDlg->RemovablePlaceSelected(); else @@ -186,4 +194,15 @@ IMPL_LINK ( PlacesListBox, DoubleClick, void*, EMPTYARG ) return 0; } +void PlacesListBox::updateView( ) +{ + if ( mbSelectionChanged ) + { + mbSelectionChanged = false; + sal_uInt32 nSelected = mpImpl->GetCurrRow(); + PlacePtr pPlace = maPlaces[nSelected]; + mpDlg->OpenURL_Impl( pPlace->GetUrl( ) ); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index 74ae8e77f8c3..49dc83e07788 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -69,14 +69,18 @@ class Place typedef boost::shared_ptr< Place > PlacePtr; +class PlacesListBox; class PlacesListBox_Impl : public SvHeaderTabListBox { private: HeaderBar* mpHeaderBar; + PlacesListBox* mpParent; public: - PlacesListBox_Impl( Window* pParent, const rtl::OUString& rTitle ); + PlacesListBox_Impl( PlacesListBox* pParent, const rtl::OUString& rTitle ); ~PlacesListBox_Impl( ); + + virtual void MouseButtonUp( const MouseEvent& rMEvt ); }; /** ListBox to handle Places. @@ -89,6 +93,7 @@ class PlacesListBox : public Control PlacesListBox_Impl* mpImpl; sal_Int32 mnNbEditables; bool mbUpdated; + bool mbSelectionChanged; public: PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId ); @@ -102,6 +107,7 @@ class PlacesListBox : public Control const std::vector<PlacePtr>& GetPlaces(); void SetSizePixel( const Size& rNewSize ); + void updateView( ); private: |