DummyStorage Class Reference

This module provides a simple storage abstraction which contains exactly nothing. More...

#include <dummystorage.h>

Inheritance diagram for DummyStorage:

Public Member Functions

 DummyStorage (const mKCal::ExtendedCalendar::Ptr &cal)
 
void calendarModified (bool, KCalendarCore::Calendar *)
 
void calendarIncidenceAdded (const KCalendarCore::Incidence::Ptr &)
 
void calendarIncidenceChanged (const KCalendarCore::Incidence::Ptr &)
 
void calendarIncidenceDeleted (const KCalendarCore::Incidence::Ptr &, const KCalendarCore::Calendar *)
 
void calendarIncidenceAdditionCanceled (const KCalendarCore::Incidence::Ptr &)
 
bool open ()
 
bool load ()
 
bool save ()
 
bool save (DeleteAction)
 This is an overload of save() method.
 
bool close ()
 
bool load (const QString &)
 Load all incidences sharing the same uid into the memory.
 
bool load (const QDate &, const QDate &)
 Load incidences between given dates into the memory.
 
bool loadNotebookIncidences (const QString &)
 Load incidences of one notebook into the memory.
 
bool purgeDeletedIncidences (const KCalendarCore::Incidence::List &, const QString &)
 Remove from storage all incidences that have been previously marked as deleted and that matches the UID / RecID of the incidences in list.
 
bool insertedIncidences (KCalendarCore::Incidence::List *, const QDateTime &, const QString &)
 Get inserted incidences from storage.
 
bool modifiedIncidences (KCalendarCore::Incidence::List *, const QDateTime &, const QString &)
 Get modified incidences from storage.
 
bool deletedIncidences (KCalendarCore::Incidence::List *, const QDateTime &, const QString &)
 Get deleted incidences from storage.
 
bool allIncidences (KCalendarCore::Incidence::List *, const QString &)
 Get all incidences from storage.
 
bool search (const QString &, QStringList *, int)
 Get all incidences from storage that match key.
 
bool loadNotebooks ()
 
bool insertNotebook (const mKCal::Notebook::Ptr &)
 
bool modifyNotebook (const mKCal::Notebook::Ptr &)
 
bool eraseNotebook (const mKCal::Notebook::Ptr &)
 
QDateTime incidenceDeletedDate (const KCalendarCore::Incidence::Ptr &)
 Get deletion time of incidence.
 
void virtual_hook (int, void *)
 Standard trick to add virtuals later.
 
- Public Member Functions inherited from mKCal::ExtendedStorage
 ExtendedStorage (const ExtendedCalendar::Ptr &cal, bool validateNotebooks=true)
 Constructs a new ExtendedStorage object.
 
virtual ~ExtendedStorage ()
 Destructor.
 
bool loadSeries (const QString &uid)
 Load all incidences sharing the same uid into the memory.
 
bool load (const QString &uid, const QDateTime &recurrenceId)
 Load incidence by uid/recid into the memory.
 
virtual bool load (const QDate &date)
 Load incidences at given date into the memory.
 
virtual bool loadIncidenceInstance (const QString &instanceIdentifier)
 Load the incidence matching the given identifier.
 
void registerObserver (ExtendedStorageObserver *observer)
 Registers an Observer for this Storage.
 
void unregisterObserver (ExtendedStorageObserver *observer)
 Unregisters an Observer for this Storage.
 
bool addNotebook (const Notebook::Ptr &nb)
 Add new notebook to the storage.
 
bool updateNotebook (const Notebook::Ptr &nb)
 Update notebook parameters.
 
bool deleteNotebook (const Notebook::Ptr &nb)
 Delete notebook from storage.
 
bool setDefaultNotebook (const Notebook::Ptr &nb)
 setDefaultNotebook to the storage.
 
Notebook::Ptr defaultNotebook ()
 defaultNotebook.
 
Notebook::Ptr notebook (const QString &uid) const
 Search for notebook.
 
Notebook::List notebooks ()
 List all notebooks.
 
void setValidateNotebooks (bool validateNotebooks)
 Determine if notebooks should be validated in saves and loads.
 
bool validateNotebooks () const
 Returns true if notebooks should be validated in saves and loads.
 
bool isValidNotebook (const QString &notebookUid) const
 Returns true if the given notebook is valid for the storage.
 
Notebook::Ptr createDefaultNotebook (QString name=QString(), QString color=QString())
 Creates and sets a default notebook.
 

Additional Inherited Members

- Public Types inherited from mKCal::ExtendedStorage
enum  DeleteAction { MarkDeleted , PurgeDeleted }
 Action to be performed on save for deleted incidences. More...
 
typedef QSharedPointer< ExtendedStoragePtr
 A shared pointer to a ExtendedStorage.
 
- Protected Member Functions inherited from mKCal::ExtendedStorage
bool getLoadDates (const QDate &start, const QDate &end, QDateTime *loadStart, QDateTime *loadEnd) const
 
void addLoadedRange (const QDate &start, const QDate &end) const
 
bool isRecurrenceLoaded () const
 
void setIsRecurrenceLoaded (bool loaded)
 
void emitStorageModified (const QString &info)
 
void emitStorageFinished (bool error, const QString &info)
 
void emitStorageUpdated (const KCalendarCore::Incidence::List &added, const KCalendarCore::Incidence::List &modified, const KCalendarCore::Incidence::List &deleted)
 

Detailed Description

This module provides a simple storage abstraction which contains exactly nothing.

It is only inteded to use for testing purposes

Constructor & Destructor Documentation

◆ DummyStorage()

DummyStorage::DummyStorage ( const mKCal::ExtendedCalendar::Ptr & cal)
inline

Member Function Documentation

◆ allIncidences()

bool DummyStorage::allIncidences ( KCalendarCore::Incidence::List * list,
const QString & notebookUid )
inlinevirtual

Get all incidences from storage.

Parameters
listnotebook's incidences
notebookUidlist incidences for given notebook
Returns
true if execution was scheduled; false otherwise

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceAdded()

void DummyStorage::calendarIncidenceAdded ( const KCalendarCore::Incidence::Ptr & incidence)
inlinevirtual

Calendar::CalendarObserver::calendarIncidenceAdded()

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceAdditionCanceled()

void DummyStorage::calendarIncidenceAdditionCanceled ( const KCalendarCore::Incidence::Ptr & incidence)
inlinevirtual

Calendar::CalendarObserver::calendarIncidenceAdditionCanceled()

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceChanged()

void DummyStorage::calendarIncidenceChanged ( const KCalendarCore::Incidence::Ptr & incidence)
inlinevirtual

Calendar::CalendarObserver::calendarIncidenceChanged()

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceDeleted()

void DummyStorage::calendarIncidenceDeleted ( const KCalendarCore::Incidence::Ptr & incidence,
const KCalendarCore::Calendar * calendar )
inlinevirtual

Calendar::CalendarObserver::calendarIncidenceDeleted()

Implements mKCal::ExtendedStorage.

◆ calendarModified()

void DummyStorage::calendarModified ( bool modified,
KCalendarCore::Calendar * calendar )
inlinevirtual

Calendar::CalendarObserver::calendarModified()

Implements mKCal::ExtendedStorage.

◆ close()

bool DummyStorage::close ( )
inlinevirtual

CalStorage::close()

Reimplemented from mKCal::ExtendedStorage.

◆ deletedIncidences()

bool DummyStorage::deletedIncidences ( KCalendarCore::Incidence::List * list,
const QDateTime & after,
const QString & notebookUid )
inlinevirtual

Get deleted incidences from storage.

Parameters
listdeleted incidences
afterlist only incidences deleted after or at given datetime
notebookUidlist only incidences for given notebook
Returns
true if execution was scheduled; false otherwise

Implements mKCal::ExtendedStorage.

◆ eraseNotebook()

bool DummyStorage::eraseNotebook ( const mKCal::Notebook::Ptr & )
inlinevirtual

◆ incidenceDeletedDate()

QDateTime DummyStorage::incidenceDeletedDate ( const KCalendarCore::Incidence::Ptr & incidence)
inlinevirtual

Get deletion time of incidence.

Parameters
incidenceincidence to check
Returns
valid deletion time of incidence in UTC if incidence has been deleted otherwise QDateTime()

Implements mKCal::ExtendedStorage.

◆ insertedIncidences()

bool DummyStorage::insertedIncidences ( KCalendarCore::Incidence::List * list,
const QDateTime & after,
const QString & notebookUid )
inlinevirtual

Get inserted incidences from storage.

NOTE: time stamps assigned by KCalExtended are created during save(). To obtain a time stamp that is guaranteed to not included recent changes, sleep for a second or increment the current time by a second.

Parameters
listinserted incidences
afterlist only incidences inserted after or at given datetime
notebookUidlist only incidences for given notebook
Returns
true if execution was scheduled; false otherwise

Implements mKCal::ExtendedStorage.

◆ insertNotebook()

bool DummyStorage::insertNotebook ( const mKCal::Notebook::Ptr & )
inlinevirtual

◆ load() [1/3]

bool DummyStorage::load ( )
inlinevirtual

CalStorage::load()

Implements mKCal::ExtendedStorage.

◆ load() [2/3]

bool DummyStorage::load ( const QDate & start,
const QDate & end )
inlinevirtual

Load incidences between given dates into the memory.

start is inclusive, while end is exclusive. The same definitions and restrictions for loading apply as for load(const QDate &) method.

Parameters
startis the starting date
endis the ending date, exclusive
Returns
true if the load was successful; false otherwise.

Implements mKCal::ExtendedStorage.

◆ load() [3/3]

bool DummyStorage::load ( const QString & uid)
inlinevirtual

Load all incidences sharing the same uid into the memory.

Parameters
uidis uid of the series
Returns
true if the load was successful; false otherwise.

Implements mKCal::ExtendedStorage.

◆ loadNotebookIncidences()

bool DummyStorage::loadNotebookIncidences ( const QString & notebookUid)
inlinevirtual

Load incidences of one notebook into the memory.

Parameters
notebookUidis uid of notebook
Returns
true if the load was successful; false otherwise.

Implements mKCal::ExtendedStorage.

◆ loadNotebooks()

bool DummyStorage::loadNotebooks ( )
inlinevirtual

◆ modifiedIncidences()

bool DummyStorage::modifiedIncidences ( KCalendarCore::Incidence::List * list,
const QDateTime & after,
const QString & notebookUid )
inlinevirtual

Get modified incidences from storage.

NOTE: if an incidence is both created and modified after the given time, it will be returned in insertedIncidences only, not here!

Parameters
listmodified incidences
afterlist only incidences modified after or at given datetime
notebookUidlist only incidences for given notebook
Returns
true if execution was scheduled; false otherwise

Implements mKCal::ExtendedStorage.

◆ modifyNotebook()

bool DummyStorage::modifyNotebook ( const mKCal::Notebook::Ptr & )
inlinevirtual

◆ open()

bool DummyStorage::open ( )
inlinevirtual

CalStorage::open()

Implements mKCal::ExtendedStorage.

◆ purgeDeletedIncidences()

bool DummyStorage::purgeDeletedIncidences ( const KCalendarCore::Incidence::List & list,
const QString & notebook )
inlinevirtual

Remove from storage all incidences that have been previously marked as deleted and that matches the UID / RecID of the incidences in list.

The action is performed immediately on database.

Parameters
listis the incidences to remove from the DB
notebookis the notebook they belong to, using an empty notebook uid is deprecated, but kept for backward backward compatibility.
Returns
True on success, false otherwise.

Implements mKCal::ExtendedStorage.

◆ save() [1/2]

bool DummyStorage::save ( )
inlinevirtual

CalStorage::save()

Implements mKCal::ExtendedStorage.

◆ save() [2/2]

bool DummyStorage::save ( DeleteAction deleteAction)
inlinevirtual

This is an overload of save() method.

When @deleteAction is PurgeDeleted, the deleted incidences are not marked as deleted but completely removed from the database and won't appear anymore when calling deletedIncidences().

Parameters
deleteActionthe action to apply to deleted incidences
Returns
True if successful; false otherwise

Implements mKCal::ExtendedStorage.

◆ search()

bool DummyStorage::search ( const QString & key,
QStringList * identifiers,
int limit )
inlinevirtual

Get all incidences from storage that match key.

Incidences are loaded into the associated ExtendedCalendar. More incidences than the listed ones in

Parameters
identifiersmay be loaded into memory to ensure calendar consistency with respect to exceptions of recurring incidences.

Matching is done on summary, description and location fields.

The matching incidences are sorted by start dates before applying the

Parameters
limit.Since recurring incidences have occurrences later than their start date, they are not taken into account when counting the limit and all matching recurring events are always loaded.
keycan be any substring from the summary, the description or the location.
identifiersoptional, stores the instance identifiers of matching incidences.
limitthe maximum number of non-recurring incidences, unlimited by default
Returns
true on success.

Implements mKCal::ExtendedStorage.

◆ virtual_hook()

void DummyStorage::virtual_hook ( int id,
void * data )
inlinevirtual

Standard trick to add virtuals later.

Parameters
idis any integer unique to this class which we will use to identify the method to be called.
datais a pointer to some glob of data, typically a struct.

Implements mKCal::ExtendedStorage.


The documentation for this class was generated from the following file:

Generated on Thu Nov 28 2024 09:02:24 for libextendedkcal by doxygen 1.12.0