From 46673b5c3215d05877043a81470b2a059c2eef75 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 7 Nov 2023 12:24:10 +0100 Subject: tdf#146386 cui: remove FTP UI, SvxHyperlinkInternetTp Change-Id: Ib55d6609e0bea4033533e3211c04888e52b86bb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159071 Tested-by: Jenkins Reviewed-by: Michael Stahl --- cui/source/dialogs/hlinettp.cxx | 117 ++----------------------------- cui/source/inc/hlinettp.hxx | 20 ++---- cui/uiconfig/ui/hyperlinkinternetpage.ui | 109 +--------------------------- 3 files changed, 10 insertions(+), 236 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx index 8ffdb2053f5b..21cf34b3c7b6 100644 --- a/cui/source/dialogs/hlinettp.cxx +++ b/cui/source/dialogs/hlinettp.cxx @@ -24,7 +24,6 @@ #include #include -constexpr OUString sAnonymous = u"anonymous"_ustr; /************************************************************************* |* @@ -38,14 +37,8 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp(weld::Container* pParent, pItemSet) , m_bMarkWndOpen(false) , m_xRbtLinktypInternet(xBuilder->weld_radio_button("linktyp_internet")) - , m_xRbtLinktypFTP(xBuilder->weld_radio_button("linktyp_ftp")) , m_xCbbTarget(new SvxHyperURLBox(xBuilder->weld_combo_box("target"))) , m_xFtTarget(xBuilder->weld_label("target_label")) - , m_xFtLogin(xBuilder->weld_label("login_label")) - , m_xEdLogin(xBuilder->weld_entry("login")) - , m_xFtPassword(xBuilder->weld_label("password_label")) - , m_xEdPassword(xBuilder->weld_entry("password")) - , m_xCbAnonymous(xBuilder->weld_check_button("anonymous")) { // gtk_size_group_set_ignore_hidden, "Measuring the size of hidden widgets // ... they will report a size of 0 nowadays, and thus, their size will @@ -69,9 +62,6 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp(weld::Container* pParent, // set handlers Link aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) ); m_xRbtLinktypInternet->connect_toggled( aLink ); - m_xRbtLinktypFTP->connect_toggled( aLink ); - m_xCbAnonymous->connect_toggled( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) ); - m_xEdLogin->connect_changed( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) ); m_xCbbTarget->connect_focus_out( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) ); m_xCbbTarget->connect_changed( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) ); maTimer.SetInvokeHandler ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) ); @@ -91,19 +81,6 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL) INetURLObject aURL(rStrURL); OUString aStrScheme(GetSchemeFromURL(rStrURL)); - // set additional controls for FTP: Username / Password - if (aStrScheme.startsWith(INET_FTP_SCHEME)) - { - if ( aURL.GetUser().toAsciiLowerCase().startsWith( sAnonymous ) ) - setAnonymousFTPUser(); - else - setFTPUser(aURL.GetUser(), aURL.GetPass()); - - //do not show password and user in url - if(!aURL.GetUser().isEmpty() || !aURL.GetPass().isEmpty() ) - aURL.SetUserAndPass(u"", u""); - } - // set URL-field // Show the scheme, #72740 if ( aURL.GetProtocol() != INetProtocol::NotValid ) @@ -114,31 +91,6 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL) SetScheme(aStrScheme); } -void SvxHyperlinkInternetTp::setAnonymousFTPUser() -{ - m_xEdLogin->set_text(sAnonymous); - SvAddressParser aAddress(SvtUserOptions().GetEmail()); - m_xEdPassword->set_text(aAddress.Count() ? aAddress.GetEmailAddress(0) : OUString()); - - m_xFtLogin->set_sensitive(false); - m_xFtPassword->set_sensitive(false); - m_xEdLogin->set_sensitive(false); - m_xEdPassword->set_sensitive(false); - m_xCbAnonymous->set_active(true); -} - -void SvxHyperlinkInternetTp::setFTPUser(const OUString& rUser, const OUString& rPassword) -{ - m_xEdLogin->set_text(rUser); - m_xEdPassword->set_text(rPassword); - - m_xFtLogin->set_sensitive(true); - m_xFtPassword->set_sensitive(true); - m_xEdLogin->set_sensitive(true); - m_xEdPassword->set_sensitive(true); - m_xCbAnonymous->set_active(false); -} - /************************************************************************* |* |* retrieve and prepare data from dialog-fields @@ -160,10 +112,6 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const INetURLObject aURL(aStrURL, GetSmartProtocolFromButtons()); - // username and password for ftp-url - if( aURL.GetProtocol() == INetProtocol::Ftp && !m_xEdLogin->get_text().isEmpty() ) - aURL.SetUserAndPass ( m_xEdLogin->get_text(), m_xEdPassword->get_text() ); - if ( aURL.GetProtocol() != INetProtocol::NotValid ) return aURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ); else //#105788# always create a URL even if it is not valid @@ -217,42 +165,18 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, void) RefreshMarkWindow(); } -/************************************************************************* -|* -|* Contents of editfield "Login" modified -|* -|************************************************************************/ -IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, weld::Entry&, void) -{ - OUString aStrLogin ( m_xEdLogin->get_text() ); - if ( aStrLogin.equalsIgnoreAsciiCase( sAnonymous ) ) - { - m_xCbAnonymous->set_active(true); - ClickAnonymousHdl_Impl(*m_xCbAnonymous); - } -} - void SvxHyperlinkInternetTp::SetScheme(std::u16string_view rScheme) { //if rScheme is empty or unknown the default behaviour is like it where HTTP - bool bFTP = o3tl::starts_with(rScheme, INET_FTP_SCHEME); - bool bInternet = !bFTP; + bool bInternet = true; //update protocol button selection: - m_xRbtLinktypFTP->set_active(bFTP); m_xRbtLinktypInternet->set_active(bInternet); //update target: RemoveImproperProtocol(rScheme); m_xCbbTarget->SetSmartProtocol( GetSmartProtocolFromButtons() ); - //show/hide special fields for FTP: - m_xFtLogin->set_visible( bFTP ); - m_xFtPassword->set_visible( bFTP ); - m_xEdLogin->set_visible( bFTP ); - m_xEdPassword->set_visible( bFTP ); - m_xCbAnonymous->set_visible( bFTP ); - //update 'link target in document'-window and opening-button if (o3tl::starts_with(rScheme, INET_HTTP_SCHEME) || rScheme.empty()) { @@ -287,25 +211,19 @@ void SvxHyperlinkInternetTp::RemoveImproperProtocol(std::u16string_view aProperS } } -OUString SvxHyperlinkInternetTp::GetSchemeFromButtons() const +OUString SvxHyperlinkInternetTp::GetSchemeFromButtons() { - if( m_xRbtLinktypFTP->get_active() ) - return INET_FTP_SCHEME; return INET_HTTP_SCHEME; } -INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const +INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() { - if( m_xRbtLinktypFTP->get_active() ) - { - return INetProtocol::Ftp; - } return INetProtocol::Http; } /************************************************************************* |* -|* Click on Radiobutton : Internet or FTP +|* Click on Radiobutton : WWW or ... |* |************************************************************************/ IMPL_LINK(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, weld::Toggleable&, rButton, void) @@ -316,33 +234,6 @@ IMPL_LINK(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, weld::Toggleable&, r SetScheme(aScheme); } -/************************************************************************* -|* -|* Click on Checkbox : Anonymous user -|* -|************************************************************************/ -IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, weld::Toggleable&, void) -{ - // disable login-editfields if checked - if ( m_xCbAnonymous->get_active() ) - { - if ( m_xEdLogin->get_text().toAsciiLowerCase().startsWith( sAnonymous ) ) - { - maStrOldUser.clear(); - maStrOldPassword.clear(); - } - else - { - maStrOldUser = m_xEdLogin->get_text(); - maStrOldPassword = m_xEdPassword->get_text(); - } - - setAnonymousFTPUser(); - } - else - setFTPUser(maStrOldUser, maStrOldPassword); -} - /************************************************************************* |* |* Combobox Target lost the focus diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx index 8f0dfdcc6bc6..a164063150de 100644 --- a/cui/source/inc/hlinettp.hxx +++ b/cui/source/inc/hlinettp.hxx @@ -40,18 +40,10 @@ private: bool m_bMarkWndOpen; std::unique_ptr m_xRbtLinktypInternet; - std::unique_ptr m_xRbtLinktypFTP; std::unique_ptr m_xCbbTarget; std::unique_ptr m_xFtTarget; - std::unique_ptr m_xFtLogin; - std::unique_ptr m_xEdLogin; - std::unique_ptr m_xFtPassword; - std::unique_ptr m_xEdPassword; - std::unique_ptr m_xCbAnonymous; - - DECL_LINK( Click_SmartProtocol_Impl, weld::Toggleable&, void ); ///< Radiobutton toggled: Type HTTP or FTP - DECL_LINK( ClickAnonymousHdl_Impl, weld::Toggleable&, void ); ///< Checkbox : Anonymous User - DECL_LINK( ModifiedLoginHdl_Impl, weld::Entry&, void ); ///< Contents of editfield "Login" modified + + DECL_LINK( Click_SmartProtocol_Impl, weld::Toggleable&, void ); ///< Radiobutton toggled: Type HTTP or DECL_LINK( LostFocusTargetHdl_Impl, weld::Widget&, void ); ///< Combobox "Target" lost its focus DECL_LINK( ModifiedTargetHdl_Impl, weld::ComboBox&, void ); ///< Contents of editfield "Target" modified @@ -60,13 +52,11 @@ private: void SetScheme(std::u16string_view rScheme); void RemoveImproperProtocol(std::u16string_view rProperScheme); - OUString GetSchemeFromButtons() const; - INetProtocol GetSmartProtocolFromButtons() const; + static OUString GetSchemeFromButtons(); + static INetProtocol GetSmartProtocolFromButtons(); OUString CreateAbsoluteURL() const; - void setAnonymousFTPUser(); - void setFTPUser(const OUString& rUser, const OUString& rPassword); void RefreshMarkWindow(); protected: @@ -74,7 +64,7 @@ protected: virtual void GetCurrentItemData ( OUString& rStrURL, OUString& aStrName, OUString& aStrIntName, OUString& aStrFrame, SvxLinkInsertMode& eMode ) override; - virtual bool ShouldOpenMarkWnd () override {return ( m_bMarkWndOpen && m_xRbtLinktypInternet->get_active() );} + virtual bool ShouldOpenMarkWnd () override { return false; } virtual void SetMarkWndShouldOpen (bool bOpen) override {m_bMarkWndOpen=bOpen;} public: diff --git a/cui/uiconfig/ui/hyperlinkinternetpage.ui b/cui/uiconfig/ui/hyperlinkinternetpage.ui index 63978b8d0396..6a6a191a6b91 100644 --- a/cui/uiconfig/ui/hyperlinkinternetpage.ui +++ b/cui/uiconfig/ui/hyperlinkinternetpage.ui @@ -53,26 +53,6 @@ 0 - - - _FTP - True - True - False - True - True - linktyp_internet - - - Creates an "FTP://" hyperlink. - - - - - 1 - 0 - - 1 @@ -94,91 +74,6 @@ 1 - - - True - False - start - _Login name: - True - login - 0 - - - 0 - 3 - - - - - True - False - start - _Password: - True - password - 0 - - - 0 - 4 - - - - - True - True - True - True - True - - - Specifies your login name, if you are working with FTP addresses. - - - - - 1 - 3 - - - - - True - True - True - True - True - - - Specifies your password, if you are working with FTP addresses. - - - - - 1 - 4 - - - - - Anonymous _user - True - True - False - True - True - - - Allows you to log in to the FTP address as an anonymous user. - - - - - 1 - 5 - - True @@ -434,15 +329,13 @@ - Use the Internet page of the Hyperlink dialog to edit hyperlinks with WWW or FTP addresses. + Use the Internet page of the Hyperlink dialog to edit hyperlinks with WWW addresses. - - -- cgit v1.2.3