diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-16 15:56:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-17 09:54:45 +0200 |
commit | c899ad348c375e6c59dbbc30e2458d9cbe226c12 (patch) | |
tree | b87b7f22f5790906b8550a0400e35113ffb603b6 /fpicker/source/office | |
parent | weld SvxNewToolbarDialog (diff) | |
download | core-c899ad348c375e6c59dbbc30e2458d9cbe226c12.tar.gz core-c899ad348c375e6c59dbbc30e2458d9cbe226c12.zip |
weld QueryFolderNameDialog
Change-Id: I73ff0a15010d00a353e498755755177c8e7df607
Reviewed-on: https://gerrit.libreoffice.org/54442
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'fpicker/source/office')
-rw-r--r-- | fpicker/source/office/QueryFolderName.hxx | 22 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 8 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 61 |
3 files changed, 32 insertions, 59 deletions
diff --git a/fpicker/source/office/QueryFolderName.hxx b/fpicker/source/office/QueryFolderName.hxx index d3555e3fa9b3..4172aa0f9ee0 100644 --- a/fpicker/source/office/QueryFolderName.hxx +++ b/fpicker/source/office/QueryFolderName.hxx @@ -19,28 +19,22 @@ #ifndef INCLUDED_FPICKER_SOURCE_OFFICE_QUERYFOLDERNAME_HXX #define INCLUDED_FPICKER_SOURCE_OFFICE_QUERYFOLDERNAME_HXX -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> -#include <vcl/dialog.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> -class QueryFolderNameDialog : public ModalDialog +class QueryFolderNameDialog : public weld::GenericDialogController { private: - VclPtr<Edit> m_pNameEdit; - VclPtr<VclFrame> m_pNameLine; - VclPtr<OKButton> m_pOKBtn; + std::unique_ptr<weld::Entry> m_xNameEdit; + std::unique_ptr<weld::Button> m_xOKBtn; - DECL_LINK( OKHdl, Button*, void ); - DECL_LINK( NameHdl, Edit&, void ); + DECL_LINK( OKHdl, weld::Button&, void ); + DECL_LINK( NameHdl, weld::Entry&, void ); public: - QueryFolderNameDialog(vcl::Window* _pParent, const OUString& rTitle, + QueryFolderNameDialog(weld::Window* _pParent, const OUString& rTitle, const OUString& rDefaultText); virtual ~QueryFolderNameDialog() override; - virtual void dispose() override; - OUString GetName() const { return m_pNameEdit->GetText(); } + OUString GetName() const { return m_xNameEdit->get_text(); } }; #endif // INCLUDED_FPICKER_SOURCE_OFFICE_QUERYFOLDERNAME_HXX diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 7cac02da7777..bf629dfe8f2a 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -1087,17 +1087,17 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl, Button*, void ) OUString aTitle; aContent.getTitle( aTitle ); - ScopedVclPtrInstance< QueryFolderNameDialog > aDlg(this, aTitle, FpsResId(STR_SVT_NEW_FOLDER)); + QueryFolderNameDialog aDlg(GetFrameWeld(), aTitle, FpsResId(STR_SVT_NEW_FOLDER)); bool bHandled = false; while( !bHandled ) { - if( aDlg->Execute() == RET_OK ) + if (aDlg.run() == RET_OK) { - OUString aUrl = aContent.createFolder( aDlg->GetName() ); + OUString aUrl = aContent.createFolder(aDlg.GetName()); if( !aUrl.isEmpty() ) { - m_pFileView->CreatedFolder( aUrl, aDlg->GetName() ); + m_pFileView->CreatedFolder(aUrl, aDlg.GetName()); bHandled = true; } } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index ca7cc591db3f..880e27834a82 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -745,17 +745,17 @@ IMPL_LINK_NOARG( SvtFileDialog, NewFolderHdl_Impl, Button*, void) SmartContent aContent( _pFileView->GetViewURL( ) ); OUString aTitle; aContent.getTitle( aTitle ); - ScopedVclPtrInstance< QueryFolderNameDialog > aDlg(this, aTitle, FpsResId(STR_SVT_NEW_FOLDER)); + QueryFolderNameDialog aDlg(GetFrameWeld(), aTitle, FpsResId(STR_SVT_NEW_FOLDER)); bool bHandled = false; while ( !bHandled ) { - if ( aDlg->Execute() == RET_OK ) + if (aDlg.run() == RET_OK) { - OUString aUrl = aContent.createFolder( aDlg->GetName( ) ); + OUString aUrl = aContent.createFolder(aDlg.GetName()); if ( !aUrl.isEmpty( ) ) { - _pFileView->CreatedFolder( aUrl, aDlg->GetName() ); + _pFileView->CreatedFolder(aUrl, aDlg.GetName()); bHandled = true; } } @@ -2768,56 +2768,35 @@ Image SvtFileDialog::GetButtonImage(const OUString& rButtonId) return Image(BitmapEx(rButtonId)); } -QueryFolderNameDialog::QueryFolderNameDialog(vcl::Window* _pParent, +QueryFolderNameDialog::QueryFolderNameDialog(weld::Window* _pParent, const OUString& rTitle, const OUString& rDefaultText) - : ModalDialog(_pParent, "FolderNameDialog", "fps/ui/foldernamedialog.ui") -{ - get(m_pNameEdit, "entry"); - get(m_pNameLine, "frame"); - get(m_pOKBtn, "ok"); - - SetText( rTitle ); - m_pNameEdit->SetText( rDefaultText ); - m_pNameEdit->SetSelection( Selection( 0, rDefaultText.getLength() ) ); - m_pOKBtn->SetClickHdl( LINK( this, QueryFolderNameDialog, OKHdl ) ); - m_pNameEdit->SetModifyHdl( LINK( this, QueryFolderNameDialog, NameHdl ) ); + : GenericDialogController(_pParent, "fps/ui/foldernamedialog.ui", "FolderNameDialog") + , m_xNameEdit(m_xBuilder->weld_entry("entry")) + , m_xOKBtn(m_xBuilder->weld_button("ok")) +{ + m_xDialog->set_title(rTitle); + m_xNameEdit->set_text(rDefaultText); + m_xNameEdit->select_region(0, -1); + m_xOKBtn->connect_clicked(LINK(this, QueryFolderNameDialog, OKHdl)); + m_xNameEdit->connect_changed(LINK(this, QueryFolderNameDialog, NameHdl)); }; QueryFolderNameDialog::~QueryFolderNameDialog() { - disposeOnce(); -} - -void QueryFolderNameDialog::dispose() -{ - m_pNameEdit.clear(); - m_pNameLine.clear(); - m_pOKBtn.clear(); - ModalDialog::dispose(); } -IMPL_LINK_NOARG(QueryFolderNameDialog, OKHdl, Button*, void) +IMPL_LINK_NOARG(QueryFolderNameDialog, OKHdl, weld::Button&, void) { // trim the strings - m_pNameEdit->SetText(comphelper::string::strip(m_pNameEdit->GetText(), ' ')); - EndDialog( RET_OK ); + m_xNameEdit->set_text(comphelper::string::strip(m_xNameEdit->get_text(), ' ')); + m_xDialog->response(RET_OK); } - -IMPL_LINK_NOARG(QueryFolderNameDialog, NameHdl, Edit&, void) +IMPL_LINK_NOARG(QueryFolderNameDialog, NameHdl, weld::Entry&, void) { // trim the strings - OUString aName = comphelper::string::strip(m_pNameEdit->GetText(), ' '); - if ( !aName.isEmpty() ) - { - if ( !m_pOKBtn->IsEnabled() ) - m_pOKBtn->Enable(); - } - else - { - if ( m_pOKBtn->IsEnabled() ) - m_pOKBtn->Enable( false ); - } + OUString aName = comphelper::string::strip(m_xNameEdit->get_text(), ' '); + m_xOKBtn->set_sensitive(!aName.isEmpty()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |