Kaydet (Commit) 207ed1b1 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

CMIS: added CheckIn dialog

Change-Id: Iba938986478b880b7026285f607972a2e4d72283
üst b7686e41
......@@ -147,6 +147,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/control/unoctitm \
sfx2/source/dialog/alienwarn \
sfx2/source/dialog/basedlgs \
sfx2/source/dialog/checkin \
sfx2/source/dialog/dinfdlg \
sfx2/source/dialog/dinfedt \
sfx2/source/dialog/dockwin \
......
......@@ -10,6 +10,7 @@
$(eval $(call gb_UI_UI,sfx))
$(eval $(call gb_UI_add_uifiles,sfx,\
sfx2/uiconfig/ui/checkin \
sfx2/uiconfig/ui/password \
))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _SFX_CHECKIN_HXX
#define _SFX_CHECKIN_HXX
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/edit.hxx>
class SfxCheckinDialog : public ModalDialog
{
private:
Edit* m_pCommentED;
CheckBox* m_pMajorCB;
OKButton* m_pOKBtn;
DECL_DLLPRIVATE_LINK(OKHdl, void *);
public:
SfxCheckinDialog( Window* pParent );
rtl::OUString GetComment( );
bool IsMajor( );
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <sfx2/checkin.hxx>
#include <vcl/msgbox.hxx>
SfxCheckinDialog::SfxCheckinDialog( Window* pParent ) :
ModalDialog( pParent, "CheckinDialog", "sfx/ui/checkin.ui" )
{
get( m_pCommentED, "VersionComment" );
get( m_pMajorCB, "MajorVersion" );
get( m_pOKBtn, "ok" );
m_pOKBtn->SetClickHdl( LINK( this, SfxCheckinDialog, OKHdl ) );
}
rtl::OUString SfxCheckinDialog::GetComment( )
{
return m_pCommentED->GetText( );
}
bool SfxCheckinDialog::IsMajor( )
{
return m_pMajorCB->IsChecked( );
}
IMPL_LINK_NOARG( SfxCheckinDialog, OKHdl )
{
EndDialog( RET_OK );
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -87,6 +87,7 @@
#include "sfx2/sfxhelp.hxx"
#include <sfx2/msgpool.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/checkin.hxx>
#include "../appl/app.hrc"
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
......@@ -366,7 +367,6 @@ void SfxObjectShell::CancelCheckOut( )
try
{
uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
// TODO Pop up dialog to ask whether to loose data or not
xCmisDoc->cancelCheckOut( );
}
catch ( const uno::RuntimeException& e )
......@@ -382,13 +382,17 @@ void SfxObjectShell::CheckIn( )
try
{
uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
sal_Bool bIsMajor = sal_False;
rtl::OUString sComment( "Some sample comment" );
// TODO Pop up dialog to ask for comment and major
xCmisDoc->checkIn( bIsMajor, sComment );
uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
if ( xModifiable.is( ) )
xModifiable->setModified( sal_False );
// Pop up dialog to ask for comment and major
SfxCheckinDialog checkinDlg( &GetFrame( )->GetWindow( ) );
if ( checkinDlg.Execute( ) == RET_OK )
{
rtl::OUString sComment = checkinDlg.GetComment( );
sal_Bool bMajor = checkinDlg.IsMajor( );
xCmisDoc->checkIn( bMajor, sComment );
uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
if ( xModifiable.is( ) )
xModifiable->setModified( sal_False );
}
}
catch ( const uno::RuntimeException& e )
{
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="CheckinDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Check-in</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="ypad">8</property>
<property name="label" translatable="yes">Version comment</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</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="wrap_mode">word</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="MajorVersion">
<property name="label" translatable="yes">New major version</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
</action-widgets>
</object>
</interface>
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