Kaydet (Commit) 704d7023 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

fpicker: when selecting a place, update the URL outside the selection handler

If the file view URL open happens during the selection, that
protentially lengthy and blocking process (auth dialog) will block the
arrival of the MouseButtonUp even... and thus allowing to select items
in the places list box simply by placing the mouse over them.

To fix that, the URL is updated in the file view after the MouseButtonUp
even.

Change-Id: I0fddeb303ec9c91aef2b46592198540d6ac5c4c3
üst 6c71f411
...@@ -38,9 +38,10 @@ ...@@ -38,9 +38,10 @@
using rtl::OUString; 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 ), SvHeaderTabListBox( pParent, WB_TABSTOP | WB_NOINITIALSELECTION ),
mpHeaderBar( NULL ) mpHeaderBar( NULL ),
mpParent( pParent )
{ {
Size aBoxSize = pParent->GetSizePixel( ); Size aBoxSize = pParent->GetSizePixel( );
mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
...@@ -63,6 +64,13 @@ PlacesListBox_Impl::PlacesListBox_Impl( Window* pParent, const rtl::OUString& rT ...@@ -63,6 +64,13 @@ PlacesListBox_Impl::PlacesListBox_Impl( Window* pParent, const rtl::OUString& rT
PlacesListBox_Impl::~PlacesListBox_Impl( ) PlacesListBox_Impl::~PlacesListBox_Impl( )
{ {
delete mpHeaderBar; 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 ) : PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId ) :
...@@ -71,7 +79,8 @@ PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTit ...@@ -71,7 +79,8 @@ PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTit
mpDlg( pFileDlg ), mpDlg( pFileDlg ),
mpImpl( NULL ), mpImpl( NULL ),
mnNbEditables( 0 ), mnNbEditables( 0 ),
mbUpdated( false ) mbUpdated( false ),
mbSelectionChanged( false )
{ {
mpImpl = new PlacesListBox_Impl( this, rTitle ); mpImpl = new PlacesListBox_Impl( this, rTitle );
...@@ -149,8 +158,7 @@ IMPL_LINK( PlacesListBox, Selection, void* , EMPTYARG ) ...@@ -149,8 +158,7 @@ IMPL_LINK( PlacesListBox, Selection, void* , EMPTYARG )
sal_uInt32 nSelected = mpImpl->GetCurrRow(); sal_uInt32 nSelected = mpImpl->GetCurrRow();
PlacePtr pPlace = maPlaces[nSelected]; PlacePtr pPlace = maPlaces[nSelected];
mpDlg->OpenURL_Impl( pPlace->GetUrl() ); mbSelectionChanged = true;
if(pPlace->IsEditable()) if(pPlace->IsEditable())
mpDlg->RemovablePlaceSelected(); mpDlg->RemovablePlaceSelected();
else else
...@@ -186,4 +194,15 @@ IMPL_LINK ( PlacesListBox, DoubleClick, void*, EMPTYARG ) ...@@ -186,4 +194,15 @@ IMPL_LINK ( PlacesListBox, DoubleClick, void*, EMPTYARG )
return 0; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -69,14 +69,18 @@ class Place ...@@ -69,14 +69,18 @@ class Place
typedef boost::shared_ptr< Place > PlacePtr; typedef boost::shared_ptr< Place > PlacePtr;
class PlacesListBox;
class PlacesListBox_Impl : public SvHeaderTabListBox class PlacesListBox_Impl : public SvHeaderTabListBox
{ {
private: private:
HeaderBar* mpHeaderBar; HeaderBar* mpHeaderBar;
PlacesListBox* mpParent;
public: public:
PlacesListBox_Impl( Window* pParent, const rtl::OUString& rTitle ); PlacesListBox_Impl( PlacesListBox* pParent, const rtl::OUString& rTitle );
~PlacesListBox_Impl( ); ~PlacesListBox_Impl( );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
}; };
/** ListBox to handle Places. /** ListBox to handle Places.
...@@ -89,6 +93,7 @@ class PlacesListBox : public Control ...@@ -89,6 +93,7 @@ class PlacesListBox : public Control
PlacesListBox_Impl* mpImpl; PlacesListBox_Impl* mpImpl;
sal_Int32 mnNbEditables; sal_Int32 mnNbEditables;
bool mbUpdated; bool mbUpdated;
bool mbSelectionChanged;
public: public:
PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId ); PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId );
...@@ -102,6 +107,7 @@ class PlacesListBox : public Control ...@@ -102,6 +107,7 @@ class PlacesListBox : public Control
const std::vector<PlacePtr>& GetPlaces(); const std::vector<PlacePtr>& GetPlaces();
void SetSizePixel( const Size& rNewSize ); void SetSizePixel( const Size& rNewSize );
void updateView( );
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment