[Libreoffice-commits] core.git: svx/source svx/uiconfig
Caolán McNamara
caolanm at redhat.com
Mon May 14 13:04:33 UTC 2018
svx/source/form/datanavi.cxx | 42 +++++++++++++++-----------------------
svx/source/inc/datanavi.hxx | 20 ++++++++----------
svx/uiconfig/ui/addmodeldialog.ui | 11 ++++++++-
3 files changed, 35 insertions(+), 38 deletions(-)
New commits:
commit 2cc5db624408b9853200f7ffe09ab2f954c2ae6c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 14 12:27:57 2018 +0100
weld AddModelDialog
Change-Id: Ia12069f966c93ad7700b7a068dd7660284a40130
Reviewed-on: https://gerrit.libreoffice.org/54314
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 7d97015284b4..2446606e373d 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -1485,15 +1485,15 @@ namespace svxform
OString sIdent(pBtn->GetCurItemIdent());
if (sIdent == "modelsadd")
{
- ScopedVclPtrInstance< AddModelDialog > aDlg( this, false );
+ AddModelDialog aDlg(GetFrameWeld(), false);
bool bShowDialog = true;
while ( bShowDialog )
{
bShowDialog = false;
- if ( aDlg->Execute() == RET_OK )
+ if (aDlg.run() == RET_OK)
{
- OUString sNewName = aDlg->GetName();
- bool bDocumentData = aDlg->GetModifyDoc();
+ OUString sNewName = aDlg.GetName();
+ bool bDocumentData = aDlg.GetModifyDoc();
if ( m_pModelsBox->GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND )
{
@@ -1531,8 +1531,8 @@ namespace svxform
}
else if (sIdent == "modelsedit")
{
- ScopedVclPtrInstance< AddModelDialog > aDlg( this, true );
- aDlg->SetName( sSelectedModel );
+ AddModelDialog aDlg(GetFrameWeld(), true);
+ aDlg.SetName( sSelectedModel );
bool bDocumentData( false );
try
@@ -1548,13 +1548,13 @@ namespace svxform
{
DBG_UNHANDLED_EXCEPTION("svx");
}
- aDlg->SetModifyDoc( bDocumentData );
+ aDlg.SetModifyDoc( bDocumentData );
- if ( aDlg->Execute() == RET_OK )
+ if (aDlg.run() == RET_OK)
{
- if ( aDlg->GetModifyDoc() != bDocumentData )
+ if ( aDlg.GetModifyDoc() != bDocumentData )
{
- bDocumentData = aDlg->GetModifyDoc();
+ bDocumentData = aDlg.GetModifyDoc();
try
{
Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
@@ -1569,7 +1569,7 @@ namespace svxform
}
}
- OUString sNewName = aDlg->GetName();
+ OUString sNewName = aDlg.GetName();
if ( !sNewName.isEmpty() && ( sNewName != sSelectedModel ) )
{
try
@@ -3317,26 +3317,18 @@ namespace svxform
m_pRefBtn->Enable( m_xTempBinding.is() );
}
- AddModelDialog::AddModelDialog(vcl::Window* pParent, bool bIsEdit)
- : ModalDialog(pParent, "AddModelDialog", "svx/ui/addmodeldialog.ui")
+ AddModelDialog::AddModelDialog(weld::Window* pParent, bool bIsEdit)
+ : GenericDialogController(pParent, "svx/ui/addmodeldialog.ui", "AddModelDialog")
+ , m_xNameED(m_xBuilder->weld_entry("name"))
+ , m_xModifyCB(m_xBuilder->weld_check_button("modify"))
+ , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
{
- get(m_pNameED, "name");
- get(m_pModifyCB, "modify");
-
if (bIsEdit)
- SetText(get<FixedText>("alttitle")->GetText());
+ m_xDialog->set_title(m_xAltTitle->get_label());
}
AddModelDialog::~AddModelDialog()
{
- disposeOnce();
- }
-
- void AddModelDialog::dispose()
- {
- m_pNameED.clear();
- m_pModifyCB.clear();
- ModalDialog::dispose();
}
AddInstanceDialog::AddInstanceDialog(weld::Window* pParent, bool _bEdit)
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index cc66523361aa..786d4f767d81 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -583,26 +583,24 @@ namespace svxform
const css::uno::Reference< css::xforms::XSubmission >& GetNewSubmission() const { return m_xNewSubmission; }
};
-
- class AddModelDialog : public ModalDialog
+ class AddModelDialog : public weld::GenericDialogController
{
private:
- VclPtr<Edit> m_pNameED;
- VclPtr<CheckBox> m_pModifyCB;
+ std::unique_ptr<weld::Entry> m_xNameED;
+ std::unique_ptr<weld::CheckButton> m_xModifyCB;
+ std::unique_ptr<weld::Label> m_xAltTitle;
public:
- AddModelDialog( vcl::Window* pParent, bool _bEdit );
+ AddModelDialog(weld::Window* pParent, bool _bEdit);
virtual ~AddModelDialog() override;
- virtual void dispose() override;
- OUString GetName() const { return m_pNameED->GetText(); }
- void SetName( const OUString& _rName ) { m_pNameED->SetText( _rName );}
+ OUString GetName() const { return m_xNameED->get_text(); }
+ void SetName( const OUString& _rName ) { m_xNameED->set_text( _rName );}
- bool GetModifyDoc() const { return m_pModifyCB->IsChecked(); }
- void SetModifyDoc( const bool bModify ) { m_pModifyCB->Check( bModify ); }
+ bool GetModifyDoc() const { return m_xModifyCB->get_active(); }
+ void SetModifyDoc( const bool bModify ) { m_xModifyCB->set_active(bModify); }
};
-
class AddInstanceDialog : public weld::GenericDialogController
{
private:
diff --git a/svx/uiconfig/ui/addmodeldialog.ui b/svx/uiconfig/ui/addmodeldialog.ui
index 73fd66811171..a03647704edf 100644
--- a/svx/uiconfig/ui/addmodeldialog.ui
+++ b/svx/uiconfig/ui/addmodeldialog.ui
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="AddModelDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="addmodeldialog|AddModelDialog">Add Model</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>
@@ -97,6 +103,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="left_attach">1</property>
@@ -107,10 +114,10 @@
<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="addmodeldialog|label2">_Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
More information about the Libreoffice-commits
mailing list