include/vcl/weld.hxx                  |    9 +++++++++
 vcl/inc/qt5/QtInstanceBuilder.hxx     |    2 +-
 vcl/inc/qt5/QtInstanceRadioButton.hxx |    2 --
 vcl/inc/salvtables.hxx                |    4 ----
 vcl/qt5/QtInstance.cxx                |    2 +-
 vcl/qt5/QtInstanceBuilder.cxx         |   11 +++++++++--
 vcl/qt5/QtInstanceRadioButton.cxx     |    8 --------
 vcl/source/app/salvtables.cxx         |    7 -------
 vcl/unx/gtk3/gtkinst.cxx              |    7 +++++++
 9 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit 9a03fb9266440013eef5f8cd11cc1e5478706496
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon May 12 14:05:23 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon May 12 21:02:08 2025 +0200

    tdf#130857 qt weld: Support new Welcome dialog
    
        commit 9d90a1733bcf65763268583c97cd5e31a2f90f0c
        Date:   Tue Apr 15 09:22:55 2025 +0200
    
            Resolves tdf#137931 - Show a Welcome dialog on first start-up
    
    introduced a new dialog that gets shown on first start-up.
    (Deleting the user profile before starting can be used
    to simulate that).
    
    Make that one work using native Qt widgets with
    SAL_VCL_QT_USE_WELDED_WIDGETS=1 by adding the newly
    added .ui files to the list of supported .ui files.
    
    The existing "Appearance" tab page ("cui/ui/appearance.ui")
    cannot be declared as supported unconditionally, because
    the "Tools" -> "Options" dialog (and therefore it's "Appearance")
    page are not using native widgets yet.
    
    Therefore, only use native widgets if the parent
    itself is also a native Qt one to distinguish the
    two cases.
    
    Without this commit, the dialog looks broken, because
    part of the .ui files used were declared as supported,
    but others weren't.
    
    Change-Id: Ia224b68b36153b1e818d506e0dc9643292a394d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185215
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx 
b/vcl/inc/qt5/QtInstanceBuilder.hxx
index 788484dcbbb3..dc1a9da87457 100644
--- a/vcl/inc/qt5/QtInstanceBuilder.hxx
+++ b/vcl/inc/qt5/QtInstanceBuilder.hxx
@@ -27,7 +27,7 @@ public:
     QtInstanceBuilder(QWidget* pParent, std::u16string_view sUIRoot, const 
OUString& rUIFile);
     ~QtInstanceBuilder();
 
-    static bool IsUIFileSupported(const OUString& rUIFile);
+    static bool IsUIFileSupported(const OUString& rUIFile, const weld::Widget* 
pParent);
 
     virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const 
OUString& id) override;
     virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& rId) 
override;
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index 242b8d10a5a6..c32ec7128d29 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -912,7 +912,7 @@ QtInstance::CreateBuilder(weld::Widget* pParent, const 
OUString& rUIRoot, const
     // for now, require explicitly enabling use of QtInstanceBuilder via 
SAL_VCL_QT_USE_WELDED_WIDGETS
     static const bool bUseWeldedWidgets = 
(getenv("SAL_VCL_QT_USE_WELDED_WIDGETS") != nullptr);
     if (bUseWeldedWidgets && !QtData::noWeldedWidgets()
-        && QtInstanceBuilder::IsUIFileSupported(rUIFile))
+        && QtInstanceBuilder::IsUIFileSupported(rUIFile, pParent))
     {
         QWidget* pQtParent = GetNativeParentFromWeldParent(pParent);
         return std::make_unique<QtInstanceBuilder>(pQtParent, rUIRoot, 
rUIFile);
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 7049cbf8e3bf..73c3406ee4f5 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -55,7 +55,7 @@ QtInstanceBuilder::QtInstanceBuilder(QWidget* pParent, 
std::u16string_view sUIRo
 
 QtInstanceBuilder::~QtInstanceBuilder() {}
 
-bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile)
+bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile, const 
weld::Widget* pParent)
 {
     // set of supported UI files
     //
@@ -88,6 +88,8 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile)
         u"cui/ui/tipofthedaydialog.ui"_ustr,
         u"cui/ui/toolbarmodedialog.ui"_ustr,
         u"cui/ui/uitabpage.ui"_ustr,
+        u"cui/ui/welcomedialog.ui"_ustr,
+        u"cui/ui/whatsnewtabpage.ui"_ustr,
         u"cui/ui/zoomdialog.ui"_ustr,
         u"dbaccess/ui/savedialog.ui"_ustr,
         u"dbaccess/ui/tabledesignsavemodifieddialog.ui"_ustr,
@@ -156,7 +158,12 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile)
         u"writerperfect/ui/exportepub.ui"_ustr,
     };
 
-    return aSupportedUIFiles.contains(rUIFile);
+    if (aSupportedUIFiles.contains(rUIFile))
+        return true;
+
+    // this tab page is currently only supported in the "Welcome" dialog, but
+    // not in the "Tools" -> "Options" dialog that's not using native Qt 
widgets yet
+    return rUIFile == u"cui/ui/appearance.ui" && dynamic_cast<const 
QtInstanceWidget*>(pParent);
 }
 
 std::unique_ptr<weld::MessageDialog> 
QtInstanceBuilder::weld_message_dialog(const OUString& id)
commit ffb7dc831556c2ce898b167248bed731ea6b2024
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon May 12 13:29:53 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon May 12 21:01:58 2025 +0200

    tdf#130857 weld: Reject inconsistent state for radio button
    
    Being a weld::Toggleable subclass, weld::RadioButton
    implementations need to implement
    weldd::Toggleable::{g,s}et_inconsistent.
    
    However, neither the VCL implementation (SalInstanceRadioButton)
    nor the Qt implementation (QtInstanceRadioButton)
    have a concept of an inconsistent state for radio buttons
    (while checkboxes/check buttons do).
    
    The SalInstanceRadioButton implementation was
    already doing nothing when trying to set the
    state, and always returning false when
    querying the state.
    
    Move the logic to the base class, weld::RadioButton
    and add an assert in weld::RadioButton::set_inconsistent
    to prevent any users from trying to set that state (to true).
    (If there any existing ones, they need to be adjusted.)
    
    Setting the state to `false` (as e.g. implicitly
    happens when calling weld::Toggleable::set_state with a value
    of TRISTATE_TRUE or TRISTATE_FALSE) is fine, only trying to
    set to `true` is problematic.
    
    For GtkInstanceRadioButton, explicitly call the new
    weld::RadioButton versions. (Previously, the ones
    derived from its GtkInstanceCheckButton base class
    were used.)
    
    Change-Id: I292ff838b62205d906fb2faf0d391c503a4786e0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185214
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 7173936c2579..ec8f3f5ac4b9 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1715,6 +1715,15 @@ public:
 
 class VCL_DLLPUBLIC RadioButton : virtual public CheckButton
 {
+public:
+    // radio button doesn't support inconsistent state
+    void set_inconsistent(bool bInconsistent) override
+    {
+        assert(!bInconsistent && "Radio button doesn't support inconsistent 
state");
+        (void)bInconsistent;
+    }
+
+    bool get_inconsistent() const override { return false; }
 };
 
 class VCL_DLLPUBLIC LinkButton : virtual public Widget
diff --git a/vcl/inc/qt5/QtInstanceRadioButton.hxx 
b/vcl/inc/qt5/QtInstanceRadioButton.hxx
index 56955c5f51d5..443bffb1c5ce 100644
--- a/vcl/inc/qt5/QtInstanceRadioButton.hxx
+++ b/vcl/inc/qt5/QtInstanceRadioButton.hxx
@@ -26,8 +26,6 @@ public:
     // weld::Toggleable methods
     virtual void set_active(bool bActive) override;
     virtual bool get_active() const override;
-    virtual void set_inconsistent(bool bInconsistent) override;
-    virtual bool get_inconsistent() const override;
 
     // weld::RadioButton methods
     virtual void set_label(const OUString& rText) override;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 20fc7cf064ef..a9c4b4c3f306 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -2028,10 +2028,6 @@ public:
 
     virtual void set_from_icon_name(const OUString& rIconName) override;
 
-    virtual void set_inconsistent(bool /*inconsistent*/) override;
-
-    virtual bool get_inconsistent() const override;
-
     virtual void set_label(const OUString& rText) override { 
SalInstanceButton::set_label(rText); }
 
     virtual OUString get_label() const override { return 
SalInstanceButton::get_label(); }
diff --git a/vcl/qt5/QtInstanceRadioButton.cxx 
b/vcl/qt5/QtInstanceRadioButton.cxx
index 2ad75a7227e7..e9cf7b658ef5 100644
--- a/vcl/qt5/QtInstanceRadioButton.cxx
+++ b/vcl/qt5/QtInstanceRadioButton.cxx
@@ -34,14 +34,6 @@ bool QtInstanceRadioButton::get_active() const
     return bActive;
 }
 
-void QtInstanceRadioButton::set_inconsistent(bool) { assert(false && "Not 
implemented yet"); }
-
-bool QtInstanceRadioButton::get_inconsistent() const
-{
-    assert(false && "Not implemented yet");
-    return false;
-}
-
 void QtInstanceRadioButton::set_label(const OUString& rText)
 {
     SolarMutexGuard g;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 491db4a0e82d..d4fe36fd8b0c 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3172,13 +3172,6 @@ void SalInstanceRadioButton::set_from_icon_name(const 
OUString& rIconName)
     m_xRadioButton->SetModeRadioImage(Image(StockImage::Yes, rIconName));
 }
 
-void SalInstanceRadioButton::set_inconsistent(bool /*inconsistent*/)
-{
-    //not available
-}
-
-bool SalInstanceRadioButton::get_inconsistent() const { return false; }
-
 void SalInstanceRadioButton::set_label_wrap(bool bWrap)
 {
     ::set_label_wrap(*m_xRadioButton, bWrap);
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index a1edcf3b55ce..c43224bf81aa 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -12833,6 +12833,13 @@ public:
 #endif
     {
     }
+
+    void set_inconsistent(bool bInconsistent) override
+    {
+        weld::RadioButton::set_inconsistent(bInconsistent);
+    }
+
+    bool get_inconsistent() const override { return 
weld::RadioButton::get_inconsistent(); }
 };
 
 }

Reply via email to