diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-04 10:43:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-04 15:42:39 +0200 |
commit | 1cfcf1a5c7437b935da652e6bd25db536c4f4cf7 (patch) | |
tree | d8f4982fdfa9d3a86ea2695b99e94cf8092b785d /sw | |
parent | a57f67f1773f6693f07352fcb232460350d0d091 (diff) |
weld SwAddRenameEntryDialog
Change-Id: I687486a392450fcf3b92fdc4d7a193b10f829835
Reviewed-on: https://gerrit.libreoffice.org/61363
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/dbui/customizeaddresslistdialog.cxx | 44 | ||||
-rw-r--r-- | sw/source/ui/dbui/customizeaddresslistdialog.hxx | 30 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/addentrydialog.ui | 9 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/renameentrydialog.ui | 10 |
4 files changed, 47 insertions, 46 deletions
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx index 81deb59639e2..3c466a415487 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx @@ -85,19 +85,19 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, Button*, pButton, voi if(nPos == LISTBOX_ENTRY_NOTFOUND) nPos = 0; - ScopedVclPtr<SwAddRenameEntryDialog> pDlg; + std::unique_ptr<SwAddRenameEntryDialog> xDlg; if (bRename) - pDlg.disposeAndReset(VclPtr<SwRenameEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders)); + xDlg.reset(new SwRenameEntryDialog(GetFrameWeld(), m_pNewData->aDBColumnHeaders)); else - pDlg.disposeAndReset(VclPtr<SwAddEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders)); - if(bRename) + xDlg.reset(new SwAddEntryDialog(GetFrameWeld(), m_pNewData->aDBColumnHeaders)); + if (bRename) { OUString aTemp = m_pFieldsLB->GetEntry(nPos); - pDlg->SetFieldName(aTemp); + xDlg->SetFieldName(aTemp); } - if(RET_OK == pDlg->Execute()) + if (xDlg->run() == RET_OK) { - OUString sNew = pDlg->GetFieldName(); + OUString sNew = xDlg->GetFieldName(); if(bRename) { m_pNewData->aDBColumnHeaders[nPos] = sNew; @@ -177,32 +177,20 @@ void SwCustomizeAddressListDialog::UpdateButtons() SwAddRenameEntryDialog::SwAddRenameEntryDialog( - vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, + weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, const std::vector< OUString >& rCSVHeader) - : SfxModalDialog(pParent, rID, rUIXMLDescription) + : SfxDialogController(pParent, rUIXMLDescription, rID) , m_rCSVHeader(rCSVHeader) + , m_xFieldNameED(m_xBuilder->weld_entry("entry")) + , m_xOK(m_xBuilder->weld_button("ok")) { - get(m_pOK, "ok"); - get(m_pFieldNameED, "entry"); - m_pFieldNameED->SetModifyHdl(LINK(this, SwAddRenameEntryDialog, ModifyHdl_Impl)); - ModifyHdl_Impl(*m_pFieldNameED); -} - -SwAddRenameEntryDialog::~SwAddRenameEntryDialog() -{ - disposeOnce(); -} - -void SwAddRenameEntryDialog::dispose() -{ - m_pFieldNameED.clear(); - m_pOK.clear(); - SfxModalDialog::dispose(); + m_xFieldNameED->connect_changed(LINK(this, SwAddRenameEntryDialog, ModifyHdl_Impl)); + ModifyHdl_Impl(*m_xFieldNameED); } -IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit&, rEdit, void) +IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, weld::Entry&, rEdit, void) { - OUString sEntry = rEdit.GetText(); + OUString sEntry = rEdit.get_text(); bool bFound = sEntry.isEmpty(); if(!bFound) @@ -217,7 +205,7 @@ IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit&, rEdit, void) break; } } - m_pOK->Enable(!bFound); + m_xOK->set_sensitive(!bFound); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx index a138d83ddf94..e5e2fdb4fae8 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx @@ -53,31 +53,29 @@ public: std::unique_ptr<SwCSVData> ReleaseNewData() { return std::move(m_pNewData);} }; -class SwAddRenameEntryDialog : public SfxModalDialog +class SwAddRenameEntryDialog : public SfxDialogController { - VclPtr<Edit> m_pFieldNameED; - VclPtr<OKButton> m_pOK; const std::vector< OUString >& m_rCSVHeader; + std::unique_ptr<weld::Entry> m_xFieldNameED; + std::unique_ptr<weld::Button> m_xOK; - DECL_LINK(ModifyHdl_Impl, Edit&, void); + DECL_LINK(ModifyHdl_Impl, weld::Entry&, void); protected: - SwAddRenameEntryDialog(vcl::Window* pParent, const OUString& rID, - const OUString& rUIXMLDescription, const std::vector< OUString >& rCSVHeader); - virtual ~SwAddRenameEntryDialog() override; - virtual void dispose() override; + SwAddRenameEntryDialog(weld::Window* pParent, const OUString& rUIXMLDescription, + const OString& rID, const std::vector< OUString >& rCSVHeader); public: - void SetFieldName(const OUString& rName) {m_pFieldNameED->SetText(rName);} - OUString GetFieldName() const {return m_pFieldNameED->GetText();}; + void SetFieldName(const OUString& rName) { m_xFieldNameED->set_text(rName); } + OUString GetFieldName() const { return m_xFieldNameED->get_text(); } }; class SwAddEntryDialog : public SwAddRenameEntryDialog { public: - SwAddEntryDialog(vcl::Window* pParent, const std::vector< OUString >& rCSVHeader) - : SwAddRenameEntryDialog(pParent, "AddEntryDialog", - "modules/swriter/ui/addentrydialog.ui", rCSVHeader) + SwAddEntryDialog(weld::Window* pParent, const std::vector< OUString >& rCSVHeader) + : SwAddRenameEntryDialog(pParent, "modules/swriter/ui/addentrydialog.ui", + "AddEntryDialog", rCSVHeader) { } }; @@ -85,9 +83,9 @@ public: class SwRenameEntryDialog : public SwAddRenameEntryDialog { public: - SwRenameEntryDialog(vcl::Window* pParent, const std::vector< OUString >& rCSVHeader) - : SwAddRenameEntryDialog(pParent, "RenameEntryDialog", - "modules/swriter/ui/renameentrydialog.ui", rCSVHeader) + SwRenameEntryDialog(weld::Window* pParent, const std::vector< OUString >& rCSVHeader) + : SwAddRenameEntryDialog(pParent, "modules/swriter/ui/renameentrydialog.ui", + "RenameEntryDialog", rCSVHeader) { } }; diff --git a/sw/uiconfig/swriter/ui/addentrydialog.ui b/sw/uiconfig/swriter/ui/addentrydialog.ui index a46821a996cb..cec9db9a8b15 100644 --- a/sw/uiconfig/swriter/ui/addentrydialog.ui +++ b/sw/uiconfig/swriter/ui/addentrydialog.ui @@ -1,12 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="AddEntryDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="addentrydialog|AddEntryDialog">Add Element</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> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -87,6 +93,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">start</property> + <property name="activates_default">True</property> </object> </child> </object> diff --git a/sw/uiconfig/swriter/ui/renameentrydialog.ui b/sw/uiconfig/swriter/ui/renameentrydialog.ui index b9090e4cd180..7a94229002ae 100644 --- a/sw/uiconfig/swriter/ui/renameentrydialog.ui +++ b/sw/uiconfig/swriter/ui/renameentrydialog.ui @@ -1,11 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> - <!-- interface-requires gtk+ 3.6 --> + <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="RenameEntryDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="renameentrydialog|RenameEntryDialog">Rename Element</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> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -86,6 +93,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">start</property> + <property name="activates_default">True</property> </object> </child> </object> |