00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AKONADI_FAVORITECOLLECTIONSMODEL_H
00021 #define AKONADI_FAVORITECOLLECTIONSMODEL_H
00022
00023 #include "akonadi_export.h"
00024
00025 #include <akonadi/selectionproxymodel.h>
00026
00027 #include <akonadi/collection.h>
00028
00029 class KConfigGroup;
00030
00031 namespace Akonadi {
00032
00033 class EntityTreeModel;
00034
00064 class AKONADI_EXPORT FavoriteCollectionsModel : public Akonadi::SelectionProxyModel
00065 {
00066 Q_OBJECT
00067
00068 public:
00078 FavoriteCollectionsModel( QAbstractItemModel *model, const KConfigGroup &group, QObject *parent = 0 );
00079
00083 virtual ~FavoriteCollectionsModel();
00084
00089 Collection::List collections() const;
00090
00113 QList<Collection::Id> collectionIds() const;
00114
00118 QString favoriteLabel( const Akonadi::Collection & col );
00119
00120 virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
00121 virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
00122 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
00123 virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
00124 virtual QStringList mimeTypes() const;
00125 virtual Qt::ItemFlags flags(const QModelIndex& index) const;
00126
00127 public Q_SLOTS:
00131 void setCollections( const Collection::List &collections );
00132
00136 void addCollection( const Collection &collection );
00137
00141 void removeCollection( const Collection &collection );
00142
00147 void setFavoriteLabel( const Collection &collection, const QString &label );
00148
00149 private:
00150
00151 using KSelectionProxyModel::setSourceModel;
00152
00153 class Private;
00154 Private* const d;
00155
00156 Q_PRIVATE_SLOT( d, void clearAndUpdateSelection() )
00157 Q_PRIVATE_SLOT( d, void updateSelection() )
00158
00159 };
00160
00161 }
00162
00163 #endif