[Libreoffice-commits] core.git: basctl/source

Andreas Heinisch (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 4 06:53:26 UTC 2019


 basctl/source/basicide/moduldl2.cxx |   10 ++++------
 basctl/source/basicide/moduldlg.cxx |    7 +++++--
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit e8b3df5b9b0eb0a93c25b6dc2e445ae44a7e3f78
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Fri Aug 2 14:57:49 2019 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Sep 4 08:52:50 2019 +0200

    tdf#93476 Sort Macro library list after creating/importing a macro
    
    Only set the widget as sorted in the ctor, it remains sorted
    
    Change-Id: I96897cf5512e91192c69874ca857a967b09a1490
    Reviewed-on: https://gerrit.libreoffice.org/76866
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 18ed7f1a0796..c55b40e60c61 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -217,6 +217,9 @@ LibPage::LibPage(weld::Container* pParent, OrganizeDialog* pDialog)
                m_xLibBox->get_height_rows(10));
     m_xLibBox->set_size_request(aSize.Width(), aSize.Height());
 
+    // tdf#93476 The libraries should be listed alphabetically
+    m_xLibBox->make_sorted();
+
     m_xEditButton->connect_clicked( LINK( this, LibPage, ButtonHdl ) );
     m_xNewLibButton->connect_clicked( LINK( this, LibPage, ButtonHdl ) );
     m_xPasswordButton->connect_clicked( LINK( this, LibPage, ButtonHdl ) );
@@ -648,7 +651,6 @@ void LibPage::InsertLib()
             const int nRow = rView.n_children() - 1;
             rView.set_toggle(nRow, TRISTATE_TRUE, 0);
             rView.set_text(nRow, aLibName, 1);
-            rView.make_sorted();
             rView.set_cursor(rView.find_text(aLibName));
         }
     }
@@ -675,7 +677,6 @@ void LibPage::InsertLib()
                 return;
 
             bool bChanges = false;
-            int nNewPos = m_xLibBox->n_children();
             bool bRemove = false;
             bool bReplace = xLibDlg->IsReplace();
             bool bReference = xLibDlg->IsReference();
@@ -894,13 +895,11 @@ void LibPage::InsertLib()
 
                     // insert listbox entry
                     ImpInsertLibEntry( aLibName, m_xLibBox->n_children() );
+                    m_xLibBox->set_cursor( m_xLibBox->find_text(aLibName) );
                     bChanges = true;
                 }
             }
 
-            if (nNewPos < m_xLibBox->n_children())
-                m_xLibBox->set_cursor(nNewPos);
-
             if ( bChanges )
                 MarkDocumentModified( m_aCurDocument );
         });
@@ -1323,7 +1322,6 @@ void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
                 if( pLibBox )
                 {
                     pLibBox->append_text(aLibName);
-                    pLibBox->make_sorted();
                     pLibBox->set_cursor(pLibBox->find_text(aLibName));
                 }
 
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index cf4ff447547f..fb1d72e2d161 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -537,6 +537,9 @@ ObjectPage::ObjectPage(weld::Container* pParent, const OString &rName, BrowseMod
                m_xBasicBox->get_height_rows(14));
     m_xBasicBox->set_size_request(aSize.Width(), aSize.Height());
 
+    // tdf#93476 The dialogs should be listed alphabetically
+    m_xBasicBox->make_sorted();
+
     m_xEditButton->connect_clicked( LINK( this, ObjectPage, ButtonHdl ) );
     m_xDelButton->connect_clicked( LINK( this, ObjectPage, ButtonHdl ) );
     m_xBasicBox->connect_changed( LINK( this, ObjectPage, BasicBoxHighlightHdl ) );
@@ -817,7 +820,6 @@ void ObjectPage::NewDialog()
                             m_xBasicBox->AddEntry(aDlgName, RID_BMP_DIALOG, xSubRootEntry.get(), false,
                                                std::make_unique<Entry>(OBJ_TYPE_DIALOG), xIter.get());
                             assert(xIter.get() && "Insert entry failed!");
-                            m_xBasicBox->make_sorted();
                         }
                         m_xBasicBox->set_cursor(*xIter);
                         m_xBasicBox->select(*xIter);
@@ -888,6 +890,8 @@ LibDialog::LibDialog(weld::Window* pParent)
 {
     m_xLibBox->set_size_request(m_xLibBox->get_approximate_digit_width() * 28,
                                 m_xLibBox->get_height_rows(8));
+    // tdf#93476 The libraries should be listed alphabetically
+    m_xLibBox->make_sorted();
 }
 
 LibDialog::~LibDialog()
@@ -976,7 +980,6 @@ SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
                     {
                         rBasicBox.AddEntry(aModName, RID_BMP_MODULE, xSubRootEntry.get(), false,
                                            std::make_unique<Entry>(OBJ_TYPE_MODULE), xEntry.get());
-                        rBasicBox.make_sorted();
                     }
                     rBasicBox.set_cursor(*xEntry);
                     rBasicBox.select(*xEntry);


More information about the Libreoffice-commits mailing list