make PlaceEditDialog a bit more ordinary

the various part of PlaceEditDialog are unusual in binding multiple things to a
set of shared widgets with a bunch of multiple LINKS to the same things and
using the most recent one shown to displace the previous handlers

End up with multiple notifications in the gtk3 case, rework this to have
a single owner of the widgets so it can do what it wants to do.

Change-Id: I65826a69ce2f1d4279f6e8091a518777fcfeca07
Reviewed-on: https://gerrit.libreoffice.org/54496
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
index ea76c68..55be5d7 100644
--- a/include/svtools/PlaceEditDialog.hxx
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -39,6 +39,7 @@ private:
    bool m_bLabelChanged;
    bool m_bShowPassword;

public:
    std::unique_ptr<weld::Entry> m_xEDServerName;
    std::unique_ptr<weld::ComboBoxText> m_xLBServerType;
    std::unique_ptr<weld::Entry> m_xEDUsername;
@@ -52,21 +53,39 @@ private:
    std::unique_ptr<weld::Label> m_xFTPasswordLabel;
    std::unique_ptr<weld::Widget> m_xTypeGrid;

    std::unique_ptr<weld::Widget> m_xRepositoryBox;
    std::unique_ptr<weld::Label> m_xFTRepository;
    std::unique_ptr<weld::ComboBoxText> m_xLBRepository;

    std::unique_ptr<weld::Entry> m_xEDShare;
    std::unique_ptr<weld::Label> m_xFTShare;

    std::unique_ptr<weld::Widget> m_xDetailsGrid;
    std::unique_ptr<weld::Widget> m_xHostBox;
    std::unique_ptr<weld::Entry> m_xEDHost;
    std::unique_ptr<weld::Label> m_xFTHost;
    std::unique_ptr<weld::SpinButton> m_xEDPort;
    std::unique_ptr<weld::Label> m_xFTPort;
    std::unique_ptr<weld::Entry> m_xEDRoot;
    std::unique_ptr<weld::Label> m_xFTRoot;

    std::unique_ptr<weld::CheckButton> m_xCBDavs;

public:
     PlaceEditDialog(weld::Window* pParent);
     PlaceEditDialog(weld::Window* pParent, const std::shared_ptr<Place> &rPlace );
     virtual ~PlaceEditDialog() override;
    PlaceEditDialog(weld::Window* pParent);
    PlaceEditDialog(weld::Window* pParent, const std::shared_ptr<Place> &rPlace );
    virtual ~PlaceEditDialog() override;

     // Returns a place instance with given information
     std::shared_ptr<Place> GetPlace();
    // Returns a place instance with given information
    std::shared_ptr<Place> GetPlace();

     OUString GetServerName() { return m_xEDServerName->get_text(); }
     OUString GetServerUrl();
     OUString GetPassword() { return m_xEDPassword->get_text(); };
     OUString GetUser() { return m_xEDUsername->get_text(); };
     bool     IsRememberChecked() { return m_xCBPassword->get_active(); }
    OUString GetServerName() { return m_xEDServerName->get_text(); }
    OUString GetServerUrl();
    OUString GetPassword() { return m_xEDPassword->get_text(); };
    OUString GetUser() { return m_xEDUsername->get_text(); };
    bool     IsRememberChecked() { return m_xCBPassword->get_active(); }

     void ShowPasswordControl() { m_bShowPassword = true; }
    void ShowPasswordControl() { m_bShowPassword = true; }

private:

diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx
index 28e7bd0..731e238 100644
--- a/include/svtools/ServerDetailsControls.hxx
+++ b/include/svtools/ServerDetailsControls.hxx
@@ -16,30 +16,18 @@
#include <com/sun/star/task/XPasswordContainer2.hpp>

#include <tools/urlobj.hxx>
#include <vcl/builder.hxx>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/edit.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include <vcl/weld.hxx>

class PlaceEditDialog;

class DetailsContainer
{
    protected:
        PlaceEditDialog* m_pDialog;
        Link<DetailsContainer*,void> m_aChangeHdl;
        std::unique_ptr<weld::Widget> m_xDetailsGrid;
        std::unique_ptr<weld::Widget> m_xHostBox;
        std::unique_ptr<weld::Entry> m_xEDHost;
        std::unique_ptr<weld::Label> m_xFTHost;
        std::unique_ptr<weld::SpinButton> m_xEDPort;
        std::unique_ptr<weld::Label> m_xFTPort;
        std::unique_ptr<weld::Entry> m_xEDRoot;
        std::unique_ptr<weld::Label> m_xFTRoot;

    public:
        DetailsContainer( weld::Builder* pBuilder );
        DetailsContainer(PlaceEditDialog* pDialog);
        virtual ~DetailsContainer( );

        void setChangeHdl( const Link<DetailsContainer*,void>& rLink ) { m_aChangeHdl = rLink; }
@@ -73,7 +61,7 @@ class HostDetailsContainer : public DetailsContainer
        OUString m_sHost;

    public:
        HostDetailsContainer( weld::Builder* pBuilder, sal_uInt16 nPort, const OUString& sScheme );
        HostDetailsContainer(PlaceEditDialog* pDialog, sal_uInt16 nPort, const OUString& sScheme);

        virtual void show( bool bShow = true ) override;
        virtual INetURLObject getUrl( ) override;
@@ -90,11 +78,8 @@ class HostDetailsContainer : public DetailsContainer

class DavDetailsContainer : public HostDetailsContainer
{
    private:
        std::unique_ptr<weld::CheckButton> m_xCBDavs;

    public:
        DavDetailsContainer(weld::Builder* pBuilder);
        DavDetailsContainer(PlaceEditDialog* pDialog);

        virtual void show( bool bShow = true ) override;
        virtual bool enableUserCredentials( ) override { return false; };
@@ -108,12 +93,8 @@ class DavDetailsContainer : public HostDetailsContainer

class SmbDetailsContainer : public DetailsContainer
{
    private:
        std::unique_ptr<weld::Entry> m_xEDShare;
        std::unique_ptr<weld::Label> m_xFTShare;

    public:
        SmbDetailsContainer(weld::Builder* pBuilder);
        SmbDetailsContainer(PlaceEditDialog* pDialog);

        virtual INetURLObject getUrl( ) override;
        virtual bool setUrl( const INetURLObject& rUrl ) override;
@@ -131,13 +112,8 @@ class CmisDetailsContainer : public DetailsContainer
        OUString m_sBinding;
        css::uno::Reference< css::awt::XWindow > m_xParentDialog;

        std::unique_ptr<weld::Widget> m_xRepositoryBox;
        std::unique_ptr<weld::Label> m_xFTRepository;
        std::unique_ptr<weld::ComboBoxText> m_xLBRepository;
        std::unique_ptr<weld::Button> m_xBTRepoRefresh;

    public:
        CmisDetailsContainer(weld::Builder* pBuilder, weld::Dialog* pParentDialog, OUString const & sBinding);
        CmisDetailsContainer(PlaceEditDialog* pDialog, OUString const & sBinding);

        virtual void show( bool bShow = true ) override;
        virtual INetURLObject getUrl( ) override;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 29067a0..423a6592 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -352,7 +352,7 @@ protected:
public:
    virtual void set_label(const OUString& rText) = 0;
    virtual OUString get_label() const = 0;
    virtual void clicked() = 0;
    void clicked() { signal_clicked(); }

    void connect_clicked(const Link<Button&, void>& rLink) { m_aClickHdl = rLink; }
};
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index a0da381..06cf1a1 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -35,6 +35,24 @@ PlaceEditDialog::PlaceEditDialog(weld::Window* pParent)
    , m_xEDPassword(m_xBuilder->weld_entry("password"))
    , m_xFTPasswordLabel(m_xBuilder->weld_label("passwordLabel"))
    , m_xTypeGrid(m_xBuilder->weld_widget("TypeGrid"))

    , m_xRepositoryBox(m_xBuilder->weld_widget("RepositoryDetails"))
    , m_xFTRepository(m_xBuilder->weld_label("repositoryLabel"))
    , m_xLBRepository(m_xBuilder->weld_combo_box_text("repositories"))

    , m_xEDShare(m_xBuilder->weld_entry("share"))
    , m_xFTShare(m_xBuilder->weld_label("shareLabel"))

    , m_xDetailsGrid(m_xBuilder->weld_widget("Details"))
    , m_xHostBox(m_xBuilder->weld_widget("HostDetails"))
    , m_xEDHost(m_xBuilder->weld_entry("host"))
    , m_xFTHost(m_xBuilder->weld_label("hostLabel"))
    , m_xEDPort(m_xBuilder->weld_spin_button("port"))
    , m_xFTPort(m_xBuilder->weld_label("portLabel"))
    , m_xEDRoot(m_xBuilder->weld_entry("path"))
    , m_xFTRoot(m_xBuilder->weld_label("pathLabel"))

    , m_xCBDavs(m_xBuilder->weld_check_button("webdavs"))
{
    m_xBTOk->connect_clicked( LINK( this, PlaceEditDialog, OKHdl) );
    m_xBTOk->set_sensitive( false );
@@ -167,7 +185,7 @@ void PlaceEditDialog::InitDetails( )

        m_xLBServerType->insert_text(nPos, aTypesNamesList[i].replaceFirst("Other CMIS", SvtResId(STR_SVT_OTHER_CMIS)));

        std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(m_xBuilder.get(), m_xDialog.get(), sUrl));
        std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(this, sUrl));
        xCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
        m_aDetailsContainers.push_back(xCmisDetails);

@@ -175,20 +193,20 @@ void PlaceEditDialog::InitDetails( )
    }

    // Create WebDAV / FTP / SSH details control
    std::shared_ptr<DetailsContainer> xDavDetails(std::make_shared<DavDetailsContainer>(m_xBuilder.get()));
    std::shared_ptr<DetailsContainer> xDavDetails(std::make_shared<DavDetailsContainer>(this));
    xDavDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
    m_aDetailsContainers.push_back(xDavDetails);

    std::shared_ptr<DetailsContainer> xFtpDetails(std::make_shared<HostDetailsContainer>(m_xBuilder.get(), 21, "ftp"));
    std::shared_ptr<DetailsContainer> xFtpDetails(std::make_shared<HostDetailsContainer>(this, 21, "ftp"));
    xFtpDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
    m_aDetailsContainers.push_back(xFtpDetails);

    std::shared_ptr<DetailsContainer> xSshDetails(std::make_shared<HostDetailsContainer>(m_xBuilder.get(), 22, "ssh"));
    std::shared_ptr<DetailsContainer> xSshDetails(std::make_shared<HostDetailsContainer>(this, 22, "ssh"));
    xSshDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
    m_aDetailsContainers.push_back(xSshDetails);

    // Create Windows Share control
    std::shared_ptr<DetailsContainer> xSmbDetails(std::make_shared<SmbDetailsContainer>(m_xBuilder.get()));
    std::shared_ptr<DetailsContainer> xSmbDetails(std::make_shared<SmbDetailsContainer>(this));
    xSmbDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
    m_aDetailsContainers.push_back(xSmbDetails);

diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
index 827fd3a..7fbc80c 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -34,17 +34,10 @@ using namespace com::sun::star::task;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;

DetailsContainer::DetailsContainer(weld::Builder* pBuilder)
    : m_xDetailsGrid(pBuilder->weld_widget("Details"))
    , m_xHostBox(pBuilder->weld_widget("HostDetails"))
    , m_xEDHost(pBuilder->weld_entry("host"))
    , m_xFTHost(pBuilder->weld_label("hostLabel"))
    , m_xEDPort(pBuilder->weld_spin_button("port"))
    , m_xFTPort(pBuilder->weld_label("portLabel"))
    , m_xEDRoot(pBuilder->weld_entry("path"))
    , m_xFTRoot(pBuilder->weld_label("pathLabel"))
DetailsContainer::DetailsContainer(PlaceEditDialog* pDialog)
    : m_pDialog(pDialog)
{
    m_xEDPort->connect_output(LINK(this, DetailsContainer, FormatPortHdl));
    m_pDialog->m_xEDPort->connect_output(LINK(this, DetailsContainer, FormatPortHdl));
}

//format without thousand separator
@@ -59,11 +52,11 @@ DetailsContainer::~DetailsContainer( )

void DetailsContainer::show( bool )
{
    m_xDetailsGrid->set_sensitive(true);
    m_pDialog->m_xDetailsGrid->set_sensitive(true);

    m_xEDHost->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
    m_xEDPort->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
    m_xEDRoot->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
    m_pDialog->m_xEDHost->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
    m_pDialog->m_xEDPort->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
    m_pDialog->m_xEDRoot->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
}

INetURLObject DetailsContainer::getUrl( )
@@ -89,8 +82,8 @@ IMPL_LINK_NOARG( DetailsContainer, ValueChangeHdl, weld::Entry&, void )
    notifyChange( );
}

HostDetailsContainer::HostDetailsContainer( weld::Builder* pBuilder, sal_uInt16 nPort, const OUString& sScheme ) :
    DetailsContainer( pBuilder ),
HostDetailsContainer::HostDetailsContainer(PlaceEditDialog* pDialog, sal_uInt16 nPort, const OUString& sScheme) :
    DetailsContainer( pDialog ),
    m_nDefaultPort( nPort ),
    m_sScheme( sScheme )
{
@@ -99,28 +92,28 @@ HostDetailsContainer::HostDetailsContainer( weld::Builder* pBuilder, sal_uInt16 

void HostDetailsContainer::show( bool bShow )
{
    m_xFTHost->show( bShow );
    m_xHostBox->show( bShow );
    m_xEDRoot->show( bShow );
    m_xFTRoot->show( bShow );
    m_pDialog->m_xFTHost->show( bShow );
    m_pDialog->m_xHostBox->show( bShow );
    m_pDialog->m_xEDRoot->show( bShow );
    m_pDialog->m_xFTRoot->show( bShow );

    DetailsContainer::show( bShow );

    if ( bShow )
    {
        if ( m_xEDPort->get_value( ) == 0 )
            m_xEDPort->set_value( m_nDefaultPort );
        m_xEDHost->set_text( m_sHost );
        if (m_pDialog->m_xEDPort->get_value() == 0)
            m_pDialog->m_xEDPort->set_value( m_nDefaultPort );
        m_pDialog->m_xEDHost->set_text( m_sHost );
    }
    else
        m_xEDPort->set_value( 0 );
        m_pDialog->m_xEDPort->set_value( 0 );
}

INetURLObject HostDetailsContainer::getUrl( )
{
    OUString sHost = m_xEDHost->get_text().trim();
    sal_Int64 nPort = m_xEDPort->get_value();
    OUString sPath = m_xEDRoot->get_text().trim();
    OUString sHost = m_pDialog->m_xEDHost->get_text().trim();
    sal_Int64 nPort = m_pDialog->m_xEDPort->get_value();
    OUString sPath = m_pDialog->m_xEDRoot->get_text().trim();

    OUString sUrl;
    if ( !sHost.isEmpty( ) )
@@ -144,9 +137,9 @@ bool HostDetailsContainer::setUrl( const INetURLObject& rUrl )
    if ( bSuccess )
    {
        m_sHost = rUrl.GetHost( );
        m_xEDHost->set_text( rUrl.GetHost( ) );
        m_xEDPort->set_value( rUrl.GetPort( ) );
        m_xEDRoot->set_text( rUrl.GetURLPath() );
        m_pDialog->m_xEDHost->set_text( rUrl.GetHost( ) );
        m_pDialog->m_xEDPort->set_value( rUrl.GetPort( ) );
        m_pDialog->m_xEDRoot->set_text( rUrl.GetURLPath() );
    }

    return bSuccess;
@@ -157,11 +150,10 @@ bool HostDetailsContainer::verifyScheme( const OUString& sScheme )
    return sScheme == ( m_sScheme + "://" );
}

DavDetailsContainer::DavDetailsContainer(weld::Builder* pBuilder)
DavDetailsContainer::DavDetailsContainer(PlaceEditDialog* pBuilder)
    : HostDetailsContainer(pBuilder, 80, "http")
    , m_xCBDavs(pBuilder->weld_check_button("webdavs"))
{
    m_xCBDavs->connect_toggled(LINK(this, DavDetailsContainer, ToggledDavsHdl));
    m_pDialog->m_xCBDavs->connect_toggled(LINK(this, DavDetailsContainer, ToggledDavsHdl));

    show( false );
}
@@ -171,9 +163,9 @@ void DavDetailsContainer::show( bool bShow )
    HostDetailsContainer::show( bShow );

    if ( !bShow )
        m_xCBDavs->set_active(false);
        m_pDialog->m_xCBDavs->set_active(false);

    m_xCBDavs->show(bShow);
    m_pDialog->m_xCBDavs->show(bShow);
}

bool DavDetailsContainer::verifyScheme( const OUString& rScheme )
@@ -182,12 +174,12 @@ bool DavDetailsContainer::verifyScheme( const OUString& rScheme )
    if ( rScheme == "http://" )
    {
        bValid = true;
        m_xCBDavs->set_active(false);
        m_pDialog->m_xCBDavs->set_active(false);
    }
    else if ( rScheme == "https://" )
    {
        bValid = true;
        m_xCBDavs->set_active(true);
        m_pDialog->m_xCBDavs->set_active(true);
    }
    return bValid;
}
@@ -196,10 +188,10 @@ IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, weld::ToggleButton&, rCheckBox, 
{
    // Change default port if needed
    bool bCheckedDavs = rCheckBox.get_active();
    if ( m_xEDPort->get_value() == 80 && bCheckedDavs )
        m_xEDPort->set_value( 443 );
    else if ( m_xEDPort->get_value() == 443 && !bCheckedDavs )
        m_xEDPort->set_value( 80 );
    if ( m_pDialog->m_xEDPort->get_value() == 80 && bCheckedDavs )
        m_pDialog->m_xEDPort->set_value( 443 );
    else if ( m_pDialog->m_xEDPort->get_value() == 443 && !bCheckedDavs )
        m_pDialog->m_xEDPort->set_value( 80 );

    OUString sScheme( "http" );
    if ( bCheckedDavs )
@@ -209,21 +201,19 @@ IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, weld::ToggleButton&, rCheckBox, 
    notifyChange( );
}

SmbDetailsContainer::SmbDetailsContainer(weld::Builder* pBuilder)
    : DetailsContainer(pBuilder)
    , m_xEDShare(pBuilder->weld_entry("share"))
    , m_xFTShare(pBuilder->weld_label("shareLabel"))
SmbDetailsContainer::SmbDetailsContainer(PlaceEditDialog* pDialog)
    : DetailsContainer(pDialog)
{
    m_xEDShare->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );
    m_pDialog->m_xEDShare->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) );

    show( false );
}

INetURLObject SmbDetailsContainer::getUrl( )
{
    OUString sHost = m_xEDHost->get_text().trim( );
    OUString sShare = m_xEDShare->get_text().trim( );
    OUString sPath = m_xEDRoot->get_text().trim( );
    OUString sHost = m_pDialog->m_xEDHost->get_text().trim( );
    OUString sShare = m_pDialog->m_xEDShare->get_text().trim( );
    OUString sPath = m_pDialog->m_xEDRoot->get_text().trim( );

    OUString sUrl;
    if ( !sHost.isEmpty( ) )
@@ -257,9 +247,9 @@ bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl )
            sPath = sFullPath.copy( nPos );
        }

        m_xEDHost->set_text( rUrl.GetHost( ) );
        m_xEDShare->set_text( sShare );
        m_xEDRoot->set_text( sPath );
        m_pDialog->m_xEDHost->set_text( rUrl.GetHost( ) );
        m_pDialog->m_xEDShare->set_text( sShare );
        m_pDialog->m_xEDRoot->set_text( sPath );
    }

    return bSuccess;
@@ -267,29 +257,25 @@ bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl )

void SmbDetailsContainer::show( bool bShow )
{
    m_xEDShare->show( bShow );
    m_xFTShare->show( bShow );
    m_xEDRoot->show( bShow );
    m_xFTRoot->show( bShow );
    m_pDialog->m_xEDShare->show( bShow );
    m_pDialog->m_xFTShare->show( bShow );
    m_pDialog->m_xEDRoot->show( bShow );
    m_pDialog->m_xFTRoot->show( bShow );

    m_xFTHost->show( bShow );
    m_xHostBox->show( bShow );
    m_xEDPort->set_sensitive( !bShow );
    m_xFTPort->set_sensitive( !bShow );
    m_pDialog->m_xFTHost->show( bShow );
    m_pDialog->m_xHostBox->show( bShow );
    m_pDialog->m_xEDPort->set_sensitive( !bShow );
    m_pDialog->m_xFTPort->set_sensitive( !bShow );
}

CmisDetailsContainer::CmisDetailsContainer(weld::Builder* pBuilder, weld::Dialog* pParentDialog, OUString const & sBinding) :
    DetailsContainer( pBuilder ),
CmisDetailsContainer::CmisDetailsContainer(PlaceEditDialog* pParentDialog, OUString const & sBinding) :
    DetailsContainer( pParentDialog ),
    m_sUsername( ),
    m_xCmdEnv( ),
    m_aRepoIds( ),
    m_sRepoId( ),
    m_sBinding( sBinding ),
    m_xParentDialog(pParentDialog->GetXWindow()),
    m_xRepositoryBox(pBuilder->weld_widget("RepositoryDetails")),
    m_xFTRepository(pBuilder->weld_label("repositoryLabel")),
    m_xLBRepository(pBuilder->weld_combo_box_text("repositories")),
    m_xBTRepoRefresh(pBuilder->weld_button("repositoriesRefresh"))
    m_xParentDialog(pParentDialog->getDialog()->GetXWindow())
{
    Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    Reference< XInteractionHandler > xGlobalInteractionHandler(
@@ -301,41 +287,41 @@ CmisDetailsContainer::CmisDetailsContainer(weld::Builder* pBuilder, weld::Dialog

void CmisDetailsContainer::show( bool bShow )
{
    m_xLBRepository->connect_changed( LINK( this, CmisDetailsContainer, SelectRepoHdl ) );
    m_xBTRepoRefresh->connect_clicked( LINK( this, CmisDetailsContainer, RefreshReposHdl ) );
    m_pDialog->m_xLBRepository->connect_changed( LINK( this, CmisDetailsContainer, SelectRepoHdl ) );
    m_pDialog->m_xBTRepoRefresh->connect_clicked( LINK( this, CmisDetailsContainer, RefreshReposHdl ) );

    m_xEDHost->set_text( m_sBinding );
    m_pDialog->m_xEDHost->set_text( m_sBinding );

    if( ( m_sBinding == GDRIVE_BASE_URL )
            || m_sBinding.startsWith( ALFRESCO_CLOUD_BASE_URL )
            || ( m_sBinding == ONEDRIVE_BASE_URL ) )
    {
        m_xFTHost->show( false );
        m_xHostBox->show( false );
        m_xFTRepository->show( false );
        m_xRepositoryBox->show( false );
        m_xEDRoot->show( false );
        m_xFTRoot->show( false );
        m_pDialog->m_xFTHost->show( false );
        m_pDialog->m_xHostBox->show( false );
        m_pDialog->m_xFTRepository->show( false );
        m_pDialog->m_xRepositoryBox->show( false );
        m_pDialog->m_xEDRoot->show( false );
        m_pDialog->m_xFTRoot->show( false );
    }
    else
    {
        m_xFTHost->show( bShow );
        m_xHostBox->show( bShow );
        m_xFTRepository->show( bShow );
        m_xRepositoryBox->show( bShow );
        m_xEDRoot->show( bShow );
        m_xFTRoot->show( bShow );
        m_pDialog->m_xFTHost->show( bShow );
        m_pDialog->m_xHostBox->show( bShow );
        m_pDialog->m_xFTRepository->show( bShow );
        m_pDialog->m_xRepositoryBox->show( bShow );
        m_pDialog->m_xEDRoot->show( bShow );
        m_pDialog->m_xFTRoot->show( bShow );
    }

    DetailsContainer::show( bShow );
    m_xEDPort->set_sensitive( !bShow );
    m_xFTPort->set_sensitive( !bShow );
    m_pDialog->m_xEDPort->set_sensitive( !bShow );
    m_pDialog->m_xFTPort->set_sensitive( !bShow );
}

INetURLObject CmisDetailsContainer::getUrl( )
{
    OUString sBindingUrl = m_xEDHost->get_text().trim();
    OUString sPath = m_xEDRoot->get_text().trim();
    OUString sBindingUrl = m_pDialog->m_xEDHost->get_text().trim();
    OUString sPath = m_pDialog->m_xEDRoot->get_text().trim();

    bool bSkip = true;
    if( ( m_sBinding == GDRIVE_BASE_URL )
@@ -375,8 +361,8 @@ bool CmisDetailsContainer::setUrl( const INetURLObject& rUrl )
        m_sBinding = aHostUrl.GetURLNoMark( );
        m_sRepoId = aHostUrl.GetMark( );

        m_xEDHost->set_text( m_sBinding );
        m_xEDRoot->set_text( rUrl.GetURLPath() );
        m_pDialog->m_xEDHost->set_text( m_sBinding );
        m_pDialog->m_xEDRoot->set_text( rUrl.GetURLPath() );
    }
    return bSuccess;
}
@@ -394,7 +380,7 @@ void CmisDetailsContainer::setPassword( const OUString& rPass )
void CmisDetailsContainer::selectRepository( )
{
    // Get the repo ID and call the Change listener
    const int nPos = m_xLBRepository->get_active();
    const int nPos = m_pDialog->m_xLBRepository->get_active();
    if( static_cast<size_t>(nPos) < m_aRepoIds.size() )
    {
        m_sRepoId = m_aRepoIds[nPos];
@@ -408,7 +394,7 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void  )
    Reference< XPasswordContainer2 > xMasterPasswd = PasswordContainer::create( xContext );


    OUString sBindingUrl = m_xEDHost->get_text().trim( );
    OUString sBindingUrl = m_pDialog->m_xEDHost->get_text().trim( );

    OUString sEncodedUsername = "";

@@ -422,7 +408,7 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void  )
    }

    // Clean the listbox
    m_xLBRepository->clear();
    m_pDialog->m_xLBRepository->clear();
    m_aRepoIds.clear();

    // Compute the URL
@@ -473,7 +459,7 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void  )

            Reference< XRow > xRow( xResultSet, UNO_QUERY );
            OUString sName = xRow->getString( 1 );
            m_xLBRepository->append_text(sName);
            m_pDialog->m_xLBRepository->append_text(sName);
        }
    }
    catch ( const Exception& )
@@ -481,9 +467,9 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void  )
    }

    // Auto-select the first one
    if (m_xLBRepository->get_count() > 0)
    if (m_pDialog->m_xLBRepository->get_count() > 0)
    {
        m_xLBRepository->set_active(0);
        m_pDialog->m_xLBRepository->set_active(0);
        selectRepository( );
    }

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9556fcd..89a03c1 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -879,11 +879,6 @@ public:
        return m_xButton->GetText();
    }

    virtual void clicked() override
    {
        m_xButton->Click();
    }

    virtual ~SalInstanceButton() override
    {
        m_xButton->SetClickHdl(Link<::Button*,void>());
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a821428..b882d68 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2517,11 +2517,6 @@ public:
        return ::get_label(m_pButton);
    }

    virtual void clicked() override
    {
        gtk_button_clicked(m_pButton);
    }

    // allow us to block buttons with click handlers making dialogs return a response
    bool has_click_handler() const
    {