vcl/jsdialog/jsdialogregister.cxx |   28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

New commits:
commit cbf068581024c4211393b37efd25189b809de184
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Apr 28 12:40:56 2025 +0000
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Apr 29 11:28:53 2025 +0200

    lok: use unique ids in sidebar
    
    Panel was shared id in the past (we needed to be able to trigger
    refresh for initial mobile-wizard where no welding was done).
    So we needed the same id to catch any instance and do a full update
    of a sidebar.
    
    Now we have welding so we can use single widget as target
    and avoid sending full JSON on context change. Show/Hide
    panel functionality should be used now and thanks to that
    save some bandwidth.
    
    Signed-off-by: Szymon Kłos <szymon.k...@collabora.com>
    Change-Id: Ib564b608cb4de04185fb89832ad00bea9bcc10bd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184717
    (cherry picked from commit 846d0465b4d7171b096bf19436bd53848d9f8bb9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184748
    Tested-by: Jenkins

diff --git a/vcl/jsdialog/jsdialogregister.cxx 
b/vcl/jsdialog/jsdialogregister.cxx
index fc2ceb845dc9..e10f020432f0 100644
--- a/vcl/jsdialog/jsdialogregister.cxx
+++ b/vcl/jsdialog/jsdialogregister.cxx
@@ -33,24 +33,20 @@ void JSInstanceBuilder::InsertWindowToMap(const OUString& 
nWindowId)
 void JSInstanceBuilder::RememberWidget(OUString sId, weld::Widget* pWidget)
 {
     // do not use the same id for two widgets inside one builder
-    // exception is sidebar where we base our full invalidation on that 
"Panel" id sharing
-    if (m_sTypeOfJSON != "sidebar")
+    static std::atomic<unsigned long long int> nNotRepeatIndex = 0;
+    auto aWindowIt = JSInstanceBuilder::Widgets().Find(getMapIdFromWindowId());
+    if (aWindowIt)
     {
-        static std::atomic<unsigned long long int> nNotRepeatIndex = 0;
-        auto aWindowIt = 
JSInstanceBuilder::Widgets().Find(getMapIdFromWindowId());
-        if (aWindowIt)
+        auto aWidgetIt = aWindowIt->Find(sId);
+        if (aWidgetIt)
         {
-            auto aWidgetIt = aWindowIt->Find(sId);
-            if (aWidgetIt)
-            {
-                unsigned long long int nIndex = nNotRepeatIndex++;
-                // found duplicated it -> add some number to the id and apply 
to the widget
-                sId = sId + OUString::number(nIndex);
-                SalInstanceWidget* pSalWidget = 
dynamic_cast<SalInstanceWidget*>(pWidget);
-                assert(pSalWidget && "can only be a SalInstanceWidget");
-                vcl::Window* pVclWidget = pSalWidget->getWidget();
-                pVclWidget->set_id(pVclWidget->get_id() + 
OUString::number(nIndex));
-            }
+            unsigned long long int nIndex = nNotRepeatIndex++;
+            // found duplicated it -> add some number to the id and apply to 
the widget
+            sId = sId + OUString::number(nIndex);
+            SalInstanceWidget* pSalWidget = 
dynamic_cast<SalInstanceWidget*>(pWidget);
+            assert(pSalWidget && "can only be a SalInstanceWidget");
+            vcl::Window* pVclWidget = pSalWidget->getWidget();
+            pVclWidget->set_id(pVclWidget->get_id() + 
OUString::number(nIndex));
         }
     }
 

Reply via email to