[Kde-pim] Using an EntityMimeTypeFilterModel to show Items only
Dan Vratil
dan at progdan.cz
Sun Aug 26 00:46:22 BST 2012
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/readerview.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,
Dan
>
> Marcus Harrison
--
Dan Vratil
www.progdan.cz | dan at progdan.cz | Jabber: progdan at jabber.cz
Fingerprint: 76C9 2F08 5D0D 6F9E 5AD4 2BFD 3A85 0307 F506 5B61
-------------- 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/677648bf/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