From 8bf40d62b65ed59fe9d8ee6e2619839dc6e84b40 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 27 Aug 2026 19:00:42 +0200 Subject: [PATCH] Move QueryDialog to svtools Move QueryDialog from cui to a public svtools header. This is in preparation of using the class directly and dropping the AbstractQueryDialog abstraction altogether. The dialog can e.g. be triggered like this: * start Writer * Ctrl+Shift+S for "Save As" * select "Text (.txt)" for the file type * press OK (Resetting the profile ensures the dialog gets shown in case the "Don't show again" checkbox has been ticked previously.) Change-Id: I57bdade32c21c7ab40c5a4c90bd86e8dea5d2fad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210136 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- cui/Library_cui.mk | 1 - cui/UIConfig_cui.mk | 1 - cui/inc/bitmaps.hlst | 3 --- cui/source/factory/dlgfact.cxx | 3 ++- {cui/source/inc => include/svtools}/querydialog.hxx | 3 ++- svtools/Library_svt.mk | 1 + svtools/UIConfig_svt.mk | 1 + svtools/inc/bitmaps.hlst | 4 ++++ {cui => svtools}/source/dialogs/querydialog.cxx | 9 +++++---- {cui => svtools}/uiconfig/ui/querydialog.ui | 0 vcl/qt5/QtInstanceBuilder.cxx | 2 +- 11 files changed, 16 insertions(+), 12 deletions(-) rename {cui/source/inc => include/svtools}/querydialog.hxx (94%) rename {cui => svtools}/source/dialogs/querydialog.cxx (90%) rename {cui => svtools}/uiconfig/ui/querydialog.ui (100%) diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 02bd6c3d11ea..4456cb86f718 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -140,7 +140,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/dialogs/screenshotannotationdlg \ cui/source/dialogs/pastedlg \ cui/source/dialogs/postdlg \ - cui/source/dialogs/querydialog \ cui/source/dialogs/QrCodeGenDialog \ cui/source/dialogs/GraphicTestsDialog \ cui/source/dialogs/ImageViewerDialog \ diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index fc2de02c396d..9c65874891a8 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -184,7 +184,6 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/querydeletehatchdialog \ cui/uiconfig/ui/querydeletelineenddialog \ cui/uiconfig/ui/querydeletelinestyledialog \ - cui/uiconfig/ui/querydialog \ cui/uiconfig/ui/queryduplicatedialog \ cui/uiconfig/ui/querynoloadedfiledialog \ cui/uiconfig/ui/querynosavefiledialog \ diff --git a/cui/inc/bitmaps.hlst b/cui/inc/bitmaps.hlst index 4bfbb4faf3f8..d064f7aee321 100644 --- a/cui/inc/bitmaps.hlst +++ b/cui/inc/bitmaps.hlst @@ -89,7 +89,4 @@ inline constexpr OUString RID_SVXBMP_TOTD_DRAW = u"res/tipoftheday_d.png"_ustr; inline constexpr OUString RID_SVXBMP_TOTD_IMPRESS = u"res/tipoftheday_i.png"_ustr; inline constexpr OUString RID_SVXBMP_TOTD_SOFFICE = u"res/tipoftheday.png"_ustr; -inline constexpr OUString RID_CUIBMP_QUERY = u"res/query.png"_ustr; -inline constexpr OUString RID_CUIBMP_WARN = u"res/warn.png"_ustr; - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 8206bb29a882..d76e1589a727 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -97,11 +97,12 @@ #include #include #include -#include #include #include +#include + using namespace ::com::sun::star::frame; using namespace ::com::sun::star::container; diff --git a/cui/source/inc/querydialog.hxx b/include/svtools/querydialog.hxx similarity index 94% rename from cui/source/inc/querydialog.hxx rename to include/svtools/querydialog.hxx index cba7ed7e54cc..b6727250a146 100644 --- a/cui/source/inc/querydialog.hxx +++ b/include/svtools/querydialog.hxx @@ -18,6 +18,7 @@ */ #pragma once +#include #include #include #include @@ -25,7 +26,7 @@ #include #include -class QueryDialog final : public weld::GenericDialogController +class SVT_DLLPUBLIC QueryDialog final : public weld::GenericDialogController { private: std::unique_ptr m_pTitle; diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 531b772da62a..4b03c9491fc6 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -113,6 +113,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/dialogs/insdlg \ svtools/source/dialogs/PlaceEditDialog \ svtools/source/dialogs/prnsetup \ + svtools/source/dialogs/querydialog \ svtools/source/dialogs/restartdialog \ svtools/source/dialogs/ServerDetailsControls \ svtools/source/filter/SvFilterOptionsDialog \ diff --git a/svtools/UIConfig_svt.mk b/svtools/UIConfig_svt.mk index 04ce14b67658..04c7c9d96cbf 100644 --- a/svtools/UIConfig_svt.mk +++ b/svtools/UIConfig_svt.mk @@ -30,6 +30,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svt,\ svtools/uiconfig/ui/placeedit \ svtools/uiconfig/ui/printersetupdialog \ svtools/uiconfig/ui/querydeletedialog \ + svtools/uiconfig/ui/querydialog \ svtools/uiconfig/ui/restartdialog \ svtools/uiconfig/ui/scrollbars \ svtools/uiconfig/ui/spinfieldcontrol \ diff --git a/svtools/inc/bitmaps.hlst b/svtools/inc/bitmaps.hlst index 0513302d0544..cf23502d7480 100644 --- a/svtools/inc/bitmaps.hlst +++ b/svtools/inc/bitmaps.hlst @@ -9,6 +9,8 @@ #pragma once +#include + inline constexpr OUString BMP_IMPRESS_SC = u"res/sx03123.png"_ustr; inline constexpr OUString BMP_BITMAP_SC = u"res/sx03125.png"_ustr; inline constexpr OUString BMP_CALC_SC = u"res/sx03126.png"_ustr; @@ -122,6 +124,8 @@ inline constexpr OUString BMP_PRIMARYKEY = u"svtools/res/ed06.png"_ustr; inline constexpr OUString BMP_CURRENT_PRIMARYKEY = u"svtools/res/ed07.png"_ustr; inline constexpr OUString BMP_FILTER = u"svtools/res/ed08.png"_ustr; inline constexpr OUString BMP_HEADERFOOTER = u"svtools/res/ed09.png"_ustr; +inline constexpr OUString BMP_QUERY = u"res/query.png"_ustr; +inline constexpr OUString BMP_WARN = u"res/warn.png"_ustr; inline constexpr OUString BMP_TAB_LOCK = u"cmd/sc_lock.png"_ustr; diff --git a/cui/source/dialogs/querydialog.cxx b/svtools/source/dialogs/querydialog.cxx similarity index 90% rename from cui/source/dialogs/querydialog.cxx rename to svtools/source/dialogs/querydialog.cxx index 543da6c4b135..0fc518c20570 100644 --- a/cui/source/dialogs/querydialog.cxx +++ b/svtools/source/dialogs/querydialog.cxx @@ -17,13 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include #include + +#include #include QueryDialog::QueryDialog(weld::Window* pParent, const OUString& sTitle, const OUString& sText, const OUString& sQuestion, bool bHideShowAgain) - : GenericDialogController(pParent, u"cui/ui/querydialog.ui"_ustr, u"QueryDialog"_ustr) + : GenericDialogController(pParent, u"svt/ui/querydialog.ui"_ustr, u"QueryDialog"_ustr) , m_pTitle(m_xBuilder->weld_label(u"lbTitle"_ustr)) , m_pText(m_xBuilder->weld_label(u"lbText"_ustr)) , m_pQuestion(m_xBuilder->weld_label(u"lbQuestion"_ustr)) @@ -37,7 +38,7 @@ QueryDialog::QueryDialog(weld::Window* pParent, const OUString& sTitle, const OU m_pTitle->set_label(sTitle); m_pText->set_label(sText); m_pQuestion->set_label(sQuestion); - m_pImage->set_from_icon_name(RID_CUIBMP_QUERY); + m_pImage->set_from_icon_name(BMP_QUERY); if (bHideShowAgain) m_pCheckBox->hide(); @@ -57,6 +58,6 @@ void QueryDialog::SetNoLabel(const OUString& rLabel) m_pNo->set_visible(false); } -void QueryDialog::SetTypeWarn() { m_pImage->set_from_icon_name(RID_CUIBMP_WARN); } +void QueryDialog::SetTypeWarn() { m_pImage->set_from_icon_name(BMP_WARN); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/querydialog.ui b/svtools/uiconfig/ui/querydialog.ui similarity index 100% rename from cui/uiconfig/ui/querydialog.ui rename to svtools/uiconfig/ui/querydialog.ui diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index e804afb212b2..3f4b8e5830a8 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -118,7 +118,6 @@ constexpr auto SUPPORTED_UI_FILES = frozen::make_unordered_set