diff options
| author | Tannin <devnull@localhost> | 2015-05-18 20:41:46 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-05-18 20:41:46 +0200 |
| commit | fe5c4255c893fefd1936c6e42e5d9db8f9d3db47 (patch) | |
| tree | 0932a482fdf49805b118f523773c38268693d45c | |
| parent | ac8f6dbdec753ff04256a4e6f5cb4ee746581d9a (diff) | |
bugfix: previous fix for download name filter didn't work
| -rw-r--r-- | src/downloadlistsortproxy.cpp | 12 | ||||
| -rw-r--r-- | src/downloadlistsortproxy.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/downloadlistsortproxy.cpp b/src/downloadlistsortproxy.cpp index deddc0cf..2780f973 100644 --- a/src/downloadlistsortproxy.cpp +++ b/src/downloadlistsortproxy.cpp @@ -20,6 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "downloadlistsortproxy.h"
#include "downloadlist.h"
#include "downloadmanager.h"
+#include "settings.h"
DownloadListSortProxy::DownloadListSortProxy(const DownloadManager *manager, QObject *parent)
: QSortFilterProxyModel(parent), m_Manager(manager), m_CurrentFilter()
@@ -55,12 +56,17 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left, }
-bool DownloadListSortProxy::filterAcceptsRow(int source_row, const QModelIndex&) const
+bool DownloadListSortProxy::filterAcceptsRow(int sourceRow, const QModelIndex&) const
{
if (m_CurrentFilter.length() == 0) {
return true;
- } else if (source_row < m_Manager->numTotalDownloads()) {
- return sourceModel()->index(source_row, 0).data().toString().contains(m_CurrentFilter, Qt::CaseInsensitive);
+ } else if (sourceRow < m_Manager->numTotalDownloads()) {
+ int downloadIndex = sourceModel()->index(sourceRow, 0).data().toInt();
+
+ QString displayedName = Settings::instance().metaDownloads()
+ ? m_Manager->getDisplayName(downloadIndex)
+ : m_Manager->getFileName(downloadIndex);
+ return displayedName.contains(m_CurrentFilter, Qt::CaseInsensitive);
} else {
return false;
}
diff --git a/src/downloadlistsortproxy.h b/src/downloadlistsortproxy.h index 71ac7e56..59f46179 100644 --- a/src/downloadlistsortproxy.h +++ b/src/downloadlistsortproxy.h @@ -41,7 +41,7 @@ public slots: protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &source_parent) const;
signals:
|
