sw/source/ui/index/swuiidxmrk.cxx | 49 +++++++++++---------------- sw/source/uibase/inc/swuiidxmrk.hxx | 2 - sw/uiconfig/swriter/ui/newuserindexdialog.ui | 18 ++++++--- 3 files changed, 32 insertions(+), 37 deletions(-)
New commits: commit 19dd424dbdfa2321438860963aa98630ac008a71 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Apr 3 14:39:03 2018 +0100 weld SwNewUserIdxDlg Change-Id: I49502af0b045116fba32259d8ada80b1e53a79a8 Reviewed-on: https://gerrit.libreoffice.org/52332 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index c5628740ffdb..f0b1307dccb8 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -564,49 +564,40 @@ void SwIndexMarkPane::UpdateKeyBoxes() } } -class SwNewUserIdxDlg : public ModalDialog +class SwNewUserIdxDlg : public weld::GenericDialogController { - VclPtr<OKButton> m_pOKPB; - VclPtr<Edit> m_pNameED; - SwIndexMarkPane* m_pDlg; - DECL_LINK( ModifyHdl, Edit&, void); + std::unique_ptr<weld::Button> m_xOKPB; + std::unique_ptr<weld::Entry> m_xNameED; - public: - explicit SwNewUserIdxDlg(SwIndexMarkPane* pPane) - : ModalDialog(&(pPane->GetDialog()), "NewUserIndexDialog", - "modules/swriter/ui/newuserindexdialog.ui") - , m_pDlg(pPane) - { - get(m_pOKPB, "ok"); - get(m_pNameED, "entry"); - m_pNameED->SetModifyHdl(LINK(this, SwNewUserIdxDlg, ModifyHdl)); - m_pOKPB->Enable(false); - m_pNameED->GrabFocus(); - } - virtual ~SwNewUserIdxDlg() override { disposeOnce(); } - virtual void dispose() override + DECL_LINK(ModifyHdl, weld::Entry&, void); + +public: + explicit SwNewUserIdxDlg(SwIndexMarkPane* pPane) + : GenericDialogController(pPane->GetFrameWeld(), "modules/swriter/ui/newuserindexdialog.ui", "NewUserIndexDialog") + , m_pDlg(pPane) + , m_xOKPB(m_xBuilder->weld_button("ok")) + , m_xNameED(m_xBuilder->weld_entry("entry")) { - m_pOKPB.clear(); - m_pNameED.clear(); - ModalDialog::dispose(); + m_xNameED->connect_changed(LINK(this, SwNewUserIdxDlg, ModifyHdl)); + m_xOKPB->set_sensitive(false); + m_xNameED->grab_focus(); } - - OUString GetName(){return m_pNameED->GetText();} + OUString GetName() const { return m_xNameED->get_text(); } }; -IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, Edit&, rEdit, void) +IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, weld::Entry&, rEdit, void) { - m_pOKPB->Enable(!rEdit.GetText().isEmpty() && !m_pDlg->IsTOXType(rEdit.GetText())); + m_xOKPB->set_sensitive(!rEdit.get_text().isEmpty() && !m_pDlg->IsTOXType(rEdit.get_text())); } IMPL_LINK_NOARG(SwIndexMarkPane, NewUserIdxHdl, Button*, void) { - ScopedVclPtrInstance< SwNewUserIdxDlg > pDlg(this); - if(RET_OK == pDlg->Execute()) + SwNewUserIdxDlg aDlg(this); + if (aDlg.run() == RET_OK) { - OUString sNewName(pDlg->GetName()); + OUString sNewName(aDlg.GetName()); m_pTypeDCB->InsertEntry(sNewName); m_pTypeDCB->SelectEntry(sNewName); } diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx index 0b4010d1a92e..12b04046ec32 100644 --- a/sw/source/uibase/inc/swuiidxmrk.hxx +++ b/sw/source/uibase/inc/swuiidxmrk.hxx @@ -144,7 +144,7 @@ public: bool bNewDlg, SwWrtShell& rWrtShell); - Dialog &GetDialog() { return m_rDialog; } + weld::Window* GetFrameWeld() { return m_rDialog.GetFrameWeld(); } ~SwIndexMarkPane(); diff --git a/sw/uiconfig/swriter/ui/newuserindexdialog.ui b/sw/uiconfig/swriter/ui/newuserindexdialog.ui index ab4051f0de45..c5b06e755d0d 100644 --- a/sw/uiconfig/swriter/ui/newuserindexdialog.ui +++ b/sw/uiconfig/swriter/ui/newuserindexdialog.ui @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> - <!-- interface-requires gtk+ 3.0 --> - <!-- interface-requires LibreOffice 1.0 --> + <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="NewUserIndexDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="newuserindexdialog|NewUserIndexDialog">Create New User-defined Index</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"> @@ -58,6 +61,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -96,16 +100,14 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="newuserindexdialog|label2">_Name</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -113,12 +115,11 @@ <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> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -149,5 +150,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits