summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-27 17:04:34 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-27 17:28:36 +0200
commit704d7023f06342c2577a79957ae357e7f9eb22af (patch)
tree8f081348d7aedd68459e513828c51b8611872a81
parent6c71f41174fe45e78720ba049e60477735107b9d (diff)
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
-rw-r--r--fpicker/source/office/PlacesListBox.cxx29
-rw-r--r--fpicker/source/office/PlacesListBox.hxx8
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: