summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-16 20:35:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-18 13:43:34 +0100
commit2fb266bb77722cd45af7346e99a8f214c3f8b198 (patch)
tree00901e9e800809ea30ab378be622446bb7804e46 /extensions
parent6709db941ff3257226f48212d2c36ee1b0d68200 (diff)
unify the message dialogs with extra widgets cases
Change-Id: I9ad3573b15d24c3d1737b9f450792952ae20a31b Reviewed-on: https://gerrit.libreoffice.org/51476 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 'extensions')
-rw-r--r--extensions/source/bibliography/bibview.cxx36
1 files changed, 19 insertions, 17 deletions
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index 308c37ca4f24..c8e87a954dfe 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -41,6 +41,21 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
+namespace
+{
+ class MessageWithCheck : public weld::MessageDialogController
+ {
+ private:
+ std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
+ public:
+ MessageWithCheck(weld::Window *pParent)
+ : weld::MessageDialogController(pParent, "modules/sbibliography/ui/querydialog.ui", "QueryDialog", "ask")
+ , m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
+ {
+ }
+ bool get_active() const { return m_xWarningOnBox->get_active(); }
+ };
+}
namespace bib
{
@@ -139,24 +154,11 @@ namespace bib
sErrorString += "\n";
sErrorString += BibResId(RID_MAP_QUESTION);
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/sbibliography/ui/querydialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryDialog"));
- xQueryBox->set_primary_text(sErrorString);
- std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
-
- //fdo#75121, a bit tricky because the widgets we want to align with
- //don't actually exist in the ui description, they're implied
- std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
- std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area());
- xOrigParent->remove(xWarningOnBox.get());
- xContentArea->add(xWarningOnBox.get());
-
- short nResult = xQueryBox->run();
- BibModul::GetConfig()->SetShowColumnAssignmentWarning(!xWarningOnBox->get_active());
+ MessageWithCheck aQueryBox(GetFrameWeld());
+ aQueryBox.set_primary_text(sErrorString);
- //put them back as they were
- xContentArea->remove(xWarningOnBox.get());
- xOrigParent->add(xWarningOnBox.get());
+ short nResult = aQueryBox.run();
+ BibModul::GetConfig()->SetShowColumnAssignmentWarning(!aQueryBox.get_active());
if( RET_YES != nResult )
{