diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-23 09:35:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-26 15:27:09 +0000 |
commit | 942f05996bc287923cdbcae12c64e57adf8ec975 (patch) | |
tree | 7005380763a9ecb93f5f27c28174633b9774abb7 /uui/source | |
parent | c410a3dcfeb68ba2247c0d879727afe4ca8ed3da (diff) |
convert remaining ErrorBox to weld::MessageDialog
and
convert remaining QueryBox to weld::MessageDialog
Change-Id: Ifb4c316dee8eabf57c4940c44e29c65a2781aa6c
Diffstat (limited to 'uui/source')
-rw-r--r-- | uui/source/alreadyopen.cxx | 2 | ||||
-rw-r--r-- | uui/source/filechanged.cxx | 2 | ||||
-rw-r--r-- | uui/source/iahndl-errorhandler.cxx | 151 | ||||
-rw-r--r-- | uui/source/iahndl-ssl.cxx | 23 | ||||
-rw-r--r-- | uui/source/lockcorrupt.cxx | 2 | ||||
-rw-r--r-- | uui/source/lockfailed.cxx | 2 | ||||
-rw-r--r-- | uui/source/openlocked.cxx | 2 | ||||
-rw-r--r-- | uui/source/sslwarndlg.cxx | 23 | ||||
-rw-r--r-- | uui/source/sslwarndlg.hxx | 20 | ||||
-rw-r--r-- | uui/source/trylater.cxx | 2 | ||||
-rw-r--r-- | uui/source/unknownauthdlg.cxx | 50 | ||||
-rw-r--r-- | uui/source/unknownauthdlg.hxx | 27 |
12 files changed, 132 insertions, 174 deletions
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx index 64f5938e44c8..6a5660fda6b7 100644 --- a/uui/source/alreadyopen.cxx +++ b/uui/source/alreadyopen.cxx @@ -26,7 +26,7 @@ AlreadyOpenQueryBox::AlreadyOpenQueryBox( vcl::Window* pParent, const std::local Translate::get(STR_ALREADYOPEN_TITLE, rLocale), aMessage ) { - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage()); if ( bIsStoring ) { diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx index e486da43bfaa..54917bb1bb2a 100644 --- a/uui/source/filechanged.cxx +++ b/uui/source/filechanged.cxx @@ -26,7 +26,7 @@ FileChangedQueryBox::FileChangedQueryBox( vcl::Window* pParent, const std::local Translate::get(STR_FILECHANGED_TITLE, rLocale), OUString() ) { - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage()); AddButton(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rLocale), RET_YES, ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx index 28d1bf062636..39755708942c 100644 --- a/uui/source/iahndl-errorhandler.cxx +++ b/uui/source/iahndl-errorhandler.cxx @@ -18,7 +18,7 @@ */ #include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/button.hxx> #include <vcl/weld.hxx> #include <com/sun/star/task/XInteractionAbort.hpp> @@ -43,13 +43,22 @@ using namespace com::sun::star; namespace { +enum class MessageBoxStyle { + NONE = 0x0000, + Ok = 0x0001, + OkCancel = 0x0002, + YesNo = 0x0004, + YesNoCancel = 0x0008, + RetryCancel = 0x0010 +}; + DialogMask executeErrorDialog( vcl::Window * pParent, task::InteractionClassification eClassification, OUString const & rContext, OUString const & rMessage, - MessBoxStyle nButtonMask) + MessageBoxStyle nButtonMask) { SolarMutexGuard aGuard; @@ -59,87 +68,59 @@ executeErrorDialog( //TODO! must be internationalized aText.append(rMessage); - VclPtr< MessBox > xBox; - std::unique_ptr<weld::MessageDialog> xOtherBox; - try + std::unique_ptr<weld::MessageDialog> xBox; + + switch (eClassification) { - switch (eClassification) - { case task::InteractionClassification_ERROR: - xBox.reset(VclPtr<ErrorBox>::Create(pParent, - nButtonMask, - aText.makeStringAndClear())); + xBox.reset(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Error, VclButtonsType::NONE, aText.makeStringAndClear())); break; - case task::InteractionClassification_WARNING: - xBox.reset(VclPtr<WarningBox>::Create(pParent, - nButtonMask, - aText.makeStringAndClear())); + xBox.reset(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::NONE, aText.makeStringAndClear())); break; - case task::InteractionClassification_INFO: -# define WB_DEF_BUTTONS (MessBoxStyle::DefaultOk | MessBoxStyle::DefaultCancel | MessBoxStyle::DefaultRetry) - //(want to ignore any default button settings)... - if ((nButtonMask & WB_DEF_BUTTONS) == MessBoxStyle::DefaultOk) - { - xOtherBox.reset(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, - VclMessageType::Info, VclButtonsType::Ok, aText.makeStringAndClear())); - } - else - xBox.reset(VclPtr<ErrorBox>::Create(pParent, - nButtonMask, - aText.makeStringAndClear())); + xBox.reset(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::NONE, aText.makeStringAndClear())); break; - case task::InteractionClassification_QUERY: - xBox.reset(VclPtr<QueryBox>::Create(pParent, - nButtonMask, - aText.makeStringAndClear())); + xBox.reset(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::NONE, aText.makeStringAndClear())); break; - default: - OSL_ASSERT(false); + assert(false); break; - } - } - catch (std::bad_alloc const &) - { - throw uno::RuntimeException("out of memory"); } - sal_uInt16 aMessResult; - if (xBox) - { - aMessResult = xBox->Execute(); - xBox.disposeAndClear(); - } - else - { - aMessResult = xOtherBox->run(); - } - DialogMask aResult = DialogMask::NONE; - switch( aMessResult ) + switch (nButtonMask) { - case RET_OK: - aResult = DialogMask::ButtonsOk; - break; - case RET_CANCEL: - aResult = DialogMask::ButtonsCancel; - break; - case RET_YES: - aResult = DialogMask::ButtonsYes; - break; - case RET_NO: - aResult = DialogMask::ButtonsNo; - break; - case RET_RETRY: - aResult = DialogMask::ButtonsRetry; - break; - default: assert(false); + case MessageBoxStyle::NONE: + break; + case MessageBoxStyle::Ok: + xBox->add_button(Button::GetStandardText(StandardButtonType::OK), static_cast<int>(DialogMask::ButtonsOk)); + break; + case MessageBoxStyle::OkCancel: + xBox->add_button(Button::GetStandardText(StandardButtonType::OK), static_cast<int>(DialogMask::ButtonsOk)); + xBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), static_cast<int>(DialogMask::ButtonsCancel)); + break; + case MessageBoxStyle::YesNo: + xBox->add_button(Button::GetStandardText(StandardButtonType::Yes), static_cast<int>(DialogMask::ButtonsYes)); + xBox->add_button(Button::GetStandardText(StandardButtonType::No), static_cast<int>(DialogMask::ButtonsNo)); + break; + case MessageBoxStyle::YesNoCancel: + xBox->add_button(Button::GetStandardText(StandardButtonType::Yes), static_cast<int>(DialogMask::ButtonsYes)); + xBox->add_button(Button::GetStandardText(StandardButtonType::No), static_cast<int>(DialogMask::ButtonsNo)); + xBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), static_cast<int>(DialogMask::ButtonsCancel)); + break; + case MessageBoxStyle::RetryCancel: + xBox->add_button(Button::GetStandardText(StandardButtonType::Retry), static_cast<int>(DialogMask::ButtonsRetry)); + xBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), static_cast<int>(DialogMask::ButtonsCancel)); + break; } - return aResult; + return static_cast<DialogMask>(xBox->run()); } } @@ -225,30 +206,30 @@ UUIInteractionHelper::handleErrorHandlerRequest( // Finally, it seems to be better to leave default button // determination to VCL (the favouring of CANCEL as default button // seems to not always be what the user wants)... - MessBoxStyle const aButtonMask[16] - = { MessBoxStyle::NONE, - MessBoxStyle::Ok /*| MessBoxStyle::DefaultOk*/, // Abort - MessBoxStyle::NONE, - MessBoxStyle::RetryCancel /*| MessBoxStyle::DefaultCancel*/, // Retry, Abort - MessBoxStyle::NONE, - MessBoxStyle::NONE, - MessBoxStyle::NONE, - MessBoxStyle::NONE, - MessBoxStyle::Ok /*| MessBoxStyle::DefaultOk*/, // Approve - MessBoxStyle::OkCancel /*| MessBoxStyle::DefaultCancel*/, // Approve, Abort - MessBoxStyle::NONE, - MessBoxStyle::NONE, - MessBoxStyle::YesNo /*| MessBoxStyle::DefaultNo*/, // Approve, Disapprove - MessBoxStyle::YesNoCancel /*| MessBoxStyle::DefaultCancel*/, + MessageBoxStyle const aButtonMask[16] + = { MessageBoxStyle::NONE, + MessageBoxStyle::Ok /*| MessBoxStyle::DefaultOk*/, // Abort + MessageBoxStyle::NONE, + MessageBoxStyle::RetryCancel /*| MessBoxStyle::DefaultCancel*/, // Retry, Abort + MessageBoxStyle::NONE, + MessageBoxStyle::NONE, + MessageBoxStyle::NONE, + MessageBoxStyle::NONE, + MessageBoxStyle::Ok /*| MessBoxStyle::DefaultOk*/, // Approve + MessageBoxStyle::OkCancel /*| MessBoxStyle::DefaultCancel*/, // Approve, Abort + MessageBoxStyle::NONE, + MessageBoxStyle::NONE, + MessageBoxStyle::YesNo /*| MessBoxStyle::DefaultNo*/, // Approve, Disapprove + MessageBoxStyle::YesNoCancel /*| MessBoxStyle::DefaultCancel*/, // Approve, Disapprove, Abort - MessBoxStyle::NONE, - MessBoxStyle::NONE }; + MessageBoxStyle::NONE, + MessageBoxStyle::NONE }; - MessBoxStyle nButtonMask = aButtonMask[(xApprove.is() ? 8 : 0) + MessageBoxStyle nButtonMask = aButtonMask[(xApprove.is() ? 8 : 0) | (xDisapprove.is() ? 4 : 0) | (xRetry.is() ? 2 : 0) | (xAbort.is() ? 1 : 0)]; - if (nButtonMask == MessBoxStyle::NONE) + if (nButtonMask == MessageBoxStyle::NONE) return; //TODO! remove this backwards compatibility? diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx index 960945643e25..1044b31dbbfb 100644 --- a/uui/source/iahndl-ssl.cxx +++ b/uui/source/iahndl-ssl.cxx @@ -136,7 +136,7 @@ getLocalizedDatTimeStr( bool executeUnknownAuthDialog( - vcl::Window * pParent, + weld::Window * pParent, uno::Reference< uno::XComponentContext > const & xContext, const uno::Reference< security::XCertificate >& rXCert) { @@ -144,7 +144,7 @@ executeUnknownAuthDialog( { SolarMutexGuard aGuard; - ScopedVclPtrInstance< UnknownAuthDialog > xDialog(pParent, rXCert, xContext); + UnknownAuthDialog aDialog(pParent, rXCert, xContext); // Get correct resource string OUString aMessage; @@ -158,9 +158,9 @@ executeUnknownAuthDialog( aMessage = Translate::get(STR_UUI_UNKNOWNAUTH_UNTRUSTED, aResLocale); aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - xDialog->setDescriptionText( aMessage ); + aDialog.setDescriptionText( aMessage ); - return static_cast<bool>(xDialog->Execute()); + return static_cast<bool>(aDialog.run()); } catch (std::bad_alloc const &) { @@ -174,7 +174,7 @@ enum class SslWarnType { bool executeSSLWarnDialog( - vcl::Window * pParent, + weld::Window * pParent, uno::Reference< uno::XComponentContext > const & xContext, const uno::Reference< security::XCertificate >& rXCert, SslWarnType failure, @@ -184,7 +184,7 @@ executeSSLWarnDialog( { SolarMutexGuard aGuard; - ScopedVclPtrInstance< SSLWarnDialog > xDialog(pParent, rXCert, xContext); + SSLWarnDialog aDialog(pParent, rXCert, xContext); // Get correct resource string std::vector< OUString > aArguments_1; @@ -225,12 +225,12 @@ executeSSLWarnDialog( OUString aMessage_1 = Translate::get(pMessageKey, aResLocale); aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments( aMessage_1, aArguments_1 ); - xDialog->setDescription1Text( aMessage_1 ); + aDialog.setDescription1Text( aMessage_1 ); OUString aTitle = Translate::get(pTitleKey, aResLocale); - xDialog->SetText(aTitle); + aDialog.set_title(aTitle); - return static_cast<bool>(xDialog->Execute()); + return static_cast<bool>(aDialog.run()); } catch (std::bad_alloc const &) { @@ -240,7 +240,7 @@ executeSSLWarnDialog( void handleCertificateValidationRequest_( - vcl::Window * pParent, + weld::Window * pParent, uno::Reference< uno::XComponentContext > const & xContext, ucb::CertificateValidationRequest const & rRequest, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & @@ -362,7 +362,8 @@ UUIInteractionHelper::handleCertificateValidationRequest( ucb::CertificateValidationRequest aCertificateValidationRequest; if (aAnyRequest >>= aCertificateValidationRequest) { - handleCertificateValidationRequest_(getParentProperty(), + vcl::Window* pWindow = getParentProperty(); + handleCertificateValidationRequest_(pWindow ? pWindow->GetFrameWeld() : nullptr, m_xContext, aCertificateValidationRequest, rRequest->getContinuations()); diff --git a/uui/source/lockcorrupt.cxx b/uui/source/lockcorrupt.cxx index cb3dc9c566cb..ce6a3545d13e 100644 --- a/uui/source/lockcorrupt.cxx +++ b/uui/source/lockcorrupt.cxx @@ -26,7 +26,7 @@ LockCorruptQueryBox::LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale) : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString()) { - SetImage( ErrorBox::GetStandardImage() ); + SetImage(GetStandardErrorBoxImage()); AddButton(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_BTN, rResLocale), RET_OK, ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx index 15d58dca4981..51266f0b3420 100644 --- a/uui/source/lockfailed.cxx +++ b/uui/source/lockfailed.cxx @@ -25,7 +25,7 @@ LockFailedQueryBox::LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale) : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString()) { - SetImage( ErrorBox::GetStandardImage() ); + SetImage(GetStandardErrorBoxImage()); AddButton(Translate::get(STR_LOCKFAILED_OPENREADONLY_BTN, rResLocale), RET_OK, ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx index 3267610b78d1..81d8b896477e 100644 --- a/uui/source/openlocked.cxx +++ b/uui/source/openlocked.cxx @@ -26,7 +26,7 @@ OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& Translate::get(STR_OPENLOCKED_TITLE, rResLocale), aMessage ) { - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage()); AddButton(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES, ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); diff --git a/uui/source/sslwarndlg.cxx b/uui/source/sslwarndlg.cxx index 5db56f855a95..df20f8f71715 100644 --- a/uui/source/sslwarndlg.cxx +++ b/uui/source/sslwarndlg.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <ids.hxx> #include "sslwarndlg.hxx" @@ -27,7 +27,7 @@ using namespace css; -IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl, ::Button*, void) +IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl, weld::Button&, void) { uno::Reference< css::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures; @@ -36,25 +36,16 @@ IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl, ::Button*, void) xDocumentDigitalSignatures.get()->showCertificate(m_rXCert); } -SSLWarnDialog::SSLWarnDialog(vcl::Window* pParent, +SSLWarnDialog::SSLWarnDialog(weld::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_xBuilder(Application::CreateBuilder(pParent, "uui/ui/sslwarndialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("SSLWarnDialog")) + , m_xView(m_xBuilder->weld_button("view")) , m_xContext(xContext) , m_rXCert(rXCert) { -} - -void SSLWarnDialog::dispose() -{ - m_xView.clear(); - MessageDialog::dispose(); -} - -SSLWarnDialog::~SSLWarnDialog() -{ - disposeOnce(); + m_xView->connect_clicked(LINK(this, SSLWarnDialog, ViewCertHdl)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/sslwarndlg.hxx b/uui/source/sslwarndlg.hxx index 2183160ce2ff..9a56314d9f21 100644 --- a/uui/source/sslwarndlg.hxx +++ b/uui/source/sslwarndlg.hxx @@ -19,8 +19,7 @@ #ifndef INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX #define INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX -#include <vcl/button.hxx> -#include <vcl/messagedialog.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -28,25 +27,26 @@ //= Https_WarnDialog -class SSLWarnDialog : public MessageDialog +class SSLWarnDialog { private: - VclPtr<PushButton> m_xView; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; + std::unique_ptr<weld::Button> m_xView; const css::uno::Reference< css::uno::XComponentContext >& m_xContext; const css::uno::Reference< css::security::XCertificate >& m_rXCert; - DECL_LINK(ViewCertHdl, Button*, void); + DECL_LINK(ViewCertHdl, weld::Button&, void); public: - SSLWarnDialog( vcl::Window* pParent, + SSLWarnDialog(weld::Window* pParent, const css::uno::Reference< css::security::XCertificate >& rXCert, const css::uno::Reference< css::uno::XComponentContext >& xContext ); - void setDescription1Text(const OUString &aText) { set_primary_text(aText); } + void setDescription1Text(const OUString &rText) { m_xDialog->set_primary_text(rText); } + void set_title(const OUString &rText) { m_xDialog->set_title(rText); } - virtual void dispose() override; - - virtual ~SSLWarnDialog() override; + short run() { return m_xDialog->run(); } }; #endif // INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx index d61f2e653bf8..aa9bc08cf603 100644 --- a/uui/source/trylater.cxx +++ b/uui/source/trylater.cxx @@ -24,7 +24,7 @@ TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage) : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage) { - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage()); AddButton(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES, ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); diff --git a/uui/source/unknownauthdlg.cxx b/uui/source/unknownauthdlg.cxx index 433cfe8d6143..171d864735cd 100644 --- a/uui/source/unknownauthdlg.cxx +++ b/uui/source/unknownauthdlg.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <strings.hrc> #include "unknownauthdlg.hxx" @@ -28,19 +28,19 @@ using namespace css; -IMPL_LINK_NOARG(UnknownAuthDialog, OKHdl_Impl, Button*, void) +IMPL_LINK_NOARG(UnknownAuthDialog, OKHdl_Impl, weld::Button&, void) { - if ( m_pOptionButtonAccept->IsChecked() ) + if (m_xOptionButtonAccept->get_active()) { - EndDialog( RET_OK ); - } else + m_xDialog->response(RET_OK); + } + else { - EndDialog(); + m_xDialog->response(RET_CANCEL); } } - -IMPL_LINK_NOARG(UnknownAuthDialog, ViewCertHdl_Impl, Button*, void) +IMPL_LINK_NOARG(UnknownAuthDialog, ViewCertHdl_Impl, weld::Button&, void) { uno::Reference< css::security::XDocumentDigitalSignatures > xDocumentDigitalSignatures( css::security::DocumentDigitalSignatures::createDefault(m_xContext) ); @@ -48,36 +48,20 @@ IMPL_LINK_NOARG(UnknownAuthDialog, ViewCertHdl_Impl, Button*, void) xDocumentDigitalSignatures.get()->showCertificate(m_rXCert); } - -UnknownAuthDialog::UnknownAuthDialog(vcl::Window* pParent, +UnknownAuthDialog::UnknownAuthDialog(weld::Window* pParent, const css::uno::Reference< css::security::XCertificate >& rXCert, const css::uno::Reference< css::uno::XComponentContext >& xContext) - : MessageDialog(pParent, "UnknownAuthDialog", - "uui/ui/unknownauthdialog.ui") + : m_xBuilder(Application::CreateBuilder(pParent, "uui/ui/unknownauthdialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("UnknownAuthDialog")) + , m_xCommandButtonOK(m_xBuilder->weld_button("ok")) + , m_xView_Certificate(m_xBuilder->weld_button("examine")) + , m_xOptionButtonAccept(m_xBuilder->weld_radio_button("accept")) + , m_xOptionButtonDontAccept(m_xBuilder->weld_radio_button("reject")) , m_xContext(xContext) , m_rXCert(rXCert) { - get(m_pOptionButtonAccept, "accept"); - get(m_pOptionButtonDontAccept, "reject"); - get(m_pCommandButtonOK, "ok"); - get(m_pView_Certificate, "examine"); - - m_pView_Certificate->SetClickHdl(LINK(this, UnknownAuthDialog, ViewCertHdl_Impl)); - m_pCommandButtonOK->SetClickHdl(LINK(this, UnknownAuthDialog, OKHdl_Impl)); -} - -UnknownAuthDialog::~UnknownAuthDialog() -{ - disposeOnce(); -} - -void UnknownAuthDialog::dispose() -{ - m_pCommandButtonOK.clear(); - m_pView_Certificate.clear(); - m_pOptionButtonAccept.clear(); - m_pOptionButtonDontAccept.clear(); - MessageDialog::dispose(); + m_xView_Certificate->connect_clicked(LINK(this, UnknownAuthDialog, ViewCertHdl_Impl)); + m_xCommandButtonOK->connect_clicked(LINK(this, UnknownAuthDialog, OKHdl_Impl)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/unknownauthdlg.hxx b/uui/source/unknownauthdlg.hxx index 9c9274ef83f9..2398dfa26a2e 100644 --- a/uui/source/unknownauthdlg.hxx +++ b/uui/source/unknownauthdlg.hxx @@ -19,8 +19,7 @@ #ifndef INCLUDED_UUI_SOURCE_UNKNOWNAUTHDLG_HXX #define INCLUDED_UUI_SOURCE_UNKNOWNAUTHDLG_HXX -#include <vcl/button.hxx> -#include <vcl/messagedialog.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -28,31 +27,33 @@ //= Https_UADialog -class UnknownAuthDialog : public MessageDialog +class UnknownAuthDialog { private: - VclPtr<PushButton> m_pCommandButtonOK; - VclPtr<PushButton> m_pView_Certificate; - VclPtr<RadioButton> m_pOptionButtonAccept; - VclPtr<RadioButton> m_pOptionButtonDontAccept; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; + std::unique_ptr<weld::Button> m_xCommandButtonOK; + std::unique_ptr<weld::Button> m_xView_Certificate; + std::unique_ptr<weld::RadioButton> m_xOptionButtonAccept; + std::unique_ptr<weld::RadioButton> m_xOptionButtonDontAccept; const css::uno::Reference< css::uno::XComponentContext >& m_xContext; const css::uno::Reference< css::security::XCertificate >& m_rXCert; - DECL_LINK(OKHdl_Impl, Button*, void); - DECL_LINK(ViewCertHdl_Impl, Button*, void); + DECL_LINK(OKHdl_Impl, weld::Button&, void); + DECL_LINK(ViewCertHdl_Impl, weld::Button&, void); public: - UnknownAuthDialog(vcl::Window* pParent, + UnknownAuthDialog(weld::Window* pParent, const css::uno::Reference< css::security::XCertificate >& rXCert, const css::uno::Reference< css::uno::XComponentContext >& xContext); - virtual ~UnknownAuthDialog() override; - virtual void dispose() override; void setDescriptionText(const OUString &rText) { - set_primary_text(rText); + m_xDialog->set_primary_text(rText); } + + short run() { return m_xDialog->run(); } }; #endif // INCLUDED_UUI_SOURCE_UNKNOWNAUTHDLG_HXX |