Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwineffects/effectsfilterproxymodel.cpp
Show All 11 Lines | |||||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #include "effectsfilterproxymodel.h" | 18 | #include "effectsfilterproxymodel.h" | ||
19 | 19 | | |||
20 | #include "effectmodel.h" | 20 | #include "effectsmodel.h" | ||
21 | 21 | | |||
22 | namespace KWin | 22 | namespace KWin | ||
23 | { | 23 | { | ||
24 | 24 | | |||
25 | EffectsFilterProxyModel::EffectsFilterProxyModel(QObject *parent) | 25 | EffectsFilterProxyModel::EffectsFilterProxyModel(QObject *parent) | ||
26 | : QSortFilterProxyModel(parent) | 26 | : QSortFilterProxyModel(parent) | ||
27 | { | 27 | { | ||
28 | } | 28 | } | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 68 | { | |||
73 | } | 73 | } | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | bool EffectsFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const | 76 | bool EffectsFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const | ||
77 | { | 77 | { | ||
78 | const QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent); | 78 | const QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent); | ||
79 | 79 | | |||
80 | if (!m_query.isEmpty()) { | 80 | if (!m_query.isEmpty()) { | ||
81 | const bool matches = idx.data(EffectModel::NameRole).toString().contains(m_query, Qt::CaseInsensitive) || | 81 | const bool matches = idx.data(EffectsModel::NameRole).toString().contains(m_query, Qt::CaseInsensitive) || | ||
82 | idx.data(EffectModel::DescriptionRole).toString().contains(m_query, Qt::CaseInsensitive) || | 82 | idx.data(EffectsModel::DescriptionRole).toString().contains(m_query, Qt::CaseInsensitive) || | ||
83 | idx.data(EffectModel::CategoryRole).toString().contains(m_query, Qt::CaseInsensitive); | 83 | idx.data(EffectsModel::CategoryRole).toString().contains(m_query, Qt::CaseInsensitive); | ||
84 | if (!matches) { | 84 | if (!matches) { | ||
85 | return false; | 85 | return false; | ||
86 | } | 86 | } | ||
87 | } | 87 | } | ||
88 | 88 | | |||
89 | if (m_excludeInternal) { | 89 | if (m_excludeInternal) { | ||
90 | if (idx.data(EffectModel::InternalRole).toBool()) { | 90 | if (idx.data(EffectsModel::InternalRole).toBool()) { | ||
91 | return false; | 91 | return false; | ||
92 | } | 92 | } | ||
93 | } | 93 | } | ||
94 | 94 | | |||
95 | if (m_excludeUnsupported) { | 95 | if (m_excludeUnsupported) { | ||
96 | if (!idx.data(EffectModel::SupportedRole).toBool()) { | 96 | if (!idx.data(EffectsModel::SupportedRole).toBool()) { | ||
97 | return false; | 97 | return false; | ||
98 | } | 98 | } | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | return true; | 101 | return true; | ||
102 | } | 102 | } | ||
103 | 103 | | |||
104 | } // namespace KWin | 104 | } // namespace KWin |