Aesthetics.
[akonadigoogledata.git] / googledataresource.cpp
blob111c046098a576536285206e786c79464e3fb9b2
1 #include "googledataresource.h"
3 #include "settings.h"
4 #include "settingsadaptor.h"
6 #include <QtDBus/QDBusConnection>
8 extern "C" {
9 #include <gcalendar.h>
10 #include <gcontact.h>
11 #include <gcal_status.h>
14 using namespace Akonadi;
16 googledataResource::googledataResource( const QString &id )
17 : ResourceBase( id )
19 new SettingsAdaptor( Settings::self() );
20 QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ),
21 Settings::self(), QDBusConnection::ExportAdaptors );
24 if (!(gcal = gcal_new(GCONTACT)))
25 exit(1);
26 gcal_set_store_xml(gcal, 1);
29 googledataResource::~googledataResource()
31 gcal_delete(gcal);
34 void googledataResource::retrieveCollections()
36 // TODO: this method is called when Akonadi wants to have all the
37 // collections your resource provides.
38 // Be sure to set the remote ID and the content MIME types
41 void googledataResource::retrieveItems( const Akonadi::Collection &collection )
43 Q_UNUSED( collection );
45 // TODO: this method is called when Akonadi wants to know about all the
46 // items in the given collection. You can but don't have to provide all the
47 // data for each item, remote ID and MIME type are enough at this stage.
48 // Depending on how your resource accesses the data, there are several
49 // different ways to tell Akonadi when you are done.
52 bool googledataResource::retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts )
54 Q_UNUSED( item );
55 Q_UNUSED( parts );
57 // TODO: this method is called when Akonadi wants more data for a given item.
58 // You can only provide the parts that have been requested but you are allowed
59 // to provide all in one go
61 return true;
64 void googledataResource::aboutToQuit()
66 // TODO: any cleanup you need to do while there is still an active
67 // event loop. The resource will terminate after this method returns
70 void googledataResource::configure( WId windowId )
72 Q_UNUSED( windowId );
74 // TODO: this method is usually called when a new resource is being
75 // added to the Akonadi setup. You can do any kind of user interaction here,
76 // e.g. showing dialogs.
77 // The given window ID is usually useful to get the correct
78 // "on top of parent" behavior if the running window manager applies any kind
79 // of focus stealing prevention technique
82 void googledataResource::itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection )
84 Q_UNUSED( item );
85 Q_UNUSED( collection );
87 // TODO: this method is called when somebody else, e.g. a client application,
88 // has created an item in a collection managed by your resource.
90 // NOTE: There is an equivalent method for collections, but it isn't part
91 // of this template code to keep it simple
94 void googledataResource::itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &parts )
96 Q_UNUSED( item );
97 Q_UNUSED( parts );
99 // TODO: this method is called when somebody else, e.g. a client application,
100 // has changed an item managed by your resource.
102 // NOTE: There is an equivalent method for collections, but it isn't part
103 // of this template code to keep it simple
106 void googledataResource::itemRemoved( const Akonadi::Item &item )
108 Q_UNUSED( item );
110 // TODO: this method is called when somebody else, e.g. a client application,
111 // has deleted an item managed by your resource.
113 // NOTE: There is an equivalent method for collections, but it isn't part
114 // of this template code to keep it simple
117 AKONADI_RESOURCE_MAIN( googledataResource )
119 #include "googledataresource.moc"