akonadi
itemmodel.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AKONADI_ITEMMODEL_H
00021 #define AKONADI_ITEMMODEL_H
00022
00023 #include "akonadi_export.h"
00024 #include <akonadi/item.h>
00025 #include <akonadi/job.h>
00026
00027 #include <QtCore/QAbstractTableModel>
00028
00029 namespace Akonadi {
00030
00031 class Collection;
00032 class ItemFetchScope;
00033 class Job;
00034 class Session;
00035
00055 class AKONADI_EXPORT ItemModel : public QAbstractTableModel
00056 {
00057 Q_OBJECT
00058
00059 public:
00063 enum Column {
00064 Id = 0,
00065 RemoteId,
00066 MimeType
00067 };
00068
00072 enum Roles {
00073 IdRole = Qt::UserRole + 1,
00074 ItemRole,
00075 MimeTypeRole,
00076 UserRole = Qt::UserRole + 42
00077 };
00078
00084 explicit ItemModel( QObject* parent = 0 );
00085
00089 virtual ~ItemModel();
00090
00091 virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const;
00092
00093 virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
00094
00095 virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
00096
00097 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
00098
00099 virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
00100
00101 virtual QMimeData *mimeData( const QModelIndexList &indexes ) const;
00102
00103 virtual QStringList mimeTypes() const;
00104
00105 virtual Qt::DropActions supportedDropActions() const;
00106
00117 void setFetchScope( const ItemFetchScope &fetchScope );
00118
00131 ItemFetchScope &fetchScope();
00132
00136 Item itemForIndex( const QModelIndex &index ) const;
00137
00144 QModelIndex indexForItem( const Akonadi::Item& item, const int column ) const;
00145
00146 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
00147
00151 Collection collection() const;
00152
00153 public Q_SLOTS:
00161 void setCollection( const Akonadi::Collection &collection );
00162
00163 Q_SIGNALS:
00169 void collectionChanged( const Akonadi::Collection &collection );
00170
00171 protected:
00175 Session* session() const;
00176
00177 private:
00178
00179 class Private;
00180 Private* const d;
00181
00182 Q_PRIVATE_SLOT( d, void listingDone( KJob* ) )
00183 Q_PRIVATE_SLOT( d, void collectionFetchResult( KJob* ) )
00184 Q_PRIVATE_SLOT( d, void itemChanged( const Akonadi::Item&, const QSet<QByteArray>& ) )
00185 Q_PRIVATE_SLOT( d, void itemMoved( const Akonadi::Item&, const Akonadi::Collection&, const Akonadi::Collection& ) )
00186 Q_PRIVATE_SLOT( d, void itemAdded( const Akonadi::Item& ) )
00187 Q_PRIVATE_SLOT( d, void itemsAdded( const Akonadi::Item::List& ) )
00188 Q_PRIVATE_SLOT( d, void itemRemoved( const Akonadi::Item& ) )
00189
00190 };
00191
00192 }
00193
00194 #endif