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*/
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
This class provides a calendar storage interface.
Definition extendedstorage.h:63
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
This class provides a calendar storage as an sqlite database.
Definition sqlitestorage.h:49
void calendarIncidenceCreated(const KCalendarCore::Incidence::Ptr &incidence)
QSharedPointer< SqliteStorage > Ptr
A shared pointer to a SqliteStorage.
Definition sqlitestorage.h:57
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 Thu Nov 28 2024 09:02:24 for libextendedkcal by doxygen 1.12.0