[Kde-pim] Using an EntityMimeTypeFilterModel to show Items only
Marcus Harrison
marcus at harrisonland.co.uk
Sun Aug 26 11:29:10 BST 2012
On Sunday 26 Aug 2012 01:46:22 Dan Vratil wrote:
> On Saturday 25 of August 2012 23:51:21 Marcus Harrison wrote:
> > Hello everyone,
>
> Hi,
>
> > 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?
>
> I remember fighting this problem for quite a while when I was writing an RSS
> reader.
>
> Check
> http://gitorious.org/kgooglereader/kgooglereader/blobs/master/part/readervie
> w.cpp#line245
>
> maybe it will help :) The usecase is slightly different then what you
> describe here, but the main idea is the same.
>
> > 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());
>
> Specifically, adding
>
> changeRecorder->setMimeTypeMonitored("message/rfc822");
>
> might solve your problem.
>
> > 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();
> >
> > }
>
> Hope it helps,
>
> Cheers
Thanks for the advice. I had tried this before, but the filtermodel still
seems to be broken for me for some inexplicable reason.
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/20120826/4828b5e1/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