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
This commit is contained in:
Cédric Bosdonnat
2012-06-27 17:04:34 +02:00
parent 6c71f41174
commit 704d7023f0
2 changed files with 31 additions and 6 deletions

View File

@@ -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: */

View File

@@ -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: