diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-21 12:14:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-21 21:39:50 +0200 |
commit | 2632adfbc2a664ab99de7e24d6fcd6841a10b6f1 (patch) | |
tree | 1e703ffbb0e4a77d3b372f74303edd0824d6f4e0 | |
parent | c3a4937604fc296f3f6bf4dee48f224f255b9ffc (diff) |
weld SfxCheckinDialog
Change-Id: Iaa7954baf734229683acb81819daa332b02a7733
Reviewed-on: https://gerrit.libreoffice.org/54624
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/checkin.hxx | 28 | ||||
-rw-r--r-- | sfx2/source/dialog/checkin.cxx | 30 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 6 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/checkin.ui | 43 |
4 files changed, 54 insertions, 53 deletions
diff --git a/include/sfx2/checkin.hxx b/include/sfx2/checkin.hxx index 77a8085b3f11..054c82cd7a7d 100644 --- a/include/sfx2/checkin.hxx +++ b/include/sfx2/checkin.hxx @@ -9,27 +9,23 @@ #ifndef INCLUDED_SFX2_CHECKIN_HXX #define INCLUDED_SFX2_CHECKIN_HXX -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/edit.hxx> +#include <vcl/weld.hxx> -class SfxCheckinDialog : public ModalDialog +class SfxCheckinDialog : public weld::GenericDialogController { - private: - VclPtr<Edit> m_pCommentED; - VclPtr<CheckBox> m_pMajorCB; +private: + std::unique_ptr<weld::TextView> m_xCommentED; + std::unique_ptr<weld::CheckButton> m_xMajorCB; + std::unique_ptr<weld::Button> m_xOKBtn; - VclPtr<OKButton> m_pOKBtn; + DECL_LINK(OKHdl, weld::Button&, void); - DECL_LINK(OKHdl, Button*, void); +public: + SfxCheckinDialog(weld::Window* pParent); + virtual ~SfxCheckinDialog() override; - public: - SfxCheckinDialog( vcl::Window* pParent ); - virtual ~SfxCheckinDialog() override; - virtual void dispose() override; - - OUString GetComment( ); - bool IsMajor( ); + OUString GetComment(); + bool IsMajor(); }; #endif diff --git a/sfx2/source/dialog/checkin.cxx b/sfx2/source/dialog/checkin.cxx index 60cd7e145cff..b4834eca5535 100644 --- a/sfx2/source/dialog/checkin.cxx +++ b/sfx2/source/dialog/checkin.cxx @@ -9,42 +9,32 @@ #include <sfx2/checkin.hxx> -SfxCheckinDialog::SfxCheckinDialog( vcl::Window* pParent ) : - ModalDialog( pParent, "CheckinDialog", "sfx/ui/checkin.ui" ) +SfxCheckinDialog::SfxCheckinDialog(weld::Window* pParent) + : GenericDialogController( pParent, "sfx/ui/checkin.ui", "CheckinDialog") + , m_xCommentED(m_xBuilder->weld_text_view("VersionComment")) + , m_xMajorCB(m_xBuilder->weld_check_button("MajorVersion")) + , m_xOKBtn(m_xBuilder->weld_button("ok")) { - get( m_pCommentED, "VersionComment" ); - get( m_pMajorCB, "MajorVersion" ); - - get( m_pOKBtn, "ok" ); - m_pOKBtn->SetClickHdl( LINK( this, SfxCheckinDialog, OKHdl ) ); + m_xOKBtn->connect_clicked(LINK(this, SfxCheckinDialog, OKHdl)); } SfxCheckinDialog::~SfxCheckinDialog() { - disposeOnce(); -} - -void SfxCheckinDialog::dispose() -{ - m_pCommentED.clear(); - m_pMajorCB.clear(); - m_pOKBtn.clear(); - ModalDialog::dispose(); } OUString SfxCheckinDialog::GetComment( ) { - return m_pCommentED->GetText( ); + return m_xCommentED->get_text(); } bool SfxCheckinDialog::IsMajor( ) { - return m_pMajorCB->IsChecked( ); + return m_xMajorCB->get_active(); } -IMPL_LINK_NOARG( SfxCheckinDialog, OKHdl, Button*, void ) +IMPL_LINK_NOARG(SfxCheckinDialog, OKHdl, weld::Button&, void ) { - EndDialog( RET_OK ); + m_xDialog->response(RET_OK); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 009e2a6a1a77..fb4bb7ca7a28 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -353,10 +353,10 @@ void SfxObjectShell::CheckIn( ) { uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW ); // Pop up dialog to ask for comment and major - ScopedVclPtrInstance< SfxCheckinDialog > checkinDlg(&GetFrame( )->GetWindow( )); - if ( checkinDlg->Execute( ) == RET_OK ) + SfxCheckinDialog checkinDlg(GetFrame()->GetWindow().GetFrameWeld()); + if (checkinDlg.run() == RET_OK) { - xCmisDoc->checkIn( checkinDlg->IsMajor(), checkinDlg->GetComment() ); + xCmisDoc->checkIn(checkinDlg.IsMajor(), checkinDlg.GetComment()); uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY ); if ( xModifiable.is( ) ) xModifiable->setModified( false ); diff --git a/sfx2/uiconfig/ui/checkin.ui b/sfx2/uiconfig/ui/checkin.ui index abae0259a6e2..6eee5cacbdd1 100644 --- a/sfx2/uiconfig/ui/checkin.ui +++ b/sfx2/uiconfig/ui/checkin.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sfx"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="CheckinDialog"> @@ -9,7 +9,12 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</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> @@ -95,30 +100,40 @@ </packing> </child> <child> - <object class="GtkTextView" id="VersionComment:border"> - <property name="width_request">300</property> - <property name="height_request">150</property> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="wrap_mode">word</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="checkin|label2">Version comment:</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkLabel" id="label2"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes" context="checkin|label2">Version comment:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">VersionComment:border</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTextView" id="VersionComment"> + <property name="width_request">300</property> + <property name="height_request">150</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="wrap_mode">word</property> + </object> + </child> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="top_attach">1</property> </packing> </child> </object> |