10#include <com/sun/star/task/InteractionHandler.hpp>
11#include <com/sun/star/task/PasswordContainer.hpp>
12#include <com/sun/star/task/XPasswordContainer2.hpp>
13#include <com/sun/star/ucb/XContentAccess.hpp>
14#include <com/sun/star/sdbc/XResultSet.hpp>
15#include <com/sun/star/sdbc/XRow.hpp>
26#include <config_oauth2.h>
44 rSpinButton.set_text(OUString::number(rSpinButton.get_value()));
53 m_pDialog->m_xDetailsGrid->set_sensitive(
true);
85 m_nDefaultPort( nPort ),
86 m_sScheme(
std::move( sScheme ))
93 m_pDialog->m_xFTHost->set_visible( bShow );
94 m_pDialog->m_xHostBox->set_visible( bShow );
95 m_pDialog->m_xEDRoot->set_visible( bShow );
96 m_pDialog->m_xFTRoot->set_visible( bShow );
102 if (
m_pDialog->m_xEDPort->get_value() == 0)
112 OUString sHost =
m_pDialog->m_xEDHost->get_text().trim();
113 sal_Int64 nPort =
m_pDialog->m_xEDPort->get_value();
114 OUString sPath =
m_pDialog->m_xEDRoot->get_text().trim();
117 if ( !sHost.isEmpty( ) )
121 sUrl +=
":" + OUString::number( nPort );
122 if ( !sPath.isEmpty( ) )
123 if ( sPath.indexOf(
'/' ) != 0 )
148 return sScheme == Concat2View(
m_sScheme +
"://" );
166 m_pDialog->m_xCBDavs->set_visible(bShow);
172 if ( rScheme ==
"http://" )
178 else if ( rScheme ==
"https://" )
190 bool bCheckedDavs = rCheckBox.get_active();
191 if ( m_pDialog->m_xEDPort->get_value() == 80 && bCheckedDavs )
192 m_pDialog->m_xEDPort->set_value( 443 );
193 else if ( m_pDialog->m_xEDPort->get_value() == 443 && !bCheckedDavs )
194 m_pDialog->m_xEDPort->set_value( 80 );
196 OUString sScheme(
"http" );
199 setScheme( sScheme );
214 OUString sHost =
m_pDialog->m_xEDHost->get_text().trim( );
215 OUString sShare =
m_pDialog->m_xEDShare->get_text().trim( );
216 OUString sPath =
m_pDialog->m_xEDRoot->get_text().trim( );
219 if ( !sHost.isEmpty( ) )
221 sUrl =
"smb://" + sHost +
"/";
222 if ( !sShare.isEmpty( ) )
224 if ( !sPath.isEmpty( ) )
225 if ( sPath.indexOf(
'/' ) != 0 )
235 bool bSuccess = rUrl.
GetProtocol() == INetProtocol::Smb;
239 OUString sShare = rUrl.
getName( 0 );
242 if ( sFullPath.getLength( ) > sShare.getLength( ) )
244 sal_Int32
nPos = sShare.getLength( );
247 sPath = sFullPath.copy(
nPos );
252 m_pDialog->m_xEDShare->set_text( sShare );
261 m_pDialog->m_xEDShare->set_visible( bShow );
262 m_pDialog->m_xFTShare->set_visible( bShow );
263 m_pDialog->m_xEDRoot->set_visible( bShow );
264 m_pDialog->m_xFTRoot->set_visible( bShow );
266 m_pDialog->m_xFTHost->set_visible( bShow );
267 m_pDialog->m_xHostBox->set_visible( bShow );
268 m_pDialog->m_xEDPort->set_sensitive( !bShow );
269 m_pDialog->m_xFTPort->set_sensitive( !bShow );
281 m_sBinding(
std::move( sBinding )),
282 m_xParentDialog(pParentDialog->getDialog()->GetXWindow())
300 ||
m_sBinding.startsWith( ALFRESCO_CLOUD_BASE_URL )
312 m_pDialog->m_xFTHost->set_visible( bShow );
313 m_pDialog->m_xHostBox->set_visible( bShow );
314 m_pDialog->m_xFTRepository->set_visible( bShow );
315 m_pDialog->m_xRepositoryBox->set_visible( bShow );
316 m_pDialog->m_xEDRoot->set_visible( bShow );
317 m_pDialog->m_xFTRoot->set_visible( bShow );
321 m_pDialog->m_xEDPort->set_sensitive( !bShow );
322 m_pDialog->m_xFTPort->set_sensitive( !bShow );
327 OUString sBindingUrl =
m_pDialog->m_xEDHost->get_text().trim();
328 OUString sPath =
m_pDialog->m_xEDRoot->get_text().trim();
332 ||
m_sBinding.startsWith( ALFRESCO_CLOUD_BASE_URL )
343 if ( !sBindingUrl.isEmpty( ) && !bSkip )
345 OUString sEncodedBinding = rtl::Uri::encode(
347 rtl_UriCharClassRelSegment,
348 rtl_UriEncodeKeepEscapes,
349 RTL_TEXTENCODING_UTF8 );
350 sUrl =
"vnd.libreoffice.cmis://" + sEncodedBinding;
359 bool bSuccess = rUrl.
GetProtocol() == INetProtocol::Cmis;
401 OUString sBindingUrl = m_pDialog->m_xEDHost->get_text().trim( );
403 OUString sEncodedUsername =
"";
405 if ( !m_sUsername.isEmpty( ) )
407 sEncodedUsername = rtl::Uri::encode(m_sUsername,
408 rtl_UriCharClassUserinfo,
409 rtl_UriEncodeKeepEscapes,
410 RTL_TEXTENCODING_UTF8 )
415 m_pDialog->m_xLBRepository->clear();
420 if ( !sBindingUrl.isEmpty( ) )
422 OUString sEncodedBinding = rtl::Uri::encode(
424 rtl_UriCharClassRelSegment,
425 rtl_UriEncodeKeepEscapes,
426 RTL_TEXTENCODING_UTF8 );
427 sUrl =
"vnd.libreoffice.cmis://" + sEncodedUsername + sEncodedBinding;
433 if( !sUrl.isEmpty() && !m_sUsername.isEmpty() && !m_sPassword.isEmpty() )
436 InteractionHandler::createWithParent(xContext, m_xParentDialog);
441 sUrl, m_sUsername, aPasswd, xInteractionHandler );
454 while ( xResultSet->next() )
456 OUString sURL = xAccess->queryContentIdentifierString( );
460 m_aRepoIds.push_back(
sId );
463 OUString
sName = xRow->getString( 1 );
464 m_pDialog->m_xLBRepository->append_text(
sName);
473 if (m_pDialog->m_xLBRepository->get_count() > 0)
475 m_pDialog->m_xLBRepository->set_active(0);
482 xMasterPasswd->remove( sUrl, m_sUsername );
IMPL_STATIC_LINK(DetailsContainer, FormatPortHdl, weld::SpinButton &, rSpinButton, void)
IMPL_LINK(DavDetailsContainer, ToggledDavsHdl, weld::Toggleable &, rCheckBox, void)
IMPL_LINK_NOARG(DetailsContainer, ValueChangeHdl, weld::Entry &, void)
virtual bool setUrl(const INetURLObject &rUrl) override
Try to split the URL in the controls of that container.
virtual void setUsername(const OUString &rUsername) override
CmisDetailsContainer(PlaceEditDialog *pDialog, OUString sBinding)
std::vector< OUString > m_aRepoIds
css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv
virtual INetURLObject getUrl() override
virtual void setPassword(const OUString &rPass) override
css::uno::Reference< css::awt::XWindow > m_xParentDialog
virtual void set_visible(bool bShow) override
DavDetailsContainer(PlaceEditDialog *pDialog)
virtual bool verifyScheme(const OUString &rScheme) override
Verifies that the scheme split from the URL can be handled by the container and set the proper contro...
virtual void set_visible(bool bShow) override
DetailsContainer(PlaceEditDialog *pDialog)
Link< DetailsContainer *, void > m_aChangeHdl
PlaceEditDialog * m_pDialog
virtual INetURLObject getUrl()
virtual ~DetailsContainer()
virtual bool setUrl(const INetURLObject &rUrl)
Try to split the URL in the controls of that container.
virtual void set_visible(bool bShow)
sal_uInt16 m_nDefaultPort
virtual INetURLObject getUrl() override
HostDetailsContainer(PlaceEditDialog *pDialog, sal_uInt16 nPort, OUString sScheme)
virtual bool setUrl(const INetURLObject &rUrl) override
Try to split the URL in the controls of that container.
virtual bool verifyScheme(const OUString &rScheme)
Verifies that the scheme split from the URL can be handled by the container and set the proper contro...
virtual void set_visible(bool bShow) override
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
sal_uInt32 GetPort() const
static OUString GetScheme(INetProtocol eTheScheme)
OUString GetMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetURLNoMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetHost(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
virtual INetURLObject getUrl() override
virtual void set_visible(bool bShow) override
virtual bool setUrl(const INetURLObject &rUrl) override
Try to split the URL in the controls of that container.
SmbDetailsContainer(PlaceEditDialog *pDialog)
css::uno::Reference< css::sdbc::XResultSet > createCursor(const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define LINK(Instance, Class, Member)
Reference< XComponentContext > getProcessComponentContext()
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)