playground/base/plasma/dataengines/akonadi

David Baron d_baron at 012.net.il
Mon Feb 9 08:37:48 CET 2009


Great.

I downloaded and compiled.

I still get "no data sources" in the explorer and in some test code which 
would simply show the sources() list.
> SVN commit 923483 by sebas:
>
> birthday, location and photo for the akonadi dataengine contacts part
>
> In more general, the dataengine works as follows:
>
> For email:
> -----------
> - request "EmailCollections", you'll get a list of EmailCollections-<id>
>   as key and the name of the collection as value.
>   (The list of collections is loaded on demand)
>
> - Choose one of those collections by request the ID
>   (EmailCollection-<id>). The dataengine now queries Akonadi for all
>   emails in that collections and will add a new source for every email. In
>   you dataUpdated() method, you can simply check if the
>   source.startsWith("EmailCollection-") and then query the data from that
>   email.
>
> Properties you might be interested in for those email source are:
>  - QDate DateTime
>  - QString Subject
>  - QString From
>  - QString To
>  - qlonglong Id
>
> The Id can be used to query Akonadi for the body of the email. That part
> is not yet included in the Akonadi engine, but might come in the future.
>
> For Contacts:
> --------------
> - request "ContactCollections", choose one of those and request
>   "ContactCollection-<id>".
> - request one of those collections ("ContactCollection-<id>")
> - New sources for every contact in that collection will appear. You can
>   now get at the Contacts data through the following fields in that
>   particular source:
>
>  - double longitude
>  - double latitude
>  - QString Organization, Role, FullEmail, Name, Department, Emails,
>    various Phone- numbers
>
> Work to get those datasets more complete is under way. What's in should
> already provide for most of the use cases you can dream of.
>
> CCMAIL:plasma-devel at kde.org
>
>  M  +23 -8     akonadiengine.cpp
>
>
> --- trunk/playground/base/plasma/dataengines/akonadi/akonadiengine.cpp
> #923482:923483 @@ -29,6 +29,7 @@
>
>  #include <kabc/addressee.h>
>  #include <kabc/phonenumber.h>
> +#include <kabc/picture.h>
>
>  /*
>  #include <kmime/kmime_message.h>
> @@ -54,7 +55,6 @@
>              SLOT(emailItemChanged(Akonadi::Item)) );
>      // TODO: monitoring for contacts
>
> -    fetchContactCollections(); // TODO: remove, it's there only for
> debugging }
>
>  AkonadiEngine::~AkonadiEngine()
> @@ -256,22 +256,37 @@
>              // Phone and related
>              QStringList phoneNumbers;
>              foreach (const KABC::PhoneNumber pn, a.phoneNumbers()) {
> -                QString key = QString("Phone%1").arg(pn.typeLabel());
> -                setData(source, key, a.phoneNumber(pn.type()).toString());
> -                phoneNumbers << a.phoneNumber(pn.type()).toString();
> +                QString key = QString("Phone-%1").arg(pn.typeLabel());
> +                setData(source, key, a.phoneNumber(pn.type()).number());
> +                phoneNumbers << a.phoneNumber(pn.type()).number();
>              }
>              if (!phoneNumbers.count()) {
>                  setData(source, "PhoneNumbers", phoneNumbers);
>              }
>
> -            // department, fullEmail, nickName, organisation, note,
> prefix, realName, role +            // Personal
> +            if (!a.birthday().isValid()) {
> +                setData(source, "Birthday", a.birthday());
> +            }
>
> +            if (a.photo().isEmpty()) {
> +                setData(source, "Photo", a.photo().data());
> +                setData(source, "PhotoUrl", a.photo().url());
> +            }
> +            if (a.geo().isValid()) {
> +                setData(source, "Latitude", a.geo().latitude());
> +                setData(source, "Longitude", a.geo().longitude());
> +            }
>
> -            // phoneNumber.toString phoneNumber.typeLabel
> +            // addresses
>
> -            //setData(source, "Name", a.name());
> +            // categories
>
> -            // TODO
> +            // note,
> +
> +            // prefix,
> +
> +            // ...
>          }
>      }
>  }
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel



More information about the Plasma-devel mailing list