[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/uiconfig
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Feb 14 14:52:13 UTC 2019
vcl/inc/printdlg.hxx | 13 ++++-----
vcl/source/window/printdlg.cxx | 46 ++++++++++++-----------------------
vcl/uiconfig/ui/moreoptionsdialog.ui | 14 +++++++---
3 files changed, 33 insertions(+), 40 deletions(-)
New commits:
commit 377f7049325bf4e573ac2815b4f4255604d966c2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 14 09:35:14 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Feb 14 15:51:44 2019 +0100
weld MoreOptionsDialog
Change-Id: I2fd6ffcbd03e1b797634bdb4646f1951cd665a1c
Reviewed-on: https://gerrit.libreoffice.org/67810
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 13cdd5e3a4d6..05985ecdc309 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -40,20 +40,19 @@ namespace vcl {
namespace vcl
{
- class MoreOptionsDialog : public ModalDialog
+ class MoreOptionsDialog : public weld::GenericDialogController
{
VclPtr<PrintDialog> mpParent;
- VclPtr<OKButton> mpOKButton;
- VclPtr<CancelButton> mpCancelButton;
- VclPtr<CheckBox> mpSingleJobsBox;
+ std::unique_ptr<weld::Button> mxOKButton;
+ std::unique_ptr<weld::Button> mxCancelButton;
+ std::unique_ptr<weld::CheckButton> mxSingleJobsBox;
- DECL_LINK( ClickHdl, Button*, void );
+ DECL_LINK( ClickHdl, weld::Button&, void );
public:
MoreOptionsDialog( VclPtr<PrintDialog> i_pParent );
virtual ~MoreOptionsDialog() override;
- virtual void dispose() override;
};
class PrintDialog : public ModalDialog
@@ -134,7 +133,7 @@ namespace vcl
std::shared_ptr<PrinterController> maPController;
- VclPtr< MoreOptionsDialog > mpMoreOptionsDlg;
+ std::unique_ptr<MoreOptionsDialog> mxMoreOptionsDlg;
VclPtr<TabControl> mpTabCtrl;
VclPtr<VclFrame> mpPageLayoutFrame;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 861a33662d87..36a84c8bc2d0 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -80,48 +80,36 @@ namespace {
}
}
-MoreOptionsDialog::MoreOptionsDialog( VclPtr<PrintDialog> i_pParent )
- : ModalDialog(i_pParent, "MoreOptionsDialog", "vcl/ui/moreoptionsdialog.ui")
+MoreOptionsDialog::MoreOptionsDialog(VclPtr<PrintDialog> i_pParent)
+ : GenericDialogController(i_pParent->GetFrameWeld(), "vcl/ui/moreoptionsdialog.ui", "MoreOptionsDialog")
, mpParent( i_pParent )
+ , mxOKButton(m_xBuilder->weld_button("ok"))
+ , mxCancelButton(m_xBuilder->weld_button("cancel"))
+ , mxSingleJobsBox(m_xBuilder->weld_check_button("singlejobs"))
{
- get(mpOKButton, "ok");
- get(mpCancelButton, "cancel");
- get(mpSingleJobsBox, "singlejobs");
-
- mpSingleJobsBox->Check( mpParent->isSingleJobs() );
+ mxSingleJobsBox->set_active( mpParent->isSingleJobs() );
- mpOKButton->SetClickHdl( LINK( this, MoreOptionsDialog, ClickHdl ) );
- mpCancelButton->SetClickHdl( LINK( this, MoreOptionsDialog, ClickHdl ) );
+ mxOKButton->connect_clicked( LINK( this, MoreOptionsDialog, ClickHdl ) );
+ mxCancelButton->connect_clicked( LINK( this, MoreOptionsDialog, ClickHdl ) );
}
MoreOptionsDialog::~MoreOptionsDialog()
{
- disposeOnce();
}
-void MoreOptionsDialog::dispose()
+IMPL_LINK (MoreOptionsDialog, ClickHdl, weld::Button&, rButton, void)
{
- mpOKButton.clear();
- mpCancelButton.clear();
- mpSingleJobsBox.clear();
- mpParent.clear();
- ModalDialog::dispose();
-}
-
-IMPL_LINK ( MoreOptionsDialog, ClickHdl, Button*, pButton, void )
-{
- if ( pButton == mpOKButton )
+ if (&rButton == mxOKButton.get())
{
- mpParent->mbSingleJobs = mpSingleJobsBox->IsChecked();
- EndDialog( RET_OK );
+ mpParent->mbSingleJobs = mxSingleJobsBox->get_active();
+ m_xDialog->response(RET_OK);
}
- else if ( pButton == mpCancelButton )
+ else if (&rButton == mxCancelButton.get())
{
- EndDialog( RET_CANCEL );
+ m_xDialog->response(RET_CANCEL);
}
}
-
PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent )
: Window( i_pParent, 0 )
, maMtf()
@@ -754,7 +742,7 @@ void PrintDialog::dispose()
mpNupOrderWin.clear();
mpNupOrderTxt.clear();
mpBorderCB.clear();
- mpMoreOptionsDlg.disposeAndClear();
+ mxMoreOptionsDlg.reset();
ModalDialog::dispose();
}
@@ -1890,8 +1878,8 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void )
}
else if ( pButton == mpMoreOptionsBtn )
{
- mpMoreOptionsDlg = VclPtr< MoreOptionsDialog >::Create( this );
- mpMoreOptionsDlg->Execute();
+ mxMoreOptionsDlg.reset(new MoreOptionsDialog(this));
+ mxMoreOptionsDlg->run();
}
else
{
diff --git a/vcl/uiconfig/ui/moreoptionsdialog.ui b/vcl/uiconfig/ui/moreoptionsdialog.ui
index decde6d3ba41..4247fae4ab7a 100644
--- a/vcl/uiconfig/ui/moreoptionsdialog.ui
+++ b/vcl/uiconfig/ui/moreoptionsdialog.ui
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.4 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="vcl">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="MoreOptionsDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="moreoptionsdialog|moreprintingoptions">More Printing Options</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="box">
<property name="can_focus">False</property>
@@ -21,6 +27,7 @@
<property name="label" context="moreoptionsdialog|ok">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
@@ -35,6 +42,8 @@
<property name="label" context="moreoptionsdialog|cancel">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
@@ -81,8 +90,5 @@
</child>
</object>
</child>
- <child>
- <placeholder/>
- </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list