• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • FavoriteCollectionsModel
Public Slots | Public Member Functions | List of all members
Akonadi::FavoriteCollectionsModel Class Reference

#include <favoritecollectionsmodel.h>

Inheritance diagram for Akonadi::FavoriteCollectionsModel:
Akonadi::SelectionProxyModel

Public Slots

void addCollection (const Collection &collection)
 
void removeCollection (const Collection &collection)
 
void setCollections (const Collection::List &collections)
 
void setFavoriteLabel (const Collection &collection, const QString &label)
 

Public Member Functions

 FavoriteCollectionsModel (QAbstractItemModel *model, const KConfigGroup &group, QObject *parent=0)
 
virtual ~FavoriteCollectionsModel ()
 
QList< Collection::Id > collectionIds () const
 
Collection::List collections () const
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
QString favoriteLabel (const Akonadi::Collection &col)
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
virtual QStringList mimeTypes () const
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 
- Public Member Functions inherited from Akonadi::SelectionProxyModel
 SelectionProxyModel (QItemSelectionModel *selectionModel, QObject *parent=0)
 

Detailed Description

A model that lists a set of favorite collections.

In some applications you want to provide fast access to a list of often used collections (e.g. Inboxes from different email accounts in a mail application). Therefor you can use the FavoriteCollectionsModel which stores the list of favorite collections in a given configuration file.

Example:

using namespace Akonadi;
EntityTreeModel *sourceModel = new EntityTreeModel( ... );
const KConfigGroup group = KGlobal::config()->group( "Favorite Collections" );
FavoriteCollectionsModel *model = new FavoriteCollectionsModel( sourceModel, group, this );
EntityListView *view = new EntityListView( this );
view->setModel( model );
Akonadi::EntityListView
A view to show an item/collection list provided by an EntityTreeModel.
Definition entitylistview.h:76
Akonadi::EntityListView::setModel
virtual void setModel(QAbstractItemModel *model)
Definition entitylistview.cpp:164
Akonadi::EntityTreeModel
A model for collections and items together.
Definition entitytreemodel.h:319
Akonadi::FavoriteCollectionsModel
A model that lists a set of favorite collections.
Definition favoritecollectionsmodel.h:67
Akonadi::FavoriteCollectionsModel::FavoriteCollectionsModel
FavoriteCollectionsModel(QAbstractItemModel *model, const KConfigGroup &group, QObject *parent=0)
Creates a new favorite collections model.
Definition favoritecollectionsmodel.cpp:256
Akonadi
FreeBusyManager::Singleton.
Definition actionstatemanager_p.h:28
Author
Kevin Ottens ervin.nosp@m.@kde.nosp@m..org
Since
4.4

Definition at line 66 of file favoritecollectionsmodel.h.

Constructor & Destructor Documentation

◆ FavoriteCollectionsModel()

FavoriteCollectionsModel::FavoriteCollectionsModel ( QAbstractItemModel * model,
const KConfigGroup & group,
QObject * parent = 0 )

Creates a new favorite collections model.

Parameters
modelThe source model where the favorite collections come from.
groupThe config group that shall be used to save the selection of favorite collections.
parentThe parent object.

Definition at line 256 of file favoritecollectionsmodel.cpp.

◆ ~FavoriteCollectionsModel()

FavoriteCollectionsModel::~FavoriteCollectionsModel ( )
virtual

Destroys the favorite collections model.

Definition at line 275 of file favoritecollectionsmodel.cpp.

Member Function Documentation

◆ addCollection

void FavoriteCollectionsModel::addCollection ( const Collection & collection)
slot

Adds a collection to the list of favorite collections.

Definition at line 286 of file favoritecollectionsmodel.cpp.

◆ collectionIds()

QList< Collection::Id > FavoriteCollectionsModel::collectionIds ( ) const

Returns the list of ids of favorite collections set on the FavoriteCollectionsModel.

Note that if you want Collections with actual data you should use something like this instead:

FavoriteCollectionsModel* favs = getFavsModel();
Collection::List cols;
const int rowCount = favs->rowCount();
for (int row = 0; row < rowcount; ++row) {
static const int column = 0;
const QModelIndex index = favs->index(row, column);
const Collection col = index.data(EntityTreeModel::CollectionRole).value<Collection>();
cols << col;
}
Akonadi::Collection
Represents a collection of PIM items.
Definition collection.h:76
Akonadi::Collection::List
QList< Collection > List
Describes a list of collections.
Definition collection.h:81
Akonadi::EntityTreeModel::CollectionRole
@ CollectionRole
The collection.
Definition entitytreemodel.h:336

Note that due to the asynchronous nature of the model, this method returns collection ids of collections which may not be in the model yet. If you want the ids of the collections that are actually in the model, use a loop similar to above with the CollectionIdRole.

Definition at line 309 of file favoritecollectionsmodel.cpp.

◆ collections()

Akonadi::Collection::List FavoriteCollectionsModel::collections ( ) const

Returns the list of favorite collections.

Deprecated
Use collectionIds instead.

Definition at line 298 of file favoritecollectionsmodel.cpp.

◆ data()

QVariant Akonadi::FavoriteCollectionsModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
virtual

Definition at line 330 of file favoritecollectionsmodel.cpp.

◆ dropMimeData()

bool FavoriteCollectionsModel::dropMimeData ( const QMimeData * data,
Qt::DropAction action,
int row,
int column,
const QModelIndex & parent )
virtual

Definition at line 379 of file favoritecollectionsmodel.cpp.

◆ favoriteLabel()

QString Akonadi::FavoriteCollectionsModel::favoriteLabel ( const Akonadi::Collection & col)

Return associate label for collection.

Definition at line 360 of file favoritecollectionsmodel.cpp.

◆ flags()

Qt::ItemFlags FavoriteCollectionsModel::flags ( const QModelIndex & index) const
virtual

Definition at line 437 of file favoritecollectionsmodel.cpp.

◆ headerData()

QVariant FavoriteCollectionsModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
virtual

Definition at line 368 of file favoritecollectionsmodel.cpp.

◆ mimeTypes()

QStringList FavoriteCollectionsModel::mimeTypes ( ) const
virtual

Definition at line 428 of file favoritecollectionsmodel.cpp.

◆ removeCollection

void FavoriteCollectionsModel::removeCollection ( const Collection & collection)
slot

Removes a collection from the list of favorite collections.

Definition at line 292 of file favoritecollectionsmodel.cpp.

◆ setCollections

void FavoriteCollectionsModel::setCollections ( const Collection::List & collections)
slot

Sets the collections as favorite collections.

Definition at line 280 of file favoritecollectionsmodel.cpp.

◆ setData()

bool FavoriteCollectionsModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
virtual

Definition at line 344 of file favoritecollectionsmodel.cpp.

◆ setFavoriteLabel

void Akonadi::FavoriteCollectionsModel::setFavoriteLabel ( const Collection & collection,
const QString & label )
slot

Sets a custom label that will be used when showing the favorite collection.

Definition at line 314 of file favoritecollectionsmodel.cpp.


The documentation for this class was generated from the following files:
  • favoritecollectionsmodel.h
  • favoritecollectionsmodel.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal