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);
111
116 bool load(const QDate &start, const QDate &end);
117
122 bool loadNotebookIncidences(const QString &notebookUid);
123
128 bool purgeDeletedIncidences(const KCalendarCore::Incidence::List &list,
129 const QString &notebookUid = QString());
130
135 bool save();
136
141 bool save(ExtendedStorage::DeleteAction deleteAction);
142
147 bool close();
148
153 void calendarModified(bool modified, KCalendarCore::Calendar *calendar);
154
159 void calendarIncidenceCreated(const KCalendarCore::Incidence::Ptr &incidence);
160
165 void calendarIncidenceAdded(const KCalendarCore::Incidence::Ptr &incidence);
166
171 void calendarIncidenceChanged(const KCalendarCore::Incidence::Ptr &incidence);
172
177 void calendarIncidenceDeleted(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Calendar *calendar);
178
183 void calendarIncidenceAdditionCanceled(const KCalendarCore::Incidence::Ptr &incidence);
184
189 bool insertedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after,
190 const QString &notebookUid = QString());
191
196 bool modifiedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after,
197 const QString &notebookUid = QString());
198
203 bool deletedIncidences(KCalendarCore::Incidence::List *list,
204 const QDateTime &after = QDateTime(),
205 const QString &notebookUid = QString());
206
211 bool allIncidences(KCalendarCore::Incidence::List *list, const QString &notebookUid = QString());
212
217 bool search(const QString &key, QStringList *identifiers, int limit = 0);
218
223 QDateTime incidenceDeletedDate(const KCalendarCore::Incidence::Ptr &incidence);
224
229 virtual void virtual_hook(int id, void *data);
230
231protected:
232 bool loadNotebooks();
233 bool insertNotebook(const Notebook::Ptr &nb);
234 bool modifyNotebook(const Notebook::Ptr &nb);
235 bool eraseNotebook(const Notebook::Ptr &nb);
236
237private:
238 //@cond PRIVATE
239 Q_DISABLE_COPY(SqliteStorage)
240 class Private;
241 Private *const d;
242 //@endcond
243
244public Q_SLOTS:
245 void fileChanged(const QString &path);
246};
247
248}
249
250#endif
bool validateNotebooks() const
Returns true if notebooks should be validated in saves and loads.
Definition extendedstorage.cpp:513
ExtendedStorage(const ExtendedCalendar::Ptr &cal, bool validateNotebooks=true)
Constructs a new ExtendedStorage object.
Definition extendedstorage.cpp:157
ExtendedCalendar::Ptr calendar() const
Definition extendedstorage.cpp:169
DeleteAction
Action to be performed on save for deleted incidences.
Definition extendedstorage.h:71
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:1336
bool insertedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:915
bool purgeDeletedIncidences(const KCalendarCore::Incidence::List &list, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:678
void fileChanged(const QString &path)
Definition sqlitestorage.cpp:1316
void calendarIncidenceDeleted(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Calendar *calendar)
Definition sqlitestorage.cpp:890
bool close()
Definition sqlitestorage.cpp:838
QDateTime incidenceDeletedDate(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:1129
bool search(const QString &key, QStringList *identifiers, int limit=0)
Definition sqlitestorage.cpp:525
bool modifyNotebook(const Notebook::Ptr &nb)
Definition sqlitestorage.cpp:1239
bool modifiedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:966
void calendarIncidenceChanged(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:879
void calendarIncidenceCreated(const KCalendarCore::Incidence::Ptr &incidence)
bool save()
Definition sqlitestorage.cpp:720
void calendarIncidenceAdded(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:863
bool load()
Definition sqlitestorage.cpp:310
bool loadNotebookIncidences(const QString &notebookUid)
Definition sqlitestorage.cpp:458
void calendarIncidenceAdditionCanceled(const KCalendarCore::Incidence::Ptr &incidence)
Definition sqlitestorage.cpp:906
QSharedPointer< SqliteStorage > Ptr
A shared pointer to a SqliteStorage.
Definition sqlitestorage.h:57
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:150
QString databaseName() const
Returns a string containing the name of the calendar database.
Definition sqlitestorage.cpp:205
bool loadNotebooks()
Definition sqlitestorage.cpp:1183
void calendarModified(bool modified, KCalendarCore::Calendar *calendar)
Definition sqlitestorage.cpp:857
bool insertNotebook(const Notebook::Ptr &nb)
Definition sqlitestorage.cpp:1234
bool eraseNotebook(const Notebook::Ptr &nb)
Definition sqlitestorage.cpp:1244
bool open()
Definition sqlitestorage.cpp:210
bool deletedIncidences(KCalendarCore::Incidence::List *list, const QDateTime &after=QDateTime(), const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1018
bool allIncidences(KCalendarCore::Incidence::List *list, const QString &notebookUid=QString())
Definition sqlitestorage.cpp:1082
This file is part of the API for handling calendar data and defines the ExtendedStorage interface.
#define MKCAL_EXPORT
Definition mkcal_export.h:29
Definition extendedstorage.h:49

Generated on for libextendedkcal by doxygen 1.16.1