cui/source/inc/treeopt.hxx     |    4 ++--
 cui/source/options/treeopt.cxx |   22 +++-------------------
 2 files changed, 5 insertions(+), 21 deletions(-)

New commits:
commit a97b6e3426ad6bab862bb8ddb98ea367c5ee2e7f
Author:     Bayram Çiçek <bayram.ci...@collabora.com>
AuthorDate: Thu May 2 22:40:22 2024 +0300
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed May 8 10:41:26 2024 +0200

    tdf#159375: remove initialization on Tools>Options
    
    - Initializing some dialogs at the startup of Options
    makes it opening very slow on some low-power systems.
    
    - This patch removes this initialization. This means,
    all dialogs will be initialized at the time of search.
    Therefore, we should wait a bit longer when typing
    on the search bar to get the results...
    
    - remove the default parameter "nNumberOfNode" from
    initializeFirstNDialog()
    
    - rename initializeFirstNDialog() to initializeAllDialogs()
    
    Change-Id: I4fd9c5673f7edecfe6a6621b6018d5d405f112a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167023
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>
    Reviewed-by: Moritz Duge <moritz.d...@allotropia.de>
    (cherry picked from commit dd3953f705cc19aad4b0fcec7fd2961246b659e3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167223
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 307c70f9edd5..1522ded3d7c4 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -229,8 +229,8 @@ public:
     void                ActivatePage( const OUString& rPageURL );
     void                ApplyItemSets();
 
-    // default value initializes all dialogs
-    void initializeFirstNDialog(sal_Int16 nNumberOfNode = -1);
+    // initialize all dialogs in "Tools > Options"
+    void initializeAllDialogs();
 
     // helper functions to call the Languages and Locales TabPage from the 
SpellDialog
     static void         ApplyLanguageOptions(const SfxItemSet& rSet);
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index d8fe793e10b7..029c5f773f8f 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -790,7 +790,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, SearchUpdateHdl, 
weld::Entry&, void)
 
 IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, Timer*, void)
 {
-    // initializeFirstNDialog() can take a long time, show wait cursor and 
disable input
+    // initializeAllDialogs() can take a long time, show wait cursor and 
disable input
     std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new 
weld::WaitObject(m_pParent) : nullptr);
 
     // Pause redraw
@@ -801,7 +801,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, 
Timer*, void)
         m_xSearchEdit->freeze();
         xTreeLB->hide();
 
-        initializeFirstNDialog();
+        initializeAllDialogs();
 
         m_xSearchEdit->thaw();
         xTreeLB->show();
@@ -847,10 +847,9 @@ void OfaTreeOptionsDialog::selectFirstEntry()
     }
 }
 
-void OfaTreeOptionsDialog::initializeFirstNDialog(sal_Int16 nNumberOfNode)
+void OfaTreeOptionsDialog::initializeAllDialogs()
 {
     std::unique_ptr<weld::TreeIter> xEntry;
-    sal_Int16 nCount = 0;
 
     std::unique_ptr<weld::TreeIter> xTemp = xTreeLB->make_iterator();
     bool bTemp = xTreeLB->get_iter_first(*xTemp);
@@ -877,12 +876,6 @@ void 
OfaTreeOptionsDialog::initializeFirstNDialog(sal_Int16 nNumberOfNode)
             }
         }
 
-        /* if nNumberOfNode is -1 (which is the default value if no parameter 
provided),
-           this function will initialize all dialogs since nCount always 
greater than -1 */
-        if (nCount == nNumberOfNode)
-            break;
-
-        ++nCount;
         bTemp = xTreeLB->iter_next(*xTemp);
     }
 }
@@ -1187,15 +1180,6 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
     xTreeLB->select(*xEntry);
     m_xSearchEdit->grab_focus();
     SelectHdl_Impl();
-
-    // initializeFirstNDialog() can take a long time, show wait cursor
-    std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new 
weld::WaitObject(m_pParent) : nullptr);
-
-    /* initialize first 25 dialogs which are almost half of the dialogs
-    in a row while Options dialog opens. then clear&reselect to avoid UI test 
failures. */
-    initializeFirstNDialog(25);
-    clearOptionsDialog();
-    SelectHdl_Impl();
 }
 
 void OfaTreeOptionsDialog::InitItemSets(OptionsGroupInfo& rGroupInfo)

Reply via email to