bug fix: move isEnabled test out of acceptCardAttr
in the case of AND'ed filter terms, returning true from acceptCardAttr will be equivalent to ignoring the disabled term, but in the case of OR'ed terms, returning true will incorrectly cause all cards to be accepted. the fix is to test for whether the term is enabled before calling acceptCardAttr and continue if disabled.
This commit is contained in:
parent
cd4d04be3e
commit
040d9d15a3
1 changed files with 8 additions and 5 deletions
|
@ -112,9 +112,12 @@ bool FilterItemList::testTypeAnd(const CardInfo *info, CardFilter::Attr attr) co
|
|||
{
|
||||
QList<FilterItem *>::const_iterator i;
|
||||
|
||||
for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++)
|
||||
for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) {
|
||||
if (!(*i)->isEnabled())
|
||||
continue;
|
||||
if (!(*i)->acceptCardAttr(info, attr))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -129,9 +132,12 @@ bool FilterItemList::testTypeOr(const CardInfo *info, CardFilter::Attr attr) con
|
|||
{
|
||||
QList<FilterItem *>::const_iterator i;
|
||||
|
||||
for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++)
|
||||
for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) {
|
||||
if (!(*i)->isEnabled())
|
||||
continue;
|
||||
if ((*i)->acceptCardAttr(info, attr))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -197,9 +203,6 @@ bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) con
|
|||
{
|
||||
bool status;
|
||||
|
||||
if (!isEnabled())
|
||||
return true;
|
||||
|
||||
switch (attr) {
|
||||
case CardFilter::AttrName:
|
||||
status = acceptName(info);
|
||||
|
|
Loading…
Reference in a new issue