added Akonadi/KDE backend

This is a verbatim copy of svn://anonsvn.kde.org/home/kde/trunk/playground/pim/syncml/clientagent/funambol
revision 1072301, the latest as of January 9th 2010.

The source implements the Funambol C++ client API SyncSource API,
accessing Akonadi as the underlying database. Change tracking is based
on the end time stamp of the last sync.

The source still needs to be adapted to SyncEvolution before it can
be used there.
This commit is contained in:
Sascha Peilicke 2010-01-09 23:05:50 +01:00 committed by Patrick Ohly
parent 9f18a93e1c
commit 6c48f78743
10 changed files with 794 additions and 0 deletions

View File

@ -0,0 +1,286 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "akonadisyncsource.h"
#include "timetrackingobserver.h"
#include <Akonadi/ItemCreateJob>
#include <Akonadi/ItemDeleteJob>
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/ItemModifyJob>
using namespace Akonadi;
AkonadiSyncSource::AkonadiSyncSource(TimeTrackingObserver *observer,
AkonadiSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: SyncSource(config->getName(), config)
, m_observer(observer)
{
managerConfig->setSyncSourceConfig(*config);
}
AkonadiSyncSource::~AkonadiSyncSource()
{
}
int AkonadiSyncSource::beginSync()
{
// Fetch all item sets from the time-tracking observer that
// correspond to this SyncSource's corresponding Akonadi collection
m_allItems = m_observer->allItems(m_lastSyncTime, m_collectionId);
m_newItems = m_observer->addedItems(m_lastSyncTime, m_collectionId);
m_updatedItems = m_observer->changedItems(m_lastSyncTime, m_collectionId);
m_deletedItems = m_observer->removedItems(m_lastSyncTime, m_collectionId);
m_currentTime = QDateTime::currentDateTime().toUTC();
kDebug() << "Begin sync at" << m_currentTime;
return 0;
}
int AkonadiSyncSource::endSync()
{
m_lastSyncTime = m_currentTime;
kDebug() << "End sync at" << m_lastSyncTime;
return 0;
}
int AkonadiSyncSource::addItem(SyncItem& syncItem)
{
kDebug() << "Remote wants us to add" << syncItemToString(syncItem);
Item item;
item.setMimeType(syncItem.getDataType());
item.setPayloadFromData(QByteArray((char *)syncItem.getData()));
ItemCreateJob *createJob = new ItemCreateJob(item, Collection(m_collectionId));
if (createJob->exec()) {
item = createJob->item();
kDebug() << "Created new item" << item.id() << "with mimetype" << item.mimeType()
<< "and added it to collection" << m_collectionId;
syncItem.setKey(QByteArray::number(item.id()));
//TODO: Read-only datastores may not have actually added something here!
return 200; // Ok, the SyncML command completed successfully
} else {
kDebug() << "Unable to create item" << item.id() << "in Akonadi datastore";
return 211; // Failed, the recipient encountered an error
}
}
int AkonadiSyncSource::updateItem(SyncItem& syncItem)
{
kDebug() << "Remote wants us to update" << syncItemToString(syncItem);
Entity::Id syncItemId = QByteArray(syncItem.getKey()).toLongLong();
// Fetch item which shall be modified
ItemFetchJob *fetchJob = new ItemFetchJob(Item(syncItemId));
if (fetchJob->exec()) {
Item item = fetchJob->items().first();
// Modify item, e.g. set new payload data
QByteArray data((char *)syncItem.getData());
item.setPayloadFromData(data);
// Store back modified item
ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item);
if (modifyJob->exec()) {
kDebug() << "Item" << item.id() << "modified successfully";
return 200; // Ok, the SyncML command completed successfully
} else {
return 211; // Failed, the recipient encountered an error
}
} else {
kDebug() << "Unable to find item with id" << syncItemId;
return 211; // Failed, the recipient encountered an error
}
}
int AkonadiSyncSource::deleteItem(SyncItem& syncItem)
{
kDebug() << "Remote wants us to delete" << syncItemToString(syncItem);
Entity::Id syncItemId = QByteArray(syncItem.getKey()).toLongLong();
// Delete the item from our collection
ItemDeleteJob *deleteJob = new ItemDeleteJob(Item(syncItemId));
if (deleteJob->exec()) {
return 200; // Ok, the SyncML command completed successfully
} else {
return 211; // Failed, the recipient encountered an error
}
}
int AkonadiSyncSource::removeAllItems()
{
kDebug() << "Remote wants us to remove all items";
// Remove all items from our collection
ItemDeleteJob *deleteJob = new ItemDeleteJob(Collection(m_collectionId));
if (deleteJob->exec()) {
return 200; // Ok, the SyncML command completed successfully
} else {
return 211; // Failed, the recipient encountered an error
}
}
SyncItem *AkonadiSyncSource::first(ItemSet set, bool withData)
{
SyncState state = SYNC_STATE_NONE;
Akonadi::Item item;
switch (set) {
case AllItems:
m_allItemsIndex = 0;
if (m_allItemsIndex < m_allItems.size()) {
kDebug() << "Fetch first item from 'all items' set";
item = m_allItems[m_allItemsIndex];
}
break;
case NewItems:
m_newItemsIndex = 0;
if (m_newItemsIndex < m_newItems.size()) {
kDebug() << "Fetch first item from 'new items' set";
state = SYNC_STATE_NEW;
item = m_newItems[m_newItemsIndex];
}
break;
case UpdatedItems:
m_updatedItemsIndex = 0;
if (m_updatedItemsIndex < m_updatedItems.size()) {
kDebug() << "Fetch first item from 'updated items' set";
state = SYNC_STATE_UPDATED;
item = m_updatedItems[m_updatedItemsIndex];
}
break;
case DeletedItems:
m_deletedItemsIndex = 0;
if (m_deletedItemsIndex < m_deletedItems.size()) {
kDebug() << "Fetch first item from 'next items' set";
state = SYNC_STATE_DELETED;
item = m_deletedItems[m_deletedItemsIndex];
}
break;
}
if (item.isValid()) {
return syncItem(item, withData, state);
} else {
kDebug() << "Fetched invalid item";
return 0;
}
}
SyncItem *AkonadiSyncSource::next(ItemSet set, bool withData)
{
SyncState state = SYNC_STATE_NONE;
Akonadi::Item item;
switch (set) {
case AllItems:
m_allItemsIndex++;
if (m_allItemsIndex < m_allItems.size()) {
kDebug() << "Fetch item" << m_allItemsIndex << "from 'all items' set";
item = m_allItems[m_allItemsIndex];
}
break;
case NewItems:
m_newItemsIndex++;
if (m_newItemsIndex < m_newItems.size()) {
kDebug() << "Fetch item" << m_newItemsIndex << "from 'new items' set";
state = SYNC_STATE_NEW;
item = m_newItems[m_newItemsIndex];
}
break;
case UpdatedItems:
m_updatedItemsIndex++;
if (m_updatedItemsIndex < m_updatedItems.size()) {
kDebug() << "Fetch item" << m_updatedItemsIndex << "from 'updated items' set";
state = SYNC_STATE_UPDATED;
item = m_updatedItems[m_updatedItemsIndex];
}
break;
case DeletedItems:
m_deletedItemsIndex++;
if (m_deletedItemsIndex < m_deletedItems.size()) {
kDebug() << "Fetch item" << m_deletedItemsIndex << "from 'deleted items' set";
state = SYNC_STATE_DELETED;
item = m_deletedItems[m_deletedItemsIndex];
}
break;
}
if (item.isValid()) {
return syncItem(item, withData, state);
} else {
kDebug() << "Fetched invalid item";
return 0;
}
}
SyncItem *AkonadiSyncSource::syncItem(const Item &item, bool withData, SyncState state) const
{
SyncItem *syncItem = new SyncItem();
kDebug() << "Return SyncItem for item" << item.id();
syncItem->setKey(QByteArray::number(item.id()));
syncItem->setModificationTime(m_lastSyncTime.toTime_t());
syncItem->setState(state);
if (withData) {
ItemFetchJob *fetchJob = new ItemFetchJob(item);
fetchJob->fetchScope().fetchFullPayload();
if (fetchJob->exec()) {
kDebug() << "Add payload data";
QByteArray data = fetchJob->items().first().payloadData().toBase64();
syncItem->setData(data, data.size());
syncItem->setDataEncoding(SyncItem::encodings::escaped);
syncItem->setDataType(getConfig().getType());
} else {
kDebug() << "Unable to add payload data";
}
}
//kDebug() << "Created SyncItem:" << syncItemToString(*syncItem);
return syncItem;
}
QString AkonadiSyncSource::syncItemToString(SyncItem& syncItem) const
{
QByteArray data((char *)syncItem.getData());
QString ret("Key: ");
ret += syncItem.getKey();
ret += " Mod.Time: ";
ret += QString::number(syncItem.getModificationTime());
ret += " Encoding: ";
ret += syncItem.getDataEncoding();
ret += " Size: ";
ret += QString::number(syncItem.getDataSize());
ret += " Type: ";
ret += syncItem.getDataType();
ret += " State: ";
ret += QString::number(syncItem.getState());
ret += " Data:\n";
ret += data;
return ret;
}
#include "moc_akonadisyncsource.cpp"

View File

@ -0,0 +1,155 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADISYNCSOURCE_H
#define AKONADISYNCSOURCE_H
#include "settings.h"
#include <Akonadi/Collection>
#include <Akonadi/Item>
#include <QDateTime>
#include <QObject>
#include <funambol/common/spds/SyncManagerConfig.h>
#include <funambol/common/spds/SyncSource.h>
class TimeTrackingObserver;
/**
* Base config for all sync sources.
*/
class AkonadiSyncSourceConfig : public QObject,
public SyncSourceConfig
{
Q_OBJECT
public:
enum SyncMode {
Slow = 0,
TwoWay,
OneWayFromServer,
OneWayFromClient,
RefreshFromServer,
RefreshFromClient
};
AkonadiSyncSourceConfig(unsigned long lastSync = 0,
const char *uri = "default")
: SyncSourceConfig()
{
setURI(uri);
setLast(lastSync); // Set last sync time
setVersion(""); // Don't care for the SyncML version
setEncoding(SyncItem::encodings::escaped); // Means base64 in Funambol tongue
setSyncModes("slow,two-way,one-way-from-server,one-way-from-client,refresh-from-server,refresh-from-client");
//setSupportedTypes(""); // This can be set by derived sync sources
setEncryption("");
// Determine how to sync
switch(Settings::self()->syncMode()) {
case 0: setSync("slow");
kDebug() << "Use 'Slow' sync mode"; break;
case 1: setSync("two-way");
kDebug() << "Use 'TwoWay' sync mode"; break;
case 2: setSync("one-way-from-server");
kDebug() << "Use 'OneWayFromServer' sync mode"; break;
case 3: setSync("one-way-from-client");
kDebug() << "Use 'OneWayFromClient' sync mode"; break;
case 4: setSync("refresh-from-server");
kDebug() << "Use 'RefreshFromServer' sync mode"; break;
case 5: setSync("refresh-from-client");
kDebug() << "Use 'RefreshFromClient' sync mode"; break;
}
kDebug() << "Sync source config for" << getName() << "with URI" << getURI() << "set up";
}
};
/**
* Abstract base class for all sync sources.
*/
class AkonadiSyncSource : public QObject
, public SyncSource
{
Q_OBJECT
public:
virtual ~AkonadiSyncSource();
// The following are Funambol API specific methods
int beginSync();
int endSync();
int addItem(SyncItem& syncItem);
int updateItem(SyncItem& syncItem);
int deleteItem(SyncItem& syncItem);
int removeAllItems();
SyncItem *getFirstItem() { return first(AllItems); }
SyncItem *getNextItem() { return next(AllItems); }
SyncItem *getFirstNewItem() { return first(NewItems); }
SyncItem *getNextNewItem() { return next(NewItems); }
SyncItem *getFirstUpdatedItem() { return first(UpdatedItems); }
SyncItem *getNextUpdatedItem() { return next(UpdatedItems); }
SyncItem *getFirstDeletedItem() { return first(DeletedItems, false); }
SyncItem *getNextDeletedItem() { return next(DeletedItems, false); }
SyncItem *getFirstItemKey() { return first(AllItems, false); }
SyncItem *getNextItemKey() { return next(AllItems, false); }
// End of Funambol API specific methods
QDateTime lastSyncTime() const { return m_lastSyncTime; }
protected:
AkonadiSyncSource(TimeTrackingObserver *observer,
AkonadiSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
TimeTrackingObserver *m_observer;
Akonadi::Entity::Id m_collectionId;
QDateTime m_lastSyncTime;
QDateTime m_currentTime;
private:
enum ItemSet {
AllItems = 0,
NewItems,
UpdatedItems,
DeletedItems
};
SyncItem *first(ItemSet set, bool withData = true);
SyncItem *next(ItemSet set, bool withData = true);
SyncItem *syncItem(const Akonadi::Item &item, bool withData = true, SyncState state = SYNC_STATE_NONE) const;
QString syncItemToString(SyncItem& syncItem) const;
int m_allItemsIndex;
int m_newItemsIndex;
int m_updatedItemsIndex;
int m_deletedItemsIndex;
Akonadi::Item::List m_allItems;
Akonadi::Item::List m_newItems;
Akonadi::Item::List m_updatedItems;
Akonadi::Item::List m_deletedItems;
};
#endif

View File

@ -0,0 +1,32 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "contactssyncsource.h"
#include "settings.h"
ContactsSyncSource::ContactsSyncSource(TimeTrackingObserver *observer,
ContactsSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: AkonadiSyncSource(observer, config, managerConfig)
{
m_collectionId = Settings::self()->contactsCollectionId();
m_lastSyncTime = Settings::self()->contactsLastSyncTime();
}
#include "moc_contactssyncsource.cpp"

View File

@ -0,0 +1,56 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef CONTACTSSYNCSOURCE_H
#define CONTACTSSYNCSOURCE_H
#include "akonadisyncsource.h"
/**
*
*/
class ContactsSyncSourceConfig : public AkonadiSyncSourceConfig
{
Q_OBJECT
public:
ContactsSyncSourceConfig()
: AkonadiSyncSourceConfig(Settings::self()->contactsLastSyncTime().toTime_t(),
Settings::self()->contactsRemoteDatabaseName().toLatin1())
{
setName(Settings::self()->contactsCollectionName().toLatin1());
setType("text/x-vcard");
setSupportedTypes("text/x-vcard:,text/vcard");
}
};
/**
*
*/
class ContactsSyncSource : public AkonadiSyncSource
{
Q_OBJECT
public:
ContactsSyncSource(TimeTrackingObserver *observer,
ContactsSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
};
#endif

View File

@ -0,0 +1,33 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "eventssyncsource.h"
#include "settings.h"
EventsSyncSource::EventsSyncSource(TimeTrackingObserver *observer,
EventsSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: AkonadiSyncSource(observer, config, managerConfig)
{
m_collectionId = Settings::self()->eventsCollectionId();
m_lastSyncTime = Settings::self()->eventsLastSyncTime();
}
#include "moc_eventssyncsource.cpp"

View File

@ -0,0 +1,56 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef EVENTSSYNCSOURCE_H
#define EVENTSSYNCSOURCE_H
#include "akonadisyncsource.h"
/**
*
*/
class EventsSyncSourceConfig : public AkonadiSyncSourceConfig
{
Q_OBJECT
public:
EventsSyncSourceConfig()
: AkonadiSyncSourceConfig(Settings::self()->eventsLastSyncTime().toTime_t(),
Settings::self()->eventsRemoteDatabaseName().toLatin1())
{
setName(Settings::self()->eventsCollectionName().toLatin1());
setType("text/x-vcalendar");
setSupportedTypes("text/x-vcalendar:");
}
};
/**
*
*/
class EventsSyncSource : public AkonadiSyncSource
{
Q_OBJECT
public:
EventsSyncSource(TimeTrackingObserver *observer,
EventsSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
};
#endif

View File

@ -0,0 +1,32 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "notessyncsource.h"
#include "settings.h"
NotesSyncSource::NotesSyncSource(TimeTrackingObserver *observer,
NotesSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: AkonadiSyncSource(observer, config, managerConfig)
{
m_collectionId = Settings::self()->notesCollectionId();
m_lastSyncTime = Settings::self()->notesLastSyncTime();
}
#include "moc_notessyncsource.cpp"

View File

@ -0,0 +1,56 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef NOTESSYNCSOURCE_H
#define NOTESSYNCSOURCE_H
#include "akonadisyncsource.h"
/**
*
*/
class NotesSyncSourceConfig : public AkonadiSyncSourceConfig
{
Q_OBJECT
public:
NotesSyncSourceConfig()
: AkonadiSyncSourceConfig(Settings::self()->notesLastSyncTime().toTime_t(),
Settings::self()->notesRemoteDatabaseName().toLatin1())
{
setName(Settings::self()->notesCollectionName().toLatin1());
setType("text/plain");
setSupportedTypes("text/x-vcard:,text/vcard");
}
};
/**
*
*/
class NotesSyncSource : public AkonadiSyncSource
{
Q_OBJECT
public:
NotesSyncSource(TimeTrackingObserver *observer,
NotesSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
};
#endif

View File

@ -0,0 +1,32 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "todossyncsource.h"
#include "settings.h"
TodosSyncSource::TodosSyncSource(TimeTrackingObserver *observer,
TodosSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: AkonadiSyncSource(observer, config, managerConfig)
{
m_collectionId = Settings::self()->todosCollectionId();
m_lastSyncTime = Settings::self()->todosLastSyncTime();
}
#include "moc_todossyncsource.cpp"

View File

@ -0,0 +1,56 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef TODOSSYNCSOURCE_H
#define TODOSSYNCSOURCE_H
#include "akonadisyncsource.h"
/**
*
*/
class TodosSyncSourceConfig : public AkonadiSyncSourceConfig
{
Q_OBJECT
public:
TodosSyncSourceConfig()
: AkonadiSyncSourceConfig(Settings::self()->todosLastSyncTime().toTime_t(),
Settings::self()->todosRemoteDatabaseName().toLatin1())
{
setName(Settings::self()->todosCollectionName().toLatin1());
setType("text/x-vcalendar");
setSupportedTypes("text/x-vcard:,text/vcard");
}
};
/**
*
*/
class TodosSyncSource : public AkonadiSyncSource
{
Q_OBJECT
public:
TodosSyncSource(TimeTrackingObserver *observer,
TodosSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
};
#endif