From 6f4ff4b50d3da72d045829f3a51a74aec2cbab05 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Fri, 30 Jan 2009 15:45:41 -0400 Subject: [PATCH] And now code to delete the contact. --- googledataresource.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/googledataresource.cpp b/googledataresource.cpp index 66dbeb6..2029e40 100644 --- a/googledataresource.cpp +++ b/googledataresource.cpp @@ -224,13 +224,31 @@ void googledataResource::itemChanged( const Akonadi::Item &item, const QSet()) + addressee = item.payload(); + + if (!(contact = gcal_contact_new(NULL))) + exit(1); - // TODO: this method is called when somebody else, e.g. a client application, - // has deleted an item managed by your resource. + temp = addressee.uid(); + gcal_contact_set_id(contact, const_cast(qPrintable(temp))); + + /* I suppose that this retrieves the first element in the key list */ + key = addressee.keys()[0]; + temp = key.id(); + gcal_contact_set_etag(contact, const_cast(qPrintable(temp))); + + if ((result = gcal_erase_contact(gcal, contact))) + exit(1); + + gcal_contact_delete(contact); - // NOTE: There is an equivalent method for collections, but it isn't part - // of this template code to keep it simple } AKONADI_RESOURCE_MAIN( googledataResource ) -- 2.11.4.GIT