diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-07 15:18:59 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-07 15:19:34 +0100 |
commit | 207ed1b1a17ca6d785cad936ecadcd160acc2b83 (patch) | |
tree | 620205f5f7aa14d9dab6d8d6a954c0449094bae3 | |
parent | b7686e41f1bbf655a4e3a5f142a5520faecfa6bc (diff) |
CMIS: added CheckIn dialog
Change-Id: Iba938986478b880b7026285f607972a2e4d72283
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/UI_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/checkin.hxx | 35 | ||||
-rw-r--r-- | sfx2/source/dialog/checkin.cxx | 39 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 20 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/checkin.ui | 132 |
6 files changed, 220 insertions, 8 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index eae3511b8511..8a12ad9e9911 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -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 \ diff --git a/sfx2/UI_sfx.mk b/sfx2/UI_sfx.mk index a084da170522..c164884df217 100644 --- a/sfx2/UI_sfx.mk +++ b/sfx2/UI_sfx.mk @@ -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 \ )) diff --git a/sfx2/inc/sfx2/checkin.hxx b/sfx2/inc/sfx2/checkin.hxx new file mode 100644 index 000000000000..65aa2e75cd1b --- /dev/null +++ b/sfx2/inc/sfx2/checkin.hxx @@ -0,0 +1,35 @@ +/* -*- 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: */ diff --git a/sfx2/source/dialog/checkin.cxx b/sfx2/source/dialog/checkin.cxx new file mode 100644 index 000000000000..a2bac2570771 --- /dev/null +++ b/sfx2/source/dialog/checkin.cxx @@ -0,0 +1,39 @@ +/* -*- 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: */ diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 490a72bf54b1..2412dcc7b744 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -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 ) { diff --git a/sfx2/uiconfig/ui/checkin.ui b/sfx2/uiconfig/ui/checkin.ui new file mode 100644 index 000000000000..c97657d380fc --- /dev/null +++ b/sfx2/uiconfig/ui/checkin.ui @@ -0,0 +1,132 @@ +<?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> |