diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-23 07:29:55 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-23 08:51:16 +0200 |
commit | 7c2c5400cb1726112165482cc6074a88351edfae (patch) | |
tree | 2e933ad1f00785209356250f1427c1562c56ec36 /cui | |
parent | 2e088bf71767849e99070d576fb300c244bd6475 (diff) |
Extend loplugin:stringviewparam to starts/endsWith: cui
Change-Id: I96bbf66fa62784f0a4de61b627d6e21b665a4edc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122505
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/hlinettp.cxx | 10 | ||||
-rw-r--r-- | cui/source/inc/hlinettp.hxx | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx index afa7b3e4e602..19153270a600 100644 --- a/cui/source/dialogs/hlinettp.cxx +++ b/cui/source/dialogs/hlinettp.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/string_view.hxx> #include <unotools/useroptions.hxx> #include <svl/adrparse.hxx> @@ -24,7 +25,6 @@ #include <hlmarkwn_def.hxx> constexpr OUStringLiteral sAnonymous = u"anonymous"; -char const sFTPScheme[] = INET_FTP_SCHEME; /************************************************************************* |* @@ -92,7 +92,7 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL) OUString aStrScheme(GetSchemeFromURL(rStrURL)); // set additional controls for FTP: Username / Password - if (aStrScheme.startsWith(sFTPScheme)) + if (aStrScheme.startsWith(INET_FTP_SCHEME)) { if ( aURL.GetUser().toAsciiLowerCase().startsWith( sAnonymous ) ) setAnonymousFTPUser(); @@ -238,10 +238,10 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, weld::Entry&, voi } } -void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme) +void SvxHyperlinkInternetTp::SetScheme(std::u16string_view rScheme) { //if rScheme is empty or unknown the default behaviour is like it where HTTP - bool bFTP = rScheme.startsWith(sFTPScheme); + bool bFTP = o3tl::starts_with(rScheme, u"" INET_FTP_SCHEME); bool bInternet = !bFTP; //update protocol button selection: @@ -260,7 +260,7 @@ void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme) m_xCbAnonymous->set_visible( bFTP ); //update 'link target in document'-window and opening-button - if (rScheme.startsWith(INET_HTTP_SCHEME) || rScheme.isEmpty()) + if (o3tl::starts_with(rScheme, u"" INET_HTTP_SCHEME) || rScheme.empty()) { if ( m_bMarkWndOpen ) ShowMarkWnd (); diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx index e8eb96e6883d..c2340fdde2f7 100644 --- a/cui/source/inc/hlinettp.hxx +++ b/cui/source/inc/hlinettp.hxx @@ -18,6 +18,10 @@ */ #pragma once +#include <sal/config.h> + +#include <string_view> + #include "cuihyperdlg.hxx" #include "hltpbase.hxx" @@ -54,7 +58,7 @@ private: DECL_LINK( TimeoutHdl_Impl, Timer *, void); ///< Handler for timer -timeout - void SetScheme(const OUString& rScheme); + void SetScheme(std::u16string_view rScheme); void RemoveImproperProtocol(std::u16string_view rProperScheme); OUString GetSchemeFromButtons() const; INetProtocol GetSmartProtocolFromButtons() const; |