[Kde-pim] KDE - Counting Number of Address Books
Kevin Krammer
kevin.krammer at gmx.at
Tue Jun 29 15:52:04 BST 2010
On Tuesday, 2010-06-29, Tobias Koenig wrote:
> using namespace Akonadi;
> CollectionFetchJob *job = new CollectionFetchJob( Collection::root(),
> CollectionFetchJob::Recursive ); connect( job, SIGNAL( result( KJob* ) ),
> SLOT( collectionsFetched( KJob* ) ) );
>
> ...
>
> void MyClass::collectionsFetched( KJob *job )
> {
> if ( job->error() ) {
> // error handling
> return;
> }
>
> const CollectionFetchJob *fetchJob = qobject_cast<CollectionFetchJob*>(
> job );
>
> int addressBookCounter = 0;
> foreach ( const Collection &collection, fetchJob->collections() ) {
> if ( collection.contentMimeTypes().contains(
> KABC::Addressee::mimeType() ) || collection.contentMimeTypes().contains(
> KABC::ContactGroup::mimeType() ) ) addressBookCounter++;
> }
> }
While this is of course correct, wouldn't it be better to do specify the MIME
type at job creation time?
I.e. using:
job->fetchScope().setContentMimeTypes( QStringList() << Addressee::mimeType()
);
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100629/9f080164/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