Git commit 8b5711119721c6e1f61cb659ec3572d1949d333c by Alex Neundorf. Committed on 30/09/2017 at 21:13. Pushed by neundorf into branch 'master'. Search&Replace: Expand/collapse results if the expand-button is clicked Before this patch, the state of the button was only used to decide whether initially the results should be expanded or collapsed. Now the user can just click the button and expand/collapse the results tree. Alex M +24 -6 addons/search/plugin_search.cpp M +2 -0 addons/search/plugin_search.h https://commits.kde.org/kate/8b5711119721c6e1f61cb659ec3572d1949d333c diff --git a/addons/search/plugin_search.cpp b/addons/search/plugin_search.= cpp index 2fba6d673..961713610 100644 --- a/addons/search/plugin_search.cpp +++ b/addons/search/plugin_search.cpp @@ -296,6 +296,7 @@ m_mainWindow (mainWin) = connect(m_ui.folderUpButton, SIGNAL(clicked()), this, SLOT(navigateF= olderUp())); connect(m_ui.currentFolderButton, SIGNAL(clicked()), this, SLOT(setCur= rentFolder())); + connect(m_ui.expandResults, SIGNAL(clicked()), this, SLOT(expandResult= s())); = connect(m_ui.searchCombo, SIGNAL(editTextChanged(QString)), &m_ch= angeTimer, SLOT(start())); connect(m_ui.matchCase, SIGNAL(toggled(bool)), &m_changeTimer, = SLOT(start())); @@ -1174,12 +1175,7 @@ void KatePluginSearchView::searchDone() = // expand the "header item " to display all files and all results if c= onfigured QTreeWidgetItem *root =3D m_curResults->tree->topLevelItem(0); - m_curResults->tree->expandItem(root); - if (root && (root->childCount() > 1) && (!m_ui.expandResults->isChecke= d())) { - for (int i=3D0; ichildCount(); i++) { - m_curResults->tree->collapseItem(root->child(i)); - } - } + expandResults(); = if (root) { switch (m_ui.searchPlaceCombo->currentIndex()) @@ -1547,6 +1543,28 @@ void KatePluginSearchView::docViewChanged() } } = +void KatePluginSearchView::expandResults() +{ + m_curResults =3Dqobject_cast(m_ui.resultTabWidget->currentW= idget()); + if (!m_curResults) { + qWarning() << "Results not found"; + return; + } + + if (m_ui.expandResults->isChecked()) { + m_curResults->tree->expandAll(); + } + else { + QTreeWidgetItem *root =3D m_curResults->tree->topLevelItem(0); + m_curResults->tree->expandItem(root); + if (root && (root->childCount() > 1)) { + for (int i=3D0; ichildCount(); i++) { + m_curResults->tree->collapseItem(root->child(i)); + } + } + } +} + void KatePluginSearchView::itemSelected(QTreeWidgetItem *item) { if (!item) return; diff --git a/addons/search/plugin_search.h b/addons/search/plugin_search.h index d3e13839e..829587d09 100644 --- a/addons/search/plugin_search.h +++ b/addons/search/plugin_search.h @@ -164,6 +164,8 @@ private Q_SLOTS: = void resultTabChanged(int index); = + void expandResults(); + /** * keep track if the project plugin is alive and if the project file d= id change */