vcl/inc/qt5/QtInstanceDialog.hxx | 2 +- vcl/inc/qt5/QtInstanceMessageDialog.hxx | 1 - vcl/qt5/QtInstanceBuilder.cxx | 1 + vcl/qt5/QtInstanceDialog.cxx | 9 +++++++-- vcl/qt5/QtInstanceMessageDialog.cxx | 14 -------------- vcl/qt5/QtTools.cxx | 13 ------------- 6 files changed, 9 insertions(+), 31 deletions(-)
New commits: commit ef7da29145c461877ba6aad0c72ec398eca650cb Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 18 15:08:00 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 18 18:59:23 2024 +0200 tdf#130857 qt weld: Use native widgets for "Restart LO" dialog Add the .ui file of the "Restart %PRODUCTNAME" dialog to the list of .ui files suported by QtInstanceBuilder. This means that a dialog using native Qt widgets gets used by the qt5/qt6 VCL plugins now when e.g. toggling experimental mode in "Tools" -> "Options" and closing the options dialog with the "OK" button. Change-Id: I617bcb4d0815aeae8a30d7765ff7b4c0cc6992e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175136 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index c4918c13e8e4..b1c7297876b8 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -40,6 +40,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) u"modules/swriter/ui/inforeadonlydialog.ui"_ustr, u"sfx/ui/licensedialog.ui"_ustr, u"sfx/ui/querysavedialog.ui"_ustr, + u"svt/ui/restartdialog.ui"_ustr, }; return aSupportedUIFiles.contains(rUIFile); commit ea6c0c3aef800431c5ce3ff705ad6e7e878d9fee Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 18 14:44:12 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 18 18:59:17 2024 +0200 tdf#130857 qt weld: Leave dialog response codes unchanged Don't call `qtResponseTypeToVclResponseType` to convert an alleged Qt response code to a VCL one in QtInstanceDialog::run. In fact, the return code is already the VCL one, see commit 08b55df5c9e42c1ccb78a156261811875629342a Author: Michael Weghorn <[email protected]> Date: Sat Sep 28 00:32:15 2024 +0200 tdf#130857 qt weld: Close dialog on button click QDialog::Accepted and VCL's RET_OK both happen to be 1, so that mapping didn't have any effect, but everything else would be mapped to `RET_CANCEL` unconditionally. This wasn't a problem so far, most likely because the few non-message dialogs using native Qt widgets didn't use the response codes yet. For example, for the "Help" -> "License Information" dialog, only `RET_OK` is explicitly handled in `LicenseDialog::run` (sfx2/source/appl/appserv.cxx). Change-Id: If0a7cbf291ad94b21d6bbeecb9793b4afaa2c76d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175135 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index 8654b175e3b8..ef88d4e2e005 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -91,7 +91,7 @@ int QtInstanceDialog::run() return nResult; } - return qtResponseTypeToVclResponseType(m_pDialog->exec()); + return m_pDialog->exec(); } void QtInstanceDialog::response(int nResponse) diff --git a/vcl/qt5/QtTools.cxx b/vcl/qt5/QtTools.cxx index f9ca85137754..e1eb3d1d8bce 100644 --- a/vcl/qt5/QtTools.cxx +++ b/vcl/qt5/QtTools.cxx @@ -170,19 +170,6 @@ QString vclMessageTypeToQtTitle(VclMessageType eType) return title; } -int qtResponseTypeToVclResponseType(int ret) -{ - if (ret == QDialog::Accepted) - { - ret = RET_OK; - } - else - { - ret = RET_CANCEL; - } - return ret; -} - QString vclToQtStringWithAccelerator(const OUString& rText) { // preserve literal '&'s and use '&' instead of '~' for the accelerator commit 8a4cb0af2c5ea8b9194aecae272ff93ce2544823 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 18 14:17:39 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Oct 18 18:59:11 2024 +0200 tdf#130857 qt weld: Implement QtInstanceDialog::response Move the QtInstanceMessageDialog::response implementation down into the base class QtInstanceDialog and simplify a bit, and drop the override in QtInstanceMessageDialog. This will be needed e.g. by the svtools/uiconfig/ui/restartdialog.ui dialog shown when toggling experimental mode in "Tools" -> "Options" and closing the dialog with the "OK" button. Change-Id: I147ea68554725a9d3b6bea6f77b15e7754cc962b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175132 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/qt5/QtInstanceDialog.hxx b/vcl/inc/qt5/QtInstanceDialog.hxx index 0de7a1858008..d4c8dc3ff9b1 100644 --- a/vcl/inc/qt5/QtInstanceDialog.hxx +++ b/vcl/inc/qt5/QtInstanceDialog.hxx @@ -43,7 +43,7 @@ public: virtual int run() override; - virtual void response(int) override; + virtual void response(int nResponse) override; virtual void add_button(const OUString&, int, const OUString& rHelpId = {}) override; diff --git a/vcl/inc/qt5/QtInstanceMessageDialog.hxx b/vcl/inc/qt5/QtInstanceMessageDialog.hxx index a410a8fd5dfc..42489aa5a7cf 100644 --- a/vcl/inc/qt5/QtInstanceMessageDialog.hxx +++ b/vcl/inc/qt5/QtInstanceMessageDialog.hxx @@ -39,7 +39,6 @@ public: virtual void set_default_response(int nResponse) override; QtInstanceButton* weld_widget_for_response(int nResponse) override; virtual int run() override; - virtual void response(int nResponse) override; private: virtual QPushButton* buttonForResponseCode(int nResponse); diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index 39346fcfddbc..8654b175e3b8 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -94,7 +94,12 @@ int QtInstanceDialog::run() return qtResponseTypeToVclResponseType(m_pDialog->exec()); } -void QtInstanceDialog::response(int) {} +void QtInstanceDialog::response(int nResponse) +{ + SolarMutexGuard g; + QtInstance& rQtInstance = GetQtInstance(); + rQtInstance.RunInMainThread([&] { m_pDialog->done(nResponse); }); +} void QtInstanceDialog::add_button(const OUString&, int, const OUString&) {} diff --git a/vcl/qt5/QtInstanceMessageDialog.cxx b/vcl/qt5/QtInstanceMessageDialog.cxx index 906c17bc3aec..c2e80a146737 100644 --- a/vcl/qt5/QtInstanceMessageDialog.cxx +++ b/vcl/qt5/QtInstanceMessageDialog.cxx @@ -145,20 +145,6 @@ int QtInstanceMessageDialog::run() return pClickedButton->property(PROPERTY_VCL_RESPONSE_CODE).toInt(); } -void QtInstanceMessageDialog::response(int nResponse) -{ - SolarMutexGuard g; - QtInstance& rQtInstance = GetQtInstance(); - if (!rQtInstance.IsMainThread()) - { - rQtInstance.RunInMainThread([&] { response(nResponse); }); - return; - } - - assert(m_pMessageDialog); - m_pMessageDialog->done(nResponse); -} - void QtInstanceMessageDialog::dialogFinished(int nResult) { SolarMutexGuard g;
