[sdk/lokalize] src/project: fix: make "Expand Untranslated Folders" toggle work with search filter
Finley Watson <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit bc05be9d31ffddb473c6431039051bd961c5fd51 by Finley Watson.
Committed on 15/08/2026 at 12:14.
Pushed by finw into branch 'master'.
fix: make "Expand Untranslated Folders" toggle work with search filter
Search bar auto-expands directories when the search text is more than 2
characters long. Collapses when less. This interfered with the toggle
mentioned above.
Now, the search bar collapsing folders feature will only collapse
TRANSLATED folders in the filtered list, when the "expand untranslated"
toggle is set.
It's not 100% correct, you get a slightly different result when cycling
the toggle on a filtered list: there is still room for improvement.
BUG: 524023
M +1 -1 src/project/projecttab.cpp
M +9 -0 src/project/projectwidget.cpp
M +2 -1 src/project/projectwidget.h
https://invent.kde.org/sdk/lokalize/-/commit/bc05be9d31ffddb473c6431039051bd961c5fd51
diff --git a/src/project/projecttab.cpp b/src/project/projecttab.cpp
index f7aee32a6..46842def0 100644
--- a/src/project/projecttab.cpp
+++ b/src/project/projecttab.cpp
@@ -181,7 +181,7 @@ void ProjectTab::setFilterRegExp()
if (m_filterEdit->text().size() > 2)
m_browser->expandItems();
else
- m_browser->collapseAll();
+ m_browser->checkExpandUntranslatedFolders();
}
void ProjectTab::contextMenuEvent(QContextMenuEvent *event)
diff --git a/src/project/projectwidget.cpp b/src/project/projectwidget.cpp
index 33f925259..a11768a42 100644
--- a/src/project/projectwidget.cpp
+++ b/src/project/projectwidget.cpp
@@ -549,12 +549,21 @@ void ProjectWidget::gotoNextTransOnly()
void ProjectWidget::toggleTranslatedFiles()
{
m_proxyModel->toggleTranslatedFiles();
+
+ if (m_expandUntranslatedFolders)
+ expandUntranslatedItems();
+ else
+ collapseAll();
}
void ProjectWidget::toggleExpandUntranslatedFolders()
{
m_expandUntranslatedFolders = !m_expandUntranslatedFolders;
+ checkExpandUntranslatedFolders();
+}
+void ProjectWidget::checkExpandUntranslatedFolders()
+{
if (m_expandUntranslatedFolders)
expandUntranslatedItems();
else
diff --git a/src/project/projectwidget.h b/src/project/projectwidget.h
index 4cb35ba3d..86f9c9e33 100644
--- a/src/project/projectwidget.h
+++ b/src/project/projectwidget.h
@@ -52,6 +52,7 @@ public:
void gotoNextTransOnly();
void toggleTranslatedFiles();
void toggleExpandUntranslatedFolders();
+ void checkExpandUntranslatedFolders();
Q_SIGNALS:
void fileOpenRequested(const QString &, const bool setAsActive);
@@ -91,7 +92,7 @@ public:
/**
* @short Filter the list of files and dirs by their relative path from the project root.
*
- * The regex provided by ProjectTab::filterRegExp() is used to match the relative paths
+ * The regex provided by ProjectTab::setFilterRegExp() is used to match the relative paths
* for each file and directory in the project root, so that a user search shows matches
* on both the path to a file and the file itself.
*