diff options
-rw-r--r-- | fpicker/source/office/PlacesListBox.cxx | 8 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 20 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 6 | ||||
-rw-r--r-- | include/svtools/PlaceEditDialog.hxx | 69 | ||||
-rw-r--r-- | include/svtools/ServerDetailsControls.hxx | 54 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 3 | ||||
-rw-r--r-- | svtools/source/dialogs/PlaceEditDialog.cxx | 223 | ||||
-rw-r--r-- | svtools/source/dialogs/ServerDetailsControls.cxx | 210 | ||||
-rw-r--r-- | svtools/uiconfig/ui/placeedit.ui | 82 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 10 |
11 files changed, 345 insertions, 350 deletions
diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index 9f233d059a01..3d6741d1bd6e 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -210,13 +210,13 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, SvTreeListBox*, bool ) PlacePtr pPlace = maPlaces[nSelected]; if ( pPlace->IsEditable() && !pPlace->IsLocal( ) ) { - ScopedVclPtrInstance< PlaceEditDialog > aDlg(mpDlg, pPlace); - short aRetCode = aDlg->Execute(); + PlaceEditDialog aDlg(mpDlg->GetFrameWeld(), pPlace); + short aRetCode = aDlg.run(); switch(aRetCode) { case RET_OK : { - pPlace->SetName ( aDlg->GetServerName() ); - pPlace->SetUrl( aDlg->GetServerUrl() ); + pPlace->SetName ( aDlg.GetServerName() ); + pPlace->SetUrl( aDlg.GetServerUrl() ); mbUpdated = true; break; } diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 06eb31b10b3d..9c3e0902f707 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -746,22 +746,22 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, ListViewHdl, Button*, void ) IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl, Button*, void ) { - ScopedVclPtrInstance< PlaceEditDialog > aDlg( this ); - aDlg->ShowPasswordControl(); - short aRetCode = aDlg->Execute(); + PlaceEditDialog aDlg(GetFrameWeld()); + aDlg.ShowPasswordControl(); + short aRetCode = aDlg.run(); switch( aRetCode ) { case RET_OK : { - ServicePtr newService = aDlg->GetPlace(); + ServicePtr newService = aDlg.GetPlace(); m_aServices.push_back( newService ); - OUString sPassword = aDlg->GetPassword(); - OUString sUser = aDlg->GetUser(); + OUString sPassword = aDlg.GetPassword(); + OUString sUser = aDlg.GetUser(); if( !sUser.isEmpty() && !sPassword.isEmpty() ) { - bool bPersistent = aDlg->IsRememberChecked(); + bool bPersistent = aDlg.IsRememberChecked(); SavePassword( newService->GetUrl(), sUser, sPassword, bPersistent ); } @@ -811,14 +811,14 @@ IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) if( nPos >= 0 ) { - ScopedVclPtrInstance< PlaceEditDialog > aDlg( this, m_aServices[nPos] ); - short aRetCode = aDlg->Execute(); + PlaceEditDialog aDlg(GetFrameWeld(), m_aServices[nPos]); + short aRetCode = aDlg.run(); switch( aRetCode ) { case RET_OK : { - ServicePtr pEditedService = aDlg->GetPlace(); + ServicePtr pEditedService = aDlg.GetPlace(); m_aServices[nPos] = pEditedService; m_pServices_lb->RemoveEntry( nSelected ); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index a6503e680d31..e4e840b0fbd8 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1247,13 +1247,13 @@ IMPL_LINK_NOARG( SvtFileDialog, ConnectToServerPressed_Hdl, Button*, void ) { _pFileView->EndInplaceEditing(); - ScopedVclPtrInstance< PlaceEditDialog > aDlg(this); - short aRetCode = aDlg->Execute(); + PlaceEditDialog aDlg(GetFrameWeld()); + short aRetCode = aDlg.run(); switch (aRetCode) { case RET_OK : { - PlacePtr newPlace = aDlg->GetPlace(); + PlacePtr newPlace = aDlg.GetPlace(); pImpl->_pPlaces->AppendPlace(newPlace); break; diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx index 4649307f383c..ea76c68a1036 100644 --- a/include/svtools/PlaceEditDialog.hxx +++ b/include/svtools/PlaceEditDialog.hxx @@ -12,11 +12,7 @@ #include <svtools/ServerDetailsControls.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <svtools/inettbc.hxx> #include <svtools/place.hxx> @@ -26,27 +22,10 @@ #include <memory> #include <vector> -class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog +class SVT_DLLPUBLIC PlaceEditDialog : public weld::GenericDialogController { private: - VclPtr<Edit> m_pEDServerName; - VclPtr<ListBox> m_pLBServerType; std::shared_ptr< DetailsContainer > m_xCurrentDetails; - - VclPtr<Edit> m_pEDUsername; - VclPtr<FixedText> m_pFTUsernameLabel; - VclPtr<CheckBox> m_pCBPassword; - VclPtr<Edit> m_pEDPassword; - VclPtr<FixedText> m_pFTPasswordLabel; - VclPtr<OKButton> m_pBTOk; - VclPtr<CancelButton> m_pBTCancel; - - VclPtr<PushButton> m_pBTDelete; - - VclPtr<Button> m_pBTRepoRefresh; - - VclPtr<VclGrid> m_pTypeGrid; - /** Vector holding the details UI control for each server type. The elements in this vector need to match the order in the type listbox, e.g. @@ -57,24 +36,35 @@ private: sal_Int32 m_nCurrentType; - bool bLabelChanged; + bool m_bLabelChanged; bool m_bShowPassword; -public : - - PlaceEditDialog( vcl::Window* pParent); - PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Place> &rPlace ); + std::unique_ptr<weld::Entry> m_xEDServerName; + std::unique_ptr<weld::ComboBoxText> m_xLBServerType; + std::unique_ptr<weld::Entry> m_xEDUsername; + std::unique_ptr<weld::Label> m_xFTUsernameLabel; + std::unique_ptr<weld::Button> m_xBTOk; + std::unique_ptr<weld::Button> m_xBTCancel; + std::unique_ptr<weld::Button> m_xBTDelete; + std::unique_ptr<weld::Button> m_xBTRepoRefresh; + std::unique_ptr<weld::CheckButton> m_xCBPassword; + std::unique_ptr<weld::Entry> m_xEDPassword; + std::unique_ptr<weld::Label> m_xFTPasswordLabel; + std::unique_ptr<weld::Widget> m_xTypeGrid; + +public: + PlaceEditDialog(weld::Window* pParent); + PlaceEditDialog(weld::Window* pParent, const std::shared_ptr<Place> &rPlace ); virtual ~PlaceEditDialog() override; - virtual void dispose() override; // Returns a place instance with given information std::shared_ptr<Place> GetPlace(); - OUString GetServerName() { return m_pEDServerName->GetText(); } + OUString GetServerName() { return m_xEDServerName->get_text(); } OUString GetServerUrl(); - OUString GetPassword() { return m_pEDPassword->GetText(); }; - OUString GetUser() { return m_pEDUsername->GetText(); }; - bool IsRememberChecked() { return m_pCBPassword->IsChecked(); } + 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; } @@ -82,13 +72,14 @@ private: void InitDetails( ); - DECL_LINK ( OKHdl, Button *, void ); - DECL_LINK ( DelHdl, Button *, void ); + DECL_LINK ( OKHdl, weld::Button&, void ); + DECL_LINK ( DelHdl, weld::Button&, void ); DECL_LINK ( EditHdl, DetailsContainer*, void ); - DECL_LINK ( ModifyHdl, Edit&, void ); - DECL_LINK ( SelectTypeHdl, ListBox&, void ); - DECL_LINK ( EditLabelHdl, Edit&, void ); - DECL_LINK ( EditUsernameHdl, Edit&, void ); + DECL_LINK ( ModifyHdl, weld::Entry&, void ); + void SelectType(bool bSkipSeparator); + DECL_LINK ( SelectTypeHdl, weld::ComboBoxText&, void ); + DECL_LINK ( EditLabelHdl, weld::Entry&, void ); + DECL_LINK ( EditUsernameHdl, weld::Entry&, void ); }; diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx index 7f95c80a3b86..28e7bd0fea36 100644 --- a/include/svtools/ServerDetailsControls.hxx +++ b/include/svtools/ServerDetailsControls.hxx @@ -23,22 +23,23 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <vcl/layout.hxx> +#include <vcl/weld.hxx> class DetailsContainer { protected: Link<DetailsContainer*,void> m_aChangeHdl; - VclPtr<VclGrid> m_pDetailsGrid; - VclPtr<VclHBox> m_pHostBox; - VclPtr<Edit> m_pEDHost; - VclPtr<FixedText> m_pFTHost; - VclPtr<NumericField> m_pEDPort; - VclPtr<FixedText> m_pFTPort; - VclPtr<Edit> m_pEDRoot; - VclPtr<FixedText> m_pFTRoot; + 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( VclBuilderContainer* pBuilder ); + DetailsContainer( weld::Builder* pBuilder ); virtual ~DetailsContainer( ); void setChangeHdl( const Link<DetailsContainer*,void>& rLink ) { m_aChangeHdl = rLink; } @@ -60,7 +61,8 @@ class DetailsContainer protected: void notifyChange( ); - DECL_LINK ( ValueChangeHdl, Edit&, void ); + DECL_LINK(ValueChangeHdl, weld::Entry&, void); + DECL_LINK(FormatPortHdl, weld::SpinButton&, void); }; class HostDetailsContainer : public DetailsContainer @@ -71,7 +73,7 @@ class HostDetailsContainer : public DetailsContainer OUString m_sHost; public: - HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme ); + HostDetailsContainer( weld::Builder* pBuilder, sal_uInt16 nPort, const OUString& sScheme ); virtual void show( bool bShow = true ) override; virtual INetURLObject getUrl( ) override; @@ -89,29 +91,29 @@ class HostDetailsContainer : public DetailsContainer class DavDetailsContainer : public HostDetailsContainer { private: - VclPtr<CheckBox> m_pCBDavs; + std::unique_ptr<weld::CheckButton> m_xCBDavs; public: - DavDetailsContainer( VclBuilderContainer* pBuilder ); + DavDetailsContainer(weld::Builder* pBuilder); virtual void show( bool bShow = true ) override; - virtual bool enableUserCredentials( ) override { return false; }; + virtual bool enableUserCredentials( ) override { return false; }; protected: virtual bool verifyScheme( const OUString& rScheme ) override; private: - DECL_LINK( ToggledDavsHdl, CheckBox&, void ); + DECL_LINK(ToggledDavsHdl, weld::ToggleButton&, void); }; class SmbDetailsContainer : public DetailsContainer { private: - VclPtr<Edit> m_pEDShare; - VclPtr<FixedText> m_pFTShare; + std::unique_ptr<weld::Entry> m_xEDShare; + std::unique_ptr<weld::Label> m_xFTShare; public: - SmbDetailsContainer( VclBuilderContainer* pBuilder ); + SmbDetailsContainer(weld::Builder* pBuilder); virtual INetURLObject getUrl( ) override; virtual bool setUrl( const INetURLObject& rUrl ) override; @@ -127,15 +129,15 @@ class CmisDetailsContainer : public DetailsContainer std::vector< OUString > m_aRepoIds; OUString m_sRepoId; OUString m_sBinding; - - VclPtr<VclHBox> m_pRepositoryBox; - VclPtr<FixedText> m_pFTRepository; - VclPtr<ListBox> m_pLBRepository; - VclPtr<Button> m_pBTRepoRefresh; 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(VclBuilderContainer* pBuilder, Dialog* pParentDialog, OUString const & sBinding); + CmisDetailsContainer(weld::Builder* pBuilder, weld::Dialog* pParentDialog, OUString const & sBinding); virtual void show( bool bShow = true ) override; virtual INetURLObject getUrl( ) override; @@ -145,8 +147,8 @@ class CmisDetailsContainer : public DetailsContainer private: void selectRepository( ); - DECL_LINK ( RefreshReposHdl, Button*, void ); - DECL_LINK ( SelectRepoHdl, ListBox&, void ); + DECL_LINK ( RefreshReposHdl, weld::Button&, void ); + DECL_LINK ( SelectRepoHdl, weld::ComboBoxText&, void ); }; #endif diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index c3cf00270360..d6d5300acd12 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -146,6 +146,8 @@ public: virtual css::uno::Reference<css::awt::XWindow> GetXWindow() = 0; void connect_help(const Link<Widget&, bool>& rLink) { m_aHelpRequestHdl = rLink; } + + virtual void resize_to_request() = 0; }; class VCL_DLLPUBLIC WaitObject @@ -304,6 +306,7 @@ protected: public: virtual void set_label(const OUString& rText) = 0; virtual OUString get_label() const = 0; + virtual void clicked() = 0; 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 23eeaa21809b..a0da381d703c 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -17,73 +17,72 @@ using namespace com::sun::star::uno; -PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) - : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") +PlaceEditDialog::PlaceEditDialog(weld::Window* pParent) + : GenericDialogController(pParent, "svt/ui/placeedit.ui", "PlaceEditDialog") , m_xCurrentDetails() , m_nCurrentType( 0 ) - , bLabelChanged( false ) + , m_bLabelChanged( false ) , m_bShowPassword( true ) + , m_xEDServerName(m_xBuilder->weld_entry("name")) + , m_xLBServerType(m_xBuilder->weld_combo_box_text("type")) + , m_xEDUsername(m_xBuilder->weld_entry("login")) + , m_xFTUsernameLabel(m_xBuilder->weld_label("loginLabel")) + , m_xBTOk(m_xBuilder->weld_button("ok")) + , m_xBTCancel(m_xBuilder->weld_button("cancel")) + , m_xBTDelete(m_xBuilder->weld_button("delete")) + , m_xBTRepoRefresh(m_xBuilder->weld_button("repositoriesRefresh")) + , m_xCBPassword(m_xBuilder->weld_check_button("rememberPassword")) + , m_xEDPassword(m_xBuilder->weld_entry("password")) + , m_xFTPasswordLabel(m_xBuilder->weld_label("passwordLabel")) + , m_xTypeGrid(m_xBuilder->weld_widget("TypeGrid")) { - get( m_pEDServerName, "name" ); - get( m_pLBServerType, "type" ); - get( m_pEDUsername, "login" ); - get( m_pFTUsernameLabel, "loginLabel" ); - get( m_pBTOk, "ok" ); - get( m_pBTCancel, "cancel" ); - get( m_pBTDelete, "delete" ); - get( m_pBTRepoRefresh, "repositoriesRefresh" ); - get( m_pCBPassword, "rememberPassword" ); - get( m_pEDPassword, "password" ); - get( m_pFTPasswordLabel, "passwordLabel" ); - - m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); - m_pBTOk->Enable( false ); - - m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, EditLabelHdl) ); + m_xBTOk->connect_clicked( LINK( this, PlaceEditDialog, OKHdl) ); + m_xBTOk->set_sensitive( false ); + + m_xEDServerName->connect_changed( LINK( this, PlaceEditDialog, EditLabelHdl) ); // This constructor is called when user request a place creation, so // delete button is hidden. - m_pBTDelete->Hide(); + m_xBTDelete->hide(); - m_pLBServerType->SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); - m_pEDUsername->SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); - m_pEDPassword->SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); + m_xLBServerType->connect_changed( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); + m_xEDUsername->connect_changed( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); + m_xEDPassword->connect_changed( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); InitDetails( ); } -PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Place>& rPlace) - : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") +PlaceEditDialog::PlaceEditDialog(weld::Window* pParent, const std::shared_ptr<Place>& rPlace) + : GenericDialogController(pParent, "svt/ui/placeedit.ui", "PlaceEditDialog") , m_xCurrentDetails( ) - , bLabelChanged( true ) + , m_bLabelChanged( true ) , m_bShowPassword( false ) + , m_xEDServerName(m_xBuilder->weld_entry("name")) + , m_xLBServerType(m_xBuilder->weld_combo_box_text("type")) + , m_xEDUsername(m_xBuilder->weld_entry("login")) + , m_xFTUsernameLabel(m_xBuilder->weld_label("loginLabel")) + , m_xBTOk(m_xBuilder->weld_button("ok")) + , m_xBTCancel(m_xBuilder->weld_button("cancel")) + , m_xBTDelete(m_xBuilder->weld_button("delete")) + , m_xBTRepoRefresh(m_xBuilder->weld_button("repositoriesRefresh")) + , m_xCBPassword(m_xBuilder->weld_check_button("rememberPassword")) + , m_xEDPassword(m_xBuilder->weld_entry("password")) + , m_xFTPasswordLabel(m_xBuilder->weld_label("passwordLabel")) + , m_xTypeGrid(m_xBuilder->weld_widget("TypeGrid")) { - get( m_pEDServerName, "name" ); - get( m_pLBServerType, "type" ); - get( m_pEDUsername, "login" ); - get( m_pFTUsernameLabel, "loginLabel" ); - get( m_pBTOk, "ok" ); - get( m_pBTCancel, "cancel" ); - get( m_pBTDelete, "delete" ); - get( m_pBTRepoRefresh, "repositoriesRefresh" ); - get( m_pTypeGrid, "TypeGrid" ); - get( m_pCBPassword, "rememberPassword" ); - get( m_pEDPassword, "password" ); - get( m_pFTPasswordLabel, "passwordLabel" ); - - m_pEDPassword->Hide(); - m_pFTPasswordLabel->Hide(); - m_pCBPassword->Hide(); - - m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); - m_pBTDelete->SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) ); - - m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, ModifyHdl) ); - m_pLBServerType->SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); + m_xEDPassword->hide(); + m_xFTPasswordLabel->hide(); + m_xCBPassword->hide(); + + m_xBTOk->connect_clicked( LINK( this, PlaceEditDialog, OKHdl) ); + m_xBTDelete->connect_clicked( LINK( this, PlaceEditDialog, DelHdl) ); + + m_xEDServerName->connect_changed( LINK( this, PlaceEditDialog, ModifyHdl) ); + m_xLBServerType->connect_changed( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); InitDetails( ); - m_pEDServerName->SetText(rPlace->GetName()); + m_xEDServerName->set_text(rPlace->GetName()); // Fill the boxes with the URL parts bool bSuccess = false; @@ -96,41 +95,23 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla // Fill the Username field if ( rUrl.HasUserData( ) ) { - m_pEDUsername->SetText( INetURLObject::decode( rUrl.GetUser( ), + m_xEDUsername->set_text( INetURLObject::decode( rUrl.GetUser( ), INetURLObject::DecodeMechanism::WithCharset ) ); m_aDetailsContainers[i]->setUsername( INetURLObject::decode( rUrl.GetUser( ), INetURLObject::DecodeMechanism::WithCharset ) ); } - m_pLBServerType->SelectEntryPos( i ); - SelectTypeHdl( *m_pLBServerType ); + m_xLBServerType->set_active(i); + SelectType(true); } } // In edit mode user can't change connection type - m_pTypeGrid->Hide(); + m_xTypeGrid->hide(); } PlaceEditDialog::~PlaceEditDialog() { - disposeOnce(); -} - -void PlaceEditDialog::dispose() -{ - m_pEDServerName.clear(); - m_pLBServerType.clear(); - m_pEDUsername.clear(); - m_pFTUsernameLabel.clear(); - m_pBTOk.clear(); - m_pBTCancel.clear(); - m_pBTDelete.clear(); - m_pEDPassword.clear(); - m_pFTPasswordLabel.clear(); - m_pCBPassword.clear(); - m_pBTRepoRefresh.clear(); - m_pTypeGrid.clear(); - ModalDialog::dispose(); } OUString PlaceEditDialog::GetServerUrl() @@ -139,7 +120,7 @@ OUString PlaceEditDialog::GetServerUrl() if (m_xCurrentDetails.get()) { INetURLObject aUrl = m_xCurrentDetails->getUrl(); - OUString sUsername = m_pEDUsername->GetText( ).trim( ); + OUString sUsername = m_xEDUsername->get_text().trim(); if ( !sUsername.isEmpty( ) ) aUrl.SetUser( sUsername ); if ( !aUrl.HasError( ) ) @@ -151,7 +132,7 @@ OUString PlaceEditDialog::GetServerUrl() std::shared_ptr<Place> PlaceEditDialog::GetPlace() { - return std::make_shared<Place>(m_pEDServerName->GetText(), GetServerUrl(), true); + return std::make_shared<Place>(m_xEDServerName->get_text(), GetServerUrl(), true); } void PlaceEditDialog::InitDetails( ) @@ -171,7 +152,7 @@ void PlaceEditDialog::InitDetails( ) Sequence< OUString > aTypesUrlsList( officecfg::Office::Common::Misc::CmisServersUrls::get( xContext ) ); Sequence< OUString > aTypesNamesList( officecfg::Office::Common::Misc::CmisServersNames::get( xContext ) ); - unsigned int nPos = 0; + int nPos = 0; for ( sal_Int32 i = 0; i < aTypesUrlsList.getLength( ) && aTypesNamesList.getLength( ); ++i ) { OUString sUrl = aTypesUrlsList[i].replaceFirst("<host", "<" + SvtResId(STR_SVT_HOST)).replaceFirst("port>", SvtResId(STR_SVT_PORT) + ">"); @@ -184,43 +165,43 @@ void PlaceEditDialog::InitDetails( ) continue; } - nPos = m_pLBServerType->InsertEntry( aTypesNamesList[i].replaceFirst("Other CMIS", SvtResId(STR_SVT_OTHER_CMIS)), nPos ); + m_xLBServerType->insert_text(nPos, aTypesNamesList[i].replaceFirst("Other CMIS", SvtResId(STR_SVT_OTHER_CMIS))); - std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(this, this, sUrl)); + std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(m_xBuilder.get(), m_xDialog.get(), sUrl)); xCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); m_aDetailsContainers.push_back(xCmisDetails); - nPos++; + ++nPos; } // Create WebDAV / FTP / SSH details control - std::shared_ptr<DetailsContainer> xDavDetails(std::make_shared<DavDetailsContainer>(this)); + std::shared_ptr<DetailsContainer> xDavDetails(std::make_shared<DavDetailsContainer>(m_xBuilder.get())); xDavDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); m_aDetailsContainers.push_back(xDavDetails); - std::shared_ptr<DetailsContainer> xFtpDetails(std::make_shared<HostDetailsContainer>(this, 21, "ftp")); + std::shared_ptr<DetailsContainer> xFtpDetails(std::make_shared<HostDetailsContainer>(m_xBuilder.get(), 21, "ftp")); xFtpDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); m_aDetailsContainers.push_back(xFtpDetails); - std::shared_ptr<DetailsContainer> xSshDetails(std::make_shared<HostDetailsContainer>(this, 22, "ssh")); + std::shared_ptr<DetailsContainer> xSshDetails(std::make_shared<HostDetailsContainer>(m_xBuilder.get(), 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>(this)); + std::shared_ptr<DetailsContainer> xSmbDetails(std::make_shared<SmbDetailsContainer>(m_xBuilder.get())); xSmbDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); m_aDetailsContainers.push_back(xSmbDetails); // Set default to first value - m_pLBServerType->SelectEntryPos( 0 ); + m_xLBServerType->set_active(0); - if ( m_pLBServerType->GetSelectedEntry() == "--------------------" ) - m_pLBServerType->SelectEntryPos( 1 ); + if (m_xLBServerType->get_active_text() == "--------------------" ) + m_xLBServerType->set_active(1); - SelectTypeHdl( *m_pLBServerType ); + SelectType(true); } -IMPL_LINK( PlaceEditDialog, OKHdl, Button*, /*pBtn*/, void) +IMPL_LINK( PlaceEditDialog, OKHdl, weld::Button&, /*rBtn*/, void) { if ( !m_xCurrentDetails.get() ) return; @@ -231,7 +212,7 @@ IMPL_LINK( PlaceEditDialog, OKHdl, Button*, /*pBtn*/, void) || sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL ) || sUrl.startsWith( ONEDRIVE_BASE_URL ) ) { - m_pBTRepoRefresh->Click(); + m_xBTRepoRefresh->clicked(); sUrl = m_xCurrentDetails->getUrl().GetHost( INetURLObject::DecodeMechanism::WithCharset ); INetURLObject aHostUrl( sUrl ); @@ -239,7 +220,7 @@ IMPL_LINK( PlaceEditDialog, OKHdl, Button*, /*pBtn*/, void) if ( !sRepoId.isEmpty() ) { - EndDialog( RET_OK ); + m_xDialog->response(RET_OK); } else { @@ -248,97 +229,101 @@ IMPL_LINK( PlaceEditDialog, OKHdl, Button*, /*pBtn*/, void) } else { - EndDialog( RET_OK ); + m_xDialog->response(RET_OK); } } -IMPL_LINK( PlaceEditDialog, DelHdl, Button*, /*pButton*/, void) +IMPL_LINK( PlaceEditDialog, DelHdl, weld::Button&, /*rButton*/, void) { // ReUsing existing symbols... - EndDialog( RET_NO ); + m_xDialog->response(RET_NO); } IMPL_LINK_NOARG( PlaceEditDialog, EditHdl, DetailsContainer*, void ) { - if( !bLabelChanged ) + if( !m_bLabelChanged ) { - if( !m_pEDUsername->GetText().isEmpty( ) ) + if( !m_xEDUsername->get_text().isEmpty( ) ) { OUString sLabel = SvtResId( STR_SVT_DEFAULT_SERVICE_LABEL ); - OUString sUser = m_pEDUsername->GetText(); + OUString sUser = m_xEDUsername->get_text(); int nLength = sUser.indexOf( '@' ); if( nLength < 0 ) nLength = sUser.getLength(); sLabel = sLabel.replaceFirst( "$user$", sUser.copy( 0, nLength ) ); - sLabel = sLabel.replaceFirst( "$service$", m_pLBServerType->GetSelectedEntry() ); + sLabel = sLabel.replaceFirst( "$service$", m_xLBServerType->get_active_text() ); - m_pEDServerName->SetText( sLabel ); - bLabelChanged = false; + m_xEDServerName->set_text( sLabel ); + m_bLabelChanged = false; } else { - m_pEDServerName->SetText( m_pLBServerType->GetSelectedEntry( ) ); + m_xEDServerName->set_text( m_xLBServerType->get_active_text( ) ); } } OUString sUrl = GetServerUrl( ); - OUString sName = m_pEDServerName->GetText().trim( ); - m_pBTOk->Enable( !sName.isEmpty( ) && !sUrl.isEmpty( ) ); + OUString sName = m_xEDServerName->get_text().trim(); + m_xBTOk->set_sensitive( !sName.isEmpty( ) && !sUrl.isEmpty( ) ); } -IMPL_LINK_NOARG( PlaceEditDialog, ModifyHdl, Edit&, void ) +IMPL_LINK_NOARG( PlaceEditDialog, ModifyHdl, weld::Entry&, void ) { EditHdl(nullptr); } -IMPL_LINK_NOARG( PlaceEditDialog, EditLabelHdl, Edit&, void ) +IMPL_LINK_NOARG( PlaceEditDialog, EditLabelHdl, weld::Entry&, void ) { - bLabelChanged = true; + m_bLabelChanged = true; EditHdl(nullptr); } -IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl, Edit&, void ) +IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl, weld::Entry&, void ) { for ( std::vector< std::shared_ptr< DetailsContainer > >::iterator it = m_aDetailsContainers.begin( ); it != m_aDetailsContainers.end( ); ++it ) { - ( *it )->setUsername( m_pEDUsername->GetText() ); - ( *it )->setPassword( m_pEDPassword->GetText() ); + ( *it )->setUsername( m_xEDUsername->get_text() ); + ( *it )->setPassword( m_xEDPassword->get_text() ); } EditHdl(nullptr); } -IMPL_LINK_NOARG( PlaceEditDialog, SelectTypeHdl, ListBox&, void ) +IMPL_LINK_NOARG( PlaceEditDialog, SelectTypeHdl, weld::ComboBoxText&, void ) { - if ( m_pLBServerType->GetSelectedEntry() == "--------------------" ) + SelectType(false); +} + +void PlaceEditDialog::SelectType(bool bSkipSeparator) +{ + if ( m_xLBServerType->get_active_text() == "--------------------" ) { - if( !m_pLBServerType->IsTravelSelect() ) - m_pLBServerType->SelectEntryPos( m_nCurrentType ); + if (bSkipSeparator) + m_xLBServerType->set_active(m_nCurrentType); else - m_pLBServerType->SetNoSelection(); - + m_xLBServerType->set_active(-1); return; } if (m_xCurrentDetails.get()) m_xCurrentDetails->show(false); - const sal_Int32 nPos = m_pLBServerType->GetSelectedEntryPos( ); + const int nPos = m_xLBServerType->get_active( ); m_xCurrentDetails = m_aDetailsContainers[nPos]; m_nCurrentType = nPos; m_xCurrentDetails->show(); - m_pCBPassword->Show( m_bShowPassword && m_xCurrentDetails->enableUserCredentials() ); - m_pEDPassword->Show( m_bShowPassword && m_xCurrentDetails->enableUserCredentials() ); - m_pFTPasswordLabel->Show( m_bShowPassword && m_xCurrentDetails->enableUserCredentials() ); - m_pEDUsername->Show( m_xCurrentDetails->enableUserCredentials() ); - m_pFTUsernameLabel->Show( m_xCurrentDetails->enableUserCredentials() ); + m_xCBPassword->show( m_bShowPassword && m_xCurrentDetails->enableUserCredentials() ); + m_xEDPassword->show( m_bShowPassword && m_xCurrentDetails->enableUserCredentials() ); + m_xFTPasswordLabel->show( m_bShowPassword && m_xCurrentDetails->enableUserCredentials() ); + m_xEDUsername->show( m_xCurrentDetails->enableUserCredentials() ); + m_xFTUsernameLabel->show( m_xCurrentDetails->enableUserCredentials() ); - SetSizePixel(GetOptimalSize()); + m_xDialog->resize_to_request(); EditHdl(nullptr); } diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 4cb45ae21915..827fd3ae1953 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -23,6 +23,8 @@ #include <svtools/PlaceEditDialog.hxx> #include <svtools/ServerDetailsControls.hxx> +#include <vcl/lstbox.hxx> + #include <config_oauth2.h> using namespace std; @@ -32,17 +34,23 @@ using namespace com::sun::star::task; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; -DetailsContainer::DetailsContainer( VclBuilderContainer* pBuilder ) +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")) +{ + m_xEDPort->connect_output(LINK(this, DetailsContainer, FormatPortHdl)); +} + +//format without thousand separator +IMPL_LINK(DetailsContainer, FormatPortHdl, weld::SpinButton&, rSpinButton, void) { - pBuilder->get( m_pDetailsGrid, "Details" ); - pBuilder->get( m_pHostBox, "HostDetails" ); - pBuilder->get( m_pEDHost, "host" ); - pBuilder->get( m_pFTHost, "hostLabel" ); - pBuilder->get( m_pEDPort, "port-nospin" ); - pBuilder->get( m_pFTPort, "portLabel" ); - pBuilder->get( m_pEDRoot, "path" ); - pBuilder->get( m_pFTRoot, "pathLabel" ); - m_pEDPort->SetUseThousandSep( false ); + rSpinButton.set_text(OUString::number(rSpinButton.get_value())); } DetailsContainer::~DetailsContainer( ) @@ -51,11 +59,11 @@ DetailsContainer::~DetailsContainer( ) void DetailsContainer::show( bool ) { - m_pDetailsGrid->Enable(); + m_xDetailsGrid->set_sensitive(true); - m_pEDHost->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - m_pEDPort->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - m_pEDRoot->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); + m_xEDHost->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) ); + m_xEDPort->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) ); + m_xEDRoot->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) ); } INetURLObject DetailsContainer::getUrl( ) @@ -76,12 +84,12 @@ void DetailsContainer::notifyChange( ) m_aChangeHdl.Call( this ); } -IMPL_LINK_NOARG( DetailsContainer, ValueChangeHdl, Edit&, void ) +IMPL_LINK_NOARG( DetailsContainer, ValueChangeHdl, weld::Entry&, void ) { notifyChange( ); } -HostDetailsContainer::HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme ) : +HostDetailsContainer::HostDetailsContainer( weld::Builder* pBuilder, sal_uInt16 nPort, const OUString& sScheme ) : DetailsContainer( pBuilder ), m_nDefaultPort( nPort ), m_sScheme( sScheme ) @@ -91,28 +99,28 @@ HostDetailsContainer::HostDetailsContainer( VclBuilderContainer* pBuilder, sal_u void HostDetailsContainer::show( bool bShow ) { - m_pFTHost->Show( bShow ); - m_pHostBox->Show( bShow ); - m_pEDRoot->Show( bShow ); - m_pFTRoot->Show( bShow ); + m_xFTHost->show( bShow ); + m_xHostBox->show( bShow ); + m_xEDRoot->show( bShow ); + m_xFTRoot->show( bShow ); DetailsContainer::show( bShow ); if ( bShow ) { - if ( m_pEDPort->GetValue( ) == 0 ) - m_pEDPort->SetValue( m_nDefaultPort ); - m_pEDHost->SetText( m_sHost ); + if ( m_xEDPort->get_value( ) == 0 ) + m_xEDPort->set_value( m_nDefaultPort ); + m_xEDHost->set_text( m_sHost ); } else - m_pEDPort->SetValue( 0 ); + m_xEDPort->set_value( 0 ); } INetURLObject HostDetailsContainer::getUrl( ) { - OUString sHost = m_pEDHost->GetText().trim( ); - sal_Int64 nPort = m_pEDPort->GetValue(); - OUString sPath = m_pEDRoot->GetText().trim( ); + OUString sHost = m_xEDHost->get_text().trim(); + sal_Int64 nPort = m_xEDPort->get_value(); + OUString sPath = m_xEDRoot->get_text().trim(); OUString sUrl; if ( !sHost.isEmpty( ) ) @@ -136,9 +144,9 @@ bool HostDetailsContainer::setUrl( const INetURLObject& rUrl ) if ( bSuccess ) { m_sHost = rUrl.GetHost( ); - m_pEDHost->SetText( rUrl.GetHost( ) ); - m_pEDPort->SetValue( rUrl.GetPort( ) ); - m_pEDRoot->SetText( rUrl.GetURLPath() ); + m_xEDHost->set_text( rUrl.GetHost( ) ); + m_xEDPort->set_value( rUrl.GetPort( ) ); + m_xEDRoot->set_text( rUrl.GetURLPath() ); } return bSuccess; @@ -149,11 +157,11 @@ bool HostDetailsContainer::verifyScheme( const OUString& sScheme ) return sScheme == ( m_sScheme + "://" ); } -DavDetailsContainer::DavDetailsContainer( VclBuilderContainer* pBuilder ) : - HostDetailsContainer( pBuilder, 80, "http" ) +DavDetailsContainer::DavDetailsContainer(weld::Builder* pBuilder) + : HostDetailsContainer(pBuilder, 80, "http") + , m_xCBDavs(pBuilder->weld_check_button("webdavs")) { - pBuilder->get( m_pCBDavs, "webdavs" ); - m_pCBDavs->SetToggleHdl( LINK( this, DavDetailsContainer, ToggledDavsHdl ) ); + m_xCBDavs->connect_toggled(LINK(this, DavDetailsContainer, ToggledDavsHdl)); show( false ); } @@ -163,9 +171,9 @@ void DavDetailsContainer::show( bool bShow ) HostDetailsContainer::show( bShow ); if ( !bShow ) - m_pCBDavs->Check( false ); + m_xCBDavs->set_active(false); - m_pCBDavs->Show( bShow ); + m_xCBDavs->show(bShow); } bool DavDetailsContainer::verifyScheme( const OUString& rScheme ) @@ -174,24 +182,24 @@ bool DavDetailsContainer::verifyScheme( const OUString& rScheme ) if ( rScheme == "http://" ) { bValid = true; - m_pCBDavs->Check( false ); + m_xCBDavs->set_active(false); } else if ( rScheme == "https://" ) { bValid = true; - m_pCBDavs->Check(); + m_xCBDavs->set_active(true); } return bValid; } -IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, CheckBox&, rCheckBox, void ) +IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, weld::ToggleButton&, rCheckBox, void ) { // Change default port if needed - bool bCheckedDavs = rCheckBox.IsChecked(); - if ( m_pEDPort->GetValue() == 80 && bCheckedDavs ) - m_pEDPort->SetValue( 443 ); - else if ( m_pEDPort->GetValue() == 443 && !bCheckedDavs ) - m_pEDPort->SetValue( 80 ); + 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 ); OUString sScheme( "http" ); if ( bCheckedDavs ) @@ -201,22 +209,21 @@ IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, CheckBox&, rCheckBox, void ) notifyChange( ); } -SmbDetailsContainer::SmbDetailsContainer( VclBuilderContainer* pBuilder ) : - DetailsContainer( pBuilder ) +SmbDetailsContainer::SmbDetailsContainer(weld::Builder* pBuilder) + : DetailsContainer(pBuilder) + , m_xEDShare(pBuilder->weld_entry("share")) + , m_xFTShare(pBuilder->weld_label("shareLabel")) { - pBuilder->get( m_pEDShare, "share" ); - pBuilder->get( m_pFTShare, "shareLabel" ); - - m_pEDShare->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); + m_xEDShare->connect_changed( LINK( this, DetailsContainer, ValueChangeHdl ) ); show( false ); } INetURLObject SmbDetailsContainer::getUrl( ) { - OUString sHost = m_pEDHost->GetText().trim( ); - OUString sShare = m_pEDShare->GetText().trim( ); - OUString sPath = m_pEDRoot->GetText().trim( ); + OUString sHost = m_xEDHost->get_text().trim( ); + OUString sShare = m_xEDShare->get_text().trim( ); + OUString sPath = m_xEDRoot->get_text().trim( ); OUString sUrl; if ( !sHost.isEmpty( ) ) @@ -250,9 +257,9 @@ bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl ) sPath = sFullPath.copy( nPos ); } - m_pEDHost->SetText( rUrl.GetHost( ) ); - m_pEDShare->SetText( sShare ); - m_pEDRoot->SetText( sPath ); + m_xEDHost->set_text( rUrl.GetHost( ) ); + m_xEDShare->set_text( sShare ); + m_xEDRoot->set_text( sPath ); } return bSuccess; @@ -260,76 +267,75 @@ bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl ) void SmbDetailsContainer::show( bool bShow ) { - m_pEDShare->Show( bShow ); - m_pFTShare->Show( bShow ); - m_pEDRoot->Show( bShow ); - m_pFTRoot->Show( bShow ); - - m_pFTHost->Show( bShow ); - m_pHostBox->Show( bShow ); - m_pEDPort->Enable( !bShow ); - m_pFTPort->Enable( !bShow ); + m_xEDShare->show( bShow ); + m_xFTShare->show( bShow ); + m_xEDRoot->show( bShow ); + m_xFTRoot->show( bShow ); + + m_xFTHost->show( bShow ); + m_xHostBox->show( bShow ); + m_xEDPort->set_sensitive( !bShow ); + m_xFTPort->set_sensitive( !bShow ); } -CmisDetailsContainer::CmisDetailsContainer(VclBuilderContainer* pBuilder, Dialog* pParentDialog, OUString const & sBinding) : +CmisDetailsContainer::CmisDetailsContainer(weld::Builder* pBuilder, weld::Dialog* pParentDialog, OUString const & sBinding) : DetailsContainer( pBuilder ), m_sUsername( ), m_xCmdEnv( ), m_aRepoIds( ), m_sRepoId( ), m_sBinding( sBinding ), - m_xParentDialog( VCLUnoHelper::GetInterface(pParentDialog) ) + 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")) { Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler( InteractionHandler::createWithParent(xContext, m_xParentDialog), UNO_QUERY); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); - pBuilder->get( m_pFTRepository, "repositoryLabel" ); - pBuilder->get( m_pLBRepository, "repositories" ); - pBuilder->get( m_pBTRepoRefresh, "repositoriesRefresh" ); - pBuilder->get( m_pRepositoryBox, "RepositoryDetails" ); - show( false ); } void CmisDetailsContainer::show( bool bShow ) { - m_pLBRepository->SetSelectHdl( LINK( this, CmisDetailsContainer, SelectRepoHdl ) ); - m_pBTRepoRefresh->SetClickHdl( LINK( this, CmisDetailsContainer, RefreshReposHdl ) ); + m_xLBRepository->connect_changed( LINK( this, CmisDetailsContainer, SelectRepoHdl ) ); + m_xBTRepoRefresh->connect_clicked( LINK( this, CmisDetailsContainer, RefreshReposHdl ) ); - m_pEDHost->SetText( m_sBinding ); + 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_pFTHost->Show( false ); - m_pHostBox->Show( false ); - m_pFTRepository->Show( false ); - m_pRepositoryBox->Show( false ); - m_pEDRoot->Show( false ); - m_pFTRoot->Show( false ); + m_xFTHost->show( false ); + m_xHostBox->show( false ); + m_xFTRepository->show( false ); + m_xRepositoryBox->show( false ); + m_xEDRoot->show( false ); + m_xFTRoot->show( false ); } else { - m_pFTHost->Show( bShow ); - m_pHostBox->Show( bShow ); - m_pFTRepository->Show( bShow ); - m_pRepositoryBox->Show( bShow ); - m_pEDRoot->Show( bShow ); - m_pFTRoot->Show( bShow ); + m_xFTHost->show( bShow ); + m_xHostBox->show( bShow ); + m_xFTRepository->show( bShow ); + m_xRepositoryBox->show( bShow ); + m_xEDRoot->show( bShow ); + m_xFTRoot->show( bShow ); } DetailsContainer::show( bShow ); - m_pEDPort->Enable( !bShow ); - m_pFTPort->Enable( !bShow ); + m_xEDPort->set_sensitive( !bShow ); + m_xFTPort->set_sensitive( !bShow ); } INetURLObject CmisDetailsContainer::getUrl( ) { - OUString sBindingUrl = m_pEDHost->GetText().trim( ); - OUString sPath = m_pEDRoot->GetText().trim( ); + OUString sBindingUrl = m_xEDHost->get_text().trim(); + OUString sPath = m_xEDRoot->get_text().trim(); bool bSkip = true; if( ( m_sBinding == GDRIVE_BASE_URL ) @@ -369,8 +375,8 @@ bool CmisDetailsContainer::setUrl( const INetURLObject& rUrl ) m_sBinding = aHostUrl.GetURLNoMark( ); m_sRepoId = aHostUrl.GetMark( ); - m_pEDHost->SetText( m_sBinding ); - m_pEDRoot->SetText( rUrl.GetURLPath() ); + m_xEDHost->set_text( m_sBinding ); + m_xEDRoot->set_text( rUrl.GetURLPath() ); } return bSuccess; } @@ -388,7 +394,7 @@ void CmisDetailsContainer::setPassword( const OUString& rPass ) void CmisDetailsContainer::selectRepository( ) { // Get the repo ID and call the Change listener - const sal_Int32 nPos = m_pLBRepository->GetSelectedEntryPos( ); + const int nPos = m_xLBRepository->get_active(); if( static_cast<size_t>(nPos) < m_aRepoIds.size() ) { m_sRepoId = m_aRepoIds[nPos]; @@ -396,13 +402,13 @@ void CmisDetailsContainer::selectRepository( ) } } -IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, Button*, void ) +IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void ) { Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XPasswordContainer2 > xMasterPasswd = PasswordContainer::create( xContext ); - OUString sBindingUrl = m_pEDHost->GetText().trim( ); + OUString sBindingUrl = m_xEDHost->get_text().trim( ); OUString sEncodedUsername = ""; @@ -416,8 +422,8 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, Button*, void ) } // Clean the listbox - m_pLBRepository->Clear( ); - m_aRepoIds.clear( ); + m_xLBRepository->clear(); + m_aRepoIds.clear(); // Compute the URL OUString sUrl; @@ -467,7 +473,7 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, Button*, void ) Reference< XRow > xRow( xResultSet, UNO_QUERY ); OUString sName = xRow->getString( 1 ); - m_pLBRepository->InsertEntry( sName ); + m_xLBRepository->append_text(sName); } } catch ( const Exception& ) @@ -475,9 +481,9 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, Button*, void ) } // Auto-select the first one - if ( m_pLBRepository->GetEntryCount( ) > 0 ) + if (m_xLBRepository->get_count() > 0) { - m_pLBRepository->SelectEntryPos( 0 ); + m_xLBRepository->set_active(0); selectRepository( ); } @@ -490,7 +496,7 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, Button*, void ) {} } -IMPL_LINK_NOARG( CmisDetailsContainer, SelectRepoHdl, ListBox&, void ) +IMPL_LINK_NOARG( CmisDetailsContainer, SelectRepoHdl, weld::ComboBoxText&, void ) { selectRepository( ); } diff --git a/svtools/uiconfig/ui/placeedit.ui b/svtools/uiconfig/ui/placeedit.ui index 13261dcc5bf8..8d211ef2352d 100644 --- a/svtools/uiconfig/ui/placeedit.ui +++ b/svtools/uiconfig/ui/placeedit.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="svt"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -12,31 +12,13 @@ <property name="can_focus">False</property> <property name="stock">gtk-refresh</property> </object> - <object class="GtkListStore" id="liststore1"> - <columns> - <!-- column-name type --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="placeedit|liststore1">WebDAV</col> - </row> - <row> - <col id="0" translatable="yes" context="placeedit|liststore1">FTP</col> - </row> - <row> - <col id="0" translatable="yes" context="placeedit|liststore1">SSH</col> - </row> - <row> - <col id="0" translatable="yes" context="placeedit|liststore1">Windows Share</col> - </row> - </data> - </object> <object class="GtkDialog" id="PlaceEditDialog"> - <property name="width_request">400</property> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="placeedit|PlaceEditDialog">File Services</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -126,10 +108,10 @@ <object class="GtkLabel" id="typeLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="placeedit|typeLabel">Type:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">type</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -137,17 +119,16 @@ </packing> </child> <child> - <object class="GtkComboBox" id="type"> + <object class="GtkComboBoxText" id="type"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="model">liststore1</property> - <child> - <object class="GtkCellRendererText" id="cellrenderertext1"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> + <items> + <item translatable="yes" context="placeedit|liststore1">WebDAV</item> + <item translatable="yes" context="placeedit|liststore1">FTP</item> + <item translatable="yes" context="placeedit|liststore1">SSH</item> + <item translatable="yes" context="placeedit|liststore1">Windows Share</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -171,10 +152,10 @@ <object class="GtkLabel" id="hostLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|hostLabel">Host:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">host</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -185,10 +166,10 @@ <object class="GtkLabel" id="pathLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|pathLabel">Root:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">path</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -200,6 +181,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -210,10 +192,10 @@ <object class="GtkLabel" id="shareLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|shareLabel">Share:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">share</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -225,6 +207,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -235,10 +218,10 @@ <object class="GtkLabel" id="repositoryLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|repositoryLabel">Repository:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">repositories</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -263,10 +246,10 @@ <object class="GtkLabel" id="loginLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|loginLabel">User:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">login</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -278,6 +261,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -288,10 +272,10 @@ <object class="GtkLabel" id="nameLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|nameLabel">Label:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">name</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -303,6 +287,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -319,6 +304,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="expand">True</property> @@ -330,10 +316,10 @@ <object class="GtkLabel" id="portLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|portLabel">Port:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">port-nospin</property> + <property name="mnemonic_widget">port</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -342,13 +328,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="port-nospin"> - <property name="width_request">50</property> + <object class="GtkSpinButton" id="port"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="max_length">5</property> - <property name="max_width_chars">5</property> - <property name="text" translatable="no">0</property> + <property name="activates_default">True</property> + <property name="text">0</property> <property name="adjustment">adjustment1</property> <property name="numeric">True</property> </object> @@ -370,7 +354,7 @@ <property name="can_focus">False</property> <property name="spacing">6</property> <child> - <object class="GtkComboBox" id="repositories"> + <object class="GtkComboBoxText" id="repositories"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -404,9 +388,9 @@ <object class="GtkLabel" id="passwordLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="placeedit|passwordLabel">Password:</property> <property name="mnemonic_widget">password</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -418,6 +402,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="visibility">False</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -454,10 +439,13 @@ </object> </child> <action-widgets> + <action-widget response="-11">help</action-widget> <action-widget response="0">delete</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> - <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 6ca938aea058..9e7b13e8bb37 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -518,6 +518,11 @@ public: return xWindow; } + virtual void resize_to_request() override + { + m_xWindow->setOptimalLayoutSize(); + } + virtual ~SalInstanceWindow() override { clear_child_help(m_xWindow); @@ -798,6 +803,11 @@ 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 59270fd994fa..f13f408492eb 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1689,6 +1689,11 @@ public: g_object_unref(pCursor); } + virtual void resize_to_request() override + { + gtk_window_resize(m_pWindow, 1, 1); + } + virtual ~GtkInstanceWindow() override { if (m_xWindow.is()) @@ -2366,6 +2371,11 @@ public: return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } + 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 { |