Commit 0d36f993 authored by Laurent Montel's avatar Laurent Montel 😁

Use new QSFPM with recursive search support

parent 50f03914
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
#include <AkonadiCore/CollectionModifyJob> #include <AkonadiCore/CollectionModifyJob>
#include <AkonadiCore/CollectionFilterProxyModel> #include <AkonadiCore/CollectionFilterProxyModel>
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
#include <KRecursiveFilterProxyModel> #include <KRecursiveFilterProxyModel>
#else
#include <QSortFilterProxyModel>
#endif
#include <QInputDialog> #include <QInputDialog>
#include <AkonadiWidgets/CollectionRequester> #include <AkonadiWidgets/CollectionRequester>
...@@ -141,10 +145,17 @@ KNoteCollectionConfigWidget::KNoteCollectionConfigWidget(QWidget *parent) ...@@ -141,10 +145,17 @@ KNoteCollectionConfigWidget::KNoteCollectionConfigWidget(QWidget *parent)
connect(mModel, &Akonadi::EntityTreeModel::collectionTreeFetched, this, &KNoteCollectionConfigWidget::slotCollectionsInserted); connect(mModel, &Akonadi::EntityTreeModel::collectionTreeFetched, this, &KNoteCollectionConfigWidget::slotCollectionsInserted);
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
mCollectionFilter = new KRecursiveFilterProxyModel(this); mCollectionFilter = new KRecursiveFilterProxyModel(this);
mCollectionFilter->setSourceModel(mDisplayNotifierProxyModel); mCollectionFilter->setSourceModel(mDisplayNotifierProxyModel);
mCollectionFilter->setDynamicSortFilter(true); mCollectionFilter->setDynamicSortFilter(true);
mCollectionFilter->setFilterCaseSensitivity(Qt::CaseInsensitive); mCollectionFilter->setFilterCaseSensitivity(Qt::CaseInsensitive);
#else
mCollectionFilter = new QSortFilterProxyModel(this);
mCollectionFilter->setSourceModel(mDisplayNotifierProxyModel);
mCollectionFilter->setDynamicSortFilter(true);
mCollectionFilter->setFilterCaseSensitivity(Qt::CaseInsensitive);
#endif
QLineEdit *searchLine = new QLineEdit(this); QLineEdit *searchLine = new QLineEdit(this);
searchLine->setPlaceholderText(i18n("Search...")); searchLine->setPlaceholderText(i18n("Search..."));
......
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
#include <AkonadiCore/Collection> #include <AkonadiCore/Collection>
#include <QIdentityProxyModel> #include <QIdentityProxyModel>
#include <QModelIndex> #include <QModelIndex>
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
class KRecursiveFilterProxyModel; class KRecursiveFilterProxyModel;
#endif
namespace Akonadi { namespace Akonadi {
class EntityTreeModel; class EntityTreeModel;
class ChangeRecorder; class ChangeRecorder;
...@@ -79,7 +80,11 @@ private: ...@@ -79,7 +80,11 @@ private:
Akonadi::EntityTreeView *mFolderView = nullptr; Akonadi::EntityTreeView *mFolderView = nullptr;
Akonadi::EntityTreeModel *mModel = nullptr; Akonadi::EntityTreeModel *mModel = nullptr;
Akonadi::ChangeRecorder *mChangeRecorder = nullptr; Akonadi::ChangeRecorder *mChangeRecorder = nullptr;
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
KRecursiveFilterProxyModel *mCollectionFilter = nullptr; KRecursiveFilterProxyModel *mCollectionFilter = nullptr;
#else
QSortFilterProxyModel *mCollectionFilter = nullptr;
#endif
Akonadi::CollectionRequester *mDefaultSaveFolder = nullptr; Akonadi::CollectionRequester *mDefaultSaveFolder = nullptr;
QPushButton *mRenameCollection = nullptr; QPushButton *mRenameCollection = nullptr;
KNoteCollectionDisplayProxyModel *mDisplayNotifierProxyModel = nullptr; KNoteCollectionDisplayProxyModel *mDisplayNotifierProxyModel = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment