diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-19 16:33:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-22 22:07:38 +0100 |
commit | 6a4c464b49dbfa2801818ead1b50bc9580824d00 (patch) | |
tree | 3d6381b6b13576bc536670992b36784436486e95 /cui/source/options | |
parent | f7733528e88a6619f82b54b59e92a9bca72c0a89 (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 'cui/source/options')
-rw-r--r-- | cui/source/options/dbregister.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/doclinkdialog.cxx | 18 | ||||
-rw-r--r-- | cui/source/options/optchart.cxx | 10 | ||||
-rw-r--r-- | cui/source/options/optcolor.cxx | 9 | ||||
-rw-r--r-- | cui/source/options/optdict.cxx | 17 | ||||
-rw-r--r-- | cui/source/options/optinet2.cxx | 10 | ||||
-rw-r--r-- | cui/source/options/optjava.cxx | 22 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/optopencl.cxx | 7 |
9 files changed, 69 insertions, 38 deletions
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 2ab19ca73d15..1d3cf77c746b 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -27,7 +27,7 @@ #include <strings.hrc> #include <bitmaps.hlst> #include <vcl/field.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/eitem.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Exception.hpp> @@ -275,8 +275,9 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, DeleteHdl, Button*, void) SvTreeListEntry* pEntry = m_pPathBox->FirstSelected(); if ( pEntry ) { - ScopedVclPtrInstance< MessageDialog > aQuery(this, CuiResId(RID_SVXSTR_QUERY_DELETE_CONFIRM), VclMessageType::Question, VclButtonsType::YesNo); - if ( aQuery->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, CuiResId(RID_SVXSTR_QUERY_DELETE_CONFIRM))); + if (xQuery->run() == RET_YES) m_pPathBox->GetModel()->Remove(pEntry); } } diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx index f57cd6210ebd..abaabd906b90 100644 --- a/cui/source/options/doclinkdialog.cxx +++ b/cui/source/options/doclinkdialog.cxx @@ -23,7 +23,8 @@ #include <comphelper/processfactory.hxx> #include <strings.hrc> #include <svl/filenotation.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <ucbhelper/content.hxx> #include <dialmgr.hxx> #include <tools/urlobj.hxx> @@ -126,8 +127,9 @@ namespace svx { OUString sMsg = CuiResId(STR_LINKEDDOC_DOESNOTEXIST); sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText()); - ScopedVclPtrInstance< MessageDialog > aError(this, sMsg); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xErrorBox->run(); return; } // if (!bFileExists) INetURLObject aURL( sURL ); @@ -135,8 +137,9 @@ namespace svx { OUString sMsg = CuiResId(STR_LINKEDDOC_NO_SYSTEM_FILE); sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText()); - ScopedVclPtrInstance< MessageDialog > aError(this, sMsg); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xErrorBox->run(); return; } @@ -147,8 +150,9 @@ namespace svx { OUString sMsg = CuiResId(STR_NAME_CONFLICT); sMsg = sMsg.replaceFirst("$file$", sCurrentText); - ScopedVclPtrInstance< MessageDialog > aError(this, sMsg, VclMessageType::Info); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, sMsg)); + xErrorBox->run(); m_pName->SetSelection(Selection(0,sCurrentText.getLength())); m_pName->GrabFocus(); diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index 7cecd8e01376..0cedb6e21e9b 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -22,6 +22,7 @@ #include <dialmgr.hxx> #include <vcl/builderfactory.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <svx/svxids.hrc> @@ -286,7 +287,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor, Button*, void) // RemoveChartColor -IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) +IMPL_LINK_NOARG( SvxDefaultColorOptPage, RemoveChartColor, Button*, void ) { sal_Int32 nIndex = m_pLbChartColors->GetSelectedEntryPos(); @@ -297,9 +298,10 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) { OSL_ENSURE(pColorConfig->GetColorList().size() > 1, "don't delete the last chart color"); - ScopedVclPtrInstance<MessageDialog> aQuery(pButton, "QueryDeleteChartColorDialog", - "cui/ui/querydeletechartcolordialog.ui"); - if (RET_YES == aQuery->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletechartcolordialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteChartColorDialog")); + + if (RET_YES == xQuery->run()) { pColorConfig->GetColorList().remove( nIndex ); diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index c20b723a26be..1e8e4c5b2dc3 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -34,6 +34,7 @@ #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> +#include <vcl/weld.hxx> #include <svx/svxdlg.hxx> #include <helpids.h> #include <dialmgr.hxx> @@ -1130,9 +1131,11 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, Button*, pButton, void ) else { DBG_ASSERT(m_pColorSchemeLB->GetEntryCount() > 1, "don't delete the last scheme"); - ScopedVclPtrInstance< MessageDialog > aQuery(pButton, CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - aQuery->SetText(CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE)); - if(RET_YES == aQuery->Execute()) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE))); + xQuery->set_title(CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE)); + if (RET_YES == xQuery->run()) { OUString sDeleteScheme(m_pColorSchemeLB->GetSelectedEntry()); m_pColorSchemeLB->RemoveEntry(m_pColorSchemeLB->GetSelectedEntryPos()); diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 695f358a0346..7b4e4ea5797e 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -27,7 +27,7 @@ #include <comphelper/string.hxx> #include <unotools/intlwrapper.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> #include <svx/dialogs.hrc> @@ -151,7 +151,10 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, Button*, void) if ( bFound ) { // duplicate names? - ScopedVclPtrInstance<MessageDialog>(this, CuiResId(RID_SVXSTR_OPT_DOUBLE_DICTS), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_OPT_DOUBLE_DICTS))); + xInfoBox->run(); pNameEdit->GrabFocus(); return; } @@ -450,12 +453,14 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox&, void) if ( nLang != nOldLang ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, CuiResId( RID_SVXSTR_CONFIRM_SET_LANGUAGE), VclMessageType::Question, VclButtonsType::YesNo); - OUString sTxt(aBox->get_primary_text()); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SVXSTR_CONFIRM_SET_LANGUAGE))); + OUString sTxt(xBox->get_primary_text()); sTxt = sTxt.replaceFirst( "%1", pAllDictsLB->GetSelectedEntry() ); - aBox->set_primary_text(sTxt); + xBox->set_primary_text(sTxt); - if ( aBox->Execute() == RET_YES ) + if (xBox->run() == RET_YES) { xDic->setLocale( LanguageTag::convertToLocale( nLang ) ); bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE; diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index b1d5197e6687..1b4161575e67 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -39,7 +39,7 @@ #include <sfx2/objsh.hxx> #include <unotools/bootstrap.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/builderfactory.hxx> #include <sfx2/viewfrm.hxx> #include <unotools/pathoptions.hxx> @@ -138,7 +138,6 @@ void SvxNoSpaceEdit::KeyInput( const KeyEvent& rKEvent ) Edit::KeyInput(rKEvent); } - void SvxNoSpaceEdit::Modify() { Edit::Modify(); @@ -146,7 +145,12 @@ void SvxNoSpaceEdit::Modify() if ( bOnlyNumeric ) { if ( !isValidPort(GetText()) ) - ScopedVclPtrInstance<MessageDialog>(this, CuiResId( RID_SVXSTR_OPT_PROXYPORTS))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + CuiResId( RID_SVXSTR_OPT_PROXYPORTS))); + xErrorBox->run(); + } } } diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 26b34709384e..30d968607df6 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -35,7 +35,7 @@ #include <vcl/svapp.hxx> #include <vcl/help.hxx> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <unotools/pathoptions.hxx> #include <svtools/imagemgr.hxx> @@ -538,13 +538,17 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder ) } else if ( JFW_E_NOT_RECOGNIZED == eErr ) { - ScopedVclPtrInstance< MessageDialog > aErrBox( this, CuiResId( RID_SVXSTR_JRE_NOT_RECOGNIZED ) ); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_JRE_NOT_RECOGNIZED))); + xBox->run(); } else if ( JFW_E_FAILED_VERSION == eErr ) { - ScopedVclPtrInstance< MessageDialog > aErrBox( this, CuiResId( RID_SVXSTR_JRE_FAILED_VERSION ) ); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_JRE_FAILED_VERSION))); + xBox->run(); } if ( bStartAgain ) @@ -928,7 +932,9 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, Button*, void) { OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sFile ); - ScopedVclPtrInstance<MessageDialog>(this, sMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xBox->run(); } } EnableRemoveButton(); @@ -963,7 +969,9 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, Button*, void) { OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sNewFolder ); - ScopedVclPtrInstance<MessageDialog>(this, sMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xBox->run(); } } EnableRemoveButton(); diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 9400320e3d2d..c2adea57d669 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -21,6 +21,7 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <i18nlangtag/mslangid.hxx> #include <unotools/lingucfg.hxx> #include <editeng/unolingu.hxx> @@ -1553,9 +1554,9 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) } else if (m_pLinguDicsDelPB == pBtn) { - ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDeleteDictionaryDialog", - "cui/ui/querydeletedictionarydialog.ui"); - if (RET_NO == aQuery->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletedictionarydialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteDictionaryDialog")); + if (RET_NO == xQuery->run()) return; SvTreeListEntry *pEntry = m_pLinguDicsCLB->GetCurEntry(); diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx index 5e94bda5a12a..e757231a0c33 100644 --- a/cui/source/options/optopencl.cxx +++ b/cui/source/options/optopencl.cxx @@ -21,6 +21,7 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <svl/zforlist.hxx> #include <opencl/openclconfig.hxx> #include <opencl/openclwrapper.hxx> @@ -101,8 +102,10 @@ bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* ) if (bModified) { - ScopedVclPtrInstance<MessageDialog> aWarnBox(this, CuiResId(RID_SVXSTR_OPTIONS_RESTART), VclMessageType::Info); - aWarnBox->Execute(); + std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_OPTIONS_RESTART))); + xWarnBox->run(); batch->commit(); } |