diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-26 16:53:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-27 11:22:49 +0100 |
commit | 082e69fefb7439fd4f3d543f0c402039e94c1e9c (patch) | |
tree | 8348cacdc54a15dae722b93fc198995756924fc0 /uui/source | |
parent | f41a08183504a59d6ffc7a00ed7f24e6b19995ab (diff) |
convert various MessBox to weld::MessageDialog
Change-Id: I4d2d0393c753114aeb9bb7e646dfdc810f6caa38
Reviewed-on: https://gerrit.libreoffice.org/50398
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/alreadyopen.cxx | 34 | ||||
-rw-r--r-- | uui/source/alreadyopen.hxx | 10 | ||||
-rw-r--r-- | uui/source/filechanged.cxx | 25 | ||||
-rw-r--r-- | uui/source/filechanged.hxx | 10 | ||||
-rw-r--r-- | uui/source/iahndl-locking.cxx | 51 | ||||
-rw-r--r-- | uui/source/lockcorrupt.cxx | 22 | ||||
-rw-r--r-- | uui/source/lockcorrupt.hxx | 10 | ||||
-rw-r--r-- | uui/source/lockfailed.cxx | 22 | ||||
-rw-r--r-- | uui/source/lockfailed.hxx | 10 | ||||
-rw-r--r-- | uui/source/openlocked.cxx | 31 | ||||
-rw-r--r-- | uui/source/openlocked.hxx | 10 | ||||
-rw-r--r-- | uui/source/trylater.cxx | 33 | ||||
-rw-r--r-- | uui/source/trylater.hxx | 10 |
13 files changed, 121 insertions, 157 deletions
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx index 6a5660fda6b7..9f94e22dc49a 100644 --- a/uui/source/alreadyopen.cxx +++ b/uui/source/alreadyopen.cxx @@ -20,35 +20,25 @@ #include <strings.hrc> #include "alreadyopen.hxx" #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> -AlreadyOpenQueryBox::AlreadyOpenQueryBox( vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bIsStoring ) : - MessBox(pParent, MessBoxStyle::NONE, 0, - Translate::get(STR_ALREADYOPEN_TITLE, rLocale), - aMessage ) +AlreadyOpenQueryBox::AlreadyOpenQueryBox(weld::Window* pParent, const std::locale& rLocale, const OUString& rMessage, bool bIsStoring) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) { - SetImage(GetStandardQueryBoxImage()); - - if ( bIsStoring ) + m_xQueryBox->set_title(Translate::get(STR_ALREADYOPEN_TITLE, rLocale)); + if (bIsStoring) { - AddButton( Translate::get(STR_ALREADYOPEN_RETRY_SAVE_BTN, rLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( Translate::get(STR_ALREADYOPEN_SAVE_BTN, rLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_RETRY_SAVE_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_SAVE_BTN, rLocale), RET_NO); } else { - AddButton( Translate::get(STR_ALREADYOPEN_READONLY_BTN, rLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( Translate::get(STR_ALREADYOPEN_OPEN_BTN, rLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_READONLY_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rLocale), RET_NO); } - - SetButtonHelpText( RET_YES, OUString() ); - SetButtonHelpText( RET_NO, OUString() ); -} - -AlreadyOpenQueryBox::~AlreadyOpenQueryBox() -{ + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/alreadyopen.hxx b/uui/source/alreadyopen.hxx index 809044bc120e..3d6e5a8fab80 100644 --- a/uui/source/alreadyopen.hxx +++ b/uui/source/alreadyopen.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_ALREADYOPEN_HXX #define INCLUDED_UUI_SOURCE_ALREADYOPEN_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class AlreadyOpenQueryBox : public MessBox +class AlreadyOpenQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - AlreadyOpenQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bIsStoring ); - virtual ~AlreadyOpenQueryBox() override; + AlreadyOpenQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bIsStoring); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx index 54917bb1bb2a..0c0b5d53dcc9 100644 --- a/uui/source/filechanged.cxx +++ b/uui/source/filechanged.cxx @@ -19,25 +19,18 @@ #include <strings.hrc> #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> #include "filechanged.hxx" -FileChangedQueryBox::FileChangedQueryBox( vcl::Window* pParent, const std::locale& rLocale ) : - MessBox(pParent, MessBoxStyle::NONE, 0, - Translate::get(STR_FILECHANGED_TITLE, rLocale), - OUString() ) -{ - SetImage(GetStandardQueryBoxImage()); - - AddButton(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetButtonHelpText( RET_YES, OUString() ); - SetMessText(Translate::get(STR_FILECHANGED_MSG, rLocale)); -} - -FileChangedQueryBox::~FileChangedQueryBox() +FileChangedQueryBox::FileChangedQueryBox(weld::Window* pParent, const std::locale& rLocale) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, + VclButtonsType::NONE, Translate::get(STR_FILECHANGED_MSG, rLocale))) { + m_xQueryBox->set_title(Translate::get(STR_FILECHANGED_TITLE, rLocale)); + m_xQueryBox->add_button(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/filechanged.hxx b/uui/source/filechanged.hxx index f15e1ced340d..6e73d17407ab 100644 --- a/uui/source/filechanged.hxx +++ b/uui/source/filechanged.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_FILECHANGED_HXX #define INCLUDED_UUI_SOURCE_FILECHANGED_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class FileChangedQueryBox : public MessBox +class FileChangedQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - FileChangedQueryBox( vcl::Window* pParent, const std::locale& pResLocale ); - virtual ~FileChangedQueryBox() override; + FileChangedQueryBox(weld::Window* pParent, const std::locale& pResLocale); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index ecd49ea55baf..d52142da4667 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -57,7 +57,7 @@ namespace { void handleLockedDocumentRequest_( - vcl::Window * pParent, + weld::Window * pParent, const OUString& aDocumentURL, const OUString& aInfo, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & @@ -96,8 +96,8 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is()); - nResult = xDialog->Execute(); + OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is()); + nResult = aDialog.run(); } else if ( nMode == UUI_DOC_SAVE_LOCK ) { @@ -110,8 +110,8 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< TryLaterQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is()); - nResult = xDialog->Execute(); + TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is()); + nResult = aDialog.run(); } else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || nMode == UUI_DOC_OWN_SAVE_LOCK ) @@ -124,11 +124,8 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< AlreadyOpenQueryBox > xDialog( pParent, - aResLocale, - aMessage, - nMode == UUI_DOC_OWN_SAVE_LOCK ); - nResult = xDialog->Execute(); + AlreadyOpenQueryBox aDialog(pParent, aResLocale, aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK); + nResult = aDialog.run(); } if ( nResult == RET_YES ) @@ -148,7 +145,7 @@ handleLockedDocumentRequest_( void handleChangedByOthersRequest_( - vcl::Window * pParent, + weld::Window * pParent, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations ) { @@ -163,8 +160,8 @@ handleChangedByOthersRequest_( { SolarMutexGuard aGuard; std::locale aResLocale = Translate::Create("uui"); - ScopedVclPtrInstance< FileChangedQueryBox > xDialog(pParent, aResLocale); - sal_Int32 nResult = xDialog->Execute(); + FileChangedQueryBox aDialog(pParent, aResLocale); + sal_Int32 nResult = aDialog.run(); if ( nResult == RET_YES ) xApprove->select(); @@ -184,7 +181,7 @@ const sal_uInt16 UUI_DOC_CorruptErrDlg = 1; void handleLockFileProblemRequest_( - vcl::Window * pParent, + weld::Window * pParent, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations, sal_uInt16 nWhichDlg ) { @@ -204,13 +201,13 @@ handleLockFileProblemRequest_( if (nWhichDlg == UUI_DOC_CreateErrDlg) { - ScopedVclPtrInstance< LockFailedQueryBox > xDialog(pParent, aResLocale); - nResult = xDialog->Execute(); + LockFailedQueryBox aDialog(pParent, aResLocale); + nResult = aDialog.run(); } else { - ScopedVclPtrInstance< LockCorruptQueryBox > xDialog(pParent, aResLocale); - nResult = xDialog->Execute(); + LockCorruptQueryBox aDialog(pParent, aResLocale); + nResult = aDialog.run(); } if ( nResult == RET_OK ) @@ -235,7 +232,8 @@ UUIInteractionHelper::handleLockedDocumentRequest( document::LockedDocumentRequest aLockedDocumentRequest; if (aAnyRequest >>= aLockedDocumentRequest ) { - handleLockedDocumentRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockedDocumentRequest_( pWin ? pWin->GetFrameWeld() : nullptr, aLockedDocumentRequest.DocumentURL, aLockedDocumentRequest.UserInfo, rRequest->getContinuations(), @@ -246,7 +244,8 @@ UUIInteractionHelper::handleLockedDocumentRequest( document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest; if (aAnyRequest >>= aOwnLockOnDocumentRequest ) { - handleLockedDocumentRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockedDocumentRequest_( pWin ? pWin->GetFrameWeld() : nullptr, aOwnLockOnDocumentRequest.DocumentURL, aOwnLockOnDocumentRequest.TimeInfo, rRequest->getContinuations(), @@ -259,7 +258,8 @@ UUIInteractionHelper::handleLockedDocumentRequest( document::LockedOnSavingRequest aLockedOnSavingRequest; if (aAnyRequest >>= aLockedOnSavingRequest ) { - handleLockedDocumentRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockedDocumentRequest_( pWin ? pWin->GetFrameWeld() : nullptr, aLockedOnSavingRequest.DocumentURL, aLockedOnSavingRequest.UserInfo, rRequest->getContinuations(), @@ -278,7 +278,8 @@ UUIInteractionHelper::handleChangedByOthersRequest( document::ChangedByOthersRequest aChangedByOthersRequest; if (aAnyRequest >>= aChangedByOthersRequest ) { - handleChangedByOthersRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleChangedByOthersRequest_( pWin ? pWin->GetFrameWeld() : nullptr, rRequest->getContinuations() ); return true; } @@ -295,7 +296,8 @@ UUIInteractionHelper::handleLockFileProblemRequest( document::LockFileIgnoreRequest aLockFileIgnoreRequest; if (aAnyRequest >>= aLockFileIgnoreRequest ) { - handleLockFileProblemRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockFileProblemRequest_( pWin ? pWin->GetFrameWeld() : nullptr, rRequest->getContinuations(), UUI_DOC_CreateErrDlg ); return true; } @@ -303,7 +305,8 @@ UUIInteractionHelper::handleLockFileProblemRequest( document::LockFileCorruptRequest aLockFileCorruptRequest; if (aAnyRequest >>= aLockFileCorruptRequest ) { - handleLockFileProblemRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockFileProblemRequest_( pWin ? pWin->GetFrameWeld() : nullptr, rRequest->getContinuations(), UUI_DOC_CorruptErrDlg ); return true; } diff --git a/uui/source/lockcorrupt.cxx b/uui/source/lockcorrupt.cxx index ce6a3545d13e..bba82db1db3f 100644 --- a/uui/source/lockcorrupt.cxx +++ b/uui/source/lockcorrupt.cxx @@ -22,22 +22,16 @@ #include "lockcorrupt.hxx" #include <unotools/resmgr.hxx> #include <vcl/button.hxx> +#include <vcl/svapp.hxx> -LockCorruptQueryBox::LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale) - : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString()) -{ - SetImage(GetStandardErrorBoxImage()); - - AddButton(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_BTN, rResLocale), RET_OK, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetMessText(Translate::get(STR_LOCKCORRUPT_MSG, rResLocale)); -} - -LockCorruptQueryBox::~LockCorruptQueryBox() +LockCorruptQueryBox::LockCorruptQueryBox(weld::Window* pParent, const std::locale& rResLocale) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, + VclButtonsType::NONE, Translate::get(STR_LOCKCORRUPT_MSG, rResLocale))) { + m_xQueryBox->set_title(Translate::get(STR_LOCKCORRUPT_MSG, rResLocale)); + m_xQueryBox->add_button(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_BTN, rResLocale), RET_OK); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_OK); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/lockcorrupt.hxx b/uui/source/lockcorrupt.hxx index 425117144e14..3d6a13f50658 100644 --- a/uui/source/lockcorrupt.hxx +++ b/uui/source/lockcorrupt.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_LOCKCORRUPT_HXX #define INCLUDED_UUI_SOURCE_LOCKCORRUPT_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class LockCorruptQueryBox : public MessBox +class LockCorruptQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale); - virtual ~LockCorruptQueryBox() override; + LockCorruptQueryBox(weld::Window* pParent, const std::locale& rResLocale); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx index 51266f0b3420..0f2167294f21 100644 --- a/uui/source/lockfailed.cxx +++ b/uui/source/lockfailed.cxx @@ -21,22 +21,16 @@ #include "lockfailed.hxx" #include <unotools/resmgr.hxx> #include <vcl/button.hxx> +#include <vcl/svapp.hxx> -LockFailedQueryBox::LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale) - : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString()) -{ - SetImage(GetStandardErrorBoxImage()); - - AddButton(Translate::get(STR_LOCKFAILED_OPENREADONLY_BTN, rResLocale), RET_OK, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetMessText(Translate::get(STR_LOCKFAILED_MSG, rResLocale)); -} - -LockFailedQueryBox::~LockFailedQueryBox() +LockFailedQueryBox::LockFailedQueryBox(weld::Window* pParent, const std::locale& rLocale) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Error, + VclButtonsType::NONE, Translate::get(STR_LOCKFAILED_MSG, rLocale))) { + m_xQueryBox->set_title(Translate::get(STR_LOCKFAILED_TITLE, rLocale)); + m_xQueryBox->add_button(Translate::get(STR_LOCKFAILED_OPENREADONLY_BTN, rLocale), RET_OK); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_OK); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/lockfailed.hxx b/uui/source/lockfailed.hxx index 5cf9ceda1ee7..62ac5f8528dc 100644 --- a/uui/source/lockfailed.hxx +++ b/uui/source/lockfailed.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_LOCKFAILED_HXX #define INCLUDED_UUI_SOURCE_LOCKFAILED_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class LockFailedQueryBox : public MessBox +class LockFailedQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale); - virtual ~LockFailedQueryBox() override; + LockFailedQueryBox(weld::Window* pParent, const std::locale& rResLocale); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx index 81d8b896477e..453067f8e3ae 100644 --- a/uui/source/openlocked.cxx +++ b/uui/source/openlocked.cxx @@ -20,34 +20,21 @@ #include <strings.hrc> #include "openlocked.hxx" #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> -OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride ) : - MessBox(pParent, MessBoxStyle::NONE, 0, - Translate::get(STR_OPENLOCKED_TITLE, rResLocale), - aMessage ) +OpenLockedQueryBox::OpenLockedQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) { - SetImage(GetStandardQueryBoxImage()); - - AddButton(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - SetButtonHelpText(RET_YES, OUString()); - - AddButton(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO); - SetButtonHelpText(RET_NO, OUString()); - + m_xQueryBox->set_title(Translate::get(STR_OPENLOCKED_TITLE, rResLocale)); + m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO); if (bEnableOverride) { // Present option to ignore the (stale?) lock file and open the document - AddButton(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE); - SetButtonHelpText(RET_IGNORE, OUString()); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE); } - - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); } -OpenLockedQueryBox::~OpenLockedQueryBox() -{ -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/openlocked.hxx b/uui/source/openlocked.hxx index bb80a3c64146..c4835c8c1314 100644 --- a/uui/source/openlocked.hxx +++ b/uui/source/openlocked.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_OPENLOCKED_HXX #define INCLUDED_UUI_SOURCE_OPENLOCKED_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class OpenLockedQueryBox : public MessBox +class OpenLockedQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - OpenLockedQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride); - virtual ~OpenLockedQueryBox() override; + OpenLockedQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx index cacc68bc7d7c..242c1fa7bb22 100644 --- a/uui/source/trylater.cxx +++ b/uui/source/trylater.cxx @@ -18,41 +18,32 @@ */ #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> #include <strings.hrc> #include "trylater.hxx" -TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride) - : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage) +TryLaterQueryBox::TryLaterQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) { - SetImage(GetStandardQueryBoxImage()); + m_xQueryBox->set_title(Translate::get(STR_TRYLATER_TITLE, rResLocale)); // Currently we don't have the retry/save-as functionality implemented for cases when file is locked. // So threat them mutually exclusive with overwrite here. TODO/LATER: just add the overwrite option // as third option when retrying and saving with another name would be possible along with overwriting if (bEnableOverride) { - AddButton(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rResLocale), RET_IGNORE, - ButtonDialogFlags::OK); - AddButton(StandardButtonType::Cancel, RET_CANCEL, - ButtonDialogFlags::Default | ButtonDialogFlags::Cancel | ButtonDialogFlags::Focus); - - SetButtonHelpText(RET_IGNORE, OUString()); + m_xQueryBox->add_button(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rResLocale), RET_IGNORE); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_IGNORE); } else { - AddButton(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - AddButton(Translate::get(STR_TRYLATER_SAVEAS_BTN, rResLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetButtonHelpText( RET_YES, OUString() ); - SetButtonHelpText( RET_NO, OUString() ); + m_xQueryBox->add_button(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_TRYLATER_SAVEAS_BTN, rResLocale), RET_NO); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } } -TryLaterQueryBox::~TryLaterQueryBox() -{ -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/trylater.hxx b/uui/source/trylater.hxx index f03f3cf92187..26b1d6714b9c 100644 --- a/uui/source/trylater.hxx +++ b/uui/source/trylater.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_TRYLATER_HXX #define INCLUDED_UUI_SOURCE_TRYLATER_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class TryLaterQueryBox : public MessBox +class TryLaterQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - TryLaterQueryBox(vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bEnableOverride); - virtual ~TryLaterQueryBox() override; + TryLaterQueryBox(weld::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bEnableOverride); + short run() { return m_xQueryBox->run(); } }; #endif |