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

add gtk_message_dialog_new-alike ctor for MessageDialog

Change-Id: Ie422cd2c903cbd18353b1929c074574d452559ce
üst 1c068a7a
......@@ -705,6 +705,11 @@ private:
short get_response(const Window *pWindow) const;
public:
MessageDialog(Window* pParent,
const OUString &rMessage,
VclMessageType eMessageType = VCL_MESSAGE_ERROR,
VclButtonsType eButtonsType = VCL_BUTTONS_OK,
WinBits nStyle = WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE);
MessageDialog(Window* pParent, WinBits nStyle);
MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
virtual bool set_property(const OString &rKey, const OString &rValue);
......
......@@ -21,9 +21,9 @@
#include <mailmergewizard.hxx>
#include <swtypes.hxx>
#include <addresslistdialog.hxx>
#include <vcl/xtextedt.hxx>
#include <vcl/layout.hxx>
#include <vcl/txtattr.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/xtextedt.hxx>
#include <mmconfigitem.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
......@@ -185,7 +185,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl)
catch (const uno::Exception& e)
{
OSL_FAIL(OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
ErrorBox(this, WB_OK, e.Message).Execute();
MessageDialog(this, e.Message).Execute();
}
return 0;
}
......
......@@ -70,7 +70,7 @@
#include <svx/dlgutil.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/layout.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <sal/macros.h>
......@@ -794,7 +794,7 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
uno::Any exc( ::cppu::getCaughtException() );
OUString msg( ::comphelper::anyToString( exc ) );
const SolarMutexGuard guard;
ErrorBox aErrorBox( NULL, WB_OK, msg );
MessageDialog aErrorBox(NULL, msg);
aErrorBox.SetText( "Explanations" );
aErrorBox.Execute();
}
......
......@@ -333,10 +333,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
if( !bFmtInserted )
{
bOk = RET_CANCEL == ErrorBox( this,
WinBits( WB_OK_CANCEL | WB_DEF_OK),
aStrInvalidFmt
).Execute();
bOk = RET_CANCEL == MessageDialog(this, aStrInvalidFmt, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL)
.Execute();
}
}
else
......@@ -437,10 +435,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
if( !bFmtRenamed )
{
bOk = RET_CANCEL == ErrorBox( this,
WinBits( WB_OK_CANCEL | WB_DEF_OK),
aStrInvalidFmt
).Execute();
bOk = RET_CANCEL == MessageDialog(this, aStrInvalidFmt, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL)
.Execute();
}
}
else
......
......@@ -11,6 +11,8 @@ $(eval $(call gb_UIConfig_UIConfig,vcl))
$(eval $(call gb_UIConfig_add_uifiles,vcl,\
vcl/uiconfig/ui/printdialog \
vcl/uiconfig/ui/errornocontentdialog \
vcl/uiconfig/ui/errornoprinterdialog \
))
# vim: set noet sw=4 ts=4:
......@@ -122,8 +122,6 @@
#define SV_PRINT_PROGRESS_TEXT 2
#define SV_PRINT_NATIVE_STRINGS 2050
#define SV_PRINT_NOPRINTERWARNING 2051
#define SV_PRINT_NOCONTENT 2052
#define SV_HELPTEXT_CLOSE 10000
#define SV_HELPTEXT_MINIMIZE 10001
......
......@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "vcl/layout.hxx"
#include "vcl/print.hxx"
#include "vcl/svapp.hxx"
#include "vcl/metaact.hxx"
#include "vcl/msgbox.hxx"
#include "vcl/configsettings.hxx"
#include "vcl/unohelp.hxx"
......@@ -312,7 +312,8 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
// && ! pController->isDirectPrint()
)
{
ErrorBox aBox( NULL, VclResId( SV_PRINT_NOPRINTERWARNING ) );
MessageDialog aBox(NULL, "ErrorNoPrinterDialog",
"vcl/ui/errornoprinterdialog.ui");
aBox.Execute();
}
pController->setValue( OUString( "IsDirect" ),
......@@ -460,7 +461,8 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
{
if( pController->getFilteredPageCount() == 0 )
{
ErrorBox aBox( NULL, VclResId( SV_PRINT_NOCONTENT ) );
MessageDialog aBox(NULL, "ErrorNoContentDialog",
"vcl/ui/errornocontentdialog.ui");
aBox.Execute();
return;
}
......
......@@ -44,18 +44,6 @@ ModelessDialog SV_DLG_PRINT_PROGRESS
};
};
ErrorBox SV_PRINT_NOPRINTERWARNING
{
Title = "%PRODUCTNAME";
Message [en-US] = "No default printer found.\nPlease choose a printer and try again.";
};
ErrorBox SV_PRINT_NOCONTENT
{
Title = "%PRODUCTNAME";
Message [en-US] = "There are no pages to be printed. Please check your document for ranges relevant to printing.";
};
StringArray SV_PRINT_NATIVE_STRINGS
{
ItemList [en-US] =
......
......@@ -1768,6 +1768,23 @@ MessageDialog::MessageDialog(Window* pParent, WinBits nStyle)
SetType(WINDOW_MESSBOX);
}
MessageDialog::MessageDialog(Window* pParent,
const OUString &rMessage,
VclMessageType eMessageType,
VclButtonsType eButtonsType,
WinBits nStyle)
: Dialog(pParent, nStyle)
, m_eButtonsType(eButtonsType)
, m_eMessageType(eMessageType)
, m_pGrid(NULL)
, m_pImage(NULL)
, m_pPrimaryMessage(NULL)
, m_pSecondaryMessage(NULL)
, m_sPrimaryString(rMessage)
{
SetType(WINDOW_MESSBOX);
}
MessageDialog::MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
: Dialog(pParent, rID, rUIXMLDescription, WINDOW_MESSBOX)
, m_eButtonsType(VCL_BUTTONS_NONE)
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkMessageDialog" id="ErrorNoContentDialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="title" translatable="yes">%PRODUCTNAME</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="message_type">error</property>
<property name="buttons">ok</property>
<property name="text" translatable="yes">There are no pages to be printed.</property>
<property name="secondary_text" translatable="yes">Please check your document for ranges relevant to printing.</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>
</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>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkMessageDialog" id="ErrorNoPrinterDialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="title" translatable="yes">%PRODUCTNAME</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="message_type">error</property>
<property name="buttons">ok</property>
<property name="text" translatable="yes">No default printer found.</property>
<property name="secondary_text" translatable="yes">Please choose a printer and try again.</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>
</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>
</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