[Kde-pim] Question about itemfetchscope
laurent Montel
montel at kde.org
Fri Nov 6 10:51:27 GMT 2009
Le vendredi 6 novembre 2009 12:33:47, Stephen Kelly a écrit :
> laurent Montel wrote:
> > Hi,
> > In kmail I got item:
> >
> >
> > Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( mTemplateFolder
> > ); job->fetchScope().fetchFullPayload();
> > Akonadi::Item::List items;
> > if ( job->exec() ) {
> > items = job->items();
> > }
> > for ( int idx = 0; idx < items.count(); ++idx ) {
> > qDebug()<<" items.at(idx).parentCollection() :"<<items.at( idx
> > ).parentCollection();
> > KMime::Message::Ptr msg = KMail::Util::message( items.at( idx ) );
> > if ( msg ) {
> > ....
> > }
> > }
> >
> > it works fine it's not a pb.
> > But when I test parentCollection it returns invalid parent !
> > I don't understand.
> > Why after an itemfetchjob parentcollection is invalid ?
> >
> > What I am missing ?
>
> You need to explicitly ask to fetch the parents too.
>
> job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent ); for just
> one parent collection, and ::All for all ancestors up to Collection::root.
>
> That's @since 4.4 and I've needed to use it in most cases, so we should
> probably make it the default...
Ok thanks for info.
Regards
> > Regards
>
> _______________________________________________
> 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/
>
--
Laurent Montel | laurent at kdab.com | KDE/Qt Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
_______________________________________________
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