From 60a1937bf9781252aa41b3a80a77c41ffc2930ad Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 10 Nov 2013 03:59:53 +0200 Subject: [PATCH] Expand folders when filtering files. Closes #1076. --- src/properties/propertieswidget.cpp | 12 +++++++++++- src/properties/propertieswidget.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 82016ebd5..1a1ae5d9d 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -79,7 +79,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra filesList->setSortingEnabled(true); // Torrent content filtering m_contentFilerLine = new LineEdit(this); - connect(m_contentFilerLine, SIGNAL(textChanged(QString)), PropListModel, SLOT(setFilterFixedString(QString))); + connect(m_contentFilerLine, SIGNAL(textChanged(QString)), this, SLOT(filterText(QString))); contentFilterLayout->insertWidget(1, m_contentFilerLine); // SIGNAL/SLOTS @@ -732,3 +732,13 @@ void PropertiesWidget::filteredFilesChanged() { applyPriorities(); } } + +void PropertiesWidget::filterText(const QString& filter) { + PropListModel->setFilterFixedString(filter); + if (filter.isEmpty()) { + filesList->collapseAll(); + filesList->expand(PropListModel->index(0, 0)); + } + else + filesList->expandAll(); +} diff --git a/src/properties/propertieswidget.h b/src/properties/propertieswidget.h index 65d3b41ea..d7c0d79cd 100644 --- a/src/properties/propertieswidget.h +++ b/src/properties/propertieswidget.h @@ -116,6 +116,9 @@ private: QShortcut *editHotkeyFile; QShortcut *editHotkeyWeb; QShortcut *deleteHotkeyWeb; + +private slots: + void filterText(const QString& filter); }; #endif // PROPERTIESWIDGET_H