HarmattanSyncApplications
NotesBackend.h
1/*
2 * This file is part of buteo-sync-plugins package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23#ifndef NOTESBACKEND_H
24#define NOTESBACKEND_H
25
26#include <KCalendarCore/Incidence>
27#include <extendedcalendar.h>
28#include <extendedstorage.h>
29
30class QDateTime;
31
32namespace Buteo {
33 class StorageItem;
34}
35
40{
41public:
42
47
51 virtual ~NotesBackend();
52
57 bool init( const QString& aNotebookName, const QString& aUid, const QString &aMimeType );
58
63 bool uninit();
64
70 bool getAllNotes( QList<Buteo::StorageItem*>& aItems );
71
77 bool getAllNoteIds( QList<QString>& aIds );
78
85 bool getNewNotes( QList<Buteo::StorageItem*>& aNewItems, const QDateTime& aTime );
86
93 bool getNewNoteIds( QList<QString>& aNewIds, const QDateTime& aTime );
94
101 bool getModifiedNotes( QList<Buteo::StorageItem*>& aModifiedItems, const QDateTime& aTime );
102
109 bool getModifiedNoteIds( QList<QString>& aModifiedIds, const QDateTime& aTime );
110
117 bool getDeletedNoteIds( QList<QString>& aDeletedIds, const QDateTime& aTime );
118
123 Buteo::StorageItem* newItem();
124
130 Buteo::StorageItem* getItem( const QString& aItemId );
131
138 bool addNote( Buteo::StorageItem& aItem, bool commitNow );
139
146 bool modifyNote( Buteo::StorageItem& aItem, bool commitNow );
147
154 bool deleteNote( const QString& aId, bool commitNow );
155
161
162protected:
163
164private:
165
166 void retrieveNoteItems( KCalendarCore::Incidence::List& aIncidences, QList<Buteo::StorageItem*>& aItems );
167
168 void retrieveNoteIds( KCalendarCore::Incidence::List& aIncidences, QList<QString>& aIds );
169
170 void filterIncidences( KCalendarCore::Incidence::List& aIncidences );
171
172
173 QString iNotebookName;
174 QString iMimeType;
175
176 mKCal::ExtendedCalendar::Ptr iCalendar;
177 mKCal::ExtendedStorage::Ptr iStorage;
178
179};
180
181#endif // NOTESBACKEND_H
Notes Calendar backend proxy.
Definition NotesBackend.h:40
bool getNewNotes(QList< Buteo::StorageItem * > &aNewItems, const QDateTime &aTime)
get all new notes from a timestamp
virtual ~NotesBackend()
Destructor.
Buteo::StorageItem * getItem(const QString &aItemId)
get an item
bool getModifiedNoteIds(QList< QString > &aModifiedIds, const QDateTime &aTime)
get all modified notes ids from the backend
bool uninit()
Uninitializes backend.
bool addNote(Buteo::StorageItem &aItem, bool commitNow)
Uninitializes backend.
Buteo::StorageItem * newItem()
fetch a new StorageItem
bool deleteNote(const QString &aId, bool commitNow)
Uninitializes backend.
bool init(const QString &aNotebookName, const QString &aUid, const QString &aMimeType)
Initializes backend.
bool getAllNoteIds(QList< QString > &aIds)
gets are note ids from the backend
bool getDeletedNoteIds(QList< QString > &aDeletedIds, const QDateTime &aTime)
gets all deleted note ids
bool commitChanges()
Persist notes db.
bool getNewNoteIds(QList< QString > &aNewIds, const QDateTime &aTime)
get all new note ids from a timestamp
NotesBackend()
Constructor.
bool getAllNotes(QList< Buteo::StorageItem * > &aItems)
retrieves all Notes from the backend
bool getModifiedNotes(QList< Buteo::StorageItem * > &aModifiedItems, const QDateTime &aTime)
get all modified notes from the backend
bool modifyNote(Buteo::StorageItem &aItem, bool commitNow)
Uninitializes backend.