diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-11 15:55:24 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-03-11 22:23:21 +0100 |
commit | 5f9368a35d641c5b611fab9945969e92a0f368a1 (patch) | |
tree | ad5cf8982fdeeb086854313e1dfe864cb5126534 /svtools | |
parent | 805b15ce536e3d6c40d0dc4f98b5aa6ffa5344c0 (diff) |
weld ODocumentLinkDialog
Change-Id: I9dd3a25e68da00acff24f5ccfafbfc97d9efcf54
Reviewed-on: https://gerrit.libreoffice.org/69058
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/inettbc.cxx | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 460d0354123c..6869bf8c32e1 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -1151,11 +1151,12 @@ void MatchContext_Impl::doExecute() INetProtocol eBaseProt = INetURLObject::CompareProtocolScheme( pBox->aBaseURL ); if ( pBox->aBaseURL.isEmpty() ) eBaseProt = INetURLObject::CompareProtocolScheme( SvtPathOptions().GetWorkPath() ); + INetProtocol eSmartProt = pBox->GetSmartProtocol(); // if the user input is a valid URL, go on with it // otherwise it could be parsed smart with a predefined smart protocol // ( or if this is not set with the protocol of a predefined base URL ) - if (eProt == INetProtocol::NotValid || eProt == eBaseProt) + if( eProt == INetProtocol::NotValid || eProt == eSmartProt || (eSmartProt == INetProtocol::NotValid && eProt == eBaseProt) ) { // not stopped yet ? if( schedule() ) @@ -1264,7 +1265,7 @@ void MatchContext_Impl::doExecute() INetURLObject aCurObj; OUString aCurString, aCurMainURL; INetURLObject aObj; - aObj.SetSmartProtocol(INetProtocol::Http); + aObj.SetSmartProtocol( eSmartProt == INetProtocol::NotValid ? INetProtocol::Http : eSmartProt ); for( ;; ) { for(const auto& rPick : aPickList) @@ -1279,6 +1280,9 @@ void MatchContext_Impl::doExecute() if( eProt != INetProtocol::NotValid && aCurObj.GetProtocol() != eProt ) continue; + if( eSmartProt != INetProtocol::NotValid && aCurObj.GetProtocol() != eSmartProt ) + continue; + switch( aCurObj.GetProtocol() ) { case INetProtocol::Http: @@ -2013,7 +2017,8 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void) } URLBox::URLBox(std::unique_ptr<weld::ComboBox> pWidget) - : bHistoryDisabled(false) + : eSmartProtocol(INetProtocol::NotValid) + , bHistoryDisabled(false) , m_xWidget(std::move(pWidget)) { Init(); @@ -2044,9 +2049,20 @@ URLBox::~URLBox() } } +void URLBox::SetSmartProtocol(INetProtocol eProt) +{ + if ( eSmartProtocol != eProt ) + { + eSmartProtocol = eProt; + UpdatePicklistForSmartProtocol_Impl(); + } +} + void URLBox::UpdatePicklistForSmartProtocol_Impl() { m_xWidget->clear(); + if ( bHistoryDisabled ) + return; if (bHistoryDisabled) return; @@ -2071,6 +2087,12 @@ void URLBox::UpdatePicklistForSmartProtocol_Impl() seqPropertySet[nProperty].Value >>= sURL; aCurObj.SetURL( sURL ); + if ( !sURL.isEmpty() && ( eSmartProtocol != INetProtocol::NotValid ) ) + { + if( aCurObj.GetProtocol() != eSmartProtocol ) + break; + } + OUString aURL( aCurObj.GetMainURL( INetURLObject::DecodeMechanism::WithCharset ) ); if ( !aURL.isEmpty() ) @@ -2102,6 +2124,7 @@ void URLBox::UpdatePicklistForSmartProtocol_Impl() IMPL_LINK_NOARG(URLBox, ChangedHdl, weld::ComboBox&, void) { + aChangeHdl.Call(*m_xWidget); aChangedIdle.Start(); //launch this to happen on idle after cursor position will have been set } @@ -2152,6 +2175,8 @@ OUString URLBox::GetURL() { // no autocompletion for wildcards INetURLObject aTempObj; + if ( eSmartProtocol != INetProtocol::NotValid ) + aTempObj.SetSmartProtocol( eSmartProtocol ); if ( aTempObj.SetSmartURL( aText ) ) return aTempObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); else @@ -2215,4 +2240,10 @@ void URLBox::DisableHistory() UpdatePicklistForSmartProtocol_Impl(); } +void URLBox::SetFilter(const OUString& _sFilter) +{ + pImpl->m_aFilters.clear(); + FilterMatch::createWildCardFilterList(_sFilter,pImpl->m_aFilters); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |