From afcc19815e9dd32a7fcf2b19f9f4455ed1a12e3d Mon Sep 17 00:00:00 2001 From: Antonis Tsiapaliokas Date: Mon, 9 Sep 2013 17:51:59 +0300 Subject: [PATCH] Now we are able to search our effects based on their name and their description --- kcmkwin/kwincompositing/model.cpp | 13 +++---------- kcmkwin/kwincompositing/model.h | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/kcmkwin/kwincompositing/model.cpp b/kcmkwin/kwincompositing/model.cpp index b23e1df4c6..f59858bd67 100644 --- a/kcmkwin/kwincompositing/model.cpp +++ b/kcmkwin/kwincompositing/model.cpp @@ -223,15 +223,6 @@ int EffectModel::findRowByServiceName(const QString &serviceName) return -1; } -bool EffectModel::effectListContains(const QString &effectFilter, int source_row) -{ - EffectData effect; - effect = m_effectsList.at(source_row); - - return effect.name.contains(effectFilter, Qt::CaseInsensitive); - -} - void EffectModel::syncEffectsToKWin() { QDBusInterface interface(QStringLiteral("org.kde.kwin"), QStringLiteral("/Effects")); @@ -348,7 +339,9 @@ bool EffectFilterModel::filterAcceptsRow(int source_row, const QModelIndex &sour return true; } - if (m_effectModel->effectListContains(m_filter, source_row)) { + if (m_effectModel->data(index, EffectModel::NameRole).toString().contains(m_filter, Qt::CaseInsensitive)) { + return true; + } else if (m_effectModel->data(index, EffectModel::DescriptionRole).toString().contains(m_filter, Qt::CaseInsensitive)) { return true; } diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h index c4bc0e07c0..690cf6d722 100644 --- a/kcmkwin/kwincompositing/model.h +++ b/kcmkwin/kwincompositing/model.h @@ -71,7 +71,6 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; QString serviceName(const QString &effectName); - bool effectListContains(const QString &effectFilter, int source_row); virtual QHash< int, QByteArray > roleNames() const override;