summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-19 16:33:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-22 22:07:38 +0100
commit6a4c464b49dbfa2801818ead1b50bc9580824d00 (patch)
tree3d6381b6b13576bc536670992b36784436486e95 /svtools
parentf7733528e88a6619f82b54b59e92a9bca72c0a89 (diff)
weld native message dialogs
just the straight-forward MessageDialog cases first a) remove border_width from message dialog .ui so as to take the default border width b) retain 12 as default message dialog border for vcl widget case c) remove layour_style from message dialog button boxes so as to take the default mode (a no-op for vcl widget case) d) use gtk response ids (vcl builder will converts to vcl ones) Change-Id: I7de281093a1b64f92f71ca11e7cbba42bb658154 Reviewed-on: https://gerrit.libreoffice.org/50143 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/contnr/fileview.cxx28
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx7
-rw-r--r--svtools/source/java/javainteractionhandler.cxx48
-rw-r--r--svtools/uiconfig/ui/javadisableddialog.ui10
-rw-r--r--svtools/uiconfig/ui/querydeletedialog.ui8
5 files changed, 46 insertions, 55 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index df6ef2fda9ae..c58f0a6609be 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -726,7 +726,6 @@ void ViewTabListBox_Impl::DeleteEntries()
SvTreeListEntry* pEntry = FirstSelected();
OUString aURL;
- OString sDialogPosition;
while ( pEntry )
{
SvTreeListEntry *pCurEntry = pEntry;
@@ -759,16 +758,12 @@ void ViewTabListBox_Impl::DeleteEntries()
if ( eResult != svtools::QUERYDELETE_ALL )
{
INetURLObject aObj( aURL );
- ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(nullptr, aObj.GetName( INetURLObject::DecodeMechanism::WithCharset ) );
- if ( sDialogPosition.getLength() )
- aDlg->SetWindowState( sDialogPosition );
+ svtools::QueryDeleteDlg_Impl aDlg(GetFrameWeld(), aObj.GetName(INetURLObject::DecodeMechanism::WithCharset));
if ( GetSelectionCount() > 1 )
- aDlg->EnableAllButton();
+ aDlg.EnableAllButton();
- eResult = aDlg->Execute();
-
- sDialogPosition = aDlg->GetWindowState( );
+ eResult = aDlg.run();
}
if ( ( eResult == svtools::QUERYDELETE_ALL ) ||
@@ -2186,24 +2181,17 @@ void SvtFileView_Impl::SetActualFolder( const INetURLObject& rActualFolder )
namespace svtools {
-QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName)
- : MessageDialog(pParent, "QueryDeleteDialog", "svt/ui/querydeletedialog.ui")
+QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName)
+ : m_xBuilder(Application::CreateBuilder(pParent, "svt/ui/querydeletedialog.ui"))
+ , m_xDialog(m_xBuilder->weld_message_dialog("QueryDeleteDialog"))
+ , m_xAllButton(m_xBuilder->weld_button("all"))
{
- get(m_pAllButton, "all");
-
// display specified texts
- set_secondary_text(get_secondary_text().replaceFirst("%s", rName));
+ m_xDialog->set_secondary_text(m_xDialog->get_secondary_text().replaceFirst("%s", rName));
}
QueryDeleteDlg_Impl::~QueryDeleteDlg_Impl()
{
- disposeOnce();
-}
-
-void QueryDeleteDlg_Impl::dispose()
-{
- m_pAllButton.clear();
- MessageDialog::dispose();
}
}
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 7dafc5d4dbd8..c526c7744935 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -30,6 +30,7 @@
#include <vcl/waitobj.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/settings.hxx>
+#include <vcl/weld.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
#include <com/sun/star/awt/XWindow.hpp>
@@ -723,7 +724,7 @@ void AssignmentPersistentData::ImplCommit()
if (!m_xDatabaseContext.is())
{
const OUString sContextServiceName("com.sun.star.sdb.DatabaseContext");
- ShowServiceNotAvailableError( this, sContextServiceName, false);
+ ShowServiceNotAvailableError(GetFrameWeld(), sContextServiceName, false);
return;
}
}
@@ -774,7 +775,7 @@ void AssignmentPersistentData::ImplCommit()
if (!xHandler.is())
{
const OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler");
- ShowServiceNotAvailableError(this, sInteractionHandlerServiceName, true);
+ ShowServiceNotAvailableError(GetFrameWeld(), sInteractionHandlerServiceName, true);
return;
}
@@ -1141,7 +1142,7 @@ void AssignmentPersistentData::ImplCommit()
catch(const Exception&) { }
if (!xAdminDialog.is())
{
- ShowServiceNotAvailableError(this, "com.sun.star.ui.dialogs.AddressBookSourcePilot", true);
+ ShowServiceNotAvailableError(GetFrameWeld(), "com.sun.star.ui.dialogs.AddressBookSourcePilot", true);
return;
}
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 94f0491fd676..094961c51ce3 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -27,8 +27,8 @@
#include <com/sun/star/java/JavaVMCreationFailureException.hpp>
#include <com/sun/star/java/RestartRequiredException.hpp>
#include <comphelper/processfactory.hxx>
-#include <vcl/layout.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
#include <jvmfwk/framework.hxx>
#include <svtools/restartdialog.hxx>
@@ -90,7 +90,6 @@ void SAL_CALL JavaInteractionHandler::release( ) throw ()
delete this;
}
-
void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionRequest >& Request )
{
Any anyExc = Request->getRequest();
@@ -131,20 +130,23 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
// No suitable JRE found
g_JavaEvents.bNotFoundHandled = true;
#if defined( MACOSX )
- ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND_MAC), VclMessageType::Warning);
+ std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, SvtResId(STR_WARNING_JAVANOTFOUND_MAC)));
#elif defined( _WIN32 )
- ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND_WIN), VclMessageType::Warning);
- OUString sPrimTex = aWarningBox->get_primary_text();
+ std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, SvtResId(STR_WARNING_JAVANOTFOUND_WIN)));
+ OUString sPrimTex = xWarningBox->get_primary_text();
#if defined( _WIN64 )
- aWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "64" ));
+ xWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "64" ));
#else
- aWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "32" ));
+ xWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "32" ));
#endif
#else
- ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND), VclMessageType::Warning);
+ std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, SvtResId(STR_WARNING_JAVANOTFOUND)));
#endif
- aWarningBox->SetText(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
- nResult = aWarningBox->Execute();
+ xWarningBox->set_title(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
+ nResult = xWarningBox->run();
}
else
{
@@ -159,12 +161,14 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
// javavendors.xml was updated and Java has not been configured yet
g_JavaEvents.bInvalidSettingsHandled = true;
#ifdef MACOSX
- ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC), VclMessageType::Warning);
+ OUString sWarning(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC));
#else
- ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS), VclMessageType::Warning);
+ OUString sWarning(SvtResId(STR_WARNING_INVALIDJAVASETTINGS));
#endif
- aWarningBox->SetText(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
- nResult = aWarningBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, sWarning));
+ xWarningBox->set_title(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
+ nResult = xWarningBox->run();
}
else
{
@@ -178,9 +182,9 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
{
g_JavaEvents.bDisabledHandled = true;
// Java disabled. Give user a chance to enable Java inside Office.
- ScopedVclPtrInstance<MessageDialog> aQueryBox(nullptr , "JavaDisabledDialog",
- "svt/ui/javadisableddialog.ui");
- nResult = aQueryBox->Execute();
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "svt/ui/javadisableddialog.ui"));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("JavaDisabledDialog"));
+ nResult = xQueryBox->run();
if ( nResult == RET_YES )
{
jfw_setEnabled(true);
@@ -202,12 +206,14 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
// Java not correctly installed, or damaged
g_JavaEvents.bVMCreationFailureHandled = true;
#ifdef MACOSX
- ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
+ OUString sWarning(SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
#else
- ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED));
+ OUString sWarning(SvtResId(STR_ERROR_JVMCREATIONFAILED));
#endif
- aErrorBox->SetText(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
- nResult = aErrorBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, sWarning));
+ xErrorBox->set_title(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
+ nResult = xErrorBox->run();
}
else
{
diff --git a/svtools/uiconfig/ui/javadisableddialog.ui b/svtools/uiconfig/ui/javadisableddialog.ui
index bc2d7b250207..a60d6aa74ded 100644
--- a/svtools/uiconfig/ui/javadisableddialog.ui
+++ b/svtools/uiconfig/ui/javadisableddialog.ui
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.2 -->
<interface domain="svt">
<requires lib="gtk+" version="3.0"/>
<object class="GtkMessageDialog" id="JavaDisabledDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
<property name="title" translatable="yes" context="javadisableddialog|JavaDisabledDialog">Enable JRE?</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
@@ -19,7 +18,6 @@
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
<child>
<object class="GtkButton" id="no">
<property name="label">gtk-no</property>
@@ -77,9 +75,9 @@
</object>
</child>
<action-widgets>
- <action-widget response="3">no</action-widget>
- <action-widget response="2">yes</action-widget>
- <action-widget response="0">cancel</action-widget>
+ <action-widget response="-9">no</action-widget>
+ <action-widget response="-8">yes</action-widget>
+ <action-widget response="-6">cancel</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/svtools/uiconfig/ui/querydeletedialog.ui b/svtools/uiconfig/ui/querydeletedialog.ui
index de2e3d102235..71ee4c7af917 100644
--- a/svtools/uiconfig/ui/querydeletedialog.ui
+++ b/svtools/uiconfig/ui/querydeletedialog.ui
@@ -4,7 +4,6 @@
<requires lib="gtk+" version="3.0"/>
<object class="GtkMessageDialog" id="QueryDeleteDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
<property name="title" translatable="yes" context="querydeletedialog|QueryDeleteDialog">Confirm Delete</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
@@ -20,7 +19,6 @@
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
- <property name="layout_style">center</property>
<child>
<object class="GtkButton" id="yes">
<property name="label" translatable="yes" context="querydeletedialog|yes">_Delete</property>
@@ -91,10 +89,10 @@
</object>
</child>
<action-widgets>
- <action-widget response="2">yes</action-widget>
+ <action-widget response="-8">yes</action-widget>
<action-widget response="101">all</action-widget>
- <action-widget response="3">no</action-widget>
- <action-widget response="0">cancel</action-widget>
+ <action-widget response="-9">no</action-widget>
+ <action-widget response="-6">cancel</action-widget>
</action-widgets>
</object>
</interface>