From 945671ec75a5e7011d7d7f6e5016a83f11254bce Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Wed, 28 Jan 2009 14:16:22 -0400 Subject: [PATCH] Aesthetics. --- googledataresource.cpp | 239 ++++++++++++++++++++++++------------------------- googledataresource.h | 72 +++++++-------- 2 files changed, 155 insertions(+), 156 deletions(-) rewrite googledataresource.cpp (70%) rewrite googledataresource.h (70%) diff --git a/googledataresource.cpp b/googledataresource.cpp dissimilarity index 70% index 8ccf655..111c046 100644 --- a/googledataresource.cpp +++ b/googledataresource.cpp @@ -1,120 +1,119 @@ -#include "googledataresource.h" - -#include "settings.h" -#include "settingsadaptor.h" - -#include - -extern "C" { -#include -#include -#include -} - -using namespace Akonadi; - -googledataResource::googledataResource( const QString &id ) - : ResourceBase( id ) -{ - new SettingsAdaptor( Settings::self() ); - QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ), - Settings::self(), QDBusConnection::ExportAdaptors ); - - - if (!(gcal = gcal_new(GCONTACT))) - exit(1); - gcal_set_store_xml(gcal, 1); -} - -googledataResource::~googledataResource() -{ - gcal_delete(gcal); - -} - -void googledataResource::retrieveCollections() -{ - // TODO: this method is called when Akonadi wants to have all the - // collections your resource provides. - // Be sure to set the remote ID and the content MIME types -} - -void googledataResource::retrieveItems( const Akonadi::Collection &collection ) -{ - Q_UNUSED( collection ); - - // TODO: this method is called when Akonadi wants to know about all the - // items in the given collection. You can but don't have to provide all the - // data for each item, remote ID and MIME type are enough at this stage. - // Depending on how your resource accesses the data, there are several - // different ways to tell Akonadi when you are done. -} - -bool googledataResource::retrieveItem( const Akonadi::Item &item, const QSet &parts ) -{ - Q_UNUSED( item ); - Q_UNUSED( parts ); - - // TODO: this method is called when Akonadi wants more data for a given item. - // You can only provide the parts that have been requested but you are allowed - // to provide all in one go - - return true; -} - -void googledataResource::aboutToQuit() -{ - // TODO: any cleanup you need to do while there is still an active - // event loop. The resource will terminate after this method returns -} - -void googledataResource::configure( WId windowId ) -{ - Q_UNUSED( windowId ); - - // TODO: this method is usually called when a new resource is being - // added to the Akonadi setup. You can do any kind of user interaction here, - // e.g. showing dialogs. - // The given window ID is usually useful to get the correct - // "on top of parent" behavior if the running window manager applies any kind - // of focus stealing prevention technique -} - -void googledataResource::itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ) -{ - Q_UNUSED( item ); - Q_UNUSED( collection ); - - // TODO: this method is called when somebody else, e.g. a client application, - // has created an item in a collection managed by your resource. - - // NOTE: There is an equivalent method for collections, but it isn't part - // of this template code to keep it simple -} - -void googledataResource::itemChanged( const Akonadi::Item &item, const QSet &parts ) -{ - Q_UNUSED( item ); - Q_UNUSED( parts ); - - // TODO: this method is called when somebody else, e.g. a client application, - // has changed an item managed by your resource. - - // NOTE: There is an equivalent method for collections, but it isn't part - // of this template code to keep it simple -} - -void googledataResource::itemRemoved( const Akonadi::Item &item ) -{ - Q_UNUSED( item ); - - // TODO: this method is called when somebody else, e.g. a client application, - // has deleted an item managed by your resource. - - // 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 ) - -#include "googledataresource.moc" +#include "googledataresource.h" + +#include "settings.h" +#include "settingsadaptor.h" + +#include + +extern "C" { +#include +#include +#include +} + +using namespace Akonadi; + +googledataResource::googledataResource( const QString &id ) + : ResourceBase( id ) +{ + new SettingsAdaptor( Settings::self() ); + QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ), + Settings::self(), QDBusConnection::ExportAdaptors ); + + + if (!(gcal = gcal_new(GCONTACT))) + exit(1); + gcal_set_store_xml(gcal, 1); +} + +googledataResource::~googledataResource() +{ + gcal_delete(gcal); +} + +void googledataResource::retrieveCollections() +{ + // TODO: this method is called when Akonadi wants to have all the + // collections your resource provides. + // Be sure to set the remote ID and the content MIME types +} + +void googledataResource::retrieveItems( const Akonadi::Collection &collection ) +{ + Q_UNUSED( collection ); + + // TODO: this method is called when Akonadi wants to know about all the + // items in the given collection. You can but don't have to provide all the + // data for each item, remote ID and MIME type are enough at this stage. + // Depending on how your resource accesses the data, there are several + // different ways to tell Akonadi when you are done. +} + +bool googledataResource::retrieveItem( const Akonadi::Item &item, const QSet &parts ) +{ + Q_UNUSED( item ); + Q_UNUSED( parts ); + + // TODO: this method is called when Akonadi wants more data for a given item. + // You can only provide the parts that have been requested but you are allowed + // to provide all in one go + + return true; +} + +void googledataResource::aboutToQuit() +{ + // TODO: any cleanup you need to do while there is still an active + // event loop. The resource will terminate after this method returns +} + +void googledataResource::configure( WId windowId ) +{ + Q_UNUSED( windowId ); + + // TODO: this method is usually called when a new resource is being + // added to the Akonadi setup. You can do any kind of user interaction here, + // e.g. showing dialogs. + // The given window ID is usually useful to get the correct + // "on top of parent" behavior if the running window manager applies any kind + // of focus stealing prevention technique +} + +void googledataResource::itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ) +{ + Q_UNUSED( item ); + Q_UNUSED( collection ); + + // TODO: this method is called when somebody else, e.g. a client application, + // has created an item in a collection managed by your resource. + + // NOTE: There is an equivalent method for collections, but it isn't part + // of this template code to keep it simple +} + +void googledataResource::itemChanged( const Akonadi::Item &item, const QSet &parts ) +{ + Q_UNUSED( item ); + Q_UNUSED( parts ); + + // TODO: this method is called when somebody else, e.g. a client application, + // has changed an item managed by your resource. + + // NOTE: There is an equivalent method for collections, but it isn't part + // of this template code to keep it simple +} + +void googledataResource::itemRemoved( const Akonadi::Item &item ) +{ + Q_UNUSED( item ); + + // TODO: this method is called when somebody else, e.g. a client application, + // has deleted an item managed by your resource. + + // 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 ) + +#include "googledataresource.moc" diff --git a/googledataresource.h b/googledataresource.h dissimilarity index 70% index 4c2b5a3..ee376ca 100644 --- a/googledataresource.h +++ b/googledataresource.h @@ -1,36 +1,36 @@ -#ifndef GOOGLEDATARESOURCE_H -#define GOOGLEDATARESOURCE_H - -#include -extern "C" { -#include -} - -class googledataResource : public Akonadi::ResourceBase, - public Akonadi::AgentBase::Observer -{ - Q_OBJECT - - public: - googledataResource( const QString &id ); - ~googledataResource(); - - public Q_SLOTS: - virtual void configure( WId windowId ); - - protected Q_SLOTS: - void retrieveCollections(); - void retrieveItems( const Akonadi::Collection &col ); - bool retrieveItem( const Akonadi::Item &item, const QSet &parts ); - - protected: - virtual void aboutToQuit(); - - virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ); - virtual void itemChanged( const Akonadi::Item &item, const QSet &parts ); - virtual void itemRemoved( const Akonadi::Item &item ); - - gcal_t gcal; -}; - -#endif +#ifndef GOOGLEDATARESOURCE_H +#define GOOGLEDATARESOURCE_H + +#include +extern "C" { +#include +} + +class googledataResource : public Akonadi::ResourceBase, + public Akonadi::AgentBase::Observer +{ + Q_OBJECT + + public: + googledataResource( const QString &id ); + ~googledataResource(); + + public Q_SLOTS: + virtual void configure( WId windowId ); + + protected Q_SLOTS: + void retrieveCollections(); + void retrieveItems( const Akonadi::Collection &col ); + bool retrieveItem( const Akonadi::Item &item, const QSet &parts ); + +protected: + virtual void aboutToQuit(); + + virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ); + virtual void itemChanged( const Akonadi::Item &item, const QSet &parts ); + virtual void itemRemoved( const Akonadi::Item &item ); + + gcal_t gcal; +}; + +#endif -- 2.11.4.GIT