[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: Re: [Kde-pim] Using an EntityMimeTypeFilterModel to show Items only
From: Marcus Harrison <marcus () harrisonland ! co ! uk>
Date: 2012-08-26 10:29:10
Message-ID: 4948511.YrfLnYqFIv () lunacy
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
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
["signature.asc" (application/pgp-signature)]
_______________________________________________
KDE PIM mailing list kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic