Akonadi::Monitor *TripComponentFactory::createTodoMonitor(QObject *parent)
{
    Akonadi::Monitor *chMon = new Akonadi::Monitor(parent);
    chMon->setMimeTypeMonitored(KCalCore::Todo::todoMimeType());
    chMon->itemFetchScope().fetchFullPayload(true);
    return chMon;
}
Akonadi::Monitor *TripComponentFactory::createNotesMonitor(QObject *parent)
{
    Akonadi::Monitor *chMon = new Akonadi::Monitor(parent);
    chMon->setMimeTypeMonitored(Akonotes::Note::mimeType());
    chMon->itemFetchScope().fetchFullPayload(true);
    return chMon;
}
void KPDialog::setupPane()
{
    kDebug() << "Setting up";
    // Setup the core model
    Akonadi::Session *session = new Akonadi::Session( "KPApplet", m_folderListWidget );

      Akonadi::Monitor *monitor = new Akonadi::Monitor( m_folderListWidget );
      monitor->setCollectionMonitored( Akonadi::Collection::root() );
      monitor->fetchCollection( true );
      monitor->setMimeTypeMonitored( "message/rfc822", true );
      monitor->itemFetchScope().fetchFullPayload(true);

      Akonadi::EntityTreeModel *entityModel = new Akonadi::EntityTreeModel( session, monitor, m_folderListWidget );
      entityModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation );

      // Create the collection view
      m_folderListView = new Akonadi::EntityTreeView( 0, m_folderListWidget );
      m_folderListView->setSelectionMode( QAbstractItemView::ExtendedSelection );



      // Setup the message folders collection...
      Akonadi::EntityFilterProxyModel *collectionFilter = new Akonadi::EntityFilterProxyModel( m_folderListWidget );
      collectionFilter->setSourceModel( entityModel );
      //collectionFilter->addMimeTypeInclusionFilter( "message/rfc822" );
      collectionFilter->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() );
      collectionFilter->setHeaderSet( Akonadi::EntityTreeModel::CollectionTreeHeaders );

      // ... with statistics...
      Akonadi::StatisticsToolTipProxyModel *statisticsProxyModel = new Akonadi::StatisticsToolTipProxyModel( m_folderListWidget );
      statisticsProxyModel->setSourceModel( collectionFilter );

      // ... and sortable
      QSortFilterProxyModel *sortModel = new QSortFilterProxyModel( m_folderListWidget );
      sortModel->setDynamicSortFilter( true );
      sortModel->setSortCaseSensitivity( Qt::CaseInsensitive );
      sortModel->setSourceModel( statisticsProxyModel );
      // Use the model
      m_folderListView->setModel( sortModel );
      entityModel->setRootCollection(Akonadi::Collection::root());
      
      // Now make the message list multi-tab pane
      m_messagePane = new MessageList::Pane( entityModel, m_folderListView->selectionModel(), m_messageListWidget );
      //connect( m_messagePane, SIGNAL(messageSelected(Akonadi::Item)),
      //       this, SLOT(slotMessageSelected(Akonadi::Item)) );

}