31#ifndef MKCAL_EXTENDEDSTORAGE_H
32#define MKCAL_EXTENDEDSTORAGE_H
39#include <KCalendarCore/CalStorage>
40#include <KCalendarCore/Calendar>
62 :
public QObject,
public KCalendarCore::Calendar::CalendarObserver
79 typedef QSharedPointer<ExtendedStorage>
Ptr;
107 ExtendedCalendar::Ptr
calendar()
const;
127 virtual bool load(
const QString &uid) = 0;
153 bool load(
const QString &uid,
const QDateTime &recurrenceId);
168 virtual bool load(
const QDate &date);
179 virtual bool load(
const QDate &start,
const QDate &end) = 0;
211 const QString &
notebook = QString()) = 0;
234 virtual bool close();
283 const QDateTime &after = QDateTime(),
284 const QString ¬ebookUid = QString()) = 0;
297 const QDateTime &after = QDateTime(),
298 const QString ¬ebookUid = QString()) = 0;
309 const QDateTime &after = QDateTime(),
310 const QString ¬ebookUid = QString()) = 0;
320 const QString ¬ebookUid = QString()) = 0;
343 virtual bool search(
const QString &key, QStringList *identifiers,
int limit = 0) = 0;
477 QString color = QString());
495 QDateTime *loadStart, QDateTime *loadEnd)
const;
504 const KCalendarCore::Incidence::List &modified,
505 const KCalendarCore::Incidence::List &deleted);
514 friend class ::MkcalTool;
515 friend class ::tst_load;
QSharedPointer< ExtendedStorage > Ptr
A shared pointer to a ExtendedStorage.
Definition extendedstorage.h:79
void addLoadedRange(const QDate &start, const QDate &end) const
Definition extendedstorage.cpp:215
bool deleteNotebook(const Notebook::Ptr &nb)
Delete notebook from storage.
Definition extendedstorage.cpp:422
Notebook::Ptr createDefaultNotebook(QString name=QString(), QString color=QString())
Creates and sets a default notebook.
Definition extendedstorage.cpp:536
virtual bool purgeDeletedIncidences(const KCalendarCore::Incidence::List &list, const QString ¬ebook=QString())=0
Remove from storage all incidences that have been previously marked as deleted and that matches the U...
virtual bool close()
Definition extendedstorage.cpp:174
virtual bool load(const QString &uid)=0
Load all incidences sharing the same uid into the memory.
virtual bool loadNotebookIncidences(const QString ¬ebookUid)=0
Load incidences of one notebook into the memory.
virtual void calendarIncidenceDeleted(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Calendar *calendar)=0
virtual bool load(const QDate &start, const QDate &end)=0
Load incidences between given dates into the memory.
void setValidateNotebooks(bool validateNotebooks)
Determine if notebooks should be validated in saves and loads.
Definition extendedstorage.cpp:508
void emitStorageModified(const QString &info)
Definition extendedstorage.cpp:334
virtual bool loadIncidenceInstance(const QString &instanceIdentifier)
Load the incidence matching the given identifier.
Definition extendedstorage.cpp:266
void unregisterObserver(ExtendedStorageObserver *observer)
Unregisters an Observer for this Storage.
Definition extendedstorage.cpp:329
bool setDefaultNotebook(const Notebook::Ptr &nb)
setDefaultNotebook to the storage.
Definition extendedstorage.cpp:476
virtual bool search(const QString &key, QStringList *identifiers, int limit=0)=0
Get all incidences from storage that match key.
bool validateNotebooks() const
Returns true if notebooks should be validated in saves and loads.
Definition extendedstorage.cpp:513
virtual QDateTime incidenceDeletedDate(const KCalendarCore::Incidence::Ptr &incidence)=0
Get deletion time of incidence.
ExtendedStorage(const ExtendedCalendar::Ptr &cal, bool validateNotebooks=true)
Constructs a new ExtendedStorage object.
Definition extendedstorage.cpp:157
void setIsRecurrenceLoaded(bool loaded)
Definition extendedstorage.cpp:247
bool isRecurrenceLoaded() const
Definition extendedstorage.cpp:242
virtual void calendarModified(bool modified, KCalendarCore::Calendar *calendar)=0
ExtendedCalendar::Ptr calendar() const
Definition extendedstorage.cpp:169
bool addNotebook(const Notebook::Ptr &nb)
Add new notebook to the storage.
Definition extendedstorage.cpp:376
virtual bool save(DeleteAction deleteAction)=0
This is an overload of save() method.
void registerObserver(ExtendedStorageObserver *observer)
Registers an Observer for this Storage.
Definition extendedstorage.cpp:322
bool isValidNotebook(const QString ¬ebookUid) const
Returns true if the given notebook is valid for the storage.
Definition extendedstorage.cpp:518
virtual bool loadNotebooks()=0
DeleteAction
Action to be performed on save for deleted incidences.
Definition extendedstorage.h:71
@ MarkDeleted
Definition extendedstorage.h:72
@ PurgeDeleted
Definition extendedstorage.h:73
bool getLoadDates(const QDate &start, const QDate &end, QDateTime *loadStart, QDateTime *loadEnd) const
Definition extendedstorage.cpp:179
virtual bool allIncidences(KCalendarCore::Incidence::List *list, const QString ¬ebookUid=QString())=0
Get all incidences from storage.
Notebook::List notebooks()
List all notebooks.
Definition extendedstorage.cpp:498
virtual bool modifiedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after=QDateTime(), const QString ¬ebookUid=QString())=0
Get modified incidences from storage.
bool updateNotebook(const Notebook::Ptr &nb)
Update notebook parameters.
Definition extendedstorage.cpp:395
virtual void calendarIncidenceChanged(const KCalendarCore::Incidence::Ptr &incidence)=0
bool loadSeries(const QString &uid)
Load all incidences sharing the same uid into the memory.
Definition extendedstorage.cpp:252
virtual bool modifyNotebook(const Notebook::Ptr &nb)=0
virtual void calendarIncidenceAdditionCanceled(const KCalendarCore::Incidence::Ptr &incidence)=0
virtual bool eraseNotebook(const Notebook::Ptr &nb)=0
Notebook::Ptr notebook(const QString &uid) const
Search for notebook.
Definition extendedstorage.cpp:503
void emitStorageUpdated(const KCalendarCore::Incidence::List &added, const KCalendarCore::Incidence::List &modified, const KCalendarCore::Incidence::List &deleted)
Definition extendedstorage.cpp:360
virtual void calendarIncidenceAdded(const KCalendarCore::Incidence::Ptr &incidence)=0
virtual void virtual_hook(int id, void *data)=0
Standard trick to add virtuals later.
virtual bool insertedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after=QDateTime(), const QString ¬ebookUid=QString())=0
Get inserted incidences from storage.
virtual bool deletedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after=QDateTime(), const QString ¬ebookUid=QString())=0
Get deleted incidences from storage.
void emitStorageFinished(bool error, const QString &info)
Definition extendedstorage.cpp:353
virtual bool insertNotebook(const Notebook::Ptr &nb)=0
Notebook::Ptr defaultNotebook()
defaultNotebook.
Definition extendedstorage.cpp:493
The ExtendedStorageObserver class.
Definition extendedstorageobserver.h:47
QSharedPointer< Notebook > Ptr
A shared pointer to a Notebook object.
Definition notebook.h:51
QList< Ptr > List
List of notebooks.
Definition notebook.h:61
This file is part of the API for handling calendar data and defines the ExtendedCalendar class.
This file is part of the API for handling calendar data and defines the ExtendedStorageObserver to be...
#define MKCAL_EXPORT
Definition mkcal_export.h:29
Definition extendedstorage.h:42
Definition extendedstorage.h:49
This file is part of the API for handling calendar data and defines the Notebook class.