vcl/inc/qt5/QtInstanceMessageDialog.hxx |    6 ++++++
 vcl/qt5/QtBuilder.cxx                   |    7 +++++--
 vcl/qt5/QtInstanceBuilder.cxx           |    1 +
 vcl/qt5/QtInstanceMessageDialog.cxx     |    6 +-----
 4 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit eb688cf19d870909938690fd333bf3a5e5c97273
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Sep 25 12:28:52 2024 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Wed Sep 25 21:10:28 2024 +0200

    tdf#130857 qt weld: Use native "Save Document?" dialog
    
    Now that
    
        Change-Id: If6e03bfa48b9052016539a25aadf40b599095918
        Author: Michael Weghorn <[email protected]>
        Date:   Wed Sep 25 12:10:12 2024 +0200
    
            tdf#130857 qt weld: Implement QtBuilder::set_response
    
    implemented handling for button response codes,
    let QtInstanceBuilder create the "Save Document?"
    dialog that shows when closing LibreOffice while
    an unsaved modified document is open.
    
    This means that a native QMessageBox is now used for
    that dialog as well, unless env variable
    SAL_VCL_QT_NO_WELDED_WIDGETS is set.
    
    Change-Id: Ifb6c6f181d95d88138ed49f382b9eaad4d3ad944
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173932
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 68386ec6d3d2..611d5899063b 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -33,6 +33,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile)
     // weld API at once.
     static std::unordered_set<OUString> aSupportedUIFiles = {
         u"modules/swriter/ui/inforeadonlydialog.ui"_ustr,
+        u"sfx/ui/querysavedialog.ui"_ustr,
     };
 
     return aSupportedUIFiles.contains(rUIFile);
commit 9b08982ff4a77603249af5edb013db7c6e03f82b
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Sep 25 12:10:12 2024 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Wed Sep 25 21:10:21 2024 +0200

    tdf#130857 qt weld: Implement QtBuilder::set_response
    
    Implement QtBuilder::set_response to set the
    given response code for a button:
    
    Set the `PROPERTY_VCL_RESPONSE_CODE` property
    on the QPushButton.
    `QtInstanceMessageDialog` makes use of that property
    to return the corresponding response code of the
    pressed button.
    
    (Make `PROPERTY_VCL_RESPONSE_CODE` a static
    member of `QtInstanceMessageDialog` to make
    it available outside of the class as well.)
    
    This works for buttons in message dialogs.
    An implementation for other dialogs still needs
    to be added when adding suppor for these to `QtBuilder`
    and extending `QtInstanceDialog`/`QtInstanceButton`
    accordingly.
    
    Change-Id: If6e03bfa48b9052016539a25aadf40b599095918
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173931
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/inc/qt5/QtInstanceMessageDialog.hxx 
b/vcl/inc/qt5/QtInstanceMessageDialog.hxx
index 5c09d5090781..2b73566bf574 100644
--- a/vcl/inc/qt5/QtInstanceMessageDialog.hxx
+++ b/vcl/inc/qt5/QtInstanceMessageDialog.hxx
@@ -52,6 +52,12 @@ public:
                           const std::function<void(sal_Int32)>& func) override;
     virtual void response(int nResponse) override;
 
+    /**
+    * Name of the property to set on a QPushButton that holds the
+    * int VCL response code of that button.
+    */
+    static const char* const PROPERTY_VCL_RESPONSE_CODE;
+
 private:
     virtual QPushButton* buttonForResponseCode(int nResponse);
 
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index b79c83959242..cda2d5866c58 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -9,6 +9,7 @@
 
 #include <QtBuilder.hxx>
 
+#include <QtInstanceMessageDialog.hxx>
 #include <QtTools.hxx>
 
 #include <rtl/ustrbuf.hxx>
@@ -149,9 +150,11 @@ void QtBuilder::applyPackingProperties(QObject*, QObject*, 
const stringmap&)
     SAL_WARN("vcl.qt", "QtBuilder::applyPackingProperties not implemented 
yet");
 }
 
-void QtBuilder::set_response(std::u16string_view, short)
+void QtBuilder::set_response(std::u16string_view sID, short nResponse)
 {
-    SAL_WARN("vcl.qt", "QtBuilder::set_response not implemented yet");
+    QPushButton* pPushButton = get<QPushButton>(sID);
+    assert(pPushButton);
+    
pPushButton->setProperty(QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE, 
int(nResponse));
 }
 
 void QtBuilder::setProperties(QObject* obj, stringmap& rProps)
diff --git a/vcl/qt5/QtInstanceMessageDialog.cxx 
b/vcl/qt5/QtInstanceMessageDialog.cxx
index 7b17c106fa65..a0aa35958140 100644
--- a/vcl/qt5/QtInstanceMessageDialog.cxx
+++ b/vcl/qt5/QtInstanceMessageDialog.cxx
@@ -12,11 +12,7 @@
 
 #include <QtWidgets/QPushButton>
 
-/**
- * Name of the property to set on a QPushButton that holds the
- * VCL response code of that button.
- */
-const char* const PROPERTY_VCL_RESPONSE_CODE = "response-code";
+const char* const QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE = 
"response-code";
 
 QtInstanceMessageDialog::QtInstanceMessageDialog(QMessageBox* pMessageDialog)
     : QtInstanceDialog(pMessageDialog)

Reply via email to