sqlitestorage.h
Go to the documentation of this file.
1/*
2 This file is part of the mkcal library.
3
4 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
5 Copyright (c) 2014-2019 Jolla Ltd.
6 Copyright (c) 2019 Open Mobile Platform LLC.
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22
23*/
33
34#ifndef MKCAL_SQLITESTORAGE_H
35#define MKCAL_SQLITESTORAGE_H
36
37#include "mkcal_export.h"
38#include "extendedstorage.h"
39
40namespace mKCal {
41
49{
50 Q_OBJECT
51
52public:
53
57 typedef QSharedPointer<SqliteStorage> Ptr;
58
68 explicit SqliteStorage(const ExtendedCalendar::Ptr &cal,
69 const QString &databaseName,
70 bool validateNotebooks = true);
71
81 explicit SqliteStorage(const ExtendedCalendar::Ptr &cal,
82 bool validateNotebooks = true);
83
87 virtual ~SqliteStorage();
88
92 QString databaseName() const;
93
98 bool open();
99
104 bool load();
105
110 bool load(const QString &uid, const QDateTime &recurrenceId = QDateTime());
111
116 bool load(const QDate &date);
117
122 bool load(const QDate &start, const QDate &end);
123
128 bool loadSeries(const QString &uid);
129
134 bool loadIncidenceInstance(const QString &instanceIdentifier);
135
140 bool loadNotebookIncidences(const QString &notebookUid);
141
146 bool loadJournals();
147
152 bool loadPlainIncidences();
153
159
164 bool loadGeoIncidences();
165
170 bool loadGeoIncidences(float geoLatitude, float geoLongitude,
171 float diffLatitude, float diffLongitude);
172
178
184
189 int loadCompletedTodos(bool hasDate, int limit, QDateTime *last);
190
195 int loadIncidences(bool hasDate, int limit, QDateTime *last);
196
201 int loadFutureIncidences(int limit, QDateTime *last);
202
207 int loadGeoIncidences(bool hasDate, int limit, QDateTime *last);
208
213 KCalendarCore::Person::List loadContacts();
214
219 int loadContactIncidences(const KCalendarCore::Person &person, int limit, QDateTime *last);
220
225 int loadJournals(int limit, QDateTime *last);
226
231 bool notifyOpened(const KCalendarCore::Incidence::Ptr &incidence);
232
237 bool purgeDeletedIncidences(const KCalendarCore::Incidence::List &list);
238
243 bool save();
244
249 bool save(ExtendedStorage::DeleteAction deleteAction);
250
255 bool cancel();
256
261 bool close();
262
267 void calendarModified(bool modified, KCalendarCore::Calendar *calendar);
268
273 void calendarIncidenceCreated(const KCalendarCore::Incidence::Ptr &incidence);
274
279 void calendarIncidenceAdded(const KCalendarCore::Incidence::Ptr &incidence);
280
285 void calendarIncidenceChanged(const KCalendarCore::Incidence::Ptr &incidence);
286
291 void calendarIncidenceDeleted(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Calendar *calendar);
292
297 void calendarIncidenceAdditionCanceled(const KCalendarCore::Incidence::Ptr &incidence);
298
303 bool insertedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after,
304 const QString &notebookUid = QString());
305
310 bool modifiedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after,
311 const QString &notebookUid = QString());
312
317 bool deletedIncidences(KCalendarCore::Incidence::List *list,
318 const QDateTime &after = QDateTime(),
319 const QString &notebookUid = QString());
320
325 bool allIncidences(KCalendarCore::Incidence::List *list, const QString &notebookUid = QString());
326
331 bool duplicateIncidences(KCalendarCore::Incidence::List *list,
332 const KCalendarCore::Incidence::Ptr &incidence,
333 const QString &notebookUid = QString());
334
339 QDateTime incidenceDeletedDate(const KCalendarCore::Incidence::Ptr &incidence);
340
345 int eventCount();
346
351 int todoCount();
352
357 int journalCount();
358
363 virtual void virtual_hook(int id, void *data);
364
365protected:
366 bool loadNotebooks();
367 bool modifyNotebook(const Notebook::Ptr &nb, DBOperation dbop);
368
369private:
370 //@cond PRIVATE
371 Q_DISABLE_COPY(SqliteStorage)
372 class MKCAL_HIDE Private;
373 Private *const d;
374 //@endcond
375
376public Q_SLOTS:
377 void fileChanged(const QString &path);
378};
379
380}
381
382#endif
bool validateNotebooks()
Returns true if notebooks should be validated in saves and loads.
Definition extendedstorage.cpp:564
ExtendedStorage(const ExtendedCalendar::Ptr &cal, bool validateNotebooks=true)
Constructs a new ExtendedStorage object.
Definition extendedstorage.cpp:136
DeleteAction
Action to be performed on save for deleted incidences.
Definition extendedstorage.h:80
QSharedPointer< Notebook > Ptr
A shared pointer to a Notebook object.
Definition notebook.h:51
virtual void virtual_hook(int id, void *data)
Definition sqlitestorage.cpp:2023
bool modifyNotebook(const Notebook::Ptr &nb, DBOperation dbop)
Definition sqlitestorage.cpp:1845
bool insertedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1560
void fileChanged(const QString &path)
Definition sqlitestorage.cpp:2000
void calendarIncidenceDeleted(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Calendar *calendar)
Definition sqlitestorage.cpp:1437
bool close()
Definition sqlitestorage.cpp:1369
int eventCount()
Definition sqlitestorage.cpp:1770
QDateTime incidenceDeletedDate(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:1682
bool loadIncidenceInstance(const QString &instanceIdentifier)
Definition sqlitestorage.cpp:522
int loadUncompletedTodos()
Definition sqlitestorage.cpp:730
int loadContactIncidences(const KCalendarCore::Person &person, int limit, QDateTime *last)
Definition sqlitestorage.cpp:1035
bool notifyOpened(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:1079
bool loadGeoIncidences()
Definition sqlitestorage.cpp:640
int loadIncidences(bool hasDate, int limit, QDateTime *last)
Definition sqlitestorage.cpp:862
bool modifiedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1581
bool loadPlainIncidences()
Definition sqlitestorage.cpp:578
int todoCount()
Definition sqlitestorage.cpp:1778
void calendarIncidenceChanged(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:1427
void calendarIncidenceCreated(const KCalendarCore::Incidence::Ptr &incidence)
bool duplicateIncidences(KCalendarCore::Incidence::List *list, const KCalendarCore::Incidence::Ptr &incidence, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1653
bool save()
Definition sqlitestorage.cpp:1226
void calendarIncidenceAdded(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:1394
bool purgeDeletedIncidences(const KCalendarCore::Incidence::List &list)
Definition sqlitestorage.cpp:1189
bool load()
Definition sqlitestorage.cpp:288
bool loadNotebookIncidences(const QString &notebookUid)
Definition sqlitestorage.cpp:489
void calendarIncidenceAdditionCanceled(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:1454
QSharedPointer< SqliteStorage > Ptr
A shared pointer to a SqliteStorage.
Definition sqlitestorage.h:57
bool cancel()
Definition sqlitestorage.cpp:1364
SqliteStorage(const ExtendedCalendar::Ptr &cal, const QString &databaseName, bool validateNotebooks=true)
Constructs a new SqliteStorage object for Calendar calendar with storage to file databaseName.
Definition sqlitestorage.cpp:157
QString databaseName() const
Returns a string containing the name of the calendar database.
Definition sqlitestorage.cpp:208
bool loadNotebooks()
Definition sqlitestorage.cpp:1794
bool loadSeries(const QString &uid)
Definition sqlitestorage.cpp:369
void calendarModified(bool modified, KCalendarCore::Calendar *calendar)
Definition sqlitestorage.cpp:1388
bool loadJournals()
Definition sqlitestorage.cpp:549
bool loadAttendeeIncidences()
Definition sqlitestorage.cpp:702
bool loadRecurringIncidences()
Definition sqlitestorage.cpp:606
bool open()
Definition sqlitestorage.cpp:213
int journalCount()
Definition sqlitestorage.cpp:1786
bool deletedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after=QDateTime(), const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1602
int loadCompletedTodos(bool hasDate, int limit, QDateTime *last)
Definition sqlitestorage.cpp:764
KCalendarCore::Person::List loadContacts()
Definition sqlitestorage.cpp:1020
int loadFutureIncidences(int limit, QDateTime *last)
Definition sqlitestorage.cpp:920
bool allIncidences(KCalendarCore::Incidence::List *list, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1633
This file is part of the API for handling calendar data and defines the ExtendedStorage interface.
#define MKCAL_EXPORT
Definition mkcal_export.h:27
#define MKCAL_HIDE
Definition mkcal_export.h:31
Definition extendedstorage.h:49
DBOperation
Database operation type.
Definition extendedstorage.h:54

Generated on Thu Nov 28 2024 16:34:53 for libextendedkcal by doxygen 1.13.2