extensions/source/update/check/updatehdl.cxx |   45 ++++++++++-----------------
 extensions/source/update/check/updatehdl.hxx |    8 +++-
 2 files changed, 23 insertions(+), 30 deletions(-)

New commits:
commit 670de20ab13031d0fd52dd5333b593dc8931d84d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Sep 17 11:52:50 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Sep 17 14:31:39 2025 +0200

    tdf#104833 a11y: Set mnemonic widgets in update check dialog
    
    As described in previous commit
    
        Change-Id: I8e41fb68d5b5e4c3e892803e4139c30f14019f3c
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Wed Sep 17 11:23:53 2025 +0200
    
            tdf#104833 update check: Start using vcl::Window more directly
    
    , the update check dialog doesn't use the standard
    approach of a .ui file where mnemonic widgets can
    be set at this point in time.
    
    With the above commit in place, the mnemonic widget
    can however be set in code now, using FixedText::set_mnemonic_widget.
    
    Do that for now so that the accessible relations get
    set correctly. (Eventually, the dialog should still
    get welded, i.e. converted to use the standard
    approach, but don't block making it more accessible
    on that.)
    
    This makes the Orca screen reader with the qt6
    VCL plugin on Linux now announce the associated
    label when one of the readonly text views receives
    focus, e.g. it now says
    "Status, LibreOfficeDev 26.2 is up to date." instead of
    just "LibreOfficeDev 26.2 is up to date." when that control
    receives focus, so the context is now clear.
    
    Change-Id: Ic9ad5e7042ff76c493394b2b119c6df80b0abdaf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191075
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/extensions/source/update/check/updatehdl.cxx 
b/extensions/source/update/check/updatehdl.cxx
index 085127ef77ae..14e7372d4c6c 100644
--- a/extensions/source/update/check/updatehdl.cxx
+++ b/extensions/source/update/check/updatehdl.cxx
@@ -64,6 +64,7 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/urlobj.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/toolkit/fixed.hxx>
 #include <vcl/vclenum.hxx>
 #include <comphelper/diagnose_ex.hxx>
 
@@ -76,6 +77,9 @@ constexpr OUString TEXT_STATUS = u"text_status"_ustr;
 constexpr OUString TEXT_PERCENT = u"text_percent"_ustr;
 constexpr OUString TEXT_DESCRIPTION = u"text_description"_ustr;
 
+const OUString FIXEDLINE_STATUS = u"fixedLineStatus"_ustr;
+const OUString FIXEDLINE_DESCRIPTION = u"fixedTextDescription"_ustr;
+
 constexpr OUStringLiteral FIXED_LINE_MODEL = 
u"com.sun.star.awt.UnoControlFixedLineModel";
 constexpr OUString FIXED_TEXT_MODEL = 
u"com.sun.star.awt.UnoControlFixedTextModel"_ustr;
 constexpr OUString EDIT_FIELD_MODEL = 
u"com.sun.star.awt.UnoControlEditModel"_ustr;
@@ -1008,7 +1012,7 @@ void UpdateHandler::createDialog()
     {   // Label (fixed text) <status>
         uno::Sequence< beans::NamedValue > aProps { { u"Label"_ustr, uno::Any( 
msStatusFL ) } };
 
-        insertControlModel( xControlModel, FIXED_TEXT_MODEL, 
u"fixedLineStatus"_ustr,
+        insertControlModel( xControlModel, FIXED_TEXT_MODEL, FIXEDLINE_STATUS,
                             awt::Rectangle( DIALOG_BORDER+1, DIALOG_BORDER, 
EDIT_WIDTH-2, LABEL_HEIGHT ),
                             aProps );
     }
@@ -1105,7 +1109,7 @@ void UpdateHandler::createDialog()
     {   // Label (FixedText) <description>
         uno::Sequence< beans::NamedValue > aProps { { u"Label"_ustr, uno::Any( 
msDescription ) } };
 
-        insertControlModel( xControlModel, FIXED_TEXT_MODEL, 
u"fixedTextDescription"_ustr,
+        insertControlModel( xControlModel, FIXED_TEXT_MODEL, 
FIXEDLINE_DESCRIPTION,
                             awt::Rectangle( DIALOG_BORDER+1, LABEL_Y_POS, 
EDIT_WIDTH-2, LABEL_HEIGHT ),
                             aProps );
     }
@@ -1235,6 +1239,14 @@ void UpdateHandler::createDialog()
     m_pDescriptionEdit = getWindow(TEXT_DESCRIPTION);
     m_pPercentEdit = getWindow(TEXT_PERCENT);
     m_pProgressBar = dynamic_cast<ProgressBar*>(getWindow(CTRL_PROGRESS));
+
+    FixedText* pStatusLabel = 
dynamic_cast<FixedText*>(getWindow(FIXEDLINE_STATUS));
+    assert(pStatusLabel);
+    pStatusLabel->set_mnemonic_widget(m_pStatusEdit);
+
+    FixedText* pDescriptionLabel = 
dynamic_cast<FixedText*>(getWindow(FIXEDLINE_DESCRIPTION));
+    assert(pDescriptionLabel);
+    pDescriptionLabel->set_mnemonic_widget(m_pDescriptionEdit);
 }
 
 vcl::Window* UpdateHandler::getWindow(const OUString& rControlName)
commit 96ba07a515e1c346bdfa2cd91e87fe7afdf56e91
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Sep 17 11:32:25 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Sep 17 14:31:31 2025 +0200

    tdf#104833 update check: Use ProgressBar methods directly
    
    Define VCL_INTERNALS in order to be able to use the ProgressBar
    widget directly until this dialog eventually gets ported to
    use the standard weld approach.
    
    This replaces the last uses of UpdateHandler::setControlProperty.
    
    See previous commit
    
        Change-Id: I8e41fb68d5b5e4c3e892803e4139c30f14019f3c
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Wed Sep 17 11:23:53 2025 +0200
    
            tdf#104833 update check: Start using vcl::Window more directly
    
    for more background.
    
    Change-Id: I9b8f479eb878b3454863c021ab9732048247df10
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191074
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/extensions/source/update/check/updatehdl.cxx 
b/extensions/source/update/check/updatehdl.cxx
index d785cf46edd1..085127ef77ae 100644
--- a/extensions/source/update/check/updatehdl.cxx
+++ b/extensions/source/update/check/updatehdl.cxx
@@ -237,7 +237,7 @@ void UpdateHandler::setProgress( sal_Int32 nPercent )
         osl::MutexGuard aGuard( maMutex );
 
         mnPercent = nPercent;
-        setControlProperty( CTRL_PROGRESS, u"ProgressValue"_ustr, uno::Any( 
nPercent ) );
+        m_pProgressBar->SetValue(nPercent);
         m_pPercentEdit->SetText(substVariables(msPercent));
     }
 }
@@ -548,7 +548,7 @@ void UpdateHandler::updateState( UpdateState eState )
             m_pStatusEdit->SetText(substVariables(msDownloading));
             m_pPercentEdit->SetText(substVariables(msPercent));
             m_pDescriptionEdit->SetText(substVariables(msDownloadWarning));
-            setControlProperty( CTRL_PROGRESS, u"ProgressValue"_ustr, 
uno::Any( mnPercent ) );
+            m_pProgressBar->SetValue(mnPercent );
             focusControl( CLOSE_BUTTON );
             break;
         case UPDATESTATE_DOWNLOAD_PAUSED:
@@ -557,7 +557,7 @@ void UpdateHandler::updateState( UpdateState eState )
             m_pStatusEdit->SetText(substVariables(msDownloadPause));
             m_pPercentEdit->SetText(substVariables(msPercent));
             m_pDescriptionEdit->SetText(substVariables(msDownloadWarning));
