Akonadi

favoritecollectionsmodel.h
1 /*
2  SPDX-FileCopyrightText: 2009 Kevin Ottens <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_FAVORITECOLLECTIONSMODEL_H
8 #define AKONADI_FAVORITECOLLECTIONSMODEL_H
9 
10 #include "akonadicore_export.h"
11 #include <KSelectionProxyModel>
12 #include "collection.h"
13 
14 class KConfigGroup;
15 class KJob;
16 
17 namespace Akonadi
18 {
19 
20 class EntityTreeModel;
21 
51 class AKONADICORE_EXPORT FavoriteCollectionsModel : public KSelectionProxyModel
52 {
53  Q_OBJECT
54 
55 public:
65  FavoriteCollectionsModel(QAbstractItemModel *model, const KConfigGroup &group, QObject *parent = nullptr);
66 
70  ~FavoriteCollectionsModel() override;
71 
76  Q_REQUIRED_RESULT AKONADICORE_DEPRECATED Collection::List collections() const;
77 
100  Q_REQUIRED_RESULT QList<Collection::Id> collectionIds() const;
101 
105  Q_REQUIRED_RESULT QString favoriteLabel(const Akonadi::Collection &col);
106  Q_REQUIRED_RESULT QString defaultFavoriteLabel(const Akonadi::Collection &col);
107 
108  Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
109  Q_REQUIRED_RESULT bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
110  Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
111  Q_REQUIRED_RESULT bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
112  Q_REQUIRED_RESULT QStringList mimeTypes() const override;
113  Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
114 
115 public Q_SLOTS:
119  void setCollections(const Akonadi::Collection::List &collections);
120 
124  void addCollection(const Akonadi::Collection &collection);
125 
129  void removeCollection(const Akonadi::Collection &collection);
130 
135  void setFavoriteLabel(const Akonadi::Collection &collection, const QString &label);
136 
137 private Q_SLOTS:
138  void pasteJobDone(KJob *job);
139 
140 private:
141  //@cond PRIVATE
143 
144  class Private;
145  Private *const d;
146  //@endcond
147 };
148 
149 }
150 
151 #endif
Represents a collection of PIM items.
Definition: collection.h:63
DisplayRole
void setSourceModel(QAbstractItemModel *sourceModel) override
Helper integration between Akonadi and Qt.
Orientation
DropAction
A model that lists a set of favorite collections.
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 6 2020 23:15:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.