From fe5c4255c893fefd1936c6e42e5d9db8f9d3db47 Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 18 May 2015 20:41:46 +0200 Subject: bugfix: previous fix for download name filter didn't work --- src/downloadlistsortproxy.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/downloadlistsortproxy.cpp') 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 . #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; } -- cgit v1.3.1