[Libreoffice-commits] .: 2 commits - fpicker/source ucb/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Jun 27 08:30:09 PDT 2012


 fpicker/source/office/PlacesListBox.cxx |   29 ++++++++++++++++++++++++-----
 fpicker/source/office/PlacesListBox.hxx |    8 +++++++-
 ucb/source/ucp/cmis/cmis_content.cxx    |    6 +++---
 ucb/source/ucp/cmis/cmis_url.cxx        |    9 +++++++--
 ucb/source/ucp/cmis/cmis_url.hxx        |    5 +++--
 5 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit 704d7023f06342c2577a79957ae357e7f9eb22af
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Jun 27 17:04:34 2012 +0200

    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

diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx
index c763b1d..f8e438d 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 74ae8e7..49dc83e 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:
 
commit 6c71f41174fe45e78720ba049e60477735107b9d
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Jun 27 13:44:47 2012 +0200

    CMIS UCP: session cache, better use the binding URL + repo Id as id
    
    There may be cases where we have the host part of the URL encoded
    differently... and thus trigerring the creation of another session when
    it's not needed.
    
    Change-Id: Id8da4a7be31c98bb6b01df44da0d3963803b445b

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 59febd9..ddf09ba 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -163,13 +163,13 @@ namespace cmis
         cmis::URL url( m_sURL );
 
         // Look for a cached session, key is binding url + repo id
-        INetURLObject aUrlObj( m_sURL );
-        m_pSession = pProvider->getSession( aUrlObj.GetHost( ) );
+        rtl::OUString sSessionId = url.getBindingUrl( ) + url.getRepositoryId( );
+        m_pSession = pProvider->getSession( sSessionId );
         if ( NULL == m_pSession )
         {
             // Initiate a CMIS session and register it as we found nothing
             m_pSession = libcmis::SessionFactory::createSession( url.getSessionParams( ) );
-            pProvider->registerSession( aUrlObj.GetHost( ), m_pSession );
+            pProvider->registerSession( sSessionId, m_pSession );
         }
 
         m_sObjectPath = url.getObjectPath( );
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index aed136b..92d859d 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -70,16 +70,21 @@ namespace cmis
         return params;
     }
 
-    rtl::OUString URL::getObjectPath( )
+    rtl::OUString& URL::getObjectPath( )
     {
         return m_sPath;
     }
 
-    rtl::OUString URL::getBindingUrl( )
+    rtl::OUString& URL::getBindingUrl( )
     {
         return m_sBindingUrl;
     }
 
+    rtl::OUString& URL::getRepositoryId( )
+    {
+        return m_sRepositoryId;
+    }
+
     void URL::setObjectPath( rtl::OUString sPath )
     {
         m_sPath = sPath;
diff --git a/ucb/source/ucp/cmis/cmis_url.hxx b/ucb/source/ucp/cmis/cmis_url.hxx
index 833804b..4033a17 100644
--- a/ucb/source/ucp/cmis/cmis_url.hxx
+++ b/ucb/source/ucp/cmis/cmis_url.hxx
@@ -49,8 +49,9 @@ namespace cmis
             URL( rtl::OUString const & urlStr );
 
             std::map< int, std::string > getSessionParams( );
-            rtl::OUString getObjectPath( );
-            rtl::OUString getBindingUrl( );
+            rtl::OUString& getObjectPath( );
+            rtl::OUString& getBindingUrl( );
+            rtl::OUString& getRepositoryId( );
             void setObjectPath( rtl::OUString sPath );
 
             rtl::OUString asString( );


More information about the Libreoffice-commits mailing list