[Kde-pim] Using an EntityMimeTypeFilterModel to show Items only

Marcus Harrison marcus.harrison at harrisonland.co.uk
Sat Aug 25 23:40:36 BST 2012


Hello everyone,
I've started writing an E-mail client using Akonadi and I'm having trouble. 
I'm trying to configure a model that only contains E-mail items, not 
collections.
To do this, I'm trying to use an EntityMimeTypeFilterModel on top of an 
EntityTreeModel, but it's behaving very oddly.

If I don't configure it at all, the documentation says it should have all 
mimetypes in the include filters, but in practice it's only showing 
Collections. It should show Items as well, shouldn't it?

Anyway, adding an inclusion filter of "message/rfc822" filters the Collections 
out, but because it's not including any Items anyway it then just displays 
nothing.

Can anyone explain just what's going on, please?

A paste of my test code so far:


MainWindow::MainWindow()
{
    foldersDock = new FoldersDock(this); // Some other configured widget
    
    changeRecorder = new Akonadi::ChangeRecorder(this);
    changeRecorder->setCollectionMonitored(Akonadi::Collection::root());

    model = new Akonadi::EntityTreeModel(changeRecorder, this);
    mailsModel = new Akonadi::EntityMimeTypeFilterModel(this);
    mailsModel->setSourceModel(model);
    mailsModel->addMimeTypeInclusionFilter("message/rfc822");

    mailsView = new Akonadi::EntityTreeView(this, this);
    mailsView->setModel(mailsModel);

    connect(foldersDock, SIGNAL(currentChanged(Akonadi::Collection)),
            this, SLOT(currentChanged(Akonadi::Collection)));
    
    addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
    setCentralWidget(mailsView);
    setupGUI();
}


Marcus Harrison
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20120825/18de12ff/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list