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 QtVersitOrganizer 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 QVERSITORGANIZEREXPORTER_P_H |
35 | #define QVERSITORGANIZEREXPORTER_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/qpair.h> |
49 | |
50 | #include <QtOrganizer/qorganizeritemdetail.h> |
51 | |
52 | #include <QtVersit/qversitdocument.h> |
53 | #include <QtVersit/qversitproperty.h> |
54 | |
55 | #include <QtVersitOrganizer/qversitorganizerexporter.h> |
56 | #include <QtVersitOrganizer/qversitorganizerhandler.h> |
57 | #include <QtVersitOrganizer/qversittimezonehandler.h> |
58 | |
59 | QT_BEGIN_NAMESPACE_ORGANIZER |
60 | class QOrganizerItem; |
61 | class QOrganizerItemReminder; |
62 | class QOrganizerRecurrenceRule; |
63 | QT_END_NAMESPACE_ORGANIZER |
64 | |
65 | QTORGANIZER_USE_NAMESPACE |
66 | QTVERSIT_USE_NAMESPACE |
67 | |
68 | QT_BEGIN_NAMESPACE_VERSITORGANIZER |
69 | |
70 | class QVersitOrganizerExporterPrivate |
71 | { |
72 | public: |
73 | QVersitOrganizerExporterPrivate(const QString& profile = QString()); |
74 | ~QVersitOrganizerExporterPrivate(); |
75 | |
76 | bool exportItem(const QOrganizerItem& item, |
77 | QVersitDocument* document, |
78 | QVersitOrganizerExporter::Error* error); |
79 | |
80 | QVersitDocument mResult; |
81 | QMap<int, QVersitOrganizerExporter::Error> mErrors; |
82 | QVersitOrganizerExporterDetailHandler* mDetailHandler; |
83 | QList<QVersitOrganizerHandler*> mPluginDetailHandlers; |
84 | QVersitTimeZoneHandler* mTimeZoneHandler; |
85 | |
86 | private: |
87 | void exportDetail( |
88 | const QOrganizerItem& item, |
89 | const QOrganizerItemDetail& detail, |
90 | QVersitDocument* document); |
91 | void encodeEventTimeRange( |
92 | const QOrganizerItemDetail& detail, |
93 | const QVersitDocument& document, |
94 | QList<QVersitProperty>* removedProperties, |
95 | QList<QVersitProperty>* generatedProperties, |
96 | QSet<int>* processedFields); |
97 | void encodeTodoTimeRange( |
98 | const QOrganizerItemDetail& detail, |
99 | const QVersitDocument& document, |
100 | QList<QVersitProperty>* removedProperties, |
101 | QList<QVersitProperty>* generatedProperties, |
102 | QSet<int>* processedFields); |
103 | void encodeJournalTimeRange( |
104 | const QOrganizerItemDetail& detail, |
105 | const QVersitDocument& document, |
106 | QList<QVersitProperty>* removedProperties, |
107 | QList<QVersitProperty>* generatedProperties, |
108 | QSet<int>* processedFields); |
109 | void encodeTimestamp( |
110 | const QOrganizerItemDetail& detail, |
111 | const QVersitDocument& document, |
112 | QList<QVersitProperty>* removedProperties, |
113 | QList<QVersitProperty>* generatedProperties, |
114 | QSet<int>* processedFields); |
115 | void encodeVersion( |
116 | const QOrganizerItemDetail& detail, |
117 | const QVersitDocument& document, |
118 | QList<QVersitProperty>* removedProperties, |
119 | QList<QVersitProperty>* generatedProperties, |
120 | QSet<int>* processedFields); |
121 | void encodeRecurrence( |
122 | const QOrganizerItem& item, |
123 | const QOrganizerItemDetail& detail, |
124 | const QVersitDocument& document, |
125 | QList<QVersitProperty>* removedProperties, |
126 | QList<QVersitProperty>* generatedProperties, |
127 | QSet<int>* processedFields); |
128 | void encodeRecurRule( |
129 | const QString& propertyName, |
130 | const QOrganizerRecurrenceRule& rule, |
131 | QList<QVersitProperty>* generatedProperties); |
132 | void appendInts(QString* str, const QSet<int>& ints); |
133 | QString weekString(Qt::DayOfWeek day); |
134 | void encodeRecurDates( |
135 | const QString& propertyName, |
136 | const QOrganizerItem& item, |
137 | const QSet<QDate>& dates, |
138 | const QVersitDocument& document, |
139 | QList<QVersitProperty>* removedProperties, |
140 | QList<QVersitProperty>* generatedProperties); |
141 | void encodePriority( |
142 | const QOrganizerItemDetail& detail, |
143 | const QVersitDocument& document, |
144 | QList<QVersitProperty>* removedProperties, |
145 | QList<QVersitProperty>* generatedProperties, |
146 | QSet<int>* processedFields); |
147 | void encodeInstanceOrigin( |
148 | const QOrganizerItemDetail& detail, |
149 | const QVersitDocument& document, |
150 | QList<QVersitProperty>* removedProperties, |
151 | QList<QVersitProperty>* generatedProperties, |
152 | QSet<int>* processedFields); |
153 | void encodeTodoProgress( |
154 | const QOrganizerItemDetail& detail, |
155 | const QVersitDocument& document, |
156 | QList<QVersitProperty>* removedProperties, |
157 | QList<QVersitProperty>* generatedProperties, |
158 | QSet<int>* processedFields); |
159 | void ( |
160 | const QOrganizerItemDetail& detail, |
161 | QList<QVersitProperty>* generatedProperties, |
162 | QSet<int>* processedFields); |
163 | void encodeAudibleReminder( |
164 | const QOrganizerItem &item, |
165 | const QOrganizerItemDetail &detail, |
166 | QList<QVersitProperty> *generatedProperties, |
167 | QSet<int> *processedFields); |
168 | void encodeEmailReminder( |
169 | const QOrganizerItem &item, |
170 | const QOrganizerItemDetail &detail, |
171 | QList<QVersitProperty> *generatedProperties, |
172 | QSet<int> *processedFields); |
173 | void encodeVisualReminder( |
174 | const QOrganizerItem &item, |
175 | const QOrganizerItemDetail &detail, |
176 | QList<QVersitProperty> *generatedProperties, |
177 | QSet<int> *processedFields); |
178 | QVersitDocument encodeItemReminderCommonFields( |
179 | const QOrganizerItem &item, |
180 | const QOrganizerItemReminder &reminder, |
181 | QSet<int> *processedFields); |
182 | void encodeExtendedDetail( |
183 | const QOrganizerItemDetail &detail, |
184 | QList<QVersitProperty> *generatedProperties, |
185 | QSet<int> *processedFields); |
186 | void encodeSimpleProperty( |
187 | const QOrganizerItemDetail& detail, |
188 | const QVersitDocument& document, |
189 | QList<QVersitProperty>* removedProperties, |
190 | QList<QVersitProperty>* generatedProperties, |
191 | QSet<int>* processedFields); |
192 | QString encodeDateTime(const QDateTime& dateTime); |
193 | |
194 | bool documentContainsUidAndRecurrenceId(const QVersitDocument& document); |
195 | QVersitProperty takeProperty( |
196 | const QVersitDocument& document, |
197 | const QString& propertyName, |
198 | QList<QVersitProperty>* toBeRemoved); |
199 | |
200 | // definition name -> <field name, versit property name>: |
201 | QMap<QOrganizerItemDetail::DetailType, QPair<int, QString> > mPropertyMappings; |
202 | }; |
203 | |
204 | QT_END_NAMESPACE_VERSITORGANIZER |
205 | |
206 | #endif // QVERSITORGANIZEREXPORTER_P_H |
207 | |