[Kde-pim] Akonadi::ResourceBase - API questions

Brad Hards bradh at frogmouth.net
Sun May 13 12:20:59 BST 2007


G'day,

I've been looking at Akonadi with the view to making a microsoft exchange 
resource (based on http://www.openchange.org) - no promises though...

I have a few comments/questions that others may be able to help me with. These 
are in relation to ResourceBase, which is the class I guess I'm meant to 
inherit from.

1. It seems a bit strange for Akonadi::ResourceBase to inherit from 
Akonadi::Resource. What is the rationale for this?

2. The method naming seems a bit strange in a couple of places. For example, I 
expected that the method to add an Item to a Collection would be called 
addItem(). If I'm understanding the code correctly, it is called itemAdded(), 
which feels like a signal that would be emitted. I think I understand the 
logic, but the name should still be with respect to the resource, not Akonadi 
as a whole. Same issue for itemChanged, itemRemoved, collectionAdded, 
collectionChanged, collectionRemoved.

3. changeProgress() and changeStatus() are unexpected - should be 
setProgress() and setStatus().

4. enableChangeRecording() sounds like something that turns on revision 
recording. From the API documentation it is meant to temporarily queue up 
changes to the backend - if so, it should be called something 
enableChangeQueuing() or deferChanges(). I'm still not sure how this differs 
from the online/offline idea?

5. I'm not sure what the "partIdentifiers" argument to itemChanged() is 
intended to do. Any suggestions?

6.. status() returns an int. The apidox says the possible return values are 0, 
1 or 2. If so, why does it not return the Status enum type?

7. collectionAdded(), collectionChanged() and collectionRemoved() are inline 
and virtual, which looks a bit strange.

8. Noting my concerns about how to tell the difference between 
enableChangeRecording() and setOnline(), why isn't setOnline a slot?

9. the knut resource has this function:
virtual bool requestItemDelivery( const Akonadi::DataReference &ref, int type, 
const QDBusMessage &msg )
while the ResourceBase has this:
virtual bool requestItemDelivery( int uid, const QString &remoteId, int 
type );
Are these related?


More on akonadi/resources/knut/:
10. This is a fragment from  KnutResource::loadData()
  element = element.firstChildElement();
  while ( !element.isNull() ) {
    if ( element.tagName() == QLatin1String( "collection" ) ) {
      addCollection( element, parentCollection );
    } else if ( element.tagName() == QLatin1String( "item" ) ) {
      if ( element.attribute( "mimetype" ) == QLatin1String( "text/vcard" ) )
        addAddressee( element, entry );
      else if ( element.attribute( "mimetype" ) == 
QLatin1String( "text/calendar" ) )
        addIncidence( element, entry );
    }

    element = element.nextSiblingElement();
  }

  mCollections.insert( entry.collection.remoteId(), entry );

Why isn't that last line inside the while loop?

Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20070513/3e455ddc/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