1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtOrganizer module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#ifndef QORGANIZERMANAGER_H
43
#define QORGANIZERMANAGER_H
45
#include <qorganizercollection.h>
46
#include <qorganizeritem.h>
47
#include <qorganizeritemfilter.h>
48
#include <qorganizeritemfetchhint.h>
49
#include <qorganizeritemsortorder.h>
51
#include <QtCore/qdatetime.h>
52
#include <QtCore/qstringlist.h>
54
QT_BEGIN_NAMESPACE_ORGANIZER
56
class QOrganizerManagerData;
58
class Q_ORGANIZER_EXPORT QOrganizerManager : public QObject
63
#if Q_QDOC // qdoc's parser fails to recognise the default map argument
64
explicit QOrganizerManager(const QString &managerName, const QMap<QString, QString> ¶meters = 0, QObject *parent = 0);
66
explicit QOrganizerManager(const QString &managerName, const QMap<QString, QString> ¶meters = (QMap<QString, QString>()), QObject *parent = 0);
68
explicit QOrganizerManager(QObject *parent = 0);
71
static QOrganizerManager *fromUri(const QString &uri, QObject *parent = 0);
72
static QStringList availableManagers();
74
QString managerName() const;
75
QMap<QString, QString> managerParameters() const;
76
int managerVersion() const;
77
QString managerUri() const;
79
static bool parseUri(const QString &uri, QString *managerName, QMap<QString, QString> *params);
80
static QString buildUri(const QString &managerName, const QMap<QString, QString> ¶ms);
97
InvalidCollectionError,
98
InvalidOccurrenceError,
108
/* Error reporting */
109
QOrganizerManager::Error error() const;
110
QMap<int, QOrganizerManager::Error> errorMap() const;
113
QOrganizerItem item(const QOrganizerItemId &itemId, const QOrganizerItemFetchHint &fetchHint = QOrganizerItemFetchHint());
115
QList<QOrganizerItem> items(const QList<QOrganizerItemId> &itemIds, const QOrganizerItemFetchHint &fetchHint = QOrganizerItemFetchHint());
117
QList<QOrganizerItem> items(const QDateTime &startDateTime = QDateTime(), const QDateTime &endDateTime = QDateTime(),
118
const QOrganizerItemFilter &filter = QOrganizerItemFilter(), int maxCount = -1,
119
const QList<QOrganizerItemSortOrder> &sortOrders = QList<QOrganizerItemSortOrder>(),
120
const QOrganizerItemFetchHint &fetchHint = QOrganizerItemFetchHint());
122
QList<QOrganizerItemId> itemIds(const QDateTime &startDateTime = QDateTime(), const QDateTime &endDateTime = QDateTime(),
123
const QOrganizerItemFilter &filter = QOrganizerItemFilter(),
124
const QList<QOrganizerItemSortOrder> &sortOrders = QList<QOrganizerItemSortOrder>());
126
QList<QOrganizerItem> itemOccurrences(const QOrganizerItem &parentItem, const QDateTime &startDateTime = QDateTime(),
127
const QDateTime &endDateTime = QDateTime(), int maxCount = -1,
128
const QOrganizerItemFetchHint &fetchHint = QOrganizerItemFetchHint());
130
QList<QOrganizerItem> itemsForExport(const QDateTime &startDateTime = QDateTime(), const QDateTime &endDateTime = QDateTime(),
131
const QOrganizerItemFilter &filter = QOrganizerItemFilter(),
132
const QList<QOrganizerItemSortOrder> &sortOrders = QList<QOrganizerItemSortOrder>(),
133
const QOrganizerItemFetchHint &fetchHint = QOrganizerItemFetchHint());
135
bool saveItem(QOrganizerItem *item, const QList<QOrganizerItemDetail::DetailType> &detailMask = QList<QOrganizerItemDetail::DetailType>());
137
bool saveItems(QList<QOrganizerItem> *items,
138
const QList<QOrganizerItemDetail::DetailType> &detailMask = QList<QOrganizerItemDetail::DetailType>());
140
bool removeItem(const QOrganizerItemId &itemId);
142
bool removeItem(const QOrganizerItem *item);
144
bool removeItems(const QList<QOrganizerItemId>& itemIds);
146
bool removeItems(const QList<QOrganizerItem> *items);
149
QOrganizerCollection defaultCollection();
150
QOrganizerCollection collection(const QOrganizerCollectionId& collectionId);
151
QList<QOrganizerCollection> collections();
152
bool saveCollection(QOrganizerCollection* collection);
153
bool removeCollection(const QOrganizerCollectionId& collectionId);
155
// functionality reporting
156
QList<QOrganizerItemFilter::FilterType> supportedFilters() const;
157
QList<QOrganizerItemDetail::DetailType> supportedItemDetails(QOrganizerItemType::ItemType itemType) const;
158
QList<QOrganizerItemType::ItemType> supportedItemTypes() const;
161
static QList<QOrganizerItemId> extractIds(const QList<QOrganizerItem> &items);
165
void itemsAdded(const QList<QOrganizerItemId> &itemIds);
166
void itemsChanged(const QList<QOrganizerItemId> &itemIds);
167
void itemsRemoved(const QList<QOrganizerItemId> &itemIds);
168
void itemsModified(const QList<QPair<QOrganizerItemId, QOrganizerManager::Operation> > &itemIds);
169
void collectionsAdded(const QList<QOrganizerCollectionId> &collectionIds);
170
void collectionsChanged(const QList<QOrganizerCollectionId> &collectionIds);
171
void collectionsRemoved(const QList<QOrganizerCollectionId> &collectionIds);
172
void collectionsModified(const QList<QPair<QOrganizerCollectionId, QOrganizerManager::Operation> > &collectionIds);
175
friend class QOrganizerManagerData;
176
Q_DISABLE_COPY(QOrganizerManager)
177
QOrganizerManagerData *d;
179
void createEngine(const QString &managerName, const QMap<QString, QString> ¶meters);
181
Q_PRIVATE_SLOT(d, void _q_itemsUpdated(const QList<QOrganizerItemId> &ids))
182
Q_PRIVATE_SLOT(d, void _q_itemsDeleted(const QList<QOrganizerItemId> &ids))
185
QT_END_NAMESPACE_ORGANIZER
187
#endif // QORGANIZERMANAGER_H