diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-21 21:20:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-25 20:03:26 +0100 |
commit | d75144cf44779a8f6cc9bccf9b0a6328b94a5b90 (patch) | |
tree | 25b9f3c677c50ad715e1a0bc6bef3d5bf79ef957 /uui/source | |
parent | 8d42909cd326cb26d8ba1fb383b5578f820c72ed (diff) |
convert remaining InfoBox to weld::MessageDialog
Change-Id: I91d828e38d96264cf4a76f30940942556b8f78d8
Reviewed-on: https://gerrit.libreoffice.org/50205
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'uui/source')
-rw-r--r-- | uui/source/iahndl-errorhandler.cxx | 21 | ||||
-rw-r--r-- | uui/source/iahndl.cxx | 5 | ||||
-rw-r--r-- | uui/source/sslwarndlg.cxx | 22 | ||||
-rw-r--r-- | uui/source/sslwarndlg.hxx | 10 |
4 files changed, 36 insertions, 22 deletions
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx index dca09cf4bb7f..28d1bf062636 100644 --- a/uui/source/iahndl-errorhandler.cxx +++ b/uui/source/iahndl-errorhandler.cxx @@ -19,6 +19,7 @@ #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> @@ -59,6 +60,7 @@ executeErrorDialog( aText.append(rMessage); VclPtr< MessBox > xBox; + std::unique_ptr<weld::MessageDialog> xOtherBox; try { switch (eClassification) @@ -79,8 +81,10 @@ executeErrorDialog( # define WB_DEF_BUTTONS (MessBoxStyle::DefaultOk | MessBoxStyle::DefaultCancel | MessBoxStyle::DefaultRetry) //(want to ignore any default button settings)... if ((nButtonMask & WB_DEF_BUTTONS) == MessBoxStyle::DefaultOk) - xBox.reset(VclPtr<InfoBox>::Create(pParent, - aText.makeStringAndClear())); + { + xOtherBox.reset(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, aText.makeStringAndClear())); + } else xBox.reset(VclPtr<ErrorBox>::Create(pParent, nButtonMask, @@ -103,9 +107,16 @@ executeErrorDialog( throw uno::RuntimeException("out of memory"); } - sal_uInt16 aMessResult = xBox->Execute(); - - xBox.disposeAndClear(); + sal_uInt16 aMessResult; + if (xBox) + { + aMessResult = xBox->Execute(); + xBox.disposeAndClear(); + } + else + { + aMessResult = xOtherBox->run(); + } DialogMask aResult = DialogMask::NONE; switch( aMessResult ) diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 59f62217c6ac..b45b9cea2c2d 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -1120,7 +1120,10 @@ UUIInteractionHelper::handleGenericErrorRequest( executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok); } else - ErrorHandler::HandleError(nErrorCode, getParentProperty()); + { + vcl::Window* pParent = getParentProperty(); + ErrorHandler::HandleError(nErrorCode, pParent ? pParent->GetFrameWeld() : nullptr); + } if (xApprove.is() && bWarning) xApprove->select(); diff --git a/uui/source/sslwarndlg.cxx b/uui/source/sslwarndlg.cxx index f88284a70610..5db56f855a95 100644 --- a/uui/source/sslwarndlg.cxx +++ b/uui/source/sslwarndlg.cxx @@ -27,7 +27,7 @@ using namespace css; -void SSLWarnDialog::ViewCert() +IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl, ::Button*, void) { uno::Reference< css::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures; @@ -36,27 +36,25 @@ void SSLWarnDialog::ViewCert() xDocumentDigitalSignatures.get()->showCertificate(m_rXCert); } - SSLWarnDialog::SSLWarnDialog(vcl::Window* pParent, const css::uno::Reference< css::security::XCertificate >& rXCert, const css::uno::Reference< css::uno::XComponentContext >& xContext) : MessageDialog(pParent, "SSLWarnDialog", "uui/ui/sslwarndialog.ui") + , m_xView(get<PushButton>("view")) , m_xContext(xContext) , m_rXCert(rXCert) { } -void SSLWarnDialog::response(short nResponseId) +void SSLWarnDialog::dispose() +{ + m_xView.clear(); + MessageDialog::dispose(); +} + +SSLWarnDialog::~SSLWarnDialog() { - switch (nResponseId) - { - case 101: - ViewCert(); - break; - default: - MessageDialog::response(nResponseId); - break; - } + disposeOnce(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/sslwarndlg.hxx b/uui/source/sslwarndlg.hxx index 2c0a992dcc2d..2183160ce2ff 100644 --- a/uui/source/sslwarndlg.hxx +++ b/uui/source/sslwarndlg.hxx @@ -19,7 +19,6 @@ #ifndef INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX #define INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX -#include <vcl/fixed.hxx> #include <vcl/button.hxx> #include <vcl/messagedialog.hxx> #include <com/sun/star/security/XCertificate.hpp> @@ -32,19 +31,22 @@ class SSLWarnDialog : public MessageDialog { private: + VclPtr<PushButton> m_xView; const css::uno::Reference< css::uno::XComponentContext >& m_xContext; const css::uno::Reference< css::security::XCertificate >& m_rXCert; - void ViewCert(); + DECL_LINK(ViewCertHdl, Button*, void); public: SSLWarnDialog( vcl::Window* pParent, const css::uno::Reference< css::security::XCertificate >& rXCert, const css::uno::Reference< css::uno::XComponentContext >& xContext ); - virtual void response(short nResponseId) override; - void setDescription1Text(const OUString &aText) { set_primary_text(aText); } + + virtual void dispose() override; + + virtual ~SSLWarnDialog() override; }; #endif // INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX |