LCOV - code coverage report
Current view: top level - svtools/source/dialogs - ServerDetailsControls.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 211 0.0 %
Date: 2012-08-25 Functions: 0 35 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 340 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4                 :            :  *
       5                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :            :  * the License or as specified alternatively below. You may obtain a copy of
       8                 :            :  * the License at http://www.mozilla.org/MPL/
       9                 :            :  *
      10                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :            :  * for the specific language governing rights and limitations under the
      13                 :            :  * License.
      14                 :            :  *
      15                 :            :  * Major Contributor(s):
      16                 :            :  * [ Copyright (C) 2012 SUSE <cbosdonnat@suse.com> (initial developer) ]
      17                 :            :  *
      18                 :            :  * All Rights Reserved.
      19                 :            :  *
      20                 :            :  * For minor contributions see the git repository.
      21                 :            :  *
      22                 :            :  * Alternatively, the contents of this file may be used under the terms of
      23                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      24                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      25                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      26                 :            :  * instead of those above.
      27                 :            :  */
      28                 :            : 
      29                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      30                 :            : #include <com/sun/star/task/XInteractionHandler.hpp>
      31                 :            : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
      32                 :            : #include <com/sun/star/ucb/XContentAccess.hpp>
      33                 :            : #include <com/sun/star/sdbc/XResultSet.hpp>
      34                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      35                 :            : 
      36                 :            : #include <comphelper/processfactory.hxx>
      37                 :            : #include <rtl/uri.hxx>
      38                 :            : #include <ucbhelper/content.hxx>
      39                 :            : #include <ucbhelper/commandenvironment.hxx>
      40                 :            : 
      41                 :            : #include "PlaceEditDialog.hrc"
      42                 :            : 
      43                 :            : #include "PlaceEditDialog.hxx"
      44                 :            : #include "ServerDetailsControls.hxx"
      45                 :            : 
      46                 :            : using namespace std;
      47                 :            : using namespace com::sun::star::lang;
      48                 :            : using namespace com::sun::star::sdbc;
      49                 :            : using namespace com::sun::star::task;
      50                 :            : using namespace com::sun::star::ucb;
      51                 :            : using namespace com::sun::star::uno;
      52                 :            : 
      53                 :          0 : DetailsContainer::DetailsContainer( ) :
      54                 :            :     m_aControls( ),
      55         [ #  # ]:          0 :     m_bShown( false )
      56                 :            : {
      57                 :          0 : }
      58                 :            : 
      59                 :          0 : DetailsContainer::~DetailsContainer( )
      60                 :            : {
      61                 :          0 :     m_aControls.clear( );
      62         [ #  # ]:          0 : }
      63                 :            : 
      64                 :          0 : void DetailsContainer::addControl( sal_uInt16 nId, Control* pControl )
      65                 :            : {
      66         [ #  # ]:          0 :     m_aControls.insert( pair< sal_uInt16, Control* >( nId, pControl ) );
      67                 :          0 :     pControl->Show( m_bShown );
      68                 :            : 
      69         [ #  # ]:          0 :     if ( pControl->GetType( ) == WINDOW_EDIT )
      70         [ #  # ]:          0 :         static_cast< Edit* >( pControl )->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) );
      71         [ #  # ]:          0 :     else if ( pControl->GetType( ) == WINDOW_NUMERICFIELD )
      72         [ #  # ]:          0 :         static_cast< NumericField* >( pControl )->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) );
      73         [ #  # ]:          0 :     else if ( pControl->GetType( ) == WINDOW_CHECKBOX )
      74                 :          0 :         static_cast< CheckBox* >( pControl )->SetToggleHdl( LINK( this, DetailsContainer, ValueChangeHdl ) );
      75                 :          0 : }
      76                 :            : 
      77                 :          0 : Control* DetailsContainer::getControl( sal_uInt16 nId )
      78                 :            : {
      79                 :          0 :     Control* pControl = NULL;
      80         [ #  # ]:          0 :     map< sal_uInt16, Control* >::iterator it = m_aControls.find( nId );
      81 [ #  # ][ #  # ]:          0 :     if ( it != m_aControls.end( ) )
      82         [ #  # ]:          0 :         pControl = it->second;
      83                 :          0 :     return pControl;
      84                 :            : }
      85                 :            : 
      86                 :          0 : Rectangle DetailsContainer::getBounds( )
      87                 :            : {
      88                 :          0 :     Rectangle aBounds;
      89 [ #  # ][ #  # ]:          0 :     for ( map< sal_uInt16, Control* >::iterator it = m_aControls.begin( ); it != m_aControls.end( ); ++it )
                 [ #  # ]
      90                 :            :     {
      91 [ #  # ][ #  # ]:          0 :         Rectangle aControlBounds( it->second->GetPosPixel(), it->second->GetSizePixel() );
         [ #  # ][ #  # ]
                 [ #  # ]
      92         [ #  # ]:          0 :         aBounds = aBounds.GetUnion( aControlBounds );
      93                 :            :     }
      94                 :            : 
      95                 :          0 :     return aBounds;
      96                 :            : }
      97                 :            : 
      98                 :          0 : void DetailsContainer::show( bool bShow )
      99                 :            : {
     100                 :          0 :     m_bShown = bShow;
     101 [ #  # ][ #  # ]:          0 :     for ( map< sal_uInt16, Control* >::iterator it = m_aControls.begin( ); it != m_aControls.end( ); ++it )
                 [ #  # ]
     102                 :            :     {
     103 [ #  # ][ #  # ]:          0 :         it->second->Show( m_bShown );
     104                 :            :     }
     105                 :          0 : }
     106                 :            : 
     107                 :          0 : INetURLObject DetailsContainer::getUrl( )
     108                 :            : {
     109                 :            :     // Don't use that class directly: make it smarter by subclassing it.
     110                 :          0 :     return INetURLObject( );
     111                 :            : }
     112                 :            : 
     113                 :          0 : bool DetailsContainer::setUrl( const INetURLObject& )
     114                 :            : {
     115                 :            :     // That class doesn't contain any logic... it defers the dirty work
     116                 :            :     // to the sub classes.
     117                 :          0 :     return false;
     118                 :            : }
     119                 :            : 
     120                 :          0 : void DetailsContainer::notifyChange( )
     121                 :            : {
     122                 :          0 :     m_aChangeHdl.Call( this );
     123                 :          0 : }
     124                 :            : 
     125                 :          0 : IMPL_LINK( DetailsContainer, ValueChangeHdl, void *, EMPTYARG )
     126                 :            : {
     127                 :          0 :     notifyChange( );
     128                 :          0 :     return 0;
     129                 :            : }
     130                 :            : 
     131                 :          0 : HostDetailsContainer::HostDetailsContainer( sal_uInt16 nPort, rtl::OUString sScheme ) :
     132                 :            :     DetailsContainer( ),
     133                 :            :     m_nDefaultPort( nPort ),
     134                 :          0 :     m_sScheme( sScheme )
     135                 :            : {
     136                 :          0 : }
     137                 :            : 
     138                 :          0 : void HostDetailsContainer::show( bool bShow )
     139                 :            : {
     140                 :          0 :     DetailsContainer::show( bShow );
     141         [ #  # ]:          0 :     if ( bShow )
     142                 :          0 :         static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) )->SetValue( m_nDefaultPort );
     143                 :          0 : }
     144                 :            : 
     145                 :          0 : INetURLObject HostDetailsContainer::getUrl( )
     146                 :            : {
     147 [ #  # ][ #  # ]:          0 :     rtl::OUString sHost = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_HOST ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     148 [ #  # ][ #  # ]:          0 :     sal_Int64 nPort = static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) )->GetValue();
     149 [ #  # ][ #  # ]:          0 :     rtl::OUString sPath = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_PATH ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     150                 :            : 
     151                 :          0 :     rtl::OUString sUrl;
     152         [ #  # ]:          0 :     if ( !sHost.isEmpty( ) )
     153                 :            :     {
     154                 :          0 :         sUrl = m_sScheme + "://" + sHost;
     155         [ #  # ]:          0 :         if ( nPort != m_nDefaultPort )
     156                 :          0 :             sUrl += ":" + rtl::OUString::valueOf( nPort );
     157         [ #  # ]:          0 :         if ( !sPath.isEmpty( ) )
     158         [ #  # ]:          0 :             if ( sPath.indexOf( '/' ) != 0 )
     159                 :          0 :                 sUrl += "/";
     160                 :          0 :             sUrl += sPath;
     161                 :            :     }
     162                 :            : 
     163         [ #  # ]:          0 :     return INetURLObject( sUrl );
     164                 :            : }
     165                 :            : 
     166                 :          0 : bool HostDetailsContainer::setUrl( const INetURLObject& rUrl )
     167                 :            : {
     168                 :          0 :     bool bSuccess = false;
     169                 :            : 
     170         [ #  # ]:          0 :     bSuccess = verifyScheme( INetURLObject::GetScheme( rUrl.GetProtocol( ) ) );
     171                 :            : 
     172         [ #  # ]:          0 :     if ( bSuccess )
     173                 :            :     {
     174 [ #  # ][ #  # ]:          0 :         static_cast< Edit* >( getControl( ED_ADDPLACE_HOST ) )->SetText( rUrl.GetHost( ) );
                 [ #  # ]
     175                 :          0 :         static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) )->SetValue( rUrl.GetPort( ) );
     176 [ #  # ][ #  # ]:          0 :         static_cast< Edit* >( getControl( ED_ADDPLACE_PATH ) )->SetText( rUrl.GetURLPath() );
                 [ #  # ]
     177                 :            :     }
     178                 :            : 
     179                 :          0 :     return bSuccess;
     180                 :            : }
     181                 :            : 
     182                 :          0 : bool HostDetailsContainer::verifyScheme( const rtl::OUString& sScheme )
     183                 :            : {
     184                 :          0 :     return sScheme.equals( m_sScheme + "://" );
     185                 :            : }
     186                 :            : 
     187                 :          0 : DavDetailsContainer::DavDetailsContainer( ) :
     188         [ #  # ]:          0 :     HostDetailsContainer( 80, "http" )
     189                 :            : {
     190                 :          0 : }
     191                 :            : 
     192                 :          0 : void DavDetailsContainer::addControl( sal_uInt16 nId, Control* pControl )
     193                 :            : {
     194                 :          0 :     DetailsContainer::addControl( nId, pControl );
     195                 :            : 
     196                 :            :     // Add listener on CB_ADDPLACE_DAVS
     197         [ #  # ]:          0 :     if ( nId == CB_ADDPLACE_DAVS )
     198                 :          0 :         static_cast< CheckBox* >( pControl )->SetToggleHdl( LINK( this, DavDetailsContainer, ToggledDavsHdl ) );
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : void DavDetailsContainer::show( bool bShow )
     202                 :            : {
     203                 :          0 :     HostDetailsContainer::show( bShow );
     204         [ #  # ]:          0 :     if ( bShow )
     205                 :          0 :         static_cast< CheckBox* >( getControl( CB_ADDPLACE_DAVS ) )->Check( false );
     206                 :          0 : }
     207                 :            : 
     208                 :          0 : bool DavDetailsContainer::verifyScheme( const rtl::OUString& rScheme )
     209                 :            : {
     210                 :          0 :     bool bValid = false;
     211         [ #  # ]:          0 :     if ( rScheme.equals( "http://" ) )
     212                 :            :     {
     213                 :          0 :         bValid = true;
     214                 :          0 :         static_cast< CheckBox* >( getControl( CB_ADDPLACE_DAVS ) )->Check( false );
     215                 :            :     }
     216         [ #  # ]:          0 :     else if ( rScheme.equals( "https://" ) )
     217                 :            :     {
     218                 :          0 :         bValid = true;
     219                 :          0 :         static_cast< CheckBox* >( getControl( CB_ADDPLACE_DAVS ) )->Check( true );
     220                 :            :     }
     221                 :          0 :     return bValid;
     222                 :            : }
     223                 :            : 
     224                 :          0 : IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, CheckBox*, pCheckBox )
     225                 :            : {
     226                 :            :     // Change default port if needed
     227         [ #  # ]:          0 :     sal_Bool bCheckedDavs = pCheckBox->IsChecked();
     228         [ #  # ]:          0 :     NumericField* pPortField = static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) );
     229 [ #  # ][ #  # ]:          0 :     if ( pPortField->GetValue() == 80 && bCheckedDavs == sal_True)
         [ #  # ][ #  # ]
     230         [ #  # ]:          0 :         pPortField->SetValue( 443 );
     231 [ #  # ][ #  # ]:          0 :     else if ( pPortField->GetValue() == 443 && bCheckedDavs == sal_False )
         [ #  # ][ #  # ]
     232         [ #  # ]:          0 :         pPortField->SetValue( 80 );
     233                 :            : 
     234                 :          0 :     rtl::OUString sScheme( "http" );
     235         [ #  # ]:          0 :     if ( bCheckedDavs )
     236                 :          0 :         sScheme = "https";
     237                 :          0 :     setScheme( sScheme );
     238                 :            : 
     239         [ #  # ]:          0 :     notifyChange( );
     240                 :            : 
     241                 :          0 :     return 0;
     242                 :            : }
     243                 :            : 
     244                 :          0 : INetURLObject SmbDetailsContainer::getUrl( )
     245                 :            : {
     246 [ #  # ][ #  # ]:          0 :     rtl::OUString sHost = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_SMBHOST ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     247 [ #  # ][ #  # ]:          0 :     rtl::OUString sShare = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_SHARE ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     248 [ #  # ][ #  # ]:          0 :     rtl::OUString sPath = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_SMBPATH ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     249                 :            : 
     250                 :          0 :     rtl::OUString sUrl;
     251         [ #  # ]:          0 :     if ( !sHost.isEmpty( ) )
     252                 :            :     {
     253                 :          0 :         sUrl = "smb://" + sHost + "/";
     254         [ #  # ]:          0 :         if ( !sShare.isEmpty( ) )
     255                 :          0 :             sUrl += sShare;
     256         [ #  # ]:          0 :         if ( !sPath.isEmpty( ) )
     257         [ #  # ]:          0 :             if ( sPath.indexOf( '/' ) != 0 )
     258                 :          0 :                 sUrl += "/";
     259                 :          0 :             sUrl += sPath;
     260                 :            :     }
     261                 :            : 
     262         [ #  # ]:          0 :     return INetURLObject( sUrl );
     263                 :            : }
     264                 :            : 
     265                 :          0 : bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl )
     266                 :            : {
     267                 :          0 :     bool bSuccess =  rUrl.GetProtocol() == INET_PROT_SMB;
     268                 :            : 
     269         [ #  # ]:          0 :     if ( bSuccess )
     270                 :            :     {
     271         [ #  # ]:          0 :         rtl::OUString sShare = rUrl.getName( 0 );
     272         [ #  # ]:          0 :         rtl::OUString sFullPath = rUrl.GetURLPath( );
     273                 :          0 :         rtl::OUString sPath;
     274         [ #  # ]:          0 :         if ( sFullPath.getLength( ) > sShare.getLength( ) )
     275                 :            :         {
     276                 :          0 :             sal_Int32 nPos = sShare.getLength( );
     277         [ #  # ]:          0 :             if ( nPos != 0 )
     278                 :          0 :                 ++nPos;
     279                 :          0 :             sPath = sFullPath.copy( nPos );
     280                 :            :         }
     281                 :            : 
     282 [ #  # ][ #  # ]:          0 :         static_cast< Edit* >( getControl( ED_ADDPLACE_SMBHOST ) )->SetText( rUrl.GetHost( ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     283 [ #  # ][ #  # ]:          0 :         static_cast< Edit* >( getControl( ED_ADDPLACE_SHARE ) )->SetText( sShare );
         [ #  # ][ #  # ]
     284 [ #  # ][ #  # ]:          0 :         static_cast< Edit* >( getControl( ED_ADDPLACE_SMBPATH ) )->SetText( sPath );
         [ #  # ][ #  # ]
     285                 :            :     }
     286                 :            : 
     287                 :          0 :     return bSuccess;
     288                 :            : }
     289                 :            : 
     290                 :          0 : CmisDetailsContainer::CmisDetailsContainer( ) :
     291                 :            :     DetailsContainer( ),
     292                 :            :     m_sUsername( ),
     293         [ #  # ]:          0 :     m_xCmdEnv( )
     294                 :            : {
     295         [ #  # ]:          0 :     Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
     296                 :            :     Reference< XInteractionHandler >  xGlobalInteractionHandler = Reference< XInteractionHandler >(
     297 [ #  # ][ #  # ]:          0 :         xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY );
         [ #  # ][ #  # ]
     298 [ #  # ][ #  # ]:          0 :     m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() );
                 [ #  # ]
     299                 :          0 : }
     300                 :            : 
     301                 :          0 : INetURLObject CmisDetailsContainer::getUrl( )
     302                 :            : {
     303 [ #  # ][ #  # ]:          0 :     rtl::OUString sBindingUrl = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_CMIS_BINDING ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     304                 :            : 
     305                 :          0 :     rtl::OUString sUrl;
     306 [ #  # ][ #  # ]:          0 :     if ( !sBindingUrl.isEmpty( ) && !m_sRepoId.isEmpty() )
                 [ #  # ]
     307                 :            :     {
     308                 :            :         rtl::OUString sEncodedBinding = rtl::Uri::encode(
     309                 :            :                 sBindingUrl + "#" + m_sRepoId,
     310                 :            :                 rtl_UriCharClassRelSegment,
     311                 :            :                 rtl_UriEncodeKeepEscapes,
     312                 :          0 :                 RTL_TEXTENCODING_UTF8 );
     313                 :          0 :         sUrl = "vnd.libreoffice.cmis+atom://" + sEncodedBinding;
     314                 :            :     }
     315                 :            : 
     316         [ #  # ]:          0 :     return INetURLObject( sUrl );
     317                 :            : }
     318                 :            : 
     319                 :          0 : bool CmisDetailsContainer::setUrl( const INetURLObject& rUrl )
     320                 :            : {
     321                 :          0 :     bool bSuccess =  rUrl.GetProtocol() == INET_PROT_CMIS_ATOM;
     322                 :            : 
     323         [ #  # ]:          0 :     if ( bSuccess )
     324                 :            :     {
     325                 :          0 :         rtl::OUString sBindingUrl;
     326                 :          0 :         rtl::OUString sRepositoryId;
     327                 :            : 
     328         [ #  # ]:          0 :         rtl::OUString sDecodedHost = rUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET );
     329         [ #  # ]:          0 :         INetURLObject aHostUrl( sDecodedHost );
     330         [ #  # ]:          0 :         sBindingUrl = aHostUrl.GetURLNoMark( );
     331         [ #  # ]:          0 :         sRepositoryId = aHostUrl.GetMark( );
     332                 :            : 
     333 [ #  # ][ #  # ]:          0 :         static_cast< Edit* >( getControl( ED_ADDPLACE_CMIS_BINDING ) )->SetText( sBindingUrl );
         [ #  # ][ #  # ]
                 [ #  # ]
     334                 :            :     }
     335                 :            : 
     336                 :          0 :     return bSuccess;
     337                 :            : }
     338                 :            : 
     339                 :          0 : void CmisDetailsContainer::setUsername( const rtl::OUString& rUsername )
     340                 :            : {
     341                 :          0 :     m_sUsername = rtl::OUString( rUsername );
     342                 :          0 : }
     343                 :            : 
     344                 :          0 : void CmisDetailsContainer::addControl( sal_uInt16 nId, Control* pControl )
     345                 :            : {
     346                 :          0 :     DetailsContainer::addControl( nId, pControl );
     347                 :            : 
     348                 :            :     // Add listener on BT_ADDPLACE_CMIS_REPOREFRESH
     349         [ #  # ]:          0 :     if ( nId == BT_ADDPLACE_CMIS_REPOREFRESH )
     350                 :          0 :         static_cast< ImageButton* >( pControl )->SetClickHdl( LINK( this, CmisDetailsContainer, RefreshReposHdl ) );
     351         [ #  # ]:          0 :     if ( nId == LB_ADDPLACE_CMIS_REPOSITORY )
     352                 :          0 :         static_cast< ListBox* >( pControl )->SetSelectHdl( LINK( this, CmisDetailsContainer, SelectRepoHdl ) );
     353                 :          0 : }
     354                 :            : 
     355                 :          0 : void CmisDetailsContainer::selectRepository( )
     356                 :            : {
     357                 :            :     // Get the repo ID and call the Change listener
     358                 :          0 :     ListBox* pReposList = static_cast< ListBox* >( getControl( LB_ADDPLACE_CMIS_REPOSITORY ) );
     359                 :          0 :     sal_uInt16 nPos = pReposList->GetSelectEntryPos( );
     360                 :          0 :     m_sRepoId = m_aRepoIds[nPos];
     361                 :            : 
     362                 :          0 :     notifyChange( );
     363                 :          0 : }
     364                 :            : 
     365                 :          0 : IMPL_LINK( CmisDetailsContainer, RefreshReposHdl, void *, EMPTYARG  )
     366                 :            : {
     367 [ #  # ][ #  # ]:          0 :     rtl::OUString sBindingUrl = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_CMIS_BINDING ) )->GetText() ).trim( );
         [ #  # ][ #  # ]
     368                 :            : 
     369                 :            :     // Clean the listbox
     370         [ #  # ]:          0 :     ListBox* pReposList = static_cast< ListBox* >( getControl( LB_ADDPLACE_CMIS_REPOSITORY ) );
     371         [ #  # ]:          0 :     pReposList->Clear( );
     372                 :          0 :     m_aRepoIds.clear( );
     373                 :            : 
     374                 :            :     // Compute the URL
     375                 :          0 :     rtl::OUString sUrl;
     376         [ #  # ]:          0 :     if ( !sBindingUrl.isEmpty( ) )
     377                 :            :     {
     378                 :            :         rtl::OUString sEncodedBinding = rtl::Uri::encode(
     379                 :            :                 sBindingUrl,
     380                 :            :                 rtl_UriCharClassRelSegment,
     381                 :            :                 rtl_UriEncodeKeepEscapes,
     382                 :          0 :                 RTL_TEXTENCODING_UTF8 );
     383                 :          0 :         sUrl = "vnd.libreoffice.cmis+atom://" + sEncodedBinding;
     384                 :            :     }
     385                 :            : 
     386                 :            :     // Get the Content
     387         [ #  # ]:          0 :     ::ucbhelper::Content aCnt( sUrl, m_xCmdEnv );
     388         [ #  # ]:          0 :     Sequence< rtl::OUString > aProps( 1 );
     389 [ #  # ][ #  # ]:          0 :     aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
     390                 :            : 
     391                 :            :     try
     392                 :            :     {
     393 [ #  # ][ #  # ]:          0 :         Reference< XResultSet > xResultSet( aCnt.createCursor( aProps ), UNO_QUERY_THROW );
     394         [ #  # ]:          0 :         Reference< XContentAccess > xAccess( xResultSet, UNO_QUERY_THROW );
     395 [ #  # ][ #  # ]:          0 :         while ( xResultSet->next() )
                 [ #  # ]
     396                 :            :         {
     397 [ #  # ][ #  # ]:          0 :             rtl::OUString sURL = xAccess->queryContentIdentifierString( );
     398         [ #  # ]:          0 :             INetURLObject aURL( sURL );
     399         [ #  # ]:          0 :             rtl::OUString sId = aURL.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
     400                 :          0 :             sId = sId.copy( 1 );
     401         [ #  # ]:          0 :             m_aRepoIds.push_back( sId );
     402                 :            : 
     403         [ #  # ]:          0 :             Reference< XRow > xRow( xResultSet, UNO_QUERY );
     404 [ #  # ][ #  # ]:          0 :             rtl::OUString sName = xRow->getString( 1 );
     405 [ #  # ][ #  # ]:          0 :             pReposList->InsertEntry( sName );
                 [ #  # ]
     406 [ #  # ][ #  # ]:          0 :         }
     407                 :            :     }
     408         [ #  # ]:          0 :     catch ( const Exception& )
     409                 :            :     {
     410                 :            :     }
     411                 :            : 
     412                 :            :     // Auto-select the first one
     413 [ #  # ][ #  # ]:          0 :     if ( pReposList->GetEntryCount( ) > 0 )
     414                 :            :     {
     415         [ #  # ]:          0 :         pReposList->SelectEntryPos( 0 );
     416         [ #  # ]:          0 :         selectRepository( );
     417                 :            :     }
     418                 :            : 
     419 [ #  # ][ #  # ]:          0 :     return 0;
     420                 :            : }
     421                 :            : 
     422                 :          0 : IMPL_LINK( CmisDetailsContainer, SelectRepoHdl, void *, EMPTYARG  )
     423                 :            : {
     424                 :          0 :     selectRepository( );
     425                 :          0 :     return 0;
     426                 :            : }
     427                 :            : 
     428                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10