Kaydet (Commit) 19dd424d authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwNewUserIdxDlg

Change-Id: I49502af0b045116fba32259d8ada80b1e53a79a8
Reviewed-on: https://gerrit.libreoffice.org/52332Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 96300e32
......@@ -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);
}
......
......@@ -144,7 +144,7 @@ public:
bool bNewDlg,
SwWrtShell& rWrtShell);
Dialog &GetDialog() { return m_rDialog; }
weld::Window* GetFrameWeld() { return m_rDialog.GetFrameWeld(); }
~SwIndexMarkPane();
......
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment