summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp2
-rw-r--r--libopie2/opiepim/core/opimevent.cpp36
-rw-r--r--libopie2/opiepim/core/opimevent.h2
3 files changed, 24 insertions, 16 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
index 6c32b40..f4f3c94 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp
@@ -1,333 +1,333 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) 3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29/* 29/*
30 * SQL Backend for the OPIE-Calender Database. 30 * SQL Backend for the OPIE-Calender Database.
31 * 31 *
32 */ 32 */
33 33
34#include <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37#include <qarray.h> 37#include <qarray.h>
38#include <qstringlist.h> 38#include <qstringlist.h>
39 39
40#include <qpe/global.h> 40#include <qpe/global.h>
41 41
42#include <opie2/osqldriver.h> 42#include <opie2/osqldriver.h>
43#include <opie2/osqlmanager.h> 43#include <opie2/osqlmanager.h>
44#include <opie2/osqlquery.h> 44#include <opie2/osqlquery.h>
45 45
46#include <opie2/opimrecurrence.h> 46#include <opie2/opimrecurrence.h>
47#include <opie2/odatebookaccessbackend_sql.h> 47#include <opie2/odatebookaccessbackend_sql.h>
48 48
49using namespace Opie::DB; 49using namespace Opie::DB;
50 50
51namespace { 51namespace {
52 /** 52 /**
53 * a find query for custom elements 53 * a find query for custom elements
54 */ 54 */
55 class FindCustomQuery : public OSQLQuery { 55 class FindCustomQuery : public OSQLQuery {
56 public: 56 public:
57 FindCustomQuery(int uid); 57 FindCustomQuery(int uid);
58 FindCustomQuery(const QArray<int>& ); 58 FindCustomQuery(const QArray<int>& );
59 ~FindCustomQuery(); 59 ~FindCustomQuery();
60 QString query()const; 60 QString query()const;
61 private: 61 private:
62 QString single()const; 62 QString single()const;
63 QString multi()const; 63 QString multi()const;
64 QArray<int> m_uids; 64 QArray<int> m_uids;
65 int m_uid; 65 int m_uid;
66 }; 66 };
67 67
68 FindCustomQuery::FindCustomQuery(int uid) 68 FindCustomQuery::FindCustomQuery(int uid)
69 : OSQLQuery(), m_uid( uid ) { 69 : OSQLQuery(), m_uid( uid ) {
70 } 70 }
71 FindCustomQuery::FindCustomQuery(const QArray<int>& ints) 71 FindCustomQuery::FindCustomQuery(const QArray<int>& ints)
72 : OSQLQuery(), m_uids( ints ){ 72 : OSQLQuery(), m_uids( ints ){
73 } 73 }
74 FindCustomQuery::~FindCustomQuery() { 74 FindCustomQuery::~FindCustomQuery() {
75 } 75 }
76 QString FindCustomQuery::query()const{ 76 QString FindCustomQuery::query()const{
77 // if ( m_uids.count() == 0 ) 77 // if ( m_uids.count() == 0 )
78 return single(); 78 return single();
79 } 79 }
80 QString FindCustomQuery::single()const{ 80 QString FindCustomQuery::single()const{
81 QString qu = "select uid, type, value from custom_data where uid = "; 81 QString qu = "select uid, type, value from custom_data where uid = ";
82 qu += QString::number(m_uid); 82 qu += QString::number(m_uid);
83 return qu; 83 return qu;
84 } 84 }
85} 85}
86 86
87 87
88namespace Opie { 88namespace Opie {
89 89
90 90
91ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , 91ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& ,
92 const QString& fileName ) 92 const QString& fileName )
93 : ODateBookAccessBackend(), m_driver( NULL ) 93 : ODateBookAccessBackend(), m_driver( NULL )
94{ 94{
95 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; 95 m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName;
96 96
97 // Get the standart sql-driver from the OSQLManager.. 97 // Get the standart sql-driver from the OSQLManager..
98 OSQLManager man; 98 OSQLManager man;
99 m_driver = man.standard(); 99 m_driver = man.standard();
100 m_driver->setUrl( m_fileName ); 100 m_driver->setUrl( m_fileName );
101 101
102 initFields(); 102 initFields();
103 103
104 load(); 104 load();
105} 105}
106 106
107ODateBookAccessBackend_SQL::~ODateBookAccessBackend_SQL() { 107ODateBookAccessBackend_SQL::~ODateBookAccessBackend_SQL() {
108 if( m_driver ) 108 if( m_driver )
109 delete m_driver; 109 delete m_driver;
110} 110}
111 111
112void ODateBookAccessBackend_SQL::initFields() 112void ODateBookAccessBackend_SQL::initFields()
113{ 113{
114 114
115 // This map contains the translation of the fieldtype id's to 115 // This map contains the translation of the fieldtype id's to
116 // the names of the table columns 116 // the names of the table columns
117 m_fieldMap.insert( OPimEvent::FUid, "uid" ); 117 m_fieldMap.insert( OPimEvent::FUid, "uid" );
118 m_fieldMap.insert( OPimEvent::FCategories, "Categories" ); 118 m_fieldMap.insert( OPimEvent::FCategories, "Categories" );
119 m_fieldMap.insert( OPimEvent::FDescription, "Description" ); 119 m_fieldMap.insert( OPimEvent::FDescription, "Description" );
120 m_fieldMap.insert( OPimEvent::FLocation, "Location" ); 120 m_fieldMap.insert( OPimEvent::FLocation, "Location" );
121 m_fieldMap.insert( OPimEvent::FType, "Type" ); 121 m_fieldMap.insert( OPimEvent::FType, "Type" );
122 m_fieldMap.insert( OPimEvent::FAlarm, "Alarm" ); 122 m_fieldMap.insert( OPimEvent::FAlarm, "Alarm" );
123 m_fieldMap.insert( OPimEvent::FSound, "Sound" ); 123 m_fieldMap.insert( OPimEvent::FSound, "Sound" );
124 m_fieldMap.insert( OPimEvent::FRType, "RType" ); 124 m_fieldMap.insert( OPimEvent::FRType, "RType" );
125 m_fieldMap.insert( OPimEvent::FRWeekdays, "RWeekdays" ); 125 m_fieldMap.insert( OPimEvent::FRWeekdays, "RWeekdays" );
126 m_fieldMap.insert( OPimEvent::FRPosition, "RPosition" ); 126 m_fieldMap.insert( OPimEvent::FRPosition, "RPosition" );
127 m_fieldMap.insert( OPimEvent::FRFreq, "RFreq" ); 127 m_fieldMap.insert( OPimEvent::FRFreq, "RFreq" );
128 m_fieldMap.insert( OPimEvent::FRHasEndDate, "RHasEndDate" ); 128 m_fieldMap.insert( OPimEvent::FRHasEndDate, "RHasEndDate" );
129 m_fieldMap.insert( OPimEvent::FREndDate, "REndDate" ); 129 m_fieldMap.insert( OPimEvent::FREndDate, "REndDate" );
130 m_fieldMap.insert( OPimEvent::FRCreated, "RCreated" ); 130 m_fieldMap.insert( OPimEvent::FRCreated, "RCreated" );
131 m_fieldMap.insert( OPimEvent::FRExceptions, "RExceptions" ); 131 m_fieldMap.insert( OPimEvent::FRExceptions, "RExceptions" );
132 m_fieldMap.insert( OPimEvent::FStart, "Start" ); 132 m_fieldMap.insert( OPimEvent::FStart, "Start" );
133 m_fieldMap.insert( OPimEvent::FEnd, "End" ); 133 m_fieldMap.insert( OPimEvent::FEnd, "End" );
134 m_fieldMap.insert( OPimEvent::FNote, "Note" ); 134 m_fieldMap.insert( OPimEvent::FNote, "Note" );
135 m_fieldMap.insert( OPimEvent::FTimeZone, "TimeZone" ); 135 m_fieldMap.insert( OPimEvent::FTimeZone, "TimeZone" );
136 m_fieldMap.insert( OPimEvent::FRecParent, "RecParent" ); 136 m_fieldMap.insert( OPimEvent::FRecParent, "RecParent" );
137 m_fieldMap.insert( OPimEvent::FRecChildren, "Recchildren" ); 137 m_fieldMap.insert( OPimEvent::FRecChildren, "Recchildren" );
138 138
139 // Create a map that maps the column name to the id 139 // Create a map that maps the column name to the id
140 QMapConstIterator<int, QString> it; 140 QMapConstIterator<int, QString> it;
141 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ 141 for ( it = m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
142 m_reverseFieldMap.insert( it.data(), it.key() ); 142 m_reverseFieldMap.insert( it.data(), it.key() );
143 } 143 }
144 144
145} 145}
146 146
147bool ODateBookAccessBackend_SQL::load() 147bool ODateBookAccessBackend_SQL::load()
148{ 148{
149 if (!m_driver->open() ) 149 if (!m_driver->open() )
150 return false; 150 return false;
151 151
152 // Don't expect that the database exists. 152 // Don't expect that the database exists.
153 // It is save here to create the table, even if it 153 // It is save here to create the table, even if it
154 // do exist. ( Is that correct for all databases ?? ) 154 // do exist. ( Is that correct for all databases ?? )
155 QStringqu = "create table datebook( uid INTEGER PRIMARY KEY "; 155 QStringqu = "create table datebook( uid INTEGER PRIMARY KEY ";
156 156
157 QMap<int, QString>::Iterator it; 157 QMap<int, QString>::Iterator it;
158 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ 158 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
159 qu += QString( ",%1 VARCHAR(10)" ).arg( it.data() ); 159 qu += QString( ",%1 VARCHAR(10)" ).arg( it.data() );
160 } 160 }
161 qu += " );"; 161 qu += " );";
162 162
163 qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), priority INTEGER, value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; 163 qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), priority INTEGER, value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );";
164 164
165 qWarning( "command: %s", qu.latin1() ); 165 qWarning( "command: %s", qu.latin1() );
166 166
167 OSQLRawQuery raw( qu ); 167 OSQLRawQuery raw( qu );
168 OSQLResult res = m_driver->query( &raw ); 168 OSQLResult res = m_driver->query( &raw );
169 if ( res.state() != OSQLResult::Success ) 169 if ( res.state() != OSQLResult::Success )
170 return false; 170 return false;
171 171
172 update(); 172 update();
173 173
174 return true; 174 return true;
175} 175}
176 176
177void ODateBookAccessBackend_SQL::update() 177void ODateBookAccessBackend_SQL::update()
178{ 178{
179 179
180 QString qu = "select uid from datebook"; 180 QString qu = "select uid from datebook";
181 OSQLRawQuery raw( qu ); 181 OSQLRawQuery raw( qu );
182 OSQLResult res = m_driver->query( &raw ); 182 OSQLResult res = m_driver->query( &raw );
183 if ( res.state() != OSQLResult::Success ){ 183 if ( res.state() != OSQLResult::Success ){
184 // m_uids.clear(); 184 // m_uids.clear();
185 return; 185 return;
186 } 186 }
187 187
188 m_uids = extractUids( res ); 188 m_uids = extractUids( res );
189 189
190} 190}
191 191
192bool ODateBookAccessBackend_SQL::reload() 192bool ODateBookAccessBackend_SQL::reload()
193{ 193{
194 return load(); 194 return load();
195} 195}
196 196
197bool ODateBookAccessBackend_SQL::save() 197bool ODateBookAccessBackend_SQL::save()
198{ 198{
199 return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) 199 return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers)
200} 200}
201 201
202QArray<int> ODateBookAccessBackend_SQL::allRecords()const 202QArray<int> ODateBookAccessBackend_SQL::allRecords()const
203{ 203{
204 return m_uids; 204 return m_uids;
205} 205}
206 206
207QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OPimEvent&, int, const QDateTime& ) { 207QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OPimEvent&, int, const QDateTime& ) {
208 return QArray<int>(); 208 return QArray<int>();
209} 209}
210 210
211void ODateBookAccessBackend_SQL::clear() 211void ODateBookAccessBackend_SQL::clear()
212{ 212{
213 QString qu = "drop table datebook;"; 213 QString qu = "drop table datebook;";
214 qu += "drop table custom_data;"; 214 qu += "drop table custom_data;";
215 215
216 OSQLRawQuery raw( qu ); 216 OSQLRawQuery raw( qu );
217 OSQLResult res = m_driver->query( &raw ); 217 OSQLResult res = m_driver->query( &raw );
218 218
219 reload(); 219 reload();
220} 220}
221 221
222 222
223OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{ 223OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{
224 qDebug( "ODateBookAccessBackend_SQL::find( %d )", uid ); 224 qDebug( "ODateBookAccessBackend_SQL::find( %d )", uid );
225 225
226 QString qu = "select *"; 226 QString qu = "select *";
227 qu += "from datebook where uid = " + QString::number(uid); 227 qu += "from datebook where uid = " + QString::number(uid);
228 228
229 qDebug( "Query: %s", qu.latin1() ); 229 qDebug( "Query: %s", qu.latin1() );
230 230
231 OSQLRawQuery raw( qu ); 231 OSQLRawQuery raw( qu );
232 OSQLResult res = m_driver->query( &raw ); 232 OSQLResult res = m_driver->query( &raw );
233 233
234 OSQLResultItem resItem = res.first(); 234 OSQLResultItem resItem = res.first();
235 235
236 // Create Map for date event and insert UID 236 // Create Map for date event and insert UID
237 QMap<int,QString> dateEventMap; 237 QMap<int,QString> dateEventMap;
238 dateEventMap.insert( OPimEvent::FUid, QString::number( uid ) ); 238 dateEventMap.insert( OPimEvent::FUid, QString::number( uid ) );
239 239
240 // Now insert the data out of the columns into the map. 240 // Now insert the data out of the columns into the map.
241 QMapConstIterator<int, QString> it; 241 QMapConstIterator<int, QString> it;
242 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ 242 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
243 dateEventMap.insert( m_reverseFieldMap[*it], resItem.data( *it ) ); 243 dateEventMap.insert( m_reverseFieldMap[*it], resItem.data( *it ) );
244 } 244 }
245 245
246 // Last step: Put map into date event, add custom map and return it 246 // Last step: Put map into date event, add custom map and return it
247 OPimEvent retDate( dateEventMap ); 247 OPimEvent retDate( dateEventMap );
248 retDate.setExtraMap( requestCustom( uid ) ); 248 retDate.setExtraMap( requestCustom( uid ) );
249 249
250 qDebug( "ODateBookAccessBackend_SQL::find( %d ) end", uid ); 250 qDebug( "ODateBookAccessBackend_SQL::find( %d ) end", uid );
251 return retDate; 251 return retDate;
252} 252}
253 253
254// FIXME: Speed up update of uid's.. 254// FIXME: Speed up update of uid's..
255bool ODateBookAccessBackend_SQL::add( const OPimEvent& ev ) 255bool ODateBookAccessBackend_SQL::add( const OPimEvent& ev )
256{ 256{
257 QMap<int,QString> eventMap = ev.toMap(); 257 QMap<int,QString> eventMap = ev.toMap();
258 258
259 QString qu = "insert into datebook VALUES( " + QString::number( ev.uid() ); 259 QString qu = "insert into datebook VALUES( " + QString::number( ev.uid() );
260 QMap<int, QString>::Iterator it; 260 QMap<int, QString>::Iterator it;
261 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ 261 for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
262 if ( !eventMap[it.key()].isEmpty() ) 262 if ( !eventMap[it.key()].isEmpty() )
263 qu += QString( ",\"%1\"" ).arg( eventMap[it.key()] ); 263 qu += QString( ",\"%1\"" ).arg( eventMap[it.key()] );
264 else 264 else
265 qu += QString( ",\"\"" ); 265 qu += QString( ",\"\"" );
266 } 266 }
267 qu += " );"; 267 qu += " );";
268 268
269 // Add custom entries 269 // Add custom entries
270 int id = 0; 270 int id = 0;
271 QMap<QString, QString> customMap = ev.toExtraMap(); 271 QMap<QString, QString> customMap = ev.toExtraMap();
272 for( QMap<QString, QString>::Iterator it = customMap.begin(); 272 for( QMap<QString, QString>::Iterator it = customMap.begin();
273 it != customMap.end(); ++it ){ 273 it != customMap.end(); ++it ){
274 qu += "insert into custom_data VALUES(" 274 qu += "insert into custom_data VALUES("
275 + QString::number( ev.uid() ) 275 + QString::number( ev.uid() )
276 + "," 276 + ","
277 + QString::number( id++ ) 277 + QString::number( id++ )
278 + ",'" 278 + ",'"
279 + it.key() //.latin1() 279 + it.key() //.latin1()
280 + "'," 280 + "',"
281 + "0" // Priority for future enhancements 281 + "0" // Priority for future enhancements
282 + ",'" 282 + ",'"
283 + it.data() //.latin1() 283 + it.data() //.latin1()
284 + "');"; 284 + "');";
285 } 285 }
286 qWarning("add %s", qu.latin1() ); 286 qWarning("add %s", qu.latin1() );
287 287
288 OSQLRawQuery raw( qu ); 288 OSQLRawQuery raw( qu );
289 OSQLResult res = m_driver->query( &raw ); 289 OSQLResult res = m_driver->query( &raw );
290 if ( res.state() != OSQLResult::Success ){ 290 if ( res.state() != OSQLResult::Success ){
291 return false; 291 return false;
292 } 292 }
293 293
294 // Update list of uid's 294 // Update list of uid's
295 update(); 295 update();
296 296
297 return true; 297 return true;
298} 298}
299 299
300// FIXME: Speed up update of uid's.. 300// FIXME: Speed up update of uid's..
301bool ODateBookAccessBackend_SQL::remove( int uid ) 301bool ODateBookAccessBackend_SQL::remove( int uid )
302{ 302{
303 QString qu = "DELETE from datebook where uid = " 303 QString qu = "DELETE from datebook where uid = "
304 + QString::number( uid ) + ";"; 304 + QString::number( uid ) + ";";
305 qu += "DELETE from custom_data where uid = " 305 qu += "DELETE from custom_data where uid = "
306 + QString::number( uid ) + ";"; 306 + QString::number( uid ) + ";";
307 307
308 OSQLRawQuery raw( qu ); 308 OSQLRawQuery raw( qu );
309 OSQLResult res = m_driver->query( &raw ); 309 OSQLResult res = m_driver->query( &raw );
310 if ( res.state() != OSQLResult::Success ){ 310 if ( res.state() != OSQLResult::Success ){
311 return false; 311 return false;
312 } 312 }
313 313
314 // Update list of uid's 314 // Update list of uid's
315 update(); 315 update();
316 316
317 return true; 317 return true;
318} 318}
319 319
320bool ODateBookAccessBackend_SQL::replace( const OPimEvent& ev ) 320bool ODateBookAccessBackend_SQL::replace( const OPimEvent& ev )
321{ 321{
322 remove( ev.uid() ); 322 remove( ev.uid() );
323 return add( ev ); 323 return add( ev );
324} 324}
325 325
326QArray<int> ODateBookAccessBackend_SQL::rawEvents()const 326QArray<int> ODateBookAccessBackend_SQL::rawEvents()const
327{ 327{
328 return allRecords(); 328 return allRecords();
329} 329}
330 330
331QArray<int> ODateBookAccessBackend_SQL::rawRepeats()const 331QArray<int> ODateBookAccessBackend_SQL::rawRepeats()const
332{ 332{
333 QString qu = "select uid from datebook where RType!=\"\" AND RType!=\"NoRepeat\""; 333 QString qu = "select uid from datebook where RType!=\"\" AND RType!=\"NoRepeat\"";
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp
index 8bf8b25..9d46651 100644
--- a/libopie2/opiepim/core/opimevent.cpp
+++ b/libopie2/opiepim/core/opimevent.cpp
@@ -366,488 +366,496 @@ bool OPimEvent::match( const QRegExp& re ) const
366 if ( re.match( data->location ) != -1 ) 366 if ( re.match( data->location ) != -1 )
367 { 367 {
368 setLastHitField( Qtopia::Location ); 368 setLastHitField( Qtopia::Location );
369 return true; 369 return true;
370 } 370 }
371 if ( re.match( data->start.toString() ) != -1 ) 371 if ( re.match( data->start.toString() ) != -1 )
372 { 372 {
373 setLastHitField( Qtopia::StartDateTime ); 373 setLastHitField( Qtopia::StartDateTime );
374 return true; 374 return true;
375 } 375 }
376 if ( re.match( data->end.toString() ) != -1 ) 376 if ( re.match( data->end.toString() ) != -1 )
377 { 377 {
378 setLastHitField( Qtopia::EndDateTime ); 378 setLastHitField( Qtopia::EndDateTime );
379 return true; 379 return true;
380 } 380 }
381 return false; 381 return false;
382} 382}
383 383
384 384
385QString OPimEvent::toRichText() const 385QString OPimEvent::toRichText() const
386{ 386{
387 QString text, value; 387 QString text, value;
388 388
389 // description 389 // description
390 text += "<b><h3><img src=\"datebook/DateBook\">"; 390 text += "<b><h3><img src=\"datebook/DateBook\">";
391 if ( !description().isEmpty() ) 391 if ( !description().isEmpty() )
392 { 392 {
393 text += Qtopia::escapeString( description() ).replace( QRegExp( "[\n]" ), "" ); 393 text += Qtopia::escapeString( description() ).replace( QRegExp( "[\n]" ), "" );
394 } 394 }
395 text += "</h3></b><br><hr><br>"; 395 text += "</h3></b><br><hr><br>";
396 396
397 // location 397 // location
398 if ( !( value = location() ).isEmpty() ) 398 if ( !( value = location() ).isEmpty() )
399 { 399 {
400 text += "<b>" + QObject::tr( "Location:" ) + "</b> "; 400 text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
401 text += Qtopia::escapeString( value ) + "<br>"; 401 text += Qtopia::escapeString( value ) + "<br>";
402 } 402 }
403 403
404 // all day event 404 // all day event
405 if ( isAllDay() ) 405 if ( isAllDay() )
406 { 406 {
407 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; 407 text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
408 } 408 }
409 // multiple day event 409 // multiple day event
410 else if ( isMultipleDay () ) 410 else if ( isMultipleDay () )
411 { 411 {
412 text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; 412 text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
413 } 413 }
414 // start & end times 414 // start & end times
415 else 415 else
416 { 416 {
417 // start time 417 // start time
418 if ( startDateTime().isValid() ) 418 if ( startDateTime().isValid() )
419 { 419 {
420 text += "<b>" + QObject::tr( "Start:" ) + "</b> "; 420 text += "<b>" + QObject::tr( "Start:" ) + "</b> ";
421 text += Qtopia::escapeString( startDateTime().toString() ). 421 text += Qtopia::escapeString( startDateTime().toString() ).
422 replace( QRegExp( "[\n]" ), "<br>" ) + "<br>"; 422 replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
423 } 423 }
424 424
425 // end time 425 // end time
426 if ( endDateTime().isValid() ) 426 if ( endDateTime().isValid() )
427 { 427 {
428 text += "<b>" + QObject::tr( "End:" ) + "</b> "; 428 text += "<b>" + QObject::tr( "End:" ) + "</b> ";
429 text += Qtopia::escapeString( endDateTime().toString() ). 429 text += Qtopia::escapeString( endDateTime().toString() ).
430 replace( QRegExp( "[\n]" ), "<br>" ) + "<br>"; 430 replace( QRegExp( "[\n]" ), "<br>" ) + "<br>";
431 } 431 }
432 } 432 }
433 433
434 // categories 434 // categories
435 if ( categoryNames( "Calendar" ).count() ) 435 if ( categoryNames( "Calendar" ).count() )
436 { 436 {
437 text += "<b>" + QObject::tr( "Category:" ) + "</b> "; 437 text += "<b>" + QObject::tr( "Category:" ) + "</b> ";
438 text += categoryNames( "Calendar" ).join( ", " ); 438 text += categoryNames( "Calendar" ).join( ", " );
439 text += "<br>"; 439 text += "<br>";
440 } 440 }
441 441
442 //notes 442 //notes
443 if ( !note().isEmpty() ) 443 if ( !note().isEmpty() )
444 { 444 {
445 text += "<b>" + QObject::tr( "Note:" ) + "</b><br>"; 445 text += "<b>" + QObject::tr( "Note:" ) + "</b><br>";
446 text += note(); 446 text += note();
447 // text += Qtopia::escapeString(note() ). 447 // text += Qtopia::escapeString(note() ).
448 // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 448 // replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
449 } 449 }
450 return text; 450 return text;
451} 451}
452 452
453 453
454QString OPimEvent::toShortText() const 454QString OPimEvent::toShortText() const
455{ 455{
456 QString text; 456 QString text;
457 text += QString::number( startDateTime().date().day() ); 457 text += QString::number( startDateTime().date().day() );
458 text += "."; 458 text += ".";
459 text += QString::number( startDateTime().date().month() ); 459 text += QString::number( startDateTime().date().month() );
460 text += "."; 460 text += ".";
461 text += QString::number( startDateTime().date().year() ); 461 text += QString::number( startDateTime().date().year() );
462 text += " "; 462 text += " ";
463 text += QString::number( startDateTime().time().hour() ); 463 text += QString::number( startDateTime().time().hour() );
464 text += ":"; 464 text += ":";
465 text += QString::number( startDateTime().time().minute() ); 465 text += QString::number( startDateTime().time().minute() );
466 text += " - "; 466 text += " - ";
467 text += description(); 467 text += description();
468 return text; 468 return text;
469} 469}
470 470
471 471
472QString OPimEvent::type() const 472QString OPimEvent::type() const
473{ 473{
474 return QString::fromLatin1( "OPimEvent" ); 474 return QString::fromLatin1( "OPimEvent" );
475} 475}
476 476
477 477
478QString OPimEvent::recordField( int /*id */ ) const 478QString OPimEvent::recordField( int /*id */ ) const
479{ 479{
480 return QString::null; 480 return QString::null;
481} 481}
482 482
483 483
484int OPimEvent::rtti() const 484int OPimEvent::rtti() const
485{ 485{
486 return OPimResolver::DateBook; 486 return OPimResolver::DateBook;
487} 487}
488 488
489 489
490bool OPimEvent::loadFromStream( QDataStream& ) 490bool OPimEvent::loadFromStream( QDataStream& )
491{ 491{
492 return true; 492 return true;
493} 493}
494 494
495 495
496bool OPimEvent::saveToStream( QDataStream& ) const 496bool OPimEvent::saveToStream( QDataStream& ) const
497{ 497{
498 return true; 498 return true;
499} 499}
500 500
501 501
502void OPimEvent::changeOrModify() 502void OPimEvent::changeOrModify()
503{ 503{
504 if ( data->count != 1 ) 504 if ( data->count != 1 )
505 { 505 {
506 data->deref(); 506 data->deref();
507 Data* d2 = new Data; 507 Data* d2 = new Data;
508 d2->description = data->description; 508 d2->description = data->description;
509 d2->location = data->location; 509 d2->location = data->location;
510 510
511 if ( data->manager ) 511 if ( data->manager )
512 d2->manager = new OPimNotifyManager( *data->manager ); 512 d2->manager = new OPimNotifyManager( *data->manager );
513 513
514 if ( data->recur ) 514 if ( data->recur )
515 d2->recur = new OPimRecurrence( *data->recur ); 515 d2->recur = new OPimRecurrence( *data->recur );
516 516
517 d2->note = data->note; 517 d2->note = data->note;
518 d2->created = data->created; 518 d2->created = data->created;
519 d2->start = data->start; 519 d2->start = data->start;
520 d2->end = data->end; 520 d2->end = data->end;
521 d2->isAllDay = data->isAllDay; 521 d2->isAllDay = data->isAllDay;
522 d2->timezone = data->timezone; 522 d2->timezone = data->timezone;
523 d2->parent = data->parent; 523 d2->parent = data->parent;
524 524
525 if ( data->child ) 525 if ( data->child )
526 { 526 {
527 d2->child = new QArray<int>( *data->child ); 527 d2->child = new QArray<int>( *data->child );
528 d2->child->detach(); 528 d2->child->detach();
529 } 529 }
530 530
531 data = d2; 531 data = d2;
532 } 532 }
533} 533}
534 534
535 535
536void OPimEvent::deref() 536void OPimEvent::deref()
537{ 537{
538 if ( data->deref() ) 538 if ( data->deref() )
539 { 539 {
540 delete data; 540 delete data;
541 data = 0; 541 data = 0;
542 } 542 }
543} 543}
544// Exporting Event data to map. Using the same 544// Exporting Event data to map. Using the same
545// encoding as ODateBookAccessBackend_xml does.. 545// encoding as ODateBookAccessBackend_xml does..
546// Thus, we could remove the stuff there and use this 546// Thus, we could remove the stuff there and use this
547// for it and for all other places.. 547// for it and for all other places..
548// Encoding should happen at one place, only ! (eilers) 548// Encoding should happen at one place, only ! (eilers)
549QMap<int, QString> OPimEvent::toMap() const 549QMap<int, QString> OPimEvent::toMap() const
550{ 550{
551 QMap<int, QString> retMap; 551 QMap<int, QString> retMap;
552 552
553 retMap.insert( OPimEvent::FUid, QString::number( uid() ) ); 553 retMap.insert( OPimEvent::FUid, QString::number( uid() ) );
554 retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) ); 554 retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) );
555 retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) ); 555 retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) );
556 retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) ); 556 retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) );
557 retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); 557 retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" );
558 OPimAlarm alarm = notifiers().alarms() [ 0 ]; 558 if ( notifiers().alarms().count() ){
559 retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); 559 // Currently we just support one alarm.. (eilers)
560 retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); 560 OPimAlarm alarm = notifiers().alarms() [ 0 ];
561 retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
562 retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
563 }
561 564
562 OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); 565 OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() );
563 retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) ); 566 retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) );
564 retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) ); 567 retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) );
565 retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) ); 568 retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) );
566 retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); 569 retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() );
567 if ( parent() ) 570 if ( parent() )
568 retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) ); 571 retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) );
569 if ( children().count() ) 572 if ( children().count() )
570 { 573 {
571 QArray<int> childr = children(); 574 QArray<int> childr = children();
572 QString buf; 575 QString buf;
573 for ( uint i = 0; i < childr.count(); i++ ) 576 for ( uint i = 0; i < childr.count(); i++ )
574 { 577 {
575 if ( i != 0 ) buf += " "; 578 if ( i != 0 ) buf += " ";
576 buf += QString::number( childr[ i ] ); 579 buf += QString::number( childr[ i ] );
577 } 580 }
578 retMap.insert( OPimEvent::FRecChildren, buf ); 581 retMap.insert( OPimEvent::FRecChildren, buf );
579 } 582 }
580 583
581 // Add recurrence stuff 584 // Add recurrence stuff
582 if ( hasRecurrence() ) 585 if ( hasRecurrence() )
583 { 586 {
584 OPimRecurrence recur = recurrence(); 587 OPimRecurrence recur = recurrence();
585 QMap<int, QString> recFields = recur.toMap(); 588 QMap<int, QString> recFields = recur.toMap();
586 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); 589 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] );
587 retMap.insert( OPimEvent::FRWeekdays, recFields[ OPimRecurrence::RWeekdays ] ); 590 retMap.insert( OPimEvent::FRWeekdays, recFields[ OPimRecurrence::RWeekdays ] );
588 retMap.insert( OPimEvent::FRPosition, recFields[ OPimRecurrence::RPosition ] ); 591 retMap.insert( OPimEvent::FRPosition, recFields[ OPimRecurrence::RPosition ] );
589 retMap.insert( OPimEvent::FRFreq, recFields[ OPimRecurrence::RFreq ] ); 592 retMap.insert( OPimEvent::FRFreq, recFields[ OPimRecurrence::RFreq ] );
590 retMap.insert( OPimEvent::FRHasEndDate, recFields[ OPimRecurrence::RHasEndDate ] ); 593 retMap.insert( OPimEvent::FRHasEndDate, recFields[ OPimRecurrence::RHasEndDate ] );
591 retMap.insert( OPimEvent::FREndDate, recFields[ OPimRecurrence::EndDate ] ); 594 retMap.insert( OPimEvent::FREndDate, recFields[ OPimRecurrence::EndDate ] );
592 retMap.insert( OPimEvent::FRCreated, recFields[ OPimRecurrence::Created ] ); 595 retMap.insert( OPimEvent::FRCreated, recFields[ OPimRecurrence::Created ] );
593 retMap.insert( OPimEvent::FRExceptions, recFields[ OPimRecurrence::Exceptions ] ); 596 retMap.insert( OPimEvent::FRExceptions, recFields[ OPimRecurrence::Exceptions ] );
594 } 597 }
595 else 598 else
596 { 599 {
597 OPimRecurrence recur = recurrence(); 600 OPimRecurrence recur = recurrence();
598 QMap<int, QString> recFields = recur.toMap(); 601 QMap<int, QString> recFields = recur.toMap();
599 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); 602 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] );
600 } 603 }
601 604
602 return retMap; 605 return retMap;
603} 606}
604 607
605 608
606void OPimEvent::fromMap( const QMap<int, QString>& map ) 609void OPimEvent::fromMap( const QMap<int, QString>& map )
607{ 610{
608 611
609 // We just want to set the UID if it is really stored. 612 // We just want to set the UID if it is really stored.
610 if ( !map[ OPimEvent::FUid ].isEmpty() ) 613 if ( !map[ OPimEvent::FUid ].isEmpty() )
611 setUid( map[ OPimEvent::FUid ].toInt() ); 614 setUid( map[ OPimEvent::FUid ].toInt() );
612 615
613 setCategories( idsFromString( map[ OPimEvent::FCategories ] ) ); 616 setCategories( idsFromString( map[ OPimEvent::FCategories ] ) );
614 setDescription( map[ OPimEvent::FDescription ] ); 617 setDescription( map[ OPimEvent::FDescription ] );
615 setLocation( map[ OPimEvent::FLocation ] ); 618 setLocation( map[ OPimEvent::FLocation ] );
616 619
617 if ( map[ OPimEvent::FType ] == "AllDay" ) 620 if ( map[ OPimEvent::FType ] == "AllDay" )
618 setAllDay( true ); 621 setAllDay( true );
619 else 622 else
620 setAllDay( false ); 623 setAllDay( false );
621 624
622 int alarmTime = -1;
623 if ( !map[ OPimEvent::FAlarm ].isEmpty() )
624 alarmTime = map[ OPimEvent::FAlarm ].toInt();
625
626 int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
627 if ( ( alarmTime != -1 ) )
628 {
629 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
630 OPimAlarm al( sound , dt );
631 notifiers().add( al );
632 }
633 if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) 625 if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) )
634 { 626 {
635 setTimeZone( map[ OPimEvent::FTimeZone ] ); 627 setTimeZone( map[ OPimEvent::FTimeZone ] );
636 } 628 }
637 629
638 time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); 630 time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong();
639 time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); 631 time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong();
640 632
641 /* AllDay is always in UTC */ 633 /* AllDay is always in UTC */
642 if ( isAllDay() ) 634 if ( isAllDay() )
643 { 635 {
644 OPimTimeZone utc = OPimTimeZone::utc(); 636 OPimTimeZone utc = OPimTimeZone::utc();
645 setStartDateTime( utc.fromUTCDateTime( start ) ); 637 setStartDateTime( utc.fromUTCDateTime( start ) );
646 setEndDateTime ( utc.fromUTCDateTime( end ) ); 638 setEndDateTime ( utc.fromUTCDateTime( end ) );
647 setTimeZone( "UTC" ); // make sure it is really utc 639 setTimeZone( "UTC" ); // make sure it is really utc
648 } 640 }
649 else 641 else
650 { 642 {
651 /* to current date time */ 643 /* to current date time */
652 // qWarning(" Start is %d", start ); 644 // qWarning(" Start is %d", start );
653 OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); 645 OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() );
654 QDateTime date = zone.toDateTime( start ); 646 QDateTime date = zone.toDateTime( start );
655 qWarning( " Start is %s", date.toString().latin1() ); 647 qWarning( " Start is %s", date.toString().latin1() );
656 setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); 648 setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) );
657 649
658 date = zone.toDateTime( end ); 650 date = zone.toDateTime( end );
659 setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); 651 setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) );
660 } 652 }
661 653
654 int alarmTime = -1;
655 if ( !map[ OPimEvent::FAlarm ].isEmpty() )
656 alarmTime = map[ OPimEvent::FAlarm ].toInt();
657
658 int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
659 if ( ( alarmTime != -1 ) )
660 {
661 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
662 OPimAlarm al( sound , dt );
663 notifiers().add( al );
664 }
665
666
667 if ( !map[ OPimEvent::FNote ].isEmpty() )
668 setNote( map[ OPimEvent::FNote ] );
669
662 if ( !map[ OPimEvent::FRecParent ].isEmpty() ) 670 if ( !map[ OPimEvent::FRecParent ].isEmpty() )
663 setParent( map[ OPimEvent::FRecParent ].toInt() ); 671 setParent( map[ OPimEvent::FRecParent ].toInt() );
664 672
665 if ( !map[ OPimEvent::FRecChildren ].isEmpty() ) 673 if ( !map[ OPimEvent::FRecChildren ].isEmpty() )
666 { 674 {
667 QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] ); 675 QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] );
668 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 676 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
669 { 677 {
670 addChild( ( *it ).toInt() ); 678 addChild( ( *it ).toInt() );
671 } 679 }
672 } 680 }
673 681
674 // Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap.. 682 // Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap..
675 if ( !map[ OPimEvent::FRType ].isEmpty() ) 683 if ( !map[ OPimEvent::FRType ].isEmpty() )
676 { 684 {
677 QMap<int, QString> recFields; 685 QMap<int, QString> recFields;
678 recFields.insert( OPimRecurrence::RType, map[ OPimEvent::FRType ] ); 686 recFields.insert( OPimRecurrence::RType, map[ OPimEvent::FRType ] );
679 recFields.insert( OPimRecurrence::RWeekdays, map[ OPimEvent::FRWeekdays ] ); 687 recFields.insert( OPimRecurrence::RWeekdays, map[ OPimEvent::FRWeekdays ] );
680 recFields.insert( OPimRecurrence::RPosition, map[ OPimEvent::FRPosition ] ); 688 recFields.insert( OPimRecurrence::RPosition, map[ OPimEvent::FRPosition ] );
681 recFields.insert( OPimRecurrence::RFreq, map[ OPimEvent::FRFreq ] ); 689 recFields.insert( OPimRecurrence::RFreq, map[ OPimEvent::FRFreq ] );
682 recFields.insert( OPimRecurrence::RHasEndDate, map[ OPimEvent::FRHasEndDate ] ); 690 recFields.insert( OPimRecurrence::RHasEndDate, map[ OPimEvent::FRHasEndDate ] );
683 recFields.insert( OPimRecurrence::EndDate, map[ OPimEvent::FREndDate ] ); 691 recFields.insert( OPimRecurrence::EndDate, map[ OPimEvent::FREndDate ] );
684 recFields.insert( OPimRecurrence::Created, map[ OPimEvent::FRCreated ] ); 692 recFields.insert( OPimRecurrence::Created, map[ OPimEvent::FRCreated ] );
685 recFields.insert( OPimRecurrence::Exceptions, map[ OPimEvent::FRExceptions ] ); 693 recFields.insert( OPimRecurrence::Exceptions, map[ OPimEvent::FRExceptions ] );
686 OPimRecurrence recur( recFields ); 694 OPimRecurrence recur( recFields );
687 setRecurrence( recur ); 695 setRecurrence( recur );
688 } 696 }
689 697
690} 698}
691 699
692 700
693int OPimEvent::parent() const 701int OPimEvent::parent() const
694{ 702{
695 return data->parent; 703 return data->parent;
696} 704}
697 705
698 706
699void OPimEvent::setParent( int uid ) 707void OPimEvent::setParent( int uid )
700{ 708{
701 changeOrModify(); 709 changeOrModify();
702 data->parent = uid; 710 data->parent = uid;
703} 711}
704 712
705 713
706QArray<int> OPimEvent::children() const 714QArray<int> OPimEvent::children() const
707{ 715{
708 if ( !data->child ) return QArray<int>(); 716 if ( !data->child ) return QArray<int>();
709 else 717 else
710 return data->child->copy(); 718 return data->child->copy();
711} 719}
712 720
713 721
714void OPimEvent::setChildren( const QArray<int>& arr ) 722void OPimEvent::setChildren( const QArray<int>& arr )
715{ 723{
716 changeOrModify(); 724 changeOrModify();
717 if ( data->child ) delete data->child; 725 if ( data->child ) delete data->child;
718 726
719 data->child = new QArray<int>( arr ); 727 data->child = new QArray<int>( arr );
720 data->child->detach(); 728 data->child->detach();
721} 729}
722 730
723 731
724void OPimEvent::addChild( int uid ) 732void OPimEvent::addChild( int uid )
725{ 733{
726 changeOrModify(); 734 changeOrModify();
727 if ( !data->child ) 735 if ( !data->child )
728 { 736 {
729 data->child = new QArray<int>( 1 ); 737 data->child = new QArray<int>( 1 );
730 ( *data->child ) [ 0 ] = uid; 738 ( *data->child ) [ 0 ] = uid;
731 } 739 }
732 else 740 else
733 { 741 {
734 int count = data->child->count(); 742 int count = data->child->count();
735 data->child->resize( count + 1 ); 743 data->child->resize( count + 1 );
736 ( *data->child ) [ count ] = uid; 744 ( *data->child ) [ count ] = uid;
737 } 745 }
738} 746}
739 747
740 748
741void OPimEvent::removeChild( int uid ) 749void OPimEvent::removeChild( int uid )
742{ 750{
743 if ( !data->child || !data->child->contains( uid ) ) return ; 751 if ( !data->child || !data->child->contains( uid ) ) return ;
744 changeOrModify(); 752 changeOrModify();
745 QArray<int> newAr( data->child->count() - 1 ); 753 QArray<int> newAr( data->child->count() - 1 );
746 int j = 0; 754 int j = 0;
747 uint count = data->child->count(); 755 uint count = data->child->count();
748 for ( uint i = 0; i < count; i++ ) 756 for ( uint i = 0; i < count; i++ )
749 { 757 {
750 if ( ( *data->child ) [ i ] != uid ) 758 if ( ( *data->child ) [ i ] != uid )
751 { 759 {
752 newAr[ j ] = ( *data->child ) [ i ]; 760 newAr[ j ] = ( *data->child ) [ i ];
753 j++; 761 j++;
754 } 762 }
755 } 763 }
756 ( *data->child ) = newAr; 764 ( *data->child ) = newAr;
757} 765}
758 766
759 767
760struct OEffectiveEvent::Data : public QShared 768struct OEffectiveEvent::Data : public QShared
761{ 769{
762 Data() : QShared() 770 Data() : QShared()
763 {} 771 {}
764 OPimEvent event; 772 OPimEvent event;
765 QDate date; 773 QDate date;
766 QTime start, end; 774 QTime start, end;
767 QDate startDate, endDate; 775 QDate startDate, endDate;
768bool dates : 1; 776bool dates : 1;
769}; 777};
770 778
771 779
772OEffectiveEvent::OEffectiveEvent() 780OEffectiveEvent::OEffectiveEvent()
773{ 781{
774 data = new Data; 782 data = new Data;
775 data->date = QDate::currentDate(); 783 data->date = QDate::currentDate();
776 data->start = data->end = QTime::currentTime(); 784 data->start = data->end = QTime::currentTime();
777 data->dates = false; 785 data->dates = false;
778} 786}
779 787
780 788
781OEffectiveEvent::OEffectiveEvent( const OPimEvent& ev, const QDate& startDate, 789OEffectiveEvent::OEffectiveEvent( const OPimEvent& ev, const QDate& startDate,
782 Position pos ) 790 Position pos )
783{ 791{
784 data = new Data; 792 data = new Data;
785 data->event = ev; 793 data->event = ev;
786 data->date = startDate; 794 data->date = startDate;
787 if ( pos & Start ) 795 if ( pos & Start )
788 data->start = ev.startDateTime().time(); 796 data->start = ev.startDateTime().time();
789 else 797 else
790 data->start = QTime( 0, 0, 0 ); 798 data->start = QTime( 0, 0, 0 );
791 799
792 if ( pos & End ) 800 if ( pos & End )
793 data->end = ev.endDateTime().time(); 801 data->end = ev.endDateTime().time();
794 else 802 else
795 data->end = QTime( 23, 59, 59 ); 803 data->end = QTime( 23, 59, 59 );
796 804
797 data->dates = false; 805 data->dates = false;
798} 806}
799 807
800 808
801OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev ) 809OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev )
802{ 810{
803 data = ev.data; 811 data = ev.data;
804 data->ref(); 812 data->ref();
805} 813}
806 814
807 815
808OEffectiveEvent::~OEffectiveEvent() 816OEffectiveEvent::~OEffectiveEvent()
809{ 817{
810 if ( data->deref() ) 818 if ( data->deref() )
811 { 819 {
812 delete data; 820 delete data;
813 data = 0; 821 data = 0;
814 } 822 }
815} 823}
816 824
817 825
818OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) 826OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev )
819{ 827{
820 if ( *this == ev ) return * this; 828 if ( *this == ev ) return * this;
821 829
822 ev.data->ref(); 830 ev.data->ref();
823 deref(); 831 deref();
824 data = ev.data; 832 data = ev.data;
825 833
826 return *this; 834 return *this;
827} 835}
828 836
829 837
830void OEffectiveEvent::setStartTime( const QTime& ti ) 838void OEffectiveEvent::setStartTime( const QTime& ti )
831{ 839{
832 changeOrModify(); 840 changeOrModify();
833 data->start = ti; 841 data->start = ti;
834} 842}
835 843
836 844
837void OEffectiveEvent::setEndTime( const QTime& en ) 845void OEffectiveEvent::setEndTime( const QTime& en )
838{ 846{
839 changeOrModify(); 847 changeOrModify();
840 data->end = en; 848 data->end = en;
841} 849}
842 850
843 851
844void OEffectiveEvent::setEvent( const OPimEvent& ev ) 852void OEffectiveEvent::setEvent( const OPimEvent& ev )
845{ 853{
846 changeOrModify(); 854 changeOrModify();
847 data->event = ev; 855 data->event = ev;
848} 856}
849 857
850 858
851void OEffectiveEvent::setDate( const QDate& da ) 859void OEffectiveEvent::setDate( const QDate& da )
852{ 860{
853 changeOrModify(); 861 changeOrModify();
diff --git a/libopie2/opiepim/core/opimevent.h b/libopie2/opiepim/core/opimevent.h
index 56fe917..5553cac 100644
--- a/libopie2/opiepim/core/opimevent.h
+++ b/libopie2/opiepim/core/opimevent.h
@@ -1,274 +1,274 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de> 3 Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29// CONTAINS GPLed code of TT 29// CONTAINS GPLed code of TT
30 30
31#ifndef OEVENT_H 31#ifndef OEVENT_H
32#define OEVENT_H 32#define OEVENT_H
33 33
34/* OPIE */ 34/* OPIE */
35#include <opie2/opimtimezone.h> 35#include <opie2/opimtimezone.h>
36#include <opie2/opimrecord.h> 36#include <opie2/opimrecord.h>
37#include <qpe/recordfields.h> 37#include <qpe/recordfields.h>
38#include <qpe/palmtopuidgen.h> 38#include <qpe/palmtopuidgen.h>
39 39
40/* QT */ 40/* QT */
41#include <qstring.h> 41#include <qstring.h>
42#include <qdatetime.h> 42#include <qdatetime.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44 44
45namespace Opie 45namespace Opie
46{ 46{
47struct OCalendarHelper 47struct OCalendarHelper
48{ 48{
49 /** calculate the week number of the date */ 49 /** calculate the week number of the date */
50 static int week( const QDate& ); 50 static int week( const QDate& );
51 /** calculate the occurence of week days since the start of the month */ 51 /** calculate the occurence of week days since the start of the month */
52 static int ocurrence( const QDate& ); 52 static int ocurrence( const QDate& );
53 53
54 // returns the dayOfWeek for the *first* day it finds (ignores 54 // returns the dayOfWeek for the *first* day it finds (ignores
55 // any further days!). Returns 1 (Monday) if there isn't any day found 55 // any further days!). Returns 1 (Monday) if there isn't any day found
56 static int dayOfWeek( char day ); 56 static int dayOfWeek( char day );
57 57
58 /** returns the diff of month */ 58 /** returns the diff of month */
59 static int monthDiff( const QDate& first, const QDate& second ); 59 static int monthDiff( const QDate& first, const QDate& second );
60 60
61}; 61};
62 62
63class OPimNotifyManager; 63class OPimNotifyManager;
64class OPimRecurrence; 64class OPimRecurrence;
65 65
66/** 66/**
67 * This is the container for all Events. It encapsules all 67 * This is the container for all Events. It encapsules all
68 * available information for a single Event 68 * available information for a single Event
69 * @short container for events. 69 * @short container for events.
70 */ 70 */
71class OPimEvent : public OPimRecord 71class OPimEvent : public OPimRecord
72{ 72{
73 public: 73 public:
74 typedef QValueList<OPimEvent> ValueList; 74 typedef QValueList<OPimEvent> ValueList;
75 /** 75 /**
76 * RecordFields contain possible attributes 76 * RecordFields contain possible attributes
77 * used in the Results of toMap().. 77 * used in the Results of toMap()..
78 */ 78 */
79 enum RecordFields { 79 enum RecordFields {
80 FUid = Qtopia::UID_ID, 80 FUid = Qtopia::UID_ID,
81 FCategories = Qtopia::CATEGORY_ID, 81 FCategories = Qtopia::CATEGORY_ID,
82 FDescription = 0, 82 FDescription /* = 0 Why this ? (eilers) */,
83 FLocation, 83 FLocation,
84 FType, 84 FType,
85 FAlarm, 85 FAlarm,
86 FSound, 86 FSound,
87 FRType, 87 FRType,
88 FRWeekdays, 88 FRWeekdays,
89 FRPosition, 89 FRPosition,
90 FRFreq, 90 FRFreq,
91 FRHasEndDate, 91 FRHasEndDate,
92 FREndDate, 92 FREndDate,
93 FRCreated, 93 FRCreated,
94 FRExceptions, 94 FRExceptions,
95 FStart, 95 FStart,
96 FEnd, 96 FEnd,
97 FNote, 97 FNote,
98 FTimeZone, 98 FTimeZone,
99 FRecParent, 99 FRecParent,
100 FRecChildren, 100 FRecChildren,
101 }; 101 };
102 102
103 /** 103 /**
104 * Start with an Empty OPimEvent. UID == 0 means that it is empty 104 * Start with an Empty OPimEvent. UID == 0 means that it is empty
105 */ 105 */
106 OPimEvent( int uid = 0 ); 106 OPimEvent( int uid = 0 );
107 107
108 /** 108 /**
109 * copy c'tor 109 * copy c'tor
110 */ 110 */
111 OPimEvent( const OPimEvent& ); 111 OPimEvent( const OPimEvent& );
112 112
113 /** 113 /**
114 * Create OPimEvent, initialized by map 114 * Create OPimEvent, initialized by map
115 * @see enum RecordFields 115 * @see enum RecordFields
116 */ 116 */
117 OPimEvent( const QMap<int, QString> map ); 117 OPimEvent( const QMap<int, QString> map );
118 ~OPimEvent(); 118 ~OPimEvent();
119 OPimEvent &operator=( const OPimEvent& ); 119 OPimEvent &operator=( const OPimEvent& );
120 120
121 QString description() const; 121 QString description() const;
122 void setDescription( const QString& description ); 122 void setDescription( const QString& description );
123 123
124 QString location() const; 124 QString location() const;
125 void setLocation( const QString& loc ); 125 void setLocation( const QString& loc );
126 126
127 bool hasNotifiers() const; 127 bool hasNotifiers() const;
128 OPimNotifyManager &notifiers() const; 128 OPimNotifyManager &notifiers() const;
129 129
130 OPimRecurrence recurrence() const; 130 OPimRecurrence recurrence() const;
131 void setRecurrence( const OPimRecurrence& ); 131 void setRecurrence( const OPimRecurrence& );
132 bool hasRecurrence() const; 132 bool hasRecurrence() const;
133 133
134 QString note() const; 134 QString note() const;
135 void setNote( const QString& note ); 135 void setNote( const QString& note );
136 136
137 137
138 QDateTime createdDateTime() const; 138 QDateTime createdDateTime() const;
139 void setCreatedDateTime( const QDateTime& dt ); 139 void setCreatedDateTime( const QDateTime& dt );
140 140
141 /** set the date to dt. dt is the QDateTime in localtime */ 141 /** set the date to dt. dt is the QDateTime in localtime */
142 void setStartDateTime( const QDateTime& ); 142 void setStartDateTime( const QDateTime& );
143 /** returns the datetime in the local timeZone */ 143 /** returns the datetime in the local timeZone */
144 QDateTime startDateTime() const; 144 QDateTime startDateTime() const;
145 145
146 /** returns the start datetime in the current zone */ 146 /** returns the start datetime in the current zone */
147 QDateTime startDateTimeInZone() const; 147 QDateTime startDateTimeInZone() const;
148 148
149 /** in current timezone */ 149 /** in current timezone */
150 void setEndDateTime( const QDateTime& ); 150 void setEndDateTime( const QDateTime& );
151 /** in current timezone */ 151 /** in current timezone */
152 QDateTime endDateTime() const; 152 QDateTime endDateTime() const;
153 QDateTime endDateTimeInZone() const; 153 QDateTime endDateTimeInZone() const;
154 154
155 bool isMultipleDay() const; 155 bool isMultipleDay() const;
156 bool isAllDay() const; 156 bool isAllDay() const;
157 void setAllDay( bool isAllDay ); 157 void setAllDay( bool isAllDay );
158 158
159 /* pin this event to a timezone! FIXME */ 159 /* pin this event to a timezone! FIXME */
160 void setTimeZone( const QString& timeZone ); 160 void setTimeZone( const QString& timeZone );
161 QString timeZone() const; 161 QString timeZone() const;
162 162
163 163
164 virtual bool match( const QRegExp& ) const; 164 virtual bool match( const QRegExp& ) const;
165 165
166 /** For exception to recurrence here is a list of children... */ 166 /** For exception to recurrence here is a list of children... */
167 QArray<int> children() const; 167 QArray<int> children() const;
168 void setChildren( const QArray<int>& ); 168 void setChildren( const QArray<int>& );
169 void addChild( int uid ); 169 void addChild( int uid );
170 void removeChild( int uid ); 170 void removeChild( int uid );
171 171
172 /** return the parent OPimEvent */ 172 /** return the parent OPimEvent */
173 int parent() const; 173 int parent() const;
174 void setParent( int uid ); 174 void setParent( int uid );
175 175
176 176
177 /* needed reimp */ 177 /* needed reimp */
178 QString toRichText() const; 178 QString toRichText() const;
179 QString toShortText() const; 179 QString toShortText() const;
180 QString type() const; 180 QString type() const;
181 181
182 QMap<int, QString> toMap() const; 182 QMap<int, QString> toMap() const;
183 void fromMap( const QMap<int, QString>& map ); 183 void fromMap( const QMap<int, QString>& map );
184 QString recordField( int ) const; 184 QString recordField( int ) const;
185 185
186 int rtti() const; 186 int rtti() const;
187 187
188 bool loadFromStream( QDataStream& ); 188 bool loadFromStream( QDataStream& );
189 bool saveToStream( QDataStream& ) const; 189 bool saveToStream( QDataStream& ) const;
190 190
191 /* bool operator==( const OPimEvent& ); 191 /* bool operator==( const OPimEvent& );
192 bool operator!=( const OPimEvent& ); 192 bool operator!=( const OPimEvent& );
193 bool operator<( const OPimEvent& ); 193 bool operator<( const OPimEvent& );
194 bool operator<=( const OPimEvent& ); 194 bool operator<=( const OPimEvent& );
195 bool operator>( const OPimEvent& ); 195 bool operator>( const OPimEvent& );
196 bool operator>=(const OPimEvent& ); 196 bool operator>=(const OPimEvent& );
197 */ 197 */
198 198
199 private: 199 private:
200 inline void changeOrModify(); 200 inline void changeOrModify();
201 void deref(); 201 void deref();
202 struct Data; 202 struct Data;
203 Data* data; 203 Data* data;
204 class Private; 204 class Private;
205 Private* priv; 205 Private* priv;
206 206
207}; 207};
208 208
209/** 209/**
210 * AN Event can span through multiple days. We split up a multiday eve 210 * AN Event can span through multiple days. We split up a multiday eve
211 */ 211 */
212class OEffectiveEvent 212class OEffectiveEvent
213{ 213{
214 214
215 public: 215 public:
216 typedef QValueList<OEffectiveEvent> ValueList; 216 typedef QValueList<OEffectiveEvent> ValueList;
217 enum Position { MidWay, Start, End, StartEnd }; 217 enum Position { MidWay, Start, End, StartEnd };
218 // If we calculate the effective event of a multi-day event 218 // If we calculate the effective event of a multi-day event
219 // we have to figure out whether we are at the first day, 219 // we have to figure out whether we are at the first day,
220 // at the end, or anywhere else ("middle"). This is important 220 // at the end, or anywhere else ("middle"). This is important
221 // for the start/end times (00:00/23:59) 221 // for the start/end times (00:00/23:59)
222 // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi- 222 // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi-
223 // day event 223 // day event
224 // Start: start time -> 23:59 224 // Start: start time -> 23:59
225 // End: 00:00 -> end time 225 // End: 00:00 -> end time
226 // Start | End == StartEnd: for single-day events (default) 226 // Start | End == StartEnd: for single-day events (default)
227 // here we draw start time -> end time 227 // here we draw start time -> end time
228 OEffectiveEvent(); 228 OEffectiveEvent();
229 OEffectiveEvent( const OPimEvent& event, const QDate& startDate, Position pos = StartEnd ); 229 OEffectiveEvent( const OPimEvent& event, const QDate& startDate, Position pos = StartEnd );
230 OEffectiveEvent( const OEffectiveEvent& ); 230 OEffectiveEvent( const OEffectiveEvent& );
231 OEffectiveEvent &operator=( const OEffectiveEvent& ); 231 OEffectiveEvent &operator=( const OEffectiveEvent& );
232 ~OEffectiveEvent(); 232 ~OEffectiveEvent();
233 233
234 void setStartTime( const QTime& ); 234 void setStartTime( const QTime& );
235 void setEndTime( const QTime& ); 235 void setEndTime( const QTime& );
236 void setEvent( const OPimEvent& ); 236 void setEvent( const OPimEvent& );
237 void setDate( const QDate& ); 237 void setDate( const QDate& );
238 238
239 void setEffectiveDates( const QDate& from, const QDate& to ); 239 void setEffectiveDates( const QDate& from, const QDate& to );
240 240
241 QString description() const; 241 QString description() const;
242 QString location() const; 242 QString location() const;
243 QString note() const; 243 QString note() const;
244 OPimEvent event() const; 244 OPimEvent event() const;
245 QTime startTime() const; 245 QTime startTime() const;
246 QTime endTime() const; 246 QTime endTime() const;
247 QDate date() const; 247 QDate date() const;
248 248
249 /* return the length in hours */ 249 /* return the length in hours */
250 int length() const; 250 int length() const;
251 int size() const; 251 int size() const;
252 252
253 QDate startDate() const; 253 QDate startDate() const;
254 QDate endDate() const; 254 QDate endDate() const;
255 255
256 bool operator<( const OEffectiveEvent &e ) const; 256 bool operator<( const OEffectiveEvent &e ) const;
257 bool operator<=( const OEffectiveEvent &e ) const; 257 bool operator<=( const OEffectiveEvent &e ) const;
258 bool operator==( const OEffectiveEvent &e ) const; 258 bool operator==( const OEffectiveEvent &e ) const;
259 bool operator!=( const OEffectiveEvent &e ) const; 259 bool operator!=( const OEffectiveEvent &e ) const;
260 bool operator>( const OEffectiveEvent &e ) const; 260 bool operator>( const OEffectiveEvent &e ) const;
261 bool operator>= ( const OEffectiveEvent &e ) const; 261 bool operator>= ( const OEffectiveEvent &e ) const;
262 262
263 private: 263 private:
264 void deref(); 264 void deref();
265 inline void changeOrModify(); 265 inline void changeOrModify();
266 class Private; 266 class Private;
267 Private* priv; 267 Private* priv;
268 struct Data; 268 struct Data;
269 Data* data; 269 Data* data;
270 270
271}; 271};
272 272
273} 273}
274 274