diff --git a/akonadi/entityfilterproxymodel.h b/akonadi/entityfilterproxymodel.h index 760e8714e..12cd93ab0 100644 --- a/akonadi/entityfilterproxymodel.h +++ b/akonadi/entityfilterproxymodel.h @@ -1,153 +1,157 @@ /* Copyright (c) 2007 Bruno Virlet Copyright (c) 2009 Stephen Kelly This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef AKONADI_ENTITYFILTERPROXYMODEL_H #define AKONADI_ENTITYFILTERPROXYMODEL_H -#include #include "akonadi_export.h" + +#include + namespace Akonadi { class EntityFilterProxyModelPrivate; + /** * @short A proxy model that filters entities by mime type. * * This class can be used on top of an EntityTreeModel to exclude entities by mimetype * or to include only certain mimetypes. * * @code * * Akonadi::EntityTreeModel *model = new Akonadi::EntityTreeModel( this ); * * Akonadi::EntityFilterProxyModel *proxy = new Akonadi::EntityFilterProxyModel(); * proxy->addMimeTypeInclusionFilter( "message/rfc822" ); * proxy->setSourceModel( model ); * * Akonadi::EntityTreeView *view = new Akonadi::EntityTreeView( this ); * view->setModel( proxy ); * * @endcode * * @li If a mimetype is in both the exclusion list and the inclusion list, it is excluded. * @li If the mimeTypeInclusionFilter is empty, all mimetypes are * accepted (except if they are in the exclusion filter of course). * * * @author Bruno Virlet * @author Stephen Kelly + * @since 4.4 */ class AKONADI_EXPORT EntityFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: /** * Creates a new proxy filter model. * * @param parent The parent object. */ explicit EntityFilterProxyModel( QObject *parent = 0 ); /** * Destroys the proxy filter model. */ virtual ~EntityFilterProxyModel(); /** * Add mime types to be shown by the filter. * * @param mimeTypes A list of mime types to be included. */ void addMimeTypeInclusionFilters( const QStringList &mimeTypes ); /** * Add mimetypes to filter out * * @param mimeTypes A list to exclude from the model. */ void addMimeTypeExclusionFilters( const QStringList &mimeTypes ); /** * Add mime type to be shown by the filter. * * @param mimeType A mime type to be shown. */ void addMimeTypeInclusionFilter( const QString &mimeType ); /** * Add mime type to be excluded by the filter. * * @param mimeType A mime type to be excluded. */ void addMimeTypeExclusionFilter( const QString &mimeType ); /** * Returns the list of mime type inclusion filters. */ QStringList mimeTypeInclusionFilters() const; /** * Returns the list of mime type exclusion filters. */ QStringList mimeTypeExclusionFilters() const; /** * Clear all mime type filters. */ void clearFilters(); /** * Sets the @p index that shall be used as the root for this model. */ void setRootIndex( const QModelIndex &index ); /** * Sets the header @p set of the filter model. * * \sa EntityTreeModel::HeaderGroup */ void setHeaderSet( int set ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; // QAbstractProxyModel does not proxy all methods... virtual bool dropMimeData( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ); virtual QMimeData* mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes() const; /** Reimplemented to handle the AmazingCompletionRole. */ - virtual QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const; + virtual QModelIndexList match( const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const; protected: virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; private: //@cond PRIVATE - Q_DECLARE_PRIVATE(EntityFilterProxyModel) + Q_DECLARE_PRIVATE( EntityFilterProxyModel ) EntityFilterProxyModelPrivate *d_ptr; //@endcond }; } #endif diff --git a/akonadi/favoritecollectionsmodel.h b/akonadi/favoritecollectionsmodel.h index eca1bee5b..285df1697 100644 --- a/akonadi/favoritecollectionsmodel.h +++ b/akonadi/favoritecollectionsmodel.h @@ -1,76 +1,84 @@ /* Copyright (c) 2009 Kevin Ottens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef AKONADI_FAVORITECOLLECTIONSMODEL_H #define AKONADI_FAVORITECOLLECTIONSMODEL_H -#include "selectionproxymodel.h" - #include "akonadi_export.h" +#include "selectionproxymodel.h" + #include namespace Akonadi { class EntityTreeModel; +/** + * @short A model that lists a set of favorite collections. + * + * @author Kevin Ottens + * @since 4.4 + */ class AKONADI_EXPORT FavoriteCollectionsModel : public SelectionProxyModel { Q_OBJECT public: /** * Creates a new model listing a chosen set of favorite collections. * * @param parent The parent object. */ explicit FavoriteCollectionsModel( EntityTreeModel *source, QObject *parent = 0 ); /** * Destroys the favorite collections model. */ virtual ~FavoriteCollectionsModel(); + /** + * Returns the list of favorite collections. + */ + Collection::List collections() const; + + virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; + virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + public Q_SLOTS: void setCollections( const Collection::List &collections ); void addCollection( const Collection &collection ); void removeCollection( const Collection &collection ); void setFavoriteLabel( const Collection &collection, const QString &label ); - public: - Collection::List collections() const; - - virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; - virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - private: using SelectionProxyModel::setSourceModel; Q_PRIVATE_SLOT( d, void clearAndUpdateSelection() ) Q_PRIVATE_SLOT( d, void updateSelection() ) //@cond PRIVATE class Private; Private* const d; //@endcond }; } #endif diff --git a/akonadi/itemfetchjob.h b/akonadi/itemfetchjob.h index d4faed9d9..a4b8bd700 100644 --- a/akonadi/itemfetchjob.h +++ b/akonadi/itemfetchjob.h @@ -1,157 +1,157 @@ /* Copyright (c) 2006 - 2007 Volker Krause This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef AKONADI_ITEMFETCHJOB_H #define AKONADI_ITEMFETCHJOB_H #include #include namespace Akonadi { class Collection; class ItemFetchJobPrivate; class ItemFetchScope; /** * @short Job that fetches items from the Akonadi storage. * * This class is used to fetch items from the Akonadi storage. * Which parts of the items (e.g. headers only, attachments or all) * can be specified by the ItemFetchScope. * * Example: * * @code * * // Fetch all items with full payload from the root collection * Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( Akonadi::Collection::root() ); * job->fetchScope().fetchFullPayload(); * * if ( job->exec() ) { * Akonadi::Item::List items = job->items(); * foreach( const Akonadi::Item &item, items ) { * qDebug() << "Item ID:" << item.id(); * } * } else { * qDebug() << "Error occurred"; * } * * @endcode * * @author Volker Krause */ class AKONADI_EXPORT ItemFetchJob : public Job { Q_OBJECT public: /** * Creates a new item fetch job that retrieves all items inside the given collection. * * @param collection The parent collection to fetch all items from. * @param parent The parent object. */ explicit ItemFetchJob( const Collection &collection, QObject *parent = 0 ); /** * Creates a new item fetch job that retrieves the specified item. * If the item has an uid set, this is used to identify the item on the Akonadi * server. If only a remote identifier is available, that one is used. * However, as remote identifier are not necessarily globally unique, you * need to specify the resource and/or collection to search in in that case, * using setCollection() or Akonadi::ResourceSelectJob. * * @param item The item to fetch. * @param parent The parent object. */ explicit ItemFetchJob( const Item &item, QObject *parent = 0 ); /** * Destroys the item fetch job. */ virtual ~ItemFetchJob(); /** * Returns the fetched item. * * @note The items are invalid before the result( KJob* ) * signal has been emitted or if an error occurred. */ Item::List items() const; /** * Sets the item fetch scope. * * The ItemFetchScope controls how much of an item's data is fetched * from the server, e.g. whether to fetch the full item payload or * only meta data. * * @param fetchScope The new scope for item fetch operations. * * @see fetchScope() */ void setFetchScope( ItemFetchScope &fetchScope ); /** * Returns the item fetch scope. * * Since this returns a reference it can be used to conveniently modify the * current scope in-place, i.e. by calling a method on the returned reference * without storing it in a local variable. See the ItemFetchScope documentation * for an example. * * @return a reference to the current item fetch scope * * @see setFetchScope() for replacing the current item fetch scope */ ItemFetchScope &fetchScope(); /** - Specifies the collection the item is in. - This is only required when retrieving an item based on its remote id which might not be - unique globally. - - @see Akonadi::ResourceSelectJob - */ + * Specifies the collection the item is in. + * This is only required when retrieving an item based on its remote id which might not be + * unique globally. + * + * @see Akonadi::ResourceSelectJob + */ void setCollection( const Collection &collection ); Q_SIGNALS: /** * This signal is emitted when the items are fetched completely. * * @param items The fetched items. */ void itemsReceived( const Akonadi::Item::List &items ); protected: virtual void doStart(); virtual void doHandleResponse( const QByteArray &tag, const QByteArray &data ); private: Q_DECLARE_PRIVATE( ItemFetchJob ) //@cond PRIVATE Q_PRIVATE_SLOT( d_func(), void selectDone( KJob* ) ) Q_PRIVATE_SLOT( d_func(), void timeout() ) //@endcond }; } #endif diff --git a/akonadi/statisticsproxymodel.h b/akonadi/statisticsproxymodel.h index d210f9b03..022bfb4d1 100644 --- a/akonadi/statisticsproxymodel.h +++ b/akonadi/statisticsproxymodel.h @@ -1,84 +1,87 @@ /* Copyright (c) 2009 Kevin Ottens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef AKONADI_STATISTICSPROXYMODEL_H #define AKONADI_STATISTICSPROXYMODEL_H -#include #include "akonadi_export.h" + +#include + namespace Akonadi { /** * @short A proxy model that exposes collection statistics through extra columns. * * This class can be used on top of an EntityTreeModel to display extra columns * summarizing statistics of collections. * * @code * * Akonadi::EntityTreeModel *model = new Akonadi::EntityTreeModel( ... ); * * Akonadi::StatisticsProxyModel *proxy = new Akonadi::StatisticsProxyModel(); * proxy->setSourceModel( model ); * * Akonadi::EntityTreeView *view = new Akonadi::EntityTreeView( this ); * view->setModel( proxy ); * * @endcode * * @author Kevin Ottens + * @since 4.4 */ class AKONADI_EXPORT StatisticsProxyModel : public QSortFilterProxyModel { Q_OBJECT public: /** * Creates a new statistics proxy model. * * @param parent The parent object. */ explicit StatisticsProxyModel( QObject *parent = 0 ); /** * Destroys the statistics proxy model. */ virtual ~StatisticsProxyModel(); virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual Qt::ItemFlags flags ( const QModelIndex & index ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; // QAbstractProxyModel does not proxy all methods... virtual bool dropMimeData( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ); virtual QMimeData* mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes() const; private: //@cond PRIVATE class Private; Private* const d; //@endcond }; } #endif