| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtOrganizer module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
| 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 The Qt Company. For licensing terms |
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at http://www.qt.io/contact-us. |
| 16 | ** |
| 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 or version 3 as published by the Free |
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
| 22 | ** following information to ensure the GNU Lesser General Public License |
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 25 | ** |
| 26 | ** As a special exception, The Qt Company gives you certain additional |
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception |
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 29 | ** |
| 30 | ** $QT_END_LICENSE$ |
| 31 | ** |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | #ifndef QORGANIZERSKELETON_P_H |
| 35 | #define QORGANIZERSKELETON_P_H |
| 36 | |
| 37 | // |
| 38 | // W A R N I N G |
| 39 | // ------------- |
| 40 | // |
| 41 | // This file is not part of the Qt API. It exists purely as an |
| 42 | // implementation detail. This header file may change from version to |
| 43 | // version without notice, or even be removed. |
| 44 | // |
| 45 | // We mean it. |
| 46 | // |
| 47 | |
| 48 | #include <QtCore/qdatetime.h> |
| 49 | #include <QtCore/qlist.h> |
| 50 | #include <QtCore/qmap.h> |
| 51 | #include <QtCore/qobject.h> |
| 52 | #include <QtCore/qpair.h> |
| 53 | #include <QtCore/qqueue.h> |
| 54 | #include <QtCore/qset.h> |
| 55 | #include <QtCore/qshareddata.h> |
| 56 | #include <QtCore/qstring.h> |
| 57 | |
| 58 | #include <QtOrganizer/qorganizeritem.h> |
| 59 | #include <QtOrganizer/qorganizermanager.h> |
| 60 | #include <QtOrganizer/qorganizermanagerengine.h> |
| 61 | #include <QtOrganizer/qorganizermanagerenginefactory.h> |
| 62 | #include <QtOrganizer/qorganizerabstractrequest.h> |
| 63 | |
| 64 | QT_BEGIN_NAMESPACE_ORGANIZER |
| 65 | |
| 66 | class QOrganizerItemSkeletonFactory : public QOrganizerManagerEngineFactory |
| 67 | { |
| 68 | Q_OBJECT |
| 69 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QOrganizerManagerEngineFactoryInterface" FILE "skeleton.json" ) |
| 70 | |
| 71 | public: |
| 72 | QOrganizerManagerEngine* engine(const QMap<QString, QString>& parameters, QOrganizerManager::Error*); |
| 73 | QString managerName() const; |
| 74 | }; |
| 75 | |
| 76 | |
| 77 | class QOrganizerItemSkeletonEngineData : public QSharedData |
| 78 | { |
| 79 | public: |
| 80 | QOrganizerItemSkeletonEngineData() |
| 81 | : QSharedData() |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | QOrganizerItemSkeletonEngineData(const QOrganizerItemSkeletonEngineData& other) |
| 86 | : QSharedData(other) |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | ~QOrganizerItemSkeletonEngineData() |
| 91 | { |
| 92 | } |
| 93 | }; |
| 94 | |
| 95 | class QOrganizerItemSkeletonEngine : public QOrganizerManagerEngine |
| 96 | { |
| 97 | Q_OBJECT |
| 98 | |
| 99 | public: |
| 100 | static QOrganizerItemSkeletonEngine *createSkeletonEngine(const QMap<QString, QString>& parameters); |
| 101 | |
| 102 | ~QOrganizerItemSkeletonEngine(); |
| 103 | |
| 104 | /* URI reporting */ |
| 105 | QString managerName() const; |
| 106 | QMap<QString, QString> managerParameters() const; |
| 107 | |
| 108 | // items |
| 109 | QList<QOrganizerItem> items(const QList<QOrganizerItemId> &itemIds, const QOrganizerItemFetchHint &fetchHint, |
| 110 | QMap<int, QOrganizerManager::Error> *errorMap, QOrganizerManager::Error* error); |
| 111 | |
| 112 | QList<QOrganizerItem> items(const QOrganizerItemFilter &filter, const QDateTime &startDateTime, |
| 113 | const QDateTime &endDateTime, int maxCount, |
| 114 | const QList<QOrganizerItemSortOrder> &sortOrders, |
| 115 | const QOrganizerItemFetchHint &fetchHint, QOrganizerManager::Error *error); |
| 116 | |
| 117 | QList<QOrganizerItemId> itemIds(const QOrganizerItemFilter &filter, const QDateTime &startDateTime, |
| 118 | const QDateTime &endDateTime, const QList<QOrganizerItemSortOrder> &sortOrders, |
| 119 | QOrganizerManager::Error *error); |
| 120 | |
| 121 | QList<QOrganizerItem> itemOccurrences(const QOrganizerItem &parentItem, const QDateTime &startDateTime, |
| 122 | const QDateTime &endDateTime, int maxCount, |
| 123 | const QOrganizerItemFetchHint &fetchHint, QOrganizerManager::Error *error); |
| 124 | |
| 125 | QList<QOrganizerItem> itemsForExport(const QDateTime &startDateTime, const QDateTime &endDateTime, |
| 126 | const QOrganizerItemFilter &filter, |
| 127 | const QList<QOrganizerItemSortOrder> &sortOrders, |
| 128 | const QOrganizerItemFetchHint &fetchHint, QOrganizerManager::Error *error); |
| 129 | |
| 130 | bool saveItems(QList<QOrganizerItem> *items, const QList<QOrganizerItemDetail::DetailType> &detailMask, |
| 131 | QMap<int, QOrganizerManager::Error> *errorMap, QOrganizerManager::Error *error); |
| 132 | |
| 133 | bool removeItems(const QList<QOrganizerItemId> &itemIds, QMap<int, QOrganizerManager::Error> *errorMap, |
| 134 | QOrganizerManager::Error *error); |
| 135 | |
| 136 | // collections |
| 137 | QOrganizerCollectionId defaultCollectionId() const; |
| 138 | QOrganizerCollection collection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error); |
| 139 | QList<QOrganizerCollection> collections(QOrganizerManager::Error* error); |
| 140 | bool saveCollection(QOrganizerCollection* collection, QOrganizerManager::Error* error); |
| 141 | bool removeCollection(const QOrganizerCollectionId& collectionId, QOrganizerManager::Error* error); |
| 142 | |
| 143 | /* Capabilities reporting */ |
| 144 | QList<QOrganizerItemFilter::FilterType> supportedFilters() const; |
| 145 | QList<QOrganizerItemDetail::DetailType> supportedItemDetails(QOrganizerItemType::ItemType itemType) const; |
| 146 | QList<QOrganizerItemType::ItemType> supportedItemTypes() const; |
| 147 | |
| 148 | /* Asynchronous Request Support */ |
| 149 | void requestDestroyed(QOrganizerAbstractRequest* req); |
| 150 | bool startRequest(QOrganizerAbstractRequest* req); |
| 151 | bool cancelRequest(QOrganizerAbstractRequest* req); |
| 152 | bool waitForRequestFinished(QOrganizerAbstractRequest* req, int msecs); |
| 153 | |
| 154 | private: |
| 155 | QOrganizerItemSkeletonEngineData* d; |
| 156 | |
| 157 | friend class QOrganizerItemSkeletonFactory; |
| 158 | }; |
| 159 | |
| 160 | QT_END_NAMESPACE_ORGANIZER |
| 161 | |
| 162 | #endif // QORGANIZERSKELETON_P_H |
| 163 | |