[Libreoffice-commits] core.git: cui/source fpicker/source include/unotools sfx2/source svtools/source svx/source unotools/source uui/source

Caolán McNamara caolanm at redhat.com
Tue Aug 18 12:26:48 PDT 2015


 cui/source/dialogs/hldocntp.cxx               |    3 ++-
 cui/source/dialogs/hldoctp.cxx                |    3 ++-
 cui/source/dialogs/hltpbase.cxx               |    3 ++-
 cui/source/dialogs/multipat.cxx               |    9 +++++----
 fpicker/source/office/iodlg.cxx               |   10 +++++-----
 include/unotools/localfilehelper.hxx          |    1 -
 sfx2/source/doc/printhelper.cxx               |    4 ++--
 sfx2/source/inet/inettbc.cxx                  |    3 ++-
 svtools/source/control/inettbc.cxx            |    3 ++-
 svx/source/dialog/docrecovery.cxx             |    4 ++--
 unotools/source/ucbhelper/localfilehelper.cxx |   10 ----------
 uui/source/fltdlg.cxx                         |    5 +++--
 12 files changed, 27 insertions(+), 31 deletions(-)

New commits:
commit 58d68a1bc9146334376206ae7ba8b1a6594a1040
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 18 17:11:09 2015 +0100

    ConvertURLToSystemPath->getSystemPathFromFileURL
    
    Change-Id: I7dc0e1b596f80b8f0870aed1722f711bb287ec0a

diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index d67771a..2cace41 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "hldocntp.hxx"
+#include <osl/file.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/docfac.hxx>
 #include <com/sun/star/uno/Reference.h>
@@ -454,7 +455,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl)
 
         if( aNewURL.GetProtocol() == INetProtocol::File )
         {
-            utl::LocalFileHelper::ConvertURLToSystemPath( aNewURL.GetMainURL( INetURLObject::NO_DECODE ), aStrTmp );
+            osl::FileBase::getSystemPathFromFileURL(aNewURL.GetMainURL( INetURLObject::NO_DECODE ), aStrTmp);
         }
         else
         {
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 4e710cc..a7087f3 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "cuihyperdlg.hxx"
+#include <osl/file.hxx>
 #include <unotools/localfilehelper.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
@@ -210,7 +211,7 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl)
         OUString aURL( aDlg.GetPath() );
         OUString aPath;
 
-        utl::LocalFileHelper::ConvertURLToSystemPath( aURL, aPath );
+        osl::FileBase::getSystemPathFromFileURL(aURL, aPath);
 
         m_pCbbPath->SetBaseURL( aURL );
         m_pCbbPath->SetText( aPath );
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index d7ed1a3..9764400 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <osl/file.hxx>
 #include <sfx2/frame.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sot/formats.hxx>
@@ -483,7 +484,7 @@ OUString SvxHyperlinkTabPageBase::CreateUiNameFromURL( const OUString& aStrURL )
     switch(aURLObj.GetProtocol())
     {
         case INetProtocol::File:
-            utl::LocalFileHelper::ConvertURLToSystemPath( aURLObj.GetMainURL(INetURLObject::NO_DECODE), aStrUiURL );
+            osl::FileBase::getSystemPathFromFileURL(aURLObj.GetMainURL(INetURLObject::NO_DECODE), aStrUiURL);
             break;
         case INetProtocol::Ftp :
             {
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index ba91c93..15e9a0b 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <osl/file.hxx>
 #include <tools/urlobj.hxx>
 #include <vcl/msgbox.hxx>
 #include <sfx2/filedlghelper.hxx>
@@ -77,7 +78,7 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl)
         aPath.removeFinalSlash();
         OUString aURL = aPath.GetMainURL( INetURLObject::NO_DECODE );
         OUString sInsPath;
-        ::utl::LocalFileHelper::ConvertURLToSystemPath( aURL, sInsPath );
+        osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
 
         sal_uLong nPos = m_pRadioLB->GetEntryPos( sInsPath, 1 );
         if ( 0xffffffff == nPos ) //See svtools/source/contnr/svtabbx.cxx SvTabListBox::GetEntryPos
@@ -111,7 +112,7 @@ IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl)
         aPath.removeFinalSlash();
         OUString aURL = aPath.GetMainURL( INetURLObject::NO_DECODE );
         OUString sInsPath;
-        ::utl::LocalFileHelper::ConvertURLToSystemPath( aURL, sInsPath );
+        osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
 
         if ( LISTBOX_ENTRY_NOTFOUND != m_pPathLB->GetEntryPos( sInsPath ) )
         {
@@ -314,7 +315,7 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath )
         OUString sPath = rPath.getToken( i, cDelim );
         OUString sSystemPath;
         bool bIsSystemPath =
