Cleaning up the configure method.
[akonadigoogledata.git] / googledataresource.cpp
blobce86a06901bc20ad4c1fd8c71ff1fe8366182630
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:
75 * what kind of dialog to collect google acount username + password ?
77 synchronize();
80 void googledataResource::itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection )
82 Q_UNUSED( item );
83 Q_UNUSED( collection );
85 // TODO: this method is called when somebody else, e.g. a client application,
86 // has created an item in a collection managed by your resource.
88 // NOTE: There is an equivalent method for collections, but it isn't part
89 // of this template code to keep it simple
92 void googledataResource::itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &parts )
94 Q_UNUSED( item );
95 Q_UNUSED( parts );
97 // TODO: this method is called when somebody else, e.g. a client application,
98 // has changed an item managed by your resource.
100 // NOTE: There is an equivalent method for collections, but it isn't part
101 // of this template code to keep it simple
104 void googledataResource::itemRemoved( const Akonadi::Item &item )
106 Q_UNUSED( item );
108 // TODO: this method is called when somebody else, e.g. a client application,
109 // has deleted an item managed by your resource.
111 // NOTE: There is an equivalent method for collections, but it isn't part
112 // of this template code to keep it simple
115 AKONADI_RESOURCE_MAIN( googledataResource )
117 #include "googledataresource.moc"