Kaydet (Commit) 6b703887 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld AssignComponentDialog

Change-Id: I09fac24b81248bc27128d9142487301d4dc8ea6a
Reviewed-on: https://gerrit.libreoffice.org/54440Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst c899ad34
......@@ -622,13 +622,13 @@ long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton*
)
)
{
ScopedVclPtrInstance< AssignComponentDialog > pAssignDlg( pThis, sEventURL );
AssignComponentDialog aAssignDlg(pThis->GetFrameWeld(), sEventURL);
short ret = pAssignDlg->Execute();
short ret = aAssignDlg.run();
if( ret )
{
sEventType = "UNO";
sEventURL = pAssignDlg->getURL();
sEventURL = aAssignDlg.getURL();
if(!pThis->bAppEvents)
pThis->bDocModified = true;
}
......@@ -821,45 +821,37 @@ SvxMacroAssignDlg::SvxMacroAssignDlg( vcl::Window* pParent, const Reference< fra
SetTabPage(VclPtr<SvxMacroTabPage>::Create(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex));
}
IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, Button*, void)
IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, weld::Button&, void)
{
OUString aMethodName = mpMethodEdit->GetText();
OUString aMethodName = mxMethodEdit->get_text();
maURL.clear();
if( !aMethodName.isEmpty() )
{
maURL = aVndSunStarUNO;
maURL += aMethodName;
}
EndDialog(1);
m_xDialog->response(RET_OK);
}
AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUString& rURL )
: ModalDialog( pParent, "AssignComponent", "cui/ui/assigncomponentdialog.ui" )
AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, const OUString& rURL)
: GenericDialogController(pParent, "cui/ui/assigncomponentdialog.ui", "AssignComponent")
, maURL( rURL )
, mxMethodEdit(m_xBuilder->weld_entry("methodEntry"))
, mxOKButton(m_xBuilder->weld_button("ok"))
{
get(mpMethodEdit, "methodEntry");
get(mpOKButton, "ok");
mpOKButton->SetClickHdl(LINK(this, AssignComponentDialog, ButtonHandler));
mxOKButton->connect_clicked(LINK(this, AssignComponentDialog, ButtonHandler));
OUString aMethodName;
if( maURL.startsWith( aVndSunStarUNO ) )
{
aMethodName = maURL.copy( strlen(aVndSunStarUNO) );
}
mpMethodEdit->SetText( aMethodName, Selection( 0, SELECTION_MAX ) );
mxMethodEdit->set_text(aMethodName);
mxMethodEdit->select_region(0, -1);
}
AssignComponentDialog::~AssignComponentDialog()
{
disposeOnce();
}
void AssignComponentDialog::dispose()
{
mpMethodEdit.clear();
mpOKButton.clear();
ModalDialog::dispose();
}
IMPL_LINK_NOARG( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, void )
......
......@@ -37,23 +37,21 @@ public:
bool bIDEDialogMode;
};
class AssignComponentDialog : public ModalDialog
class AssignComponentDialog : public weld::GenericDialogController
{
private:
VclPtr<Edit> mpMethodEdit;
VclPtr<OKButton> mpOKButton;
OUString maURL;
DECL_LINK(ButtonHandler, Button*, void);
std::unique_ptr<weld::Entry> mxMethodEdit;
std::unique_ptr<weld::Button> mxOKButton;
DECL_LINK(ButtonHandler, weld::Button&, void);
public:
AssignComponentDialog( vcl::Window * pParent, const OUString& rURL );
AssignComponentDialog(weld::Window* pParent, const OUString& rURL);
virtual ~AssignComponentDialog() override;
virtual void dispose() override;
const OUString& getURL() const
{ return maURL; }
const OUString& getURL() const { return maURL; }
};
#endif
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="AssignComponent">
......@@ -8,18 +8,24 @@
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="assigncomponentdialog|AssignComponent">Assign Component</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>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
......@@ -65,6 +71,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
......@@ -101,6 +108,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">False</property>
......
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