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, 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
158 bool loadRecurringIncidences();
159
164 bool loadGeoIncidences();
165
170 bool loadGeoIncidences(float geoLatitude, float geoLongitude,
171 float diffLatitude, float diffLongitude);
172
177 bool loadAttendeeIncidences();
178
183 int loadUncompletedTodos();
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
This class provides a calendar storage interface.
Definition extendedstorage.h:72
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
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: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.12.0