From 976982ba09935dd0d482ae900c58218e059741e1 Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Sun, 9 Nov 2014 03:36:53 +0300 Subject: [PATCH] Now user-created labels "all" and "none" works as regular labels --- src/transferlistfilterswidget.cpp | 4 ++-- src/transferlistwidget.cpp | 12 ++++-------- src/transferlistwidget.h | 1 + 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/transferlistfilterswidget.cpp b/src/transferlistfilterswidget.cpp index f8734d612..f52f13d5a 100644 --- a/src/transferlistfilterswidget.cpp +++ b/src/transferlistfilterswidget.cpp @@ -359,10 +359,10 @@ void TransferListFiltersWidget::removeSelectedLabel() { void TransferListFiltersWidget::applyLabelFilter(int row) { switch(row) { case 0: - transferList->applyLabelFilter("all"); + transferList->applyLabelFilterAll(); break; case 1: - transferList->applyLabelFilter("none"); + transferList->applyLabelFilter(QString()); break; default: transferList->applyLabelFilter(labelFilters->labelFromRow(row)); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 269da5670..00a99ac61 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -885,15 +885,11 @@ void TransferListWidget::currentChanged(const QModelIndex& current, const QModel emit currentTorrentChanged(h); } +void TransferListWidget::applyLabelFilterAll() { + nameFilterModel->disableLabelFilter(); +} + void TransferListWidget::applyLabelFilter(QString label) { - if (label == "all") { - nameFilterModel->disableLabelFilter(); - return; - } - if (label == "none") { - nameFilterModel->setLabelFilter(QString()); - return; - } qDebug("Applying Label filter: %s", qPrintable(label)); nameFilterModel->setLabelFilter(label); } diff --git a/src/transferlistwidget.h b/src/transferlistwidget.h index b593e4f31..47f1773e0 100644 --- a/src/transferlistwidget.h +++ b/src/transferlistwidget.h @@ -80,6 +80,7 @@ public slots: void displayDLHoSMenu(const QPoint&); void applyNameFilter(const QString& name); void applyStatusFilter(int f); + void applyLabelFilterAll(); void applyLabelFilter(QString label); void previewFile(QString filePath); void removeLabelFromRows(QString label);