• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • sources
  • kde-4.14
  • kdepimlibs
  • akonadi
itemmodel.h
1 /*
2  Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef AKONADI_ITEMMODEL_H
21 #define AKONADI_ITEMMODEL_H
22 
23 #include "akonadi_export.h"
24 #include <akonadi/item.h>
25 #include <akonadi/job.h>
26 
27 #include <QtCore/QAbstractTableModel>
28 
29 namespace Akonadi {
30 
31 class Collection;
32 class ItemFetchScope;
33 class Job;
34 class Session;
35 
56 class AKONADI_DEPRECATED_EXPORT ItemModel : public QAbstractTableModel
57 {
58  Q_OBJECT
59 
60 public:
64  enum Column {
65  Id = 0,
66  RemoteId,
67  MimeType
68  };
69 
73  enum Roles {
74  IdRole = Qt::UserRole + 1,
75  ItemRole,
76  MimeTypeRole,
77  UserRole = Qt::UserRole + 42
78  };
79 
85  explicit ItemModel(QObject *parent = 0);
86 
90  virtual ~ItemModel();
91 
92  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
93 
94  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
95 
96  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
97 
98  virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
99 
100  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
101 
102  virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
103 
104  virtual QStringList mimeTypes() const;
105 
106  virtual Qt::DropActions supportedDropActions() const;
107 
118  void setFetchScope(const ItemFetchScope &fetchScope);
119 
132  ItemFetchScope &fetchScope();
133 
137  Item itemForIndex(const QModelIndex &index) const;
138 
145  QModelIndex indexForItem(const Akonadi::Item &item, const int column) const;
146 
147  bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
148 
152  Collection collection() const;
153 
154 public Q_SLOTS:
162  void setCollection(const Akonadi::Collection &collection);
163 
164 Q_SIGNALS:
170  void collectionChanged(const Akonadi::Collection &collection);
171 
172 protected:
176  Session *session() const;
177 
178 private:
179  //@cond PRIVATE
180  class Private;
181  Private *const d;
182 
183  Q_PRIVATE_SLOT(d, void listingDone(KJob *))
184  Q_PRIVATE_SLOT(d, void collectionFetchResult(KJob *))
185  Q_PRIVATE_SLOT(d, void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &))
186  Q_PRIVATE_SLOT(d, void itemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &))
187  Q_PRIVATE_SLOT(d, void itemAdded(const Akonadi::Item &))
188  Q_PRIVATE_SLOT(d, void itemsAdded(const Akonadi::Item::List &))
189  Q_PRIVATE_SLOT(d, void itemRemoved(const Akonadi::Item &))
190  //@endcond
191 };
192 
193 }
194 
195 #endif
QModelIndex
QByteArray
QAbstractTableModel
Akonadi::ItemModel::Column
Column
Describes the types of the columns in the model.
Definition: itemmodel.h:64
Akonadi::Collection
Represents a collection of PIM items.
Definition: collection.h:75
QMimeData
QObject
Akonadi::ItemModel
A table model for items.
Definition: itemmodel.h:56
Akonadi::ItemModel::RemoteId
The remote identifier.
Definition: itemmodel.h:66
Akonadi::Session
A communication session with the Akonadi storage.
Definition: session.h:59
QSet
Definition: itemfetchscope.h:29
Akonadi::ItemModel::MimeTypeRole
The mime type of the item.
Definition: itemmodel.h:76
QStringList
Akonadi::ItemFetchScope
Specifies which parts of an item should be fetched from the Akonadi storage.
Definition: itemfetchscope.h:69
Akonadi::ItemModel::ItemRole
The item object.
Definition: itemmodel.h:75
Akonadi::ItemModel::Roles
Roles
Describes the roles of the model.
Definition: itemmodel.h:73
Qt::DropActions
typedef DropActions
QVariant
Qt::ItemFlags
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal