Akonadi

entityorderproxymodel.h
1 /*
2  Copyright (C) 2010 Klarälvdalens Datakonsult AB,
3  a KDAB Group company, [email protected],
4  author Stephen Kelly <[email protected]>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #ifndef AKONADI_ENTITYORDERPROXYMODEL_H
23 #define AKONADI_ENTITYORDERPROXYMODEL_H
24 
25 #include "akonadicore_export.h"
26 #include "collection.h"
27 
28 #include <QSortFilterProxyModel>
29 
30 class KConfigGroup;
31 
32 namespace Akonadi
33 {
34 class EntityOrderProxyModelPrivate;
35 
45 class AKONADICORE_EXPORT EntityOrderProxyModel : public QSortFilterProxyModel
46 {
47  Q_OBJECT
48 
49 public:
55  explicit EntityOrderProxyModel(QObject *parent = nullptr);
56 
60  ~EntityOrderProxyModel() override;
61 
65  void setOrderConfig(const KConfigGroup &group);
66 
70  void saveOrder();
71 
72  void clearOrder(const QModelIndex &index);
73  void clearTreeOrder();
74 
78  Q_REQUIRED_RESULT bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
79 
83  Q_REQUIRED_RESULT bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
84 
88  Q_REQUIRED_RESULT QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1,
89  Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const override;
90 
91 protected:
92  EntityOrderProxyModelPrivate *const d_ptr;
93 
94  virtual QString parentConfigString(const QModelIndex &index) const;
95  virtual QString configString(const QModelIndex &index) const;
96  virtual Akonadi::Collection parentCollection(const QModelIndex &index) const;
97 
98 private:
99  QStringList configStringsForDroppedUrls(const QList<QUrl> &urls, const Akonadi::Collection &parentCol, bool *containsMove) const;
100 
101  //@cond PRIVATE
102  Q_DECLARE_PRIVATE(EntityOrderProxyModel)
103  //@endcond
104 };
105 
106 }
107 
108 #endif
typedef MatchFlags
Represents a collection of PIM items.
Definition: collection.h:76
A model that keeps the order of entities persistent.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.