diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-26 13:28:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-27 09:52:32 +0000 |
commit | 0fad8d308122a862aa49dece498d56a418df2afe (patch) | |
tree | e67e7df1f9d315648535f436b424c9941dea589e /vcl | |
parent | f3a4129ed5946e2b8661dc8df23e00c4b6c6ecc8 (diff) |
convert remaining WarningBox to weld::MessageDialog
Change-Id: I7e3c156a6ad47ac232636ae274280c1cb7556d4a
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/msgbox.cxx | 17 | ||||
-rw-r--r-- | vcl/unx/x11/x11sys.cxx | 27 |
2 files changed, 8 insertions, 36 deletions
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 1b8f9d7d47fe..805eae6f8b4f 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -314,23 +314,6 @@ OUString GetStandardInfoBoxText() return VclResId(SV_MSGBOX_INFO); } -WarningBox::WarningBox( vcl::Window* pParent, MessBoxStyle nStyle, - const OUString& rMessage ) : - WarningBox( pParent, nStyle, 0, rMessage ) -{ -} - -WarningBox::WarningBox( vcl::Window* pParent, MessBoxStyle nStyle, WinBits nWinBits, - const OUString& rMessage ) : - MessBox( pParent, nStyle, nWinBits, OUString(), rMessage ) -{ - // Default Text is the display title from the application - if ( GetText().isEmpty() ) - SetText(GetStandardWarningBoxText()); - - SetImage(GetStandardWarningBoxImage() ); -} - Image const & GetStandardWarningBoxImage() { ImplInitMsgBoxImageList(); diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx index 50471e8fc06f..c354269b3a3d 100644 --- a/vcl/unx/x11/x11sys.cxx +++ b/vcl/unx/x11/x11sys.cxx @@ -22,8 +22,7 @@ #include <unx/saldisp.hxx> #include <unx/x11/x11sys.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/button.hxx> +#include <vcl/weld.hxx> #include <svdata.hxx> @@ -86,31 +85,21 @@ tools::Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScree int X11SalSystem::ShowNativeDialog( const OUString& rTitle, const OUString& rMessage, const std::vector< OUString >& rButtons ) { - int nRet = -1; - ImplSVData* pSVData = ImplGetSVData(); if( pSVData->mpIntroWindow ) pSVData->mpIntroWindow->Hide(); - ScopedVclPtrInstance<WarningBox> aWarn(nullptr, MessBoxStyle::NONE, WB_STDWORK, rMessage); - aWarn->SetText( rTitle ); - aWarn->Clear(); + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::NONE, + rMessage)); + xWarn->set_title(rTitle); sal_uInt16 nButton = 0; for (auto const& button : rButtons) - { - aWarn->AddButton( button, nButton+1, (nButton == 0) ? ButtonDialogFlags::Default : ButtonDialogFlags::NONE ); - nButton++; - } - aWarn->SetFocusButton( sal_uInt16(1) ); - - nRet = static_cast<int>(aWarn->Execute()) - 1; - - // normalize behaviour, actually this should never happen - if( nRet < -1 || nRet >= int(rButtons.size()) ) - nRet = -1; + xWarn->add_button(button, nButton++); + xWarn->set_default_response(0); - return nRet; + return xWarn->run(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |