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
00056 class AKONADI_EXPORT_DEPRECATED ItemModel : public QAbstractTableModel
00057 {
00058 Q_OBJECT
00059
00060 public:
00064 enum Column {
00065 Id = 0,
00066 RemoteId,
00067 MimeType
00068 };
00069
00073 enum Roles {
00074 IdRole = Qt::UserRole + 1,
00075 ItemRole,
00076 MimeTypeRole,
00077 UserRole = Qt::UserRole + 42
00078 };
00079
00085 explicit ItemModel( QObject* parent = 0 );
00086
00090 virtual ~ItemModel();
00091
00092 virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const;
00093
00094 virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
00095
00096 virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
00097
00098 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
00099
00100 virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
00101
00102 virtual QMimeData *mimeData( const QModelIndexList &indexes ) const;
00103
00104 virtual QStringList mimeTypes() const;
00105
00106 virtual Qt::DropActions supportedDropActions() const;
00107
00118 void setFetchScope( const ItemFetchScope &fetchScope );
00119
00132 ItemFetchScope &fetchScope();
00133
00137 Item itemForIndex( const QModelIndex &index ) const;
00138
00145 QModelIndex indexForItem( const Akonadi::Item& item, const int column ) const;
00146
00147 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent );
00148
00152 Collection collection() const;
00153
00154 public Q_SLOTS:
00162 void setCollection( const Akonadi::Collection &collection );
00163
00164 Q_SIGNALS:
00170 void collectionChanged( const Akonadi::Collection &collection );
00171
00172 protected:
00176 Session* session() const;
00177
00178 private:
00179
00180 class Private;
00181 Private* const d;
00182
00183 Q_PRIVATE_SLOT( d, void listingDone( KJob* ) )
00184 Q_PRIVATE_SLOT( d, void collectionFetchResult( KJob* ) )
00185 Q_PRIVATE_SLOT( d, void itemChanged( const Akonadi::Item&, const QSet<QByteArray>& ) )
00186 Q_PRIVATE_SLOT( d, void itemMoved( const Akonadi::Item&, const Akonadi::Collection&, const Akonadi::Collection& ) )
00187 Q_PRIVATE_SLOT( d, void itemAdded( const Akonadi::Item& ) )
00188 Q_PRIVATE_SLOT( d, void itemsAdded( const Akonadi::Item::List& ) )
00189 Q_PRIVATE_SLOT( d, void itemRemoved( const Akonadi::Item& ) )
00190
00191 };
00192
00193 }
00194
00195 #endif