Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
mKCal::SqliteStorage Class Reference

This class provides a calendar storage as an sqlite database. More...

#include <sqlitestorage.h>

Inheritance diagram for mKCal::SqliteStorage:
Inheritance graph
[legend]

Public Types

typedef QSharedPointer< SqliteStoragePtr
 A shared pointer to a SqliteStorage. More...
 
- 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. More...
 

Public Slots

void fileChanged (const QString &path)
 
void queryFinished ()
 

Public Member Functions

 SqliteStorage (const ExtendedCalendar::Ptr &cal, const QString &databaseName, bool validateNotebooks=false)
 Constructs a new SqliteStorage object for Calendar calendar with format format, and storage to file fileName. More...
 
virtual ~SqliteStorage ()
 Destructor. More...
 
QString databaseName () const
 Returns a string containing the name of the calendar database. More...
 
bool open ()
 
bool load ()
 
bool load (const QString &uid, const KDateTime &recurrenceId=KDateTime())
 
bool load (const QDate &date)
 
bool load (const QDate &start, const QDate &end)
 
bool loadSeries (const QString &uid)
 
bool loadNotebookIncidences (const QString &notebookUid)
 
bool loadJournals ()
 
bool loadPlainIncidences ()
 
bool loadRecurringIncidences ()
 
bool loadGeoIncidences ()
 
bool loadGeoIncidences (float geoLatitude, float geoLongitude, float diffLatitude, float diffLongitude)
 
bool loadAttendeeIncidences ()
 
int loadUncompletedTodos ()
 
int loadCompletedTodos (bool hasDate, int limit, KDateTime *last)
 
int loadIncidences (bool hasDate, int limit, KDateTime *last)
 
int loadFutureIncidences (int limit, KDateTime *last)
 
int loadGeoIncidences (bool hasDate, int limit, KDateTime *last)
 
int loadUnreadInvitationIncidences ()
 
int loadOldInvitationIncidences (int limit, KDateTime *last)
 
KCalCore::Person::List loadContacts ()
 
int loadContactIncidences (const KCalCore::Person::Ptr &person, int limit, KDateTime *last)
 
int loadJournals (int limit, KDateTime *last)
 
bool notifyOpened (const KCalCore::Incidence::Ptr &incidence)
 
bool purgeDeletedIncidences (const KCalCore::Incidence::List &list)
 
bool save ()
 
bool save (ExtendedStorage::DeleteAction deleteAction)
 
bool cancel ()
 
bool close ()
 
void calendarModified (bool modified, KCalCore::Calendar *calendar)
 
void calendarIncidenceCreated (const KCalCore::Incidence::Ptr &incidence)
 
void calendarIncidenceAdded (const KCalCore::Incidence::Ptr &incidence)
 
void calendarIncidenceChanged (const KCalCore::Incidence::Ptr &incidence)
 
void calendarIncidenceDeleted (const KCalCore::Incidence::Ptr &incidence)
 
void calendarIncidenceAdditionCanceled (const KCalCore::Incidence::Ptr &incidence)
 
bool insertedIncidences (KCalCore::Incidence::List *list, const KDateTime &after, const QString &notebookUid=QString())
 
bool modifiedIncidences (KCalCore::Incidence::List *list, const KDateTime &after, const QString &notebookUid=QString())
 
bool deletedIncidences (KCalCore::Incidence::List *list, const KDateTime &after, const QString &notebookUid=QString())
 
bool allIncidences (KCalCore::Incidence::List *list, const QString &notebookUid=QString())
 
bool duplicateIncidences (KCalCore::Incidence::List *list, const KCalCore::Incidence::Ptr &incidence, const QString &notebookUid=QString())
 
KDateTime incidenceDeletedDate (const KCalCore::Incidence::Ptr &incidence)
 
int eventCount ()
 
int todoCount ()
 
int journalCount ()
 
virtual void virtual_hook (int id, void *data)
 
sqlite3_int64 toOriginTime (KDateTime dt)
 Convert datetime to seconds relative to the origin. More...
 
sqlite3_int64 toLocalOriginTime (KDateTime dt)
 Convert local datetime to seconds relative to the origin. More...
 
KDateTime fromLocalOriginTime (sqlite3_int64 seconds)
 Convert seconds from the origin to clock time. More...
 
KDateTime fromOriginTime (sqlite3_int64 seconds)
 Convert seconds from the origin to UTC datetime. More...
 
KDateTime fromOriginTime (sqlite3_int64 seconds, QString zonename)
 Convert seconds from the origin to datetime in given timezone. More...
 
- Public Member Functions inherited from mKCal::ExtendedStorage
 ExtendedStorage (const ExtendedCalendar::Ptr &cal, bool validateNotebooks=false)
 Constructs a new ExtendedStorage object. More...
 
virtual ~ExtendedStorage ()
 Destructor. More...
 
void registerObserver (ExtendedStorageObserver *observer)
 Registers an Observer for this Storage. More...
 
void unregisterObserver (ExtendedStorageObserver *observer)
 Unregisters an Observer for this Storage. More...
 
bool addNotebook (const Notebook::Ptr &nb, bool signal=true)
 Add new notebook to the storage. More...
 
bool updateNotebook (const Notebook::Ptr &nb)
 Update notebook parameters. More...
 
bool deleteNotebook (const Notebook::Ptr &nb, bool onlyMemory=false)
 Delete notebook from storage. More...
 
bool setDefaultNotebook (const Notebook::Ptr &nb)
 setDefaultNotebook to the storage. More...
 
Notebook::Ptr defaultNotebook ()
 defaultNotebook. More...
 
Notebook::Ptr notebook (const QString &uid)
 Search for notebook. More...
 
Notebook::Ptr notebook (Notebook::List &list, const QString &uid)
 Search for notebook in a list. More...
 
Notebook::List notebooks ()
 List all notebooks. More...
 
void setValidateNotebooks (bool validateNotebooks)
 Determine if notebooks should be validated in saves and loads. More...
 
bool validateNotebooks ()
 Returns true if notebooks should be validated in saves and loads. More...
 
bool isValidNotebook (const QString &notebookUid)
 Returns true if the given notebook is valid for the storage. More...
 
KCalCore::Incidence::Ptr checkAlarm (const QString &uid, const QString &recurrenceId, bool loadAlways=false)
 Checking if an incidence has active alarms. More...
 
Notebook::Ptr createDefaultNotebook (QString name=QString(), QString color=QString())
 Creates and sets a default notebook. More...
 

Protected Member Functions

bool loadNotebooks ()
 
bool reloadNotebooks ()
 
bool modifyNotebook (const Notebook::Ptr &nb, DBOperation dbop, bool signal=true)
 
- Protected Member Functions inherited from mKCal::ExtendedStorage
bool getLoadDates (const QDate &start, const QDate &end, KDateTime &loadStart, KDateTime &loadEnd)
 
void setLoadDates (const QDate &start, const QDate &end)
 
void setModified (const QString &info)
 
void setProgress (const QString &info)
 
void setFinished (bool error, const QString &info)
 
void clearAlarms (const KCalCore::Incidence::Ptr &incidence)
 
void clearAlarms (const KCalCore::Incidence::List &incidences)
 
void clearAlarms (const QString &nname)
 
void setAlarms (const KCalCore::Incidence::Ptr &incidence)
 
void setAlarms (const KCalCore::Incidence::List &incidences)
 
void resetAlarms (const KCalCore::Incidence::List &incidences)
 
void resetAlarms (const KCalCore::Incidence::Ptr &incidence)
 
bool isUncompletedTodosLoaded ()
 
void setIsUncompletedTodosLoaded (bool loaded)
 
bool isCompletedTodosDateLoaded ()
 
void setIsCompletedTodosDateLoaded (bool loaded)
 
bool isCompletedTodosCreatedLoaded ()
 
void setIsCompletedTodosCreatedLoaded (bool loaded)
 
bool isJournalsLoaded ()
 
void setIsJournalsLoaded (bool loaded)
 
bool isDateLoaded ()
 
void setIsDateLoaded (bool loaded)
 
bool isCreatedLoaded ()
 
void setIsCreatedLoaded (bool loaded)
 
bool isFutureDateLoaded ()
 
void setIsFutureDateLoaded (bool loaded)
 
bool isGeoDateLoaded ()
 
void setIsGeoDateLoaded (bool loaded)
 
bool isGeoCreatedLoaded ()
 
void setIsGeoCreatedLoaded (bool loaded)
 
bool isUnreadIncidencesLoaded ()
 
void setIsUnreadIncidencesLoaded (bool loaded)
 
bool isInvitationIncidencesLoaded ()
 
void setIsInvitationIncidencesLoaded (bool loaded)
 
void clearLoaded ()
 

Detailed Description

This class provides a calendar storage as an sqlite database.

Warning
When saving Attendees, the CustomProperties are not saved.

Member Typedef Documentation

◆ Ptr

typedef QSharedPointer<SqliteStorage> mKCal::SqliteStorage::Ptr

A shared pointer to a SqliteStorage.

Constructor & Destructor Documentation

◆ SqliteStorage()

SqliteStorage::SqliteStorage ( const ExtendedCalendar::Ptr &  cal,
const QString &  databaseName,
bool  validateNotebooks = false 
)
explicit

Constructs a new SqliteStorage object for Calendar calendar with format format, and storage to file fileName.

Private class that helps to provide binary compatibility between releases.

Parameters
calendaris a pointer to a valid Calendar object.
databaseNameis the name of the database containing the Calendar data.
validateNotebooksset to true for saving only those incidences that belong to an existing notebook of this storage

◆ ~SqliteStorage()

SqliteStorage::~SqliteStorage ( )
virtual

Destructor.

Member Function Documentation

◆ allIncidences()

bool SqliteStorage::allIncidences ( KCalCore::Incidence::List *  list,
const QString &  notebookUid = QString() 
)
virtual

◆ calendarIncidenceAdded()

void SqliteStorage::calendarIncidenceAdded ( const KCalCore::Incidence::Ptr &  incidence)
virtual

Calendar::CalendarObserver::calendarIncidenceAdded()

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceAdditionCanceled()

void SqliteStorage::calendarIncidenceAdditionCanceled ( const KCalCore::Incidence::Ptr &  incidence)
virtual

Calendar::CalendarObserver::calendarIncidenceAdditionCanceled()

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceChanged()

void SqliteStorage::calendarIncidenceChanged ( const KCalCore::Incidence::Ptr &  incidence)
virtual

Calendar::CalendarObserver::calendarIncidenceChanged()

Implements mKCal::ExtendedStorage.

◆ calendarIncidenceCreated()

void mKCal::SqliteStorage::calendarIncidenceCreated ( const KCalCore::Incidence::Ptr &  incidence)

Calendar::CalendarObserver::calendarIncidenceCreated()

◆ calendarIncidenceDeleted()

void SqliteStorage::calendarIncidenceDeleted ( const KCalCore::Incidence::Ptr &  incidence)
virtual

Calendar::CalendarObserver::calendarIncidenceDeleted()

Implements mKCal::ExtendedStorage.

◆ calendarModified()

void SqliteStorage::calendarModified ( bool  modified,
KCalCore::Calendar *  calendar 
)
virtual

Calendar::CalendarObserver::calendarModified()

Implements mKCal::ExtendedStorage.

◆ cancel()

bool SqliteStorage::cancel ( )
virtual

◆ close()

bool SqliteStorage::close ( )
virtual

CalStorage::close()

Implements mKCal::ExtendedStorage.

◆ databaseName()

QString SqliteStorage::databaseName ( ) const

Returns a string containing the name of the calendar database.

◆ deletedIncidences()

bool SqliteStorage::deletedIncidences ( KCalCore::Incidence::List *  list,
const KDateTime &  after,
const QString &  notebookUid = QString() 
)
virtual

◆ duplicateIncidences()

bool SqliteStorage::duplicateIncidences ( KCalCore::Incidence::List *  list,
const KCalCore::Incidence::Ptr &  incidence,
const QString &  notebookUid = QString() 
)
virtual

◆ eventCount()

int SqliteStorage::eventCount ( )
virtual

◆ fileChanged

void SqliteStorage::fileChanged ( const QString &  path)
slot

◆ fromLocalOriginTime()

KDateTime SqliteStorage::fromLocalOriginTime ( sqlite3_int64  seconds)

Convert seconds from the origin to clock time.

Parameters
secondsrelative to origin.
Returns
clocktime datetime.

◆ fromOriginTime() [1/2]

KDateTime SqliteStorage::fromOriginTime ( sqlite3_int64  seconds)

Convert seconds from the origin to UTC datetime.

Parameters
secondsrelative to origin.
Returns
UTC datetime.

◆ fromOriginTime() [2/2]

KDateTime SqliteStorage::fromOriginTime ( sqlite3_int64  seconds,
QString  zonename 
)

Convert seconds from the origin to datetime in given timezone.

Parameters
secondsrelative to origin.
zonenametimezone name.
Returns
datetime in timezone.

◆ incidenceDeletedDate()

KDateTime SqliteStorage::incidenceDeletedDate ( const KCalCore::Incidence::Ptr &  incidence)
virtual

◆ insertedIncidences()

bool SqliteStorage::insertedIncidences ( KCalCore::Incidence::List *  list,
const KDateTime &  after,
const QString &  notebookUid = QString() 
)
virtual

◆ journalCount()

int SqliteStorage::journalCount ( )
virtual

◆ load() [1/4]

bool SqliteStorage::load ( )
virtual

CalStorage::load()

Implements mKCal::ExtendedStorage.

◆ load() [2/4]

bool SqliteStorage::load ( const QDate &  date)
virtual

◆ load() [3/4]

bool SqliteStorage::load ( const QDate &  start,
const QDate &  end 
)
virtual

◆ load() [4/4]

bool SqliteStorage::load ( const QString &  uid,
const KDateTime &  recurrenceId = KDateTime() 
)
virtual

◆ loadAttendeeIncidences()

bool SqliteStorage::loadAttendeeIncidences ( )
virtual

◆ loadCompletedTodos()

int SqliteStorage::loadCompletedTodos ( bool  hasDate,
int  limit,
KDateTime *  last 
)
virtual

◆ loadContactIncidences()

int SqliteStorage::loadContactIncidences ( const KCalCore::Person::Ptr &  person,
int  limit,
KDateTime *  last 
)
virtual

ExtendedStorage::loadContactIncidences( const KCalCore::Person::Ptr & )

Implements mKCal::ExtendedStorage.

◆ loadContacts()

Person::List SqliteStorage::loadContacts ( )
virtual

◆ loadFutureIncidences()

int SqliteStorage::loadFutureIncidences ( int  limit,
KDateTime *  last 
)
virtual

ExtendedStorage::loadFutureIncidences( bool, int, KDateTime* );

Implements mKCal::ExtendedStorage.

◆ loadGeoIncidences() [1/3]

bool SqliteStorage::loadGeoIncidences ( )
virtual

◆ loadGeoIncidences() [2/3]

int SqliteStorage::loadGeoIncidences ( bool  hasDate,
int  limit,
KDateTime *  last 
)
virtual

ExtendedStorage::loadGeoIncidences( bool, bool, int, KDateTime* );

