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

New commits:
commit dd3953f705cc19aad4b0fcec7fd2961246b659e3
Author:     Bayram Çiçek <bayram.ci...@collabora.com>
AuthorDate: Thu May 2 22:40:22 2024 +0300
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Mon May 6 16:45:25 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>

diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 6d07d0981d5a..367d42c8ff50 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -231,8 +231,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 6ab767bb8044..cf9cecfcb101 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -795,7 +795,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
@@ -806,7 +806,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, 
Timer*, void)
         m_xSearchEdit->freeze();
         xTreeLB->hide();
 
-        initializeFirstNDialog();
+        initializeAllDialogs();
 
         m_xSearchEdit->thaw();
         xTreeLB->show();
@@ -852,10 +852,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);
@@ -882,12 +881,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);
     }
 }
@@ -1192,15 +1185,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