-            ::utl::LocalFileHelper::ConvertURLToSystemPath( sPath, sSystemPath );
+            osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
 
         OUString sEntry( '\t' );
         sEntry += (bIsSystemPath ? sSystemPath : OUString(sPath));
@@ -346,7 +347,7 @@ void SvxPathSelectDialog::SetPath(const OUString& rPath)
         OUString sPath = rPath.getToken( i, cDelim );
         OUString sSystemPath;
         bool bIsSystemPath =
-            ::utl::LocalFileHelper::ConvertURLToSystemPath( sPath, sSystemPath );
+            osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
 
         if ( bIsSystemPath )
             nPos = m_pPathLB->InsertEntry( sSystemPath );
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 496fd8a..e4c5637 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -70,7 +70,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 
-#include <osl/file.h>
+#include <osl/file.hxx>
 #include <vcl/dibtools.hxx>
 #include <vcl/waitobj.hxx>
 #include <vcl/settings.hxx>
@@ -1070,7 +1070,7 @@ IMPL_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
             else
             {
                 OUString aCurPath;
-                if ( ::utl::LocalFileHelper::ConvertURLToSystemPath( aFileName, aCurPath ) )
+                if (osl::FileBase::getSystemPathFromFileURL(aFileName, aCurPath) == osl::FileBase::E_None)
                 {
                     // if content does not exist: at least its path must exist
                     INetURLObject aPathObj = aFileObj;
@@ -1409,7 +1409,7 @@ void SvtFileDialog::UpdateControls( const OUString& rURL )
 
         if ( aObj.getSegmentCount() )
         {
-            ::utl::LocalFileHelper::ConvertURLToSystemPath( rURL, sText );
+            osl::FileBase::getSystemPathFromFileURL(rURL, sText);
             if ( !sText.isEmpty() )
             {
                 // no Fsys path for server file system ( only UCB has mountpoints! )
@@ -1431,7 +1431,7 @@ void SvtFileDialog::UpdateControls( const OUString& rURL )
         {
             aObj.removeFinalSlash();
             OUString sURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
-            if ( !::utl::LocalFileHelper::ConvertURLToSystemPath( sURL, sText ) )
+            if (osl::FileBase::getSystemPathFromFileURL(sURL, sText) != osl::FileBase::E_None)
                 sText = sURL;
         }
 
@@ -1785,7 +1785,7 @@ void SvtFileDialog::displayIOException( const OUString& _rURL, IOErrorCode _eCod
     {
         // create make a human-readable string from the URL
         OUString sDisplayPath( _rURL );
-        ::utl::LocalFileHelper::ConvertURLToSystemPath( _rURL, sDisplayPath );
+        osl::FileBase::getSystemPathFromFileURL(_rURL, sDisplayPath);
 
         // build an own exception which tells "access denied"
         InteractiveAugmentedIOException aException;
diff --git a/include/unotools/localfilehelper.hxx b/include/unotools/localfilehelper.hxx
index a8f37c3..809104d 100644
--- a/include/unotools/localfilehelper.hxx
+++ b/include/unotools/localfilehelper.hxx
@@ -44,7 +44,6 @@ namespace utl
         file system is present ( watch: this doesn't mean that this file really exists! )
         */
         static bool ConvertURLToPhysicalName( const OUString& rName, OUString& rReturn );
-        static bool ConvertURLToSystemPath( const OUString& rName, OUString& rReturn );
 
         static bool IsLocalFile(const OUString& rName);
 
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index ce0d467..9e5c691 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -635,7 +635,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
                 throw ::com::sun::star::lang::IllegalArgumentException();
             }
 
-            OUString      sPath        ;
+            OUString      sPath;
             OUString      sURL  (sTemp);
             INetURLObject aCheck(sURL );
             if (aCheck.GetProtocol()==INetProtocol::NotValid)
@@ -662,7 +662,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
             else
             // It's a valid URL. but now we must know, if it is a local one or not.
             // It's a question of using ucb or not!
-            if (::utl::LocalFileHelper::ConvertURLToSystemPath(sURL,sPath))
+            if (osl::FileBase::getSystemPathFromFileURL(sURL, sPath) == osl::FileBase::E_None)
             {
                 // it's a local file, we can use vcl without special handling
                 // And we have to use the system notation of the incoming URL.
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 59a9831..f23ec36 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -29,6 +29,7 @@
 #include <unotools/historyoptions.hxx>
 #include <vcl/toolbox.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <osl/file.hxx>
 #include <osl/thread.hxx>
 #include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
@@ -235,7 +236,7 @@ void SfxURLToolBoxControl_Impl::StateChanged
                     OUString      sMainURL( aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) );
                     OUString      sFile;
 
-                    if (::utl::LocalFileHelper::ConvertURLToSystemPath(sMainURL,sFile))
+                    if (osl::FileBase::getSystemPathFromFileURL(sMainURL, sFile) == osl::FileBase::E_None)
                         pURLBox->InsertEntry(sFile);
                     else
                         pURLBox->InsertEntry(sMainURL);
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 4bf7565..8d0a96f 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -42,6 +42,7 @@
 #include <comphelper/string.hxx>
 #include <rtl/instance.hxx>
 #include <salhelper/thread.hxx>
+#include <osl/file.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/builderfactory.hxx>
 #include <vcl/svapp.hxx>
@@ -988,7 +989,7 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
                         if ( bFound )
                         {
                             OUString aFile;
-                            if (::utl::LocalFileHelper::ConvertURLToSystemPath(aURL,aFile))
+                            if (osl::FileBase::getSystemPathFromFileURL(aURL, aFile) == osl::FileBase::E_None)
                                 InsertEntry(aFile);
                             else
                                 InsertEntry(aURL);
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 4e1d2f7..629e645 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -1263,7 +1263,7 @@ BrokenRecoveryDialog::BrokenRecoveryDialog(vcl::Window*       pParent        ,
     m_sSavePath = SvtPathOptions().GetWorkPath();
     INetURLObject aObj( m_sSavePath );
     OUString sPath;
-    ::utl::LocalFileHelper::ConvertURLToSystemPath( aObj.GetMainURL( INetURLObject::NO_DECODE ), sPath );
+    osl::FileBase::getSystemPathFromFileURL(aObj.GetMainURL( INetURLObject::NO_DECODE ), sPath);
     m_pSaveDirED->SetText( sPath );
 
     impl_refresh();
@@ -1373,7 +1373,7 @@ void BrokenRecoveryDialog::impl_askForSavePath()
     {
         m_sSavePath = xFolderPicker->getDirectory();
         OUString sPath;
-        ::utl::LocalFileHelper::ConvertURLToSystemPath( m_sSavePath, sPath );
+        osl::FileBase::getSystemPathFromFileURL(m_sSavePath, sPath);
         m_pSaveDirED->SetText( sPath );
     }
 }
diff --git a/unotools/source/ucbhelper/localfilehelper.cxx b/unotools/source/ucbhelper/localfilehelper.cxx
index e8d82f2..b04dd2e 100644
--- a/unotools/source/ucbhelper/localfilehelper.cxx
+++ b/unotools/source/ucbhelper/localfilehelper.cxx
@@ -46,16 +46,6 @@ bool LocalFileHelper::ConvertSystemPathToURL( const OUString& rName, OUString& r
     return ok;
 }
 
-bool LocalFileHelper::ConvertURLToSystemPath( const OUString& rName, OUString& rReturn )
-{
-    bool ok = osl::FileBase::getSystemPathFromFileURL(rName, rReturn)
-        == osl::FileBase::E_None;
-    if (!ok) {
-        rReturn.clear();
-    }
-    return ok;
-}
-
 bool LocalFileHelper::ConvertPhysicalNameToURL(const OUString& rName, OUString& rReturn)
 {
     bool ok = osl::FileBase::getFileURLFromSystemPath(rName, rReturn)
diff --git a/uui/source/fltdlg.cxx b/uui/source/fltdlg.cxx
index 24e5476..9e34f82 100644
--- a/uui/source/fltdlg.cxx
+++ b/uui/source/fltdlg.cxx
@@ -23,10 +23,10 @@
 
 #include <com/sun/star/util/XStringWidth.hpp>
 #include <cppuhelper/implbase1.hxx>
-#include <unotools/localfilehelper.hxx>
 #include <tools/urlobj.hxx>
 
 #include <vcl/button.hxx>
+#include <osl/file.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 
@@ -200,7 +200,8 @@ OUString FilterDialog::impl_buildUIFileName( const OUString& sName )
 {
     OUString sShortName( sName );
 
-    if( ::utl::LocalFileHelper::ConvertURLToSystemPath( sName, sShortName ) )
+    if (osl::FileBase::getSystemPathFromFileURL(sName, sShortName) == osl::FileBase::E_None)
+
     {
         // it's a system file ... build short name by using osl functionality
     }


More information about the Libreoffice-commits mailing list