[Libreoffice-commits] core.git: include/tools sot/source svl/source svtools/source tools/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 21 02:39:07 UTC 2019
include/tools/urlobj.hxx | 12 +++++++-----
sot/source/sdstor/ucbstorage.cxx | 2 +-
svl/source/misc/lockfilecommon.cxx | 2 +-
svl/source/misc/msodocumentlockfile.cxx | 2 +-
svtools/source/contnr/fileview.cxx | 2 +-
svtools/source/control/inettbc.cxx | 4 ++--
tools/source/fsys/urlobj.cxx | 17 +++--------------
7 files changed, 16 insertions(+), 25 deletions(-)
New commits:
commit e7e87ad179d5d7383d1b6be58f624ba302c16d73
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jun 21 01:29:47 2019 +1000
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Jun 21 04:37:53 2019 +0200
Extend INetURLObject::setName and drop INetURLObject::SetName
Change-Id: I488313eeb363d2a9344d6bc801900d5b1f913020
Reviewed-on: https://gerrit.libreoffice.org/74463
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index f72f2521a2b2..a1244bd7eba6 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -574,12 +574,18 @@ public:
@param rTheName The new name.
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
@return True if the name has successfully been modified (and the
resulting URI is still valid). If the path is not hierarchical, or
the specified segment does not exist, false is returned. If false is
returned, the object is not modified.
*/
- bool setName(OUString const & rTheName);
+ bool setName(OUString const& rTheName,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
/** Get the base of the name of a segment.
@@ -926,10 +932,6 @@ public:
OUString GetBase() const;
- void SetName(OUString const & rTheName,
- EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
- rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
-
void SetExtension(OUString const & rTheExtension);
OUString CutExtension();
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index b732faef2734..a4c754610229 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1050,7 +1050,7 @@ sal_Int16 UCBStorageStream_Impl::Commit()
m_aTempURL.clear();
INetURLObject aObj( m_aURL );
- aObj.SetName( m_aName );
+ aObj.setName( m_aName );
m_aURL = aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
m_bModified = false;
m_bSourceRead = true;
diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx
index 9a3cb0c7abe0..e27c1113d975 100644
--- a/svl/source/misc/lockfilecommon.cxx
+++ b/svl/source/misc/lockfilecommon.cxx
@@ -72,7 +72,7 @@ void LockFileCommon::SetURL(const OUString& aURL)
OUString LockFileCommon::GenerateOwnLockFileURL(const OUString& aOrigURL, const OUString& aPrefix)
{
INetURLObject aURL = ResolveLinks(INetURLObject(aOrigURL));
- aURL.SetName(aPrefix + aURL.GetLastName() + "%23" /*'#'*/);
+ aURL.setName(aPrefix + aURL.GetLastName() + "%23" /*'#'*/);
return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
}
diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx
index cdb4ddd2264f..9650db03999f 100644
--- a/svl/source/misc/msodocumentlockfile.cxx
+++ b/svl/source/misc/msodocumentlockfile.cxx
@@ -56,7 +56,7 @@ OUString GenerateMSOLockFileURL(const OUString& aOrigURL)
else if (nFileNameLength == 7)
sFileName = sFileName.copy(1);
}
- aURL.SetName("~$" + sFileName);
+ aURL.setName("~$" + sFileName);
return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
}
}
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 3cf1bfab180b..9f7b6c14b6bd 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1846,7 +1846,7 @@ void SvtFileView_Impl::EntryRenamed( OUString& rURL,
(*aFoundElem)->maDisplayText = aDisplayText.replaceAt( 0, nIndex, rTitle );
INetURLObject aURLObj( rURL );
- aURLObj.SetName( rTitle, INetURLObject::EncodeMechanism::All );
+ aURLObj.setName( rTitle, INetURLObject::EncodeMechanism::All );
rURL = aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index a2ef57c6116a..eff7b67fcb47 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -1779,7 +1779,7 @@ OUString SvtURLBox::GetURL()
if( success && aTitle != "/" && aTitle != "." )
{
- aObj.SetName( aTitle );
+ aObj.setName( aTitle );
if ( bSlash )
aObj.setFinalSlash();
}
@@ -2214,7 +2214,7 @@ OUString URLBox::GetURL()
if( success && aTitle != "/" && aTitle != "." )
{
- aObj.SetName( aTitle );
+ aObj.setName( aTitle );
if ( bSlash )
aObj.setFinalSlash();
}
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 7ee92a3382b6..980619ea5d26 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -3999,7 +3999,8 @@ OUString INetURLObject::getName(sal_Int32 nIndex, bool bIgnoreFinalSlash,
return decode(pSegBegin, p, eMechanism, eCharset);
}
-bool INetURLObject::setName(OUString const & rTheName)
+bool INetURLObject::setName(OUString const& rTheName, EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
{
SubString aSegment(getSegment(LAST_SEGMENT, true));
if (!aSegment.isPresent())
@@ -4020,8 +4021,7 @@ bool INetURLObject::setName(OUString const & rTheName)
OUStringBuffer aNewPath;
aNewPath.append(pPathBegin, pSegBegin - pPathBegin);
- aNewPath.append(encodeText(rTheName, PART_PCHAR,
- EncodeMechanism::WasEncoded, RTL_TEXTENCODING_UTF8, true));
+ aNewPath.append(encodeText(rTheName, PART_PCHAR, eMechanism, eCharset, true));
aNewPath.append(p, pPathEnd - p);
return setPath(aNewPath.makeStringAndClear(), EncodeMechanism::NotCanonical,
@@ -4919,17 +4919,6 @@ OUString INetURLObject::GetBase() const
return getBase(LAST_SEGMENT, true, DecodeMechanism::WithCharset);
}
-void INetURLObject::SetName(OUString const & rTheName,
- EncodeMechanism eMechanism,
- rtl_TextEncoding eCharset)
-{
- INetURLObject aTemp(*this);
- if (aTemp.removeSegment()
- && aTemp.insertName(rTheName, false, LAST_SEGMENT, eMechanism,
- eCharset))
- *this = aTemp;
-}
-
void INetURLObject::SetExtension(OUString const & rTheExtension)
{
setExtension(rTheExtension, LAST_SEGMENT, false);
More information about the Libreoffice-commits
mailing list