Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 8b571111 authored by Alex Neundorf's avatar Alex Neundorf

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
parent aaa3484f
......@@ -296,6 +296,7 @@ m_mainWindow (mainWin)
connect(m_ui.folderUpButton, SIGNAL(clicked()), this, SLOT(navigateFolderUp()));
connect(m_ui.currentFolderButton, SIGNAL(clicked()), this, SLOT(setCurrentFolder()));
connect(m_ui.expandResults, SIGNAL(clicked()), this, SLOT(expandResults()));
connect(m_ui.searchCombo, SIGNAL(editTextChanged(QString)), &m_changeTimer, 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 configured
QTreeWidgetItem *root = m_curResults->tree->topLevelItem(0);
m_curResults->tree->expandItem(root);
if (root && (root->childCount() > 1) && (!m_ui.expandResults->isChecked())) {
for (int i=0; i<root->childCount(); 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 =qobject_cast<Results *>(m_ui.resultTabWidget->currentWidget());
if (!m_curResults) {
qWarning() << "Results not found";
return;
}
if (m_ui.expandResults->isChecked()) {
m_curResults->tree->expandAll();
}
else {
QTreeWidgetItem *root = m_curResults->tree->topLevelItem(0);
m_curResults->tree->expandItem(root);
if (root && (root->childCount() > 1)) {
for (int i=0; i<root->childCount(); i++) {
m_curResults->tree->collapseItem(root->child(i));
}
}
}
}
void KatePluginSearchView::itemSelected(QTreeWidgetItem *item)
{
if (!item) return;
......
......@@ -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 did change
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment