summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-23 09:35:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-26 15:27:09 +0000
commit942f05996bc287923cdbcae12c64e57adf8ec975 (patch)
tree7005380763a9ecb93f5f27c28174633b9774abb7 /extensions
parentc410a3dcfeb68ba2247c0d879727afe4ca8ed3da (diff)
convert remaining ErrorBox to weld::MessageDialog
and convert remaining QueryBox to weld::MessageDialog Change-Id: Ifb4c316dee8eabf57c4940c44e29c65a2781aa6c
Diffstat (limited to 'extensions')
-rw-r--r--extensions/UIConfig_sbibliography.mk1
-rw-r--r--extensions/source/bibliography/bibview.cxx27
-rw-r--r--extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx12
-rw-r--r--extensions/uiconfig/sbibliography/ui/querydialog.ui46
4 files changed, 75 insertions, 11 deletions
diff --git a/extensions/UIConfig_sbibliography.mk b/extensions/UIConfig_sbibliography.mk
index 0a25c8f0035e..00375d9fae1e 100644
--- a/extensions/UIConfig_sbibliography.mk
+++ b/extensions/UIConfig_sbibliography.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/sbibliography,\
$(eval $(call gb_UIConfig_add_uifiles,modules/sbibliography,\
extensions/uiconfig/sbibliography/ui/choosedatasourcedialog \
extensions/uiconfig/sbibliography/ui/generalpage \
+ extensions/uiconfig/sbibliography/ui/querydialog \
extensions/uiconfig/sbibliography/ui/mappingdialog \
extensions/uiconfig/sbibliography/ui/toolbar \
))
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index 33a0df0d564d..308c37ca4f24 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -32,7 +32,7 @@
#include <vcl/svapp.hxx>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/form/XLoadable.hpp>
-#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
#include <tools/debug.hxx>
using namespace ::com::sun::star;
@@ -138,11 +138,26 @@ namespace bib
{
sErrorString += "\n";
sErrorString += BibResId(RID_MAP_QUESTION);
- ScopedVclPtrInstance< QueryBox > aQuery(this, MessBoxStyle::YesNo, sErrorString);
- aQuery->SetDefaultCheckBoxText();
- short nResult = aQuery->Execute();
- BibModul::GetConfig()->SetShowColumnAssignmentWarning(
- !aQuery->GetCheckBoxState());
+
+ 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());
+
+ //put them back as they were
+ xContentArea->remove(xWarningOnBox.get());
+ xOrigParent->add(xWarningOnBox.get());
+
if( RET_YES != nResult )
{
bExecute = false;
diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx
index 7203c638f353..2f5d063ddc4d 100644
--- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx
+++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx
@@ -40,7 +40,8 @@
#include <com/sun/star/beans/Optional.hpp>
#include <com/sun/star/inspection/XObjectInspectorUI.hpp>
#include <com/sun/star/inspection/PropertyLineElement.hpp>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
#include <tools/debug.hxx>
#include <sal/macros.h>
@@ -510,7 +511,6 @@ namespace pcr
m_pHelper->setValidatingDataTypeByName( _rNewName );
}
-
bool XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType()
{
OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType: this will crash!" );
@@ -525,14 +525,16 @@ namespace pcr
// confirmation message
OUString sConfirmation( PcrRes( RID_STR_CONFIRM_DELETE_DATA_TYPE ) );
sConfirmation = sConfirmation.replaceFirst( "#type#", pType->getName() );
- ScopedVclPtrInstance<QueryBox> aQuery( nullptr, MessBoxStyle::YesNo, sConfirmation ); // TODO/eForms: proper parent
- if ( aQuery->Execute() != RET_YES )
+
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, // TODO/eForms: proper parent
+ VclMessageType::Question, VclButtonsType::YesNo,
+ sConfirmation));
+ if (xQueryBox->run() != RET_YES)
return false;
return true;
}
-
bool XSDValidationPropertyHandler::implDoRemoveCurrentDataType()
{
OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implDoRemoveCurrentDataType: this will crash!" );
diff --git a/extensions/uiconfig/sbibliography/ui/querydialog.ui b/extensions/uiconfig/sbibliography/ui/querydialog.ui
new file mode 100644
index 000000000000..1c641670ab73
--- /dev/null
+++ b/extensions/uiconfig/sbibliography/ui/querydialog.ui
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.2 -->
+<interface domain="pcr">
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkMessageDialog" id="QueryDialog">
+ <property name="can_focus">False</property>
+ <property name="type_hint">dialog</property>
+ <property name="message_type">question</property>
+ <property name="buttons">yes-no</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="ask">
+ <property name="label" translatable="yes" context="querydialog|ask">Do not show this question again.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>