diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-05-01 13:39:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-01 14:42:05 +0100 |
commit | cd841115fa28f8be5778e540819f963407b4c05b (patch) | |
tree | a16307a9ded8350912e128d7896a559e4ab8a596 | |
parent | 9e5c35454d07f880a2cb52d9a808633b908bb859 (diff) |
use new MessageDialog
Change-Id: I4fdc54d5a6e0f133c53588e255274b9f103269b4
-rw-r--r-- | include/sfx2/QuerySaveDocument.hxx | 8 | ||||
-rw-r--r-- | include/sfx2/sfx.hrc | 4 | ||||
-rw-r--r-- | sfx2/UIConfig_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/doc/QuerySaveDocument.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/doc/doc.hrc | 2 | ||||
-rw-r--r-- | sfx2/source/doc/doc.src | 13 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/querysavedialog.ui | 83 |
7 files changed, 100 insertions, 37 deletions
diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx index e442b482ff53..ecdf0aa6a67e 100644 --- a/include/sfx2/QuerySaveDocument.hxx +++ b/include/sfx2/QuerySaveDocument.hxx @@ -19,11 +19,11 @@ #ifndef SFX_QUERYSAVEDOCUMENT_HXX #define SFX_QUERYSAVEDOCUMENT_HXX -#include "sal/config.h" -#include "sfx2/dllapi.h" +#include <rtl/ustring.hxx> +#include <sfx2/dllapi.h> class Window; -class String; + /** Opens the general query save document dialog. @param _pParent The parent window. @@ -31,7 +31,7 @@ class String; The title of the document. */ SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( - Window* _pParent,const String& _rTitle); + Window* _pParent, const OUString& _rTitle); #endif //SFX_QUERYSAVEDOCUMENT_HXX diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc index 245daa2f062a..b018a73b212d 100644 --- a/include/sfx2/sfx.hrc +++ b/include/sfx2/sfx.hrc @@ -152,12 +152,12 @@ #define STR_SFX_FILTERNAME_ALL (RID_SFX_START+106) #define STR_EDIT (RID_SFX_START+108) -#define STR_QUERY_SAVE_DOCUMENT (RID_SFX_START+110) + #define STR_BYTES (RID_SFX_START+111) #define STR_KB (RID_SFX_START+112) #define STR_MB (RID_SFX_START+113) #define STR_GB (RID_SFX_START+114) -#define STR_QUERY_SAVE_DOCUMENT_TITLE (RID_SFX_START+115) + #define STR_STANDARD_SHORTCUT (RID_SFX_START+117) #define STR_REPAIREDDOCUMENT (RID_SFX_START+118) diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index 2a551930361e..2adb858dc84c 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -20,6 +20,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/optprintpage \ sfx2/uiconfig/ui/password \ sfx2/uiconfig/ui/printeroptionsdialog \ + sfx2/uiconfig/ui/querysavedialog \ sfx2/uiconfig/ui/securityinfopage \ sfx2/uiconfig/ui/singletabdialog \ sfx2/uiconfig/ui/documentfontspage \ diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx index 7b24f7d55e15..9c073d07c279 100644 --- a/sfx2/source/doc/QuerySaveDocument.cxx +++ b/sfx2/source/doc/QuerySaveDocument.cxx @@ -17,29 +17,21 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "sfx2/QuerySaveDocument.hxx" - -#include <sfx2/sfx.hrc> -#include "sfx2/sfxresid.hxx" -#include <sfx2/sfxuno.hxx> -#include "doc.hrc" -#include <vcl/msgbox.hxx> +#include <sfx2/QuerySaveDocument.hxx> +#include <vcl/layout.hxx> #include <vcl/svapp.hxx> -// ----------------------------------------------------------------------------- -short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle) + +short ExecuteQuerySaveDocument(Window* _pParent, const OUString& _rTitle) { if (Application::IsHeadlessModeEnabled()) - { // don't block Desktop::terminate() if there's no user to ask + { + // don't block Desktop::terminate() if there's no user to ask return RET_NO; } - OUString aText( SfxResId(STR_QUERY_SAVE_DOCUMENT).toString() ); - aText = aText.replaceFirst( "$(DOC)", _rTitle ); - QueryBox aQBox( _pParent, WB_YES_NO_CANCEL | WB_DEF_YES, aText ); - aQBox.SetText(SfxResId(STR_QUERY_SAVE_DOCUMENT_TITLE).toString()); // Window title - aQBox.SetButtonText( BUTTONID_NO, SfxResId(STR_NOSAVEANDCLOSE).toString() ); - aQBox.SetButtonText( BUTTONID_YES, SfxResId(STR_SAVEDOC).toString() ); + + MessageDialog aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui"); + aQBox.set_primary_text(aQBox.get_primary_text().replaceFirst("$(DOC)", _rTitle)); return aQBox.Execute(); } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index 26947bd366f3..0ccbede03071 100644 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -114,7 +114,7 @@ #define STR_DOCTYPENAME_MESSAGE (RID_SFX_DOC_START+ 75) #define RID_STR_NEW_TASK (RID_SFX_DOC_START+ 76) -#define STR_NOSAVEANDCLOSE (RID_SFX_DOC_START+ 78) + #define STR_PACKNGO_NOACCESS (RID_SFX_DOC_START+ 79) #define STR_PACKNGO_NEWMEDIUM (RID_SFX_DOC_START+ 80) diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index fa5889e0bcda..c1341cd6144d 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -47,14 +47,6 @@ QueryBox MSG_REGION_NOTEMPTY DefButton = WB_DEF_NO ; Message [ en-US ] = "The category is not empty.\nDelete anyway?" ; }; -String STR_QUERY_SAVE_DOCUMENT_TITLE -{ - Text [ en-US ] = "Save document" ; -}; -String STR_QUERY_SAVE_DOCUMENT -{ - Text [ en-US ] = "Save changes to document \"$(DOC)\" before closing?" ; -}; Bitmap BMP_STYLES_CLOSED { File = "newex.bmp" ; }; Bitmap BMP_STYLES_OPENED { File = "newex.bmp" ; }; @@ -314,11 +306,6 @@ String STR_DOCTYPENAME_MESSAGE Text [ en-US ] = "Message"; }; -String STR_NOSAVEANDCLOSE -{ - Text [ en-US ] = "Close ~without saving" ; -}; - String STR_PACKNGO_NOACCESS { Text [ en-US ] = "Access to the current data medium not possible." ; diff --git a/sfx2/uiconfig/ui/querysavedialog.ui b/sfx2/uiconfig/ui/querysavedialog.ui new file mode 100644 index 000000000000..42d0371bfd07 --- /dev/null +++ b/sfx2/uiconfig/ui/querysavedialog.ui @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkMessageDialog" id="QuerySaveDialog"> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="title" translatable="yes">Save document</property> + <property name="type_hint">dialog</property> + <property name="skip_taskbar_hint">True</property> + <property name="message_type">warning</property> + <property name="text" translatable="yes">Save changes to document "$(DOC)" before closing?</property> + <property name="secondary_text" translatable="yes">Your changes will be lost if you don't save them.</property> + <child internal-child="vbox"> + <object class="GtkBox" id="messagedialog-vbox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">24</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="messagedialog-action_area"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="button3"> + <property name="label" translatable="yes">Close _without saving</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">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="button1"> + <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> + <property name="image_position">bottom</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="button2"> + <property name="label">gtk-save</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">2</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> + </object> + </child> + <action-widgets> + <action-widget response="3">button3</action-widget> + <action-widget response="0">button1</action-widget> + <action-widget response="2">button2</action-widget> + </action-widgets> + </object> +</interface> |