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
00115 void setFetchScope( const ItemFetchScope &fetchScope );
00116
00129 ItemFetchScope &fetchScope();
00130
00134 Item itemForIndex( const QModelIndex &index ) const;
00135
00142 QModelIndex indexForItem( const Akonadi::Item& item, const int column ) const;
00143
00144 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
00145
00149 Collection collection() const;
00150
00151 public Q_SLOTS:
00159 void setCollection( const Akonadi::Collection &collection );
00160
00161 Q_SIGNALS:
00167 void collectionChanged( const Collection &collection );
00168
00169 protected:
00173 Session* session() const;
00174
00175 private:
00176
00177 class Private;
00178 Private* const d;
00179
00180 Q_PRIVATE_SLOT( d, void listingDone( KJob* ) )
00181 Q_PRIVATE_SLOT( d, void itemChanged( const Akonadi::Item&, const QSet<QByteArray>& ) )
00182 Q_PRIVATE_SLOT( d, void itemMoved( const Akonadi::Item&, const Akonadi::Collection&, const Akonadi::Collection& ) )
00183 Q_PRIVATE_SLOT( d, void itemAdded( const Akonadi::Item& ) )
00184 Q_PRIVATE_SLOT( d, void itemsAdded( const Akonadi::Item::List& ) )
00185 Q_PRIVATE_SLOT( d, void itemRemoved( const Akonadi::Item& ) )
00186
00187 };
00188
00189 }
00190
00191 #endif