summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-09 17:11:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-10 09:50:06 +0100
commit137e4bd885a913cb201d92dfc7815b2821986d49 (patch)
treea3a1e007ee2c294dc794f5a7d941936c4fcb7bab
parentc6de82163e990478aa6448cf5b6537bcca1b80b5 (diff)
convert version comment dialog to .ui format
Change-Id: I7bbcc19062883932bf2e2fd68928f3f5624c4748
-rw-r--r--sfx2/UIConfig_sfx.mk3
-rw-r--r--sfx2/source/dialog/dialog.hrc2
-rw-r--r--sfx2/source/dialog/versdlg.cxx70
-rw-r--r--sfx2/source/dialog/versdlg.src60
-rw-r--r--sfx2/source/inc/versdlg.hxx22
-rw-r--r--sfx2/uiconfig/ui/versioncommentdialog.ui160
6 files changed, 204 insertions, 113 deletions
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 2adb858dc84c..b865a7161d59 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/checkin \
sfx2/uiconfig/ui/custominfopage \
sfx2/uiconfig/ui/descriptioninfopage \
+ sfx2/uiconfig/ui/documentfontspage \
sfx2/uiconfig/ui/documentinfopage \
sfx2/uiconfig/ui/documentpropertiesdialog \
sfx2/uiconfig/ui/licensedialog \
@@ -23,7 +24,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/querysavedialog \
sfx2/uiconfig/ui/securityinfopage \
sfx2/uiconfig/ui/singletabdialog \
- sfx2/uiconfig/ui/documentfontspage \
+ sfx2/uiconfig/ui/versioncommentdialog \
))
# vim: set noet sw=4 ts=4:
diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc
index a0158afe6606..51c85a4a3bb5 100644
--- a/sfx2/source/dialog/dialog.hrc
+++ b/sfx2/source/dialog/dialog.hrc
@@ -48,7 +48,7 @@
#define MN_CONTEXT_TEMPLDLG ( RC_DIALOG_BEGIN + 46)
#define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 )
-#define DLG_COMMENTS ( RC_DIALOG_BEGIN + 70 )
+
#define STR_VIEWVERSIONCOMMENT ( RC_DIALOG_BEGIN + 71 )
#define MSG_ERROR_WRONG_CONFIRM ( RC_DIALOG_BEGIN + 76 )
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 41ade0fe68d1..d4976c4a2186 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -375,7 +375,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
{
SfxVersionInfo aInfo;
aInfo.aAuthor = SvtUserOptions().GetFullName();
- SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl( this, aInfo, sal_True );
+ SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, aInfo, true);
short nRet = pDlg->Execute();
if ( nRet == RET_OK )
{
@@ -409,7 +409,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
else if ( pButton == &aViewButton && pEntry )
{
SfxVersionInfo* pInfo = (SfxVersionInfo*) pEntry->GetUserData();
- SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl( this, *pInfo, sal_False );
+ SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, *pInfo, false);
pDlg->Execute();
delete pDlg;
}
@@ -435,54 +435,46 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
return 0L;
}
-SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl ( Window *pParent, SfxVersionInfo& rInfo, sal_Bool bEdit )
- : SfxModalDialog( pParent, SfxResId( DLG_COMMENTS ) )
- , aDateTimeText( this, SfxResId( FT_DATETIME ) )
- , aSavedByText( this, SfxResId( FT_SAVEDBY ) )
- , aEdit( this, SfxResId( ME_VERSIONS ) )
- , aOKButton( this, SfxResId( PB_OK ) )
- , aCancelButton( this, SfxResId( PB_CANCEL ) )
- , aCloseButton( this, SfxResId( PB_CLOSE ) )
- , aHelpButton( this, SfxResId( PB_HELP ) )
- , pInfo( &rInfo )
+SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit)
+ : SfxModalDialog(pParent, "VersionCommentDialog", "sfx/ui/versioncommentdialog.ui")
+ , m_rInfo(rInfo)
{
- FreeResource();
+ get(m_pDateTimeText, "timestamp");
+ get(m_pSavedByText, "author");
+ get(m_pEdit, "textview");
+ get(m_pOKButton, "ok");
+ get(m_pCancelButton, "cancel");
+ get(m_pCloseButton, "close");
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
- aDateTimeText.SetText( aDateTimeText.GetText() + ConvertDateTime_Impl( pInfo->aCreationDate, rLocaleWrapper ) );
- aSavedByText.SetText( aSavedByText.GetText() + pInfo->aAuthor );
- aEdit.SetText( rInfo.aComment );
-
- aCloseButton.SetClickHdl ( LINK( this, SfxViewVersionDialog_Impl, ButtonHdl ) );
- aOKButton.SetClickHdl ( LINK( this, SfxViewVersionDialog_Impl, ButtonHdl ) );
-
- aEdit.GrabFocus();
- if ( !bEdit )
+ m_pDateTimeText->SetText(m_pDateTimeText->GetText() + ConvertDateTime_Impl(rInfo.aCreationDate, rLocaleWrapper));
+ m_pSavedByText->SetText(m_pSavedByText->GetText() + rInfo.aAuthor);
+ m_pEdit->SetText(rInfo.aComment);
+ m_pEdit->set_height_request(7 * m_pEdit->GetTextHeight());
+ m_pEdit->set_width_request(40 * m_pEdit->approximate_char_width());
+ m_pOKButton->SetClickHdl(LINK(this, SfxViewVersionDialog_Impl, ButtonHdl));
+
+ if (!bEdit)
{
- aOKButton.Hide();
- aCancelButton.Hide();
- aEdit.SetReadOnly( sal_True );
- SetText( SfxResId( STR_VIEWVERSIONCOMMENT ) );
+ m_pOKButton->Hide();
+ m_pCancelButton->Hide();
+ m_pEdit->SetReadOnly(true);
+ SetText(SfxResId(STR_VIEWVERSIONCOMMENT));
+ m_pCloseButton->GrabFocus();
}
else
{
- aDateTimeText.Hide();
- aCloseButton.Hide();
+ m_pDateTimeText->Hide();
+ m_pCloseButton->Hide();
+ m_pEdit->GrabFocus();
}
}
-IMPL_LINK( SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton )
+IMPL_LINK(SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton)
{
- if ( pButton == &aCloseButton )
- {
- EndDialog( RET_CANCEL );
- }
- else if ( pButton == &aOKButton )
- {
- pInfo->aComment = aEdit.GetText();
- EndDialog( RET_OK );
- }
-
+ assert(pButton == m_pOKButton);
+ m_rInfo.aComment = m_pEdit->GetText();
+ EndDialog(RET_OK);
return 0L;
}
diff --git a/sfx2/source/dialog/versdlg.src b/sfx2/source/dialog/versdlg.src
index 8dbab6fee5ef..5b02a4b90a9b 100644
--- a/sfx2/source/dialog/versdlg.src
+++ b/sfx2/source/dialog/versdlg.src
@@ -126,66 +126,6 @@ ModalDialog DLG_VERSIONS
};
Text [ en-US ] = "Versions of" ;
};
-ModalDialog DLG_COMMENTS
-{
- HelpID = "sfx2:ModalDialog:DLG_COMMENTS";
- OutputSize = TRUE ;
- Size = MAP_APPFONT ( 180 , 118 ) ;
- SvLook = TRUE ;
- Moveable = TRUE ;
- FixedText FT_DATETIME
- {
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 168 , 10 ) ;
- Text [ en-US ] = "Date and time: " ;
- };
- FixedText FT_SAVEDBY
- {
- Pos = MAP_APPFONT ( 6 , 19 ) ;
- Size = MAP_APPFONT ( 168 , 10 ) ;
- Text [ en-US ] = "Saved by " ;
- };
- MultiLineEdit ME_VERSIONS
- {
- HelpID = "sfx2:MultiLineEdit:DLG_COMMENTS:ME_VERSIONS";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 32 ) ;
- Size = MAP_APPFONT ( 168 , 60 ) ;
- TabStop = TRUE ;
- };
- OKButton PB_OK
- {
- Pos = MAP_APPFONT ( 15 , 98 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton PB_CANCEL
- {
- Pos = MAP_APPFONT ( 68 , 98 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- PushButton PB_CLOSE
- {
- HelpID = "sfx2:PushButton:DLG_COMMENTS:PB_CLOSE";
- Pos = MAP_APPFONT ( 68 , 98 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Close" ;
- };
- HelpButton PB_HELP
- {
- Pos = MAP_APPFONT ( 124 , 98 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- Text [ en-US ] = "Insert Version Comment" ;
-};
-String DLG_COMMENTS
-{
- Text [ en-US ] = "Version comment" ;
-};
String STR_VIEWVERSIONCOMMENT
{
Text [ en-US ] = "View Version Comment" ;
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index a81e8eab6207..1853a3d864ed 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -74,21 +74,19 @@ public:
class SfxViewVersionDialog_Impl : public SfxModalDialog
{
- FixedText aDateTimeText;
- FixedText aSavedByText;
- MultiLineEdit aEdit;
- OKButton aOKButton;
- CancelButton aCancelButton;
- PushButton aCloseButton;
- HelpButton aHelpButton;
- SfxVersionInfo* pInfo;
+ FixedText* m_pDateTimeText;
+ FixedText* m_pSavedByText;
+ VclMultiLineEdit* m_pEdit;
+ OKButton* m_pOKButton;
+ CancelButton* m_pCancelButton;
+ CloseButton* m_pCloseButton;
+ SfxVersionInfo& m_rInfo;
- DECL_LINK( ButtonHdl, Button* );
+ DECL_LINK(ButtonHdl, Button*);
public:
- SfxViewVersionDialog_Impl( Window *pParent,
- SfxVersionInfo& rInfo, sal_Bool bEdit );
- };
+ SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit);
+};
#endif
diff --git a/sfx2/uiconfig/ui/versioncommentdialog.ui b/sfx2/uiconfig/ui/versioncommentdialog.ui
new file mode 100644
index 000000000000..09671487ae8f
--- /dev/null
+++ b/sfx2/uiconfig/ui/versioncommentdialog.ui
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.6 -->
+ <object class="GtkDialog" id="VersionCommentDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Insert Version Comment</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">12</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="ok">
+ <property name="label">gtk-ok</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>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="close">
+ <property name="label">gtk-close</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>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</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="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="timestamp">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Date and time: </property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="author">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Saved by: </property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</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="textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">close</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>