diff --git a/autotests/libs/proxymodelstest.cpp b/autotests/libs/proxymodelstest.cpp --- a/autotests/libs/proxymodelstest.cpp +++ b/autotests/libs/proxymodelstest.cpp @@ -19,15 +19,15 @@ #include -#include +#include #include -class KRFPTestModel : public KRecursiveFilterProxyModel +class KRFPTestModel : public QSortFilterProxyModel { public: - KRFPTestModel(QObject *parent) : KRecursiveFilterProxyModel(parent) { } + KRFPTestModel(QObject *parent) : QSortFilterProxyModel(parent) { } - bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const override + bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const { const QModelIndex modelIndex = sourceModel()->index(sourceRow, 0, sourceParent); return !modelIndex.data().toString().contains(QLatin1String("three")); @@ -48,7 +48,7 @@ private: QStandardItemModel m_model; - KRecursiveFilterProxyModel *m_krfp = nullptr; + QSortFilterProxyModel *m_krfp = nullptr; KRFPTestModel *m_krfptest = nullptr; }; @@ -72,8 +72,9 @@ m_model.setData(m_model.index(4, 0, QModelIndex()), QStringLiteral("mystuff"), Qt::UserRole + 42); - m_krfp = new KRecursiveFilterProxyModel(this); + m_krfp = new QSortFilterProxyModel(this); m_krfp->setSourceModel(&m_model); + m_krfp->setRecursiveFilteringEnabled(true); m_krfptest = new KRFPTestModel(this); m_krfptest->setSourceModel(m_krfp); diff --git a/src/core/models/entityorderproxymodel.h b/src/core/models/entityorderproxymodel.h --- a/src/core/models/entityorderproxymodel.h +++ b/src/core/models/entityorderproxymodel.h @@ -22,10 +22,10 @@ #ifndef AKONADI_ENTITYORDERPROXYMODEL_H #define AKONADI_ENTITYORDERPROXYMODEL_H -#include +#include "akonadicore_export.h" #include "collection.h" -#include "akonadicore_export.h" +#include class KConfigGroup; @@ -42,7 +42,7 @@ * @author Stephen Kelly * @since 4.6 */ -class AKONADICORE_EXPORT EntityOrderProxyModel : public KRecursiveFilterProxyModel +class AKONADICORE_EXPORT EntityOrderProxyModel : public QSortFilterProxyModel { Q_OBJECT diff --git a/src/core/models/entityorderproxymodel.cpp b/src/core/models/entityorderproxymodel.cpp --- a/src/core/models/entityorderproxymodel.cpp +++ b/src/core/models/entityorderproxymodel.cpp @@ -39,7 +39,6 @@ EntityOrderProxyModelPrivate(EntityOrderProxyModel *qq) : q_ptr(qq) { - } void saveOrder(const QModelIndex &index); @@ -56,9 +55,10 @@ using namespace Akonadi; EntityOrderProxyModel::EntityOrderProxyModel(QObject *parent) - : KRecursiveFilterProxyModel(parent) + : QSortFilterProxyModel(parent) , d_ptr(new EntityOrderProxyModelPrivate(this)) { + setRecursiveFilteringEnabled(true); setDynamicSortFilter(true); //setSortCaseSensitivity( Qt::CaseInsensitive ); } @@ -92,14 +92,14 @@ Q_D(const EntityOrderProxyModel); if (!d->m_orderConfig.isValid()) { - return KRecursiveFilterProxyModel::lessThan(left, right); + return QSortFilterProxyModel::lessThan(left, right); } const Collection col = parentCollection(left); const QStringList list = d->m_orderConfig.readEntry(configKey(col), QStringList()); if (list.isEmpty()) { - return KRecursiveFilterProxyModel::lessThan(left, right); + return QSortFilterProxyModel::lessThan(left, right); } const QString leftValue = configString(left); @@ -109,7 +109,7 @@ const int rightPosition = list.indexOf(rightValue); if (leftPosition < 0 || rightPosition < 0) { - return KRecursiveFilterProxyModel::lessThan(left, right); + return QSortFilterProxyModel::lessThan(left, right); } return leftPosition < rightPosition; @@ -159,15 +159,15 @@ Q_D(EntityOrderProxyModel); if (!d->m_orderConfig.isValid()) { - return KRecursiveFilterProxyModel::dropMimeData(data, action, row, column, parent); + return QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); } if (!data->hasFormat(QStringLiteral("text/uri-list"))) { - return KRecursiveFilterProxyModel::dropMimeData(data, action, row, column, parent); + return QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); } if (row == -1) { - return KRecursiveFilterProxyModel::dropMimeData(data, action, row, column, parent); + return QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); } @@ -182,7 +182,7 @@ parentCol = parent.data(EntityTreeModel::CollectionRole).value(); } else { if (!hasChildren(parent)) { - return KRecursiveFilterProxyModel::dropMimeData(data, action, row, column, parent); + return QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); } const QModelIndex targetIndex = index(0, column, parent); @@ -195,7 +195,7 @@ // Dropping new favorite folders if (droppedList.isEmpty()) { - const bool ok = KRecursiveFilterProxyModel::dropMimeData(data, action, row, column, parent); + const bool ok = QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); if (ok) { droppedList = configStringsForDroppedUrls(urls, parentCol, &containsMove); } @@ -224,7 +224,7 @@ d->m_orderConfig.writeEntry(configKey(parentCol), existingList); if (containsMove) { - bool result = KRecursiveFilterProxyModel::dropMimeData(data, action, row, column, parent); + bool result = QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); invalidate(); return result; } @@ -235,7 +235,7 @@ QModelIndexList EntityOrderProxyModel::match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const { if (role < Qt::UserRole) { - return KRecursiveFilterProxyModel::match(start, role, value, hits, flags); + return QSortFilterProxyModel::match(start, role, value, hits, flags); } QModelIndexList list; diff --git a/src/core/models/entityrightsfiltermodel.h b/src/core/models/entityrightsfiltermodel.h --- a/src/core/models/entityrightsfiltermodel.h +++ b/src/core/models/entityrightsfiltermodel.h @@ -20,11 +20,10 @@ #ifndef AKONADI_ENTITYRIGHTSFILTERMODEL_H #define AKONADI_ENTITYRIGHTSFILTERMODEL_H +#include "akonadicore_export.h" #include "entitytreemodel.h" -#include - -#include "akonadicore_export.h" +#include namespace Akonadi { @@ -58,7 +57,7 @@ * @author Tobias Koenig * @since 4.6 */ -class AKONADICORE_EXPORT EntityRightsFilterModel : public KRecursiveFilterProxyModel +class AKONADICORE_EXPORT EntityRightsFilterModel : public QSortFilterProxyModel { Q_OBJECT @@ -100,7 +99,7 @@ Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const override; protected: - bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const override; + bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const; private: //@cond PRIVATE diff --git a/src/core/models/entityrightsfiltermodel.cpp b/src/core/models/entityrightsfiltermodel.cpp --- a/src/core/models/entityrightsfiltermodel.cpp +++ b/src/core/models/entityrightsfiltermodel.cpp @@ -19,10 +19,8 @@ */ #include "entityrightsfiltermodel.h" - #include "entitytreemodel.h" - using namespace Akonadi; namespace Akonadi @@ -70,9 +68,10 @@ } EntityRightsFilterModel::EntityRightsFilterModel(QObject *parent) - : KRecursiveFilterProxyModel(parent) + : QSortFilterProxyModel(parent) , d_ptr(new EntityRightsFilterModelPrivate(this)) { + setRecursiveFilteringEnabled(true); } EntityRightsFilterModel::~EntityRightsFilterModel() @@ -107,9 +106,9 @@ Q_D(const EntityRightsFilterModel); if (d->rightsMatches(index)) { - return KRecursiveFilterProxyModel::flags(index); + return QSortFilterProxyModel::flags(index); } else { - return KRecursiveFilterProxyModel::flags(index) & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + return QSortFilterProxyModel::flags(index) & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } } diff --git a/src/core/models/favoritecollectionsmodel.cpp b/src/core/models/favoritecollectionsmodel.cpp --- a/src/core/models/favoritecollectionsmodel.cpp +++ b/src/core/models/favoritecollectionsmodel.cpp @@ -289,7 +289,7 @@ * * We use KSelectionProxyModel in order to make a flat list of selected folders from the folder tree. * - * Attempts to use QSortFilterProxyModel / KRecursiveFilterProxyModel make code somewhat simpler, + * Attempts to use QSortFilterProxyModel make code somewhat simpler, * but don't work since we then get a filtered tree, not a flat list. Stacking a KDescendantsProxyModel * on top would likely remove explicitly selected parents when one of their child is selected too. */ diff --git a/src/core/models/recursivecollectionfilterproxymodel.h b/src/core/models/recursivecollectionfilterproxymodel.h --- a/src/core/models/recursivecollectionfilterproxymodel.h +++ b/src/core/models/recursivecollectionfilterproxymodel.h @@ -21,10 +21,10 @@ #ifndef AKONADI_RECURSIVECOLLECTIONFILTERPROXYMODEL_H #define AKONADI_RECURSIVECOLLECTIONFILTERPROXYMODEL_H -#include - #include "akonadicore_export.h" +#include + namespace Akonadi { @@ -36,7 +36,7 @@ * @author Stephen Kelly * @since 4.6 */ -class AKONADICORE_EXPORT RecursiveCollectionFilterProxyModel : public KRecursiveFilterProxyModel +class AKONADICORE_EXPORT RecursiveCollectionFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT @@ -99,7 +99,7 @@ void setIncludeCheckedOnly(bool checked); protected: - bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const override; + bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const; int columnCount(const QModelIndex &index) const override; protected: diff --git a/src/core/models/recursivecollectionfilterproxymodel.cpp b/src/core/models/recursivecollectionfilterproxymodel.cpp --- a/src/core/models/recursivecollectionfilterproxymodel.cpp +++ b/src/core/models/recursivecollectionfilterproxymodel.cpp @@ -49,10 +49,10 @@ } RecursiveCollectionFilterProxyModel::RecursiveCollectionFilterProxyModel(QObject *parent) - : KRecursiveFilterProxyModel(parent) + : QSortFilterProxyModel(parent) , d_ptr(new RecursiveCollectionFilterProxyModelPrivate(this)) { - + setRecursiveFilteringEnabled(true); } RecursiveCollectionFilterProxyModel::~RecursiveCollectionFilterProxyModel() diff --git a/src/core/models/trashfilterproxymodel.h b/src/core/models/trashfilterproxymodel.h --- a/src/core/models/trashfilterproxymodel.h +++ b/src/core/models/trashfilterproxymodel.h @@ -22,7 +22,7 @@ #include "akonadicore_export.h" -#include +#include namespace Akonadi { @@ -53,7 +53,7 @@ * @author Christian Mollekopf * @since 4.8 */ -class AKONADICORE_EXPORT TrashFilterProxyModel : public KRecursiveFilterProxyModel +class AKONADICORE_EXPORT TrashFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT @@ -66,9 +66,9 @@ protected: /** - * Sort filter criterias, according to how expensive the operation is + * Sort filter criteria, according to how expensive the operation is */ - bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const override; + bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const; private: //@cond PRIVATE diff --git a/src/core/models/trashfilterproxymodel.cpp b/src/core/models/trashfilterproxymodel.cpp --- a/src/core/models/trashfilterproxymodel.cpp +++ b/src/core/models/trashfilterproxymodel.cpp @@ -33,10 +33,10 @@ }; TrashFilterProxyModel::TrashFilterProxyModel(QObject *parent) - : KRecursiveFilterProxyModel(parent) + : QSortFilterProxyModel(parent) , d_ptr(new TrashFilterProxyModelPrivate()) { - + setRecursiveFilteringEnabled(true); } TrashFilterProxyModel::~TrashFilterProxyModel()