NotesBackend.h
/*
* This file is part of buteo-sync-plugins package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef NOTESBACKEND_H
#define NOTESBACKEND_H
#include <KCalendarCore/Incidence>
#include <extendedcalendar.h>
#include <extendedstorage.h>
class QDateTime;
namespace Buteo {
class StorageItem;
}
class NotesBackend
{
public:
NotesBackend();
virtual ~NotesBackend();
bool init( const QString& aNotebookName, const QString& aUid, const QString &aMimeType );
bool uninit();
bool getAllNotes( QList<Buteo::StorageItem*>& aItems );
bool getAllNoteIds( QList<QString>& aIds );
bool getNewNotes( QList<Buteo::StorageItem*>& aNewItems, const QDateTime& aTime );
bool getNewNoteIds( QList<QString>& aNewIds, const QDateTime& aTime );
bool getModifiedNotes( QList<Buteo::StorageItem*>& aModifiedItems, const QDateTime& aTime );
bool getModifiedNoteIds( QList<QString>& aModifiedIds, const QDateTime& aTime );
bool getDeletedNoteIds( QList<QString>& aDeletedIds, const QDateTime& aTime );
Buteo::StorageItem* newItem();
Buteo::StorageItem* getItem( const QString& aItemId );
bool addNote( Buteo::StorageItem& aItem, bool commitNow );
bool modifyNote( Buteo::StorageItem& aItem, bool commitNow );
bool deleteNote( const QString& aId, bool commitNow );
bool commitChanges();
protected:
private:
void retrieveNoteItems( KCalendarCore::Incidence::List& aIncidences, QList<Buteo::StorageItem*>& aItems );
void retrieveNoteIds( KCalendarCore::Incidence::List& aIncidences, QList<QString>& aIds );
void filterIncidences( KCalendarCore::Incidence::List& aIncidences );
QString iNotebookName;
QString iMimeType;
mKCal::ExtendedCalendar::Ptr iCalendar;
mKCal::ExtendedStorage::Ptr iStorage;
};
#endif // NOTESBACKEND_H
NotesBackend::getNewNotes
bool getNewNotes(QList< Buteo::StorageItem * > &aNewItems, const QDateTime &aTime)
get all new notes from a timestamp
NotesBackend::~NotesBackend
virtual ~NotesBackend()
Destructor.
NotesBackend::getItem
Buteo::StorageItem * getItem(const QString &aItemId)
get an item
NotesBackend::getModifiedNoteIds
bool getModifiedNoteIds(QList< QString > &aModifiedIds, const QDateTime &aTime)
get all modified notes ids from the backend
NotesBackend::uninit
bool uninit()
Uninitializes backend.
NotesBackend::addNote
bool addNote(Buteo::StorageItem &aItem, bool commitNow)
Uninitializes backend.
NotesBackend::newItem
Buteo::StorageItem * newItem()
fetch a new StorageItem
NotesBackend::deleteNote
bool deleteNote(const QString &aId, bool commitNow)
Uninitializes backend.
NotesBackend::init
bool init(const QString &aNotebookName, const QString &aUid, const QString &aMimeType)
Initializes backend.
NotesBackend::getAllNoteIds
bool getAllNoteIds(QList< QString > &aIds)
gets are note ids from the backend
NotesBackend::getDeletedNoteIds
bool getDeletedNoteIds(QList< QString > &aDeletedIds, const QDateTime &aTime)
gets all deleted note ids
NotesBackend::commitChanges
bool commitChanges()
Persist notes db.
NotesBackend::getNewNoteIds
bool getNewNoteIds(QList< QString > &aNewIds, const QDateTime &aTime)
get all new note ids from a timestamp
NotesBackend::NotesBackend
NotesBackend()
Constructor.
NotesBackend::getAllNotes
bool getAllNotes(QList< Buteo::StorageItem * > &aItems)
retrieves all Notes from the backend
NotesBackend::getModifiedNotes
bool getModifiedNotes(QList< Buteo::StorageItem * > &aModifiedItems, const QDateTime &aTime)
get all modified notes from the backend
NotesBackend::modifyNote
bool modifyNote(Buteo::StorageItem &aItem, bool commitNow)
Uninitializes backend.