Kaydet (Commit) 2632adfb authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SfxCheckinDialog

Change-Id: Iaa7954baf734229683acb81819daa332b02a7733
Reviewed-on: https://gerrit.libreoffice.org/54624Tested-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 c3a49376
......@@ -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
......
......@@ -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: */
......@@ -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 );
......
<?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>
......
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