-            setControlProperty( CTRL_PROGRESS, u"ProgressValue"_ustr, 
uno::Any( mnPercent ) );
+            m_pProgressBar->SetValue(mnPercent);
             focusControl( CLOSE_BUTTON );
             break;
         case UPDATESTATE_ERROR_DOWNLOADING:
@@ -682,28 +682,6 @@ void UpdateHandler::startThrobber( bool bStart )
         xWindow->setVisible( bStart );
 }
 
-
-void UpdateHandler::setControlProperty( const OUString &rCtrlName,
-                                        const OUString &rPropName,
-                                        const uno::Any &rPropValue )
-{
-    if ( !mxUpdDlg.is() ) return;
-
-    uno::Reference< awt::XControlContainer > xContainer( mxUpdDlg, 
uno::UNO_QUERY );
-    uno::Reference< awt::XControl > xControl( xContainer->getControl( 
rCtrlName ), uno::UNO_SET_THROW );
-    uno::Reference< awt::XControlModel > xControlModel( xControl->getModel(), 
uno::UNO_SET_THROW );
-    uno::Reference< beans::XPropertySet > xPropSet( xControlModel, 
uno::UNO_QUERY_THROW );
-
-    try {
-        xPropSet->setPropertyValue( rPropName, rPropValue );
-    }
-    catch( const beans::UnknownPropertyException& )
-    {
-        TOOLS_WARN_EXCEPTION( "extensions.update", 
"UpdateHandler::setControlProperty" );
-    }
-}
-
-
 void UpdateHandler::showControl( const OUString &rCtrlName, bool bShow )
 {
     uno::Reference< awt::XControlContainer > xContainer( mxUpdDlg, 
uno::UNO_QUERY );
@@ -1256,6 +1234,7 @@ void UpdateHandler::createDialog()
     m_pStatusEdit = getWindow(TEXT_STATUS);
     m_pDescriptionEdit = getWindow(TEXT_DESCRIPTION);
     m_pPercentEdit = getWindow(TEXT_PERCENT);
+    m_pProgressBar = dynamic_cast<ProgressBar*>(getWindow(CTRL_PROGRESS));
 }
 
 vcl::Window* UpdateHandler::getWindow(const OUString& rControlName)
diff --git a/extensions/source/update/check/updatehdl.hxx 
b/extensions/source/update/check/updatehdl.hxx
index 239bdbd7ce93..d0aa37752ac7 100644
--- a/extensions/source/update/check/updatehdl.hxx
+++ b/extensions/source/update/check/updatehdl.hxx
@@ -42,6 +42,10 @@
 
 #include "actionlistener.hxx"
 
+// use vcl controls directly for now, until dialog has been welded
+#define VCL_INTERNALS
+#include <vcl/toolkit/prgsbar.hxx>
+
 enum DialogControls
 {
     CANCEL_BUTTON = 0,
@@ -82,6 +86,7 @@ private:
     VclPtr<vcl::Window> m_pStatusEdit;
     VclPtr<vcl::Window> m_pDescriptionEdit;
     VclPtr<vcl::Window> m_pPercentEdit;
+    VclPtr<ProgressBar> m_pProgressBar;
 
     css::uno::Reference< css::task::XInteractionHandler > mxInteractionHdl;
     rtl::Reference< IActionListener >                     mxActionListener;
@@ -136,9 +141,6 @@ private:
     vcl::Window*            getWindow(const OUString& rControlName);
     void                    updateState( UpdateState eNewState );
     void                    startThrobber( bool bStart = true );
-    void                    setControlProperty( const OUString &rCtrlName,
-                                                const OUString &rPropName,
-                                                const css::uno::Any 
&rPropValue );
     void                    showControl( const OUString &rCtrlName, bool bShow 
= true );
     void                    showControls( short nControls );
     void                    focusControl( DialogControls eID );

Reply via email to