Implements mKCal::ExtendedStorage.

◆ loadGeoIncidences() [3/3]

bool SqliteStorage::loadGeoIncidences ( float  geoLatitude,
float  geoLongitude,
float  diffLatitude,
float  diffLongitude 
)
virtual

◆ loadIncidences()

int SqliteStorage::loadIncidences ( bool  hasDate,
int  limit,
KDateTime *  last 
)
virtual

ExtendedStorage::loadIncidences( bool, bool, int, KDateTime* );

Implements mKCal::ExtendedStorage.

◆ loadJournals() [1/2]

bool SqliteStorage::loadJournals ( )
virtual

◆ loadJournals() [2/2]

int SqliteStorage::loadJournals ( int  limit,
KDateTime *  last 
)
virtual

◆ loadNotebookIncidences()

bool SqliteStorage::loadNotebookIncidences ( const QString &  notebookUid)
virtual

◆ loadNotebooks()

bool SqliteStorage::loadNotebooks ( )
protectedvirtual

◆ loadOldInvitationIncidences()

int SqliteStorage::loadOldInvitationIncidences ( int  limit,
KDateTime *  last 
)
virtual

ExtendedStorage::loadInvitationIncidences()

Implements mKCal::ExtendedStorage.

◆ loadPlainIncidences()

bool SqliteStorage::loadPlainIncidences ( )
virtual

◆ loadRecurringIncidences()

bool SqliteStorage::loadRecurringIncidences ( )
virtual

◆ loadSeries()

bool SqliteStorage::loadSeries ( const QString &  uid)
virtual

◆ loadUncompletedTodos()

int SqliteStorage::loadUncompletedTodos ( )
virtual

◆ loadUnreadInvitationIncidences()

int SqliteStorage::loadUnreadInvitationIncidences ( )
virtual

◆ modifiedIncidences()

bool SqliteStorage::modifiedIncidences ( KCalCore::Incidence::List *  list,
const KDateTime &  after,
const QString &  notebookUid = QString() 
)
virtual

◆ modifyNotebook()

bool SqliteStorage::modifyNotebook ( const Notebook::Ptr nb,
DBOperation  dbop,
bool  signal = true 
)
protectedvirtual

◆ notifyOpened()

bool SqliteStorage::notifyOpened ( const KCalCore::Incidence::Ptr &  incidence)
virtual

◆ open()

bool SqliteStorage::open ( )
virtual

CalStorage::open()

Implements mKCal::ExtendedStorage.

◆ purgeDeletedIncidences()

bool SqliteStorage::purgeDeletedIncidences ( const KCalCore::Incidence::List &  list)
virtual

◆ queryFinished

void SqliteStorage::queryFinished ( )
slot

◆ reloadNotebooks()

bool SqliteStorage::reloadNotebooks ( )
protectedvirtual

◆ save() [1/2]

bool SqliteStorage::save ( )
virtual

CalStorage::save()

Implements mKCal::ExtendedStorage.

◆ save() [2/2]

bool SqliteStorage::save ( ExtendedStorage::DeleteAction  deleteAction)
virtual

◆ todoCount()

int SqliteStorage::todoCount ( )
virtual

◆ toLocalOriginTime()

sqlite3_int64 SqliteStorage::toLocalOriginTime ( KDateTime  dt)

Convert local datetime to seconds relative to the origin.

Parameters
dtdatetime
Returns
seconds relative to origin

◆ toOriginTime()

sqlite3_int64 SqliteStorage::toOriginTime ( KDateTime  dt)

Convert datetime to seconds relative to the origin.

Parameters
dtdatetime
Returns
seconds relative to origin

◆ virtual_hook()

void SqliteStorage::virtual_hook ( int  id,
void *  data 
)
virtual

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

Generated on Sat Oct 17 2020 06:54:57 for libextendedkcal by doxygen 1.8.17