31#ifndef MKCAL_EXTENDEDSTORAGE_H
32#define MKCAL_EXTENDEDSTORAGE_H
39#include <KCalendarCore/CalStorage>
40#include <KCalendarCore/Calendar>
62#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
63 : public QObject, public
KCalendarCore::Calendar::CalendarObserver
83 typedef QSharedPointer<ExtendedStorage>
Ptr;
107#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
112 ExtendedCalendar::Ptr
calendar()
const;
133 virtual bool load(
const QString &uid) = 0;
159 bool load(
const QString &uid,
const QDateTime &recurrenceId);
174 virtual bool load(
const QDate &date);
185 virtual bool load(
const QDate &start,
const QDate &end) = 0;
217 const QString &
notebook = QString()) = 0;
240 virtual bool close();
289 const QDateTime &after = QDateTime(),
290 const QString ¬ebookUid = QString()) = 0;
303 const QDateTime &after = QDateTime(),
304 const QString ¬ebookUid = QString()) = 0;
315 const QDateTime &after = QDateTime(),
316 const QString ¬ebookUid = QString()) = 0;
326 const QString ¬ebookUid = QString()) = 0;
349 virtual bool search(
const QString &key, QStringList *identifiers,
int limit = 0) = 0;
483 QString color = QString());
501 QDateTime *loadStart, QDateTime *loadEnd)
const;
510 const KCalendarCore::Incidence::List &modified,
511 const KCalendarCore::Incidence::List &deleted);
520 friend class ::MkcalTool;
521 friend class ::tst_load;
QSharedPointer< ExtendedStorage > Ptr
A shared pointer to a ExtendedStorage.
Definition extendedstorage.h:83
void addLoadedRange(const QDate &start, const QDate &end) const
Definition extendedstorage.cpp:230
bool deleteNotebook(const Notebook::Ptr &nb)
Delete notebook from storage.
Definition extendedstorage.cpp:437
Notebook::Ptr createDefaultNotebook(QString name=QString(), QString color=QString())
Creates and sets a default notebook.
Definition extendedstorage.cpp:551
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:189
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:523
void emitStorageModified(const QString &info)
Definition extendedstorage.cpp:349
virtual bool loadIncidenceInstance(const QString &instanceIdentifier)
Load the incidence matching the given identifier.
Definition extendedstorage.cpp:281
void unregisterObserver(ExtendedStorageObserver *observer)
Unregisters an Observer for this Storage.
Definition extendedstorage.cpp:344
bool setDefaultNotebook(const Notebook::Ptr &nb)
setDefaultNotebook to the storage.
Definition extendedstorage.cpp:491
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:528
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:165
void setIsRecurrenceLoaded(bool loaded)
Definition extendedstorage.cpp:262
bool isRecurrenceLoaded() const
Definition extendedstorage.cpp:257
virtual void calendarModified(bool modified, KCalendarCore::Calendar *calendar)=0
ExtendedCalendar::Ptr calendar() const
Definition extendedstorage.cpp:183
bool addNotebook(const Notebook::Ptr &nb)
Add new notebook to the storage.
Definition extendedstorage.cpp:391
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:337
bool isValidNotebook(const QString ¬ebookUid) const
Returns true if the given notebook is valid for the storage.
Definition extendedstorage.cpp:533
virtual bool loadNotebooks()=0
DeleteAction
Action to be performed on save for deleted incidences.
Definition extendedstorage.h:75
@ MarkDeleted
Definition extendedstorage.h:76
@ PurgeDeleted
Definition extendedstorage.h:77
bool getLoadDates(const QDate &start, const QDate &end, QDateTime *loadStart, QDateTime *loadEnd) const
Definition extendedstorage.cpp:194
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:513
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:410
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:267
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:518
void emitStorageUpdated(const KCalendarCore::Incidence::List &added, const KCalendarCore::Incidence::List &modified, const KCalendarCore::Incidence::List &deleted)
Definition extendedstorage.cpp:375
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:368
virtual bool insertNotebook(const Notebook::Ptr &nb)=0
Notebook::Ptr defaultNotebook()
defaultNotebook.
Definition extendedstorage.cpp:508
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.