summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2002-10-13 19:05:24 (UTC)
committer zecke <zecke>2002-10-13 19:05:24 (UTC)
commit34c1199becdb2f9b0447553e66c85d8f6770558f (patch) (unidiff)
tree36c3bf20b6f07e643f4caef793356261f9982bd6 /libopie2
parenta469689def798954c0f571a00cc52e87d6b008ce (diff)
downloadopie-34c1199becdb2f9b0447553e66c85d8f6770558f.zip
opie-34c1199becdb2f9b0447553e66c85d8f6770558f.tar.gz
opie-34c1199becdb2f9b0447553e66c85d8f6770558f.tar.bz2
Add a vCal Resource
Play a bit with cahce sizes The idea is to have the current page and the prior page cached... still looking how to do that
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp9
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp192
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.h35
3 files changed, 232 insertions, 4 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index ea8b3c9..9ef6b7c 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -161,276 +161,277 @@ namespace {
161 return qu; 161 return qu;
162 } 162 }
163 163
164 RemoveQuery::RemoveQuery(int uid ) 164 RemoveQuery::RemoveQuery(int uid )
165 : OSQLQuery(), m_uid( uid ) {} 165 : OSQLQuery(), m_uid( uid ) {}
166 RemoveQuery::~RemoveQuery() {} 166 RemoveQuery::~RemoveQuery() {}
167 QString RemoveQuery::query()const { 167 QString RemoveQuery::query()const {
168 QString qu = "DELETE from todolist where uid = " + QString::number(m_uid); 168 QString qu = "DELETE from todolist where uid = " + QString::number(m_uid);
169 return qu; 169 return qu;
170 } 170 }
171 171
172 172
173 ClearQuery::ClearQuery() 173 ClearQuery::ClearQuery()
174 : OSQLQuery() {} 174 : OSQLQuery() {}
175 ClearQuery::~ClearQuery() {} 175 ClearQuery::~ClearQuery() {}
176 QString ClearQuery::query()const { 176 QString ClearQuery::query()const {
177 QString qu = "drop table todolist"; 177 QString qu = "drop table todolist";
178 return qu; 178 return qu;
179 } 179 }
180 FindQuery::FindQuery(int uid) 180 FindQuery::FindQuery(int uid)
181 : OSQLQuery(), m_uid(uid ) { 181 : OSQLQuery(), m_uid(uid ) {
182 } 182 }
183 FindQuery::FindQuery(const QArray<int>& ints) 183 FindQuery::FindQuery(const QArray<int>& ints)
184 : OSQLQuery(), m_uids(ints){ 184 : OSQLQuery(), m_uids(ints){
185 } 185 }
186 FindQuery::~FindQuery() { 186 FindQuery::~FindQuery() {
187 } 187 }
188 QString FindQuery::query()const{ 188 QString FindQuery::query()const{
189 if (m_uids.count() == 0 ) 189 if (m_uids.count() == 0 )
190 return single(); 190 return single();
191 else 191 else
192 return multi(); 192 return multi();
193 } 193 }
194 QString FindQuery::single()const{ 194 QString FindQuery::single()const{
195 QString qu = "select uid, categories, completed, progress, summary, "; 195 QString qu = "select uid, categories, completed, progress, summary, ";
196 qu += "DueDate, priority, description from todolist where uid = " + QString::number(m_uid); 196 qu += "DueDate, priority, description from todolist where uid = " + QString::number(m_uid);
197 return qu; 197 return qu;
198 } 198 }
199 QString FindQuery::multi()const { 199 QString FindQuery::multi()const {
200 QString qu = "select uid, categories, completed, progress, summary, "; 200 QString qu = "select uid, categories, completed, progress, summary, ";
201 qu += "DueDate, priority, description from todolist where "; 201 qu += "DueDate, priority, description from todolist where ";
202 for (uint i = 0; i < m_uids.count(); i++ ) { 202 for (uint i = 0; i < m_uids.count(); i++ ) {
203 qu += " UID = " + QString::number( m_uids[i] ) + " OR"; 203 qu += " UID = " + QString::number( m_uids[i] ) + " OR";
204 } 204 }
205 qu.remove( qu.length()-2, 2 ); 205 qu.remove( qu.length()-2, 2 );
206 return qu; 206 return qu;
207 } 207 }
208 208
209 OverDueQuery::OverDueQuery(): OSQLQuery() {} 209 OverDueQuery::OverDueQuery(): OSQLQuery() {}
210 OverDueQuery::~OverDueQuery() {} 210 OverDueQuery::~OverDueQuery() {}
211 QString OverDueQuery::query()const { 211 QString OverDueQuery::query()const {
212 QDate date = QDate::currentDate(); 212 QDate date = QDate::currentDate();
213 QString str; 213 QString str;
214 str = QString("select uid from todolist where DueDate ='%1-%2-%3'").arg(date.year() ).arg(date.month() ).arg(date.day() ); 214 str = QString("select uid from todolist where DueDate ='%1-%2-%3'").arg(date.year() ).arg(date.month() ).arg(date.day() );
215 215
216 return str; 216 return str;
217 } 217 }
218 218
219 219
220 EffQuery::EffQuery( const QDate& start, const QDate& end, bool inc ) 220 EffQuery::EffQuery( const QDate& start, const QDate& end, bool inc )
221 : OSQLQuery(), m_start( start ), m_end( end ),m_inc(inc) {} 221 : OSQLQuery(), m_start( start ), m_end( end ),m_inc(inc) {}
222 EffQuery::~EffQuery() {} 222 EffQuery::~EffQuery() {}
223 QString EffQuery::query()const { 223 QString EffQuery::query()const {
224 return m_inc ? with() : out(); 224 return m_inc ? with() : out();
225 } 225 }
226 QString EffQuery::with()const { 226 QString EffQuery::with()const {
227 QString str; 227 QString str;
228 str = QString("select uid from todolist where ( DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6' ) OR DueDate = '0-0-0' ") 228 str = QString("select uid from todolist where ( DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6' ) OR DueDate = '0-0-0' ")
229 .arg( m_start.year() ).arg( m_start.month() ).arg( m_start.day() ) 229 .arg( m_start.year() ).arg( m_start.month() ).arg( m_start.day() )
230 .arg( m_end .year() ).arg( m_end .month() ).arg( m_end .day() ); 230 .arg( m_end .year() ).arg( m_end .month() ).arg( m_end .day() );
231 return str; 231 return str;
232 } 232 }
233 QString EffQuery::out()const { 233 QString EffQuery::out()const {
234 QString str; 234 QString str;
235 str = QString("select uid from todolist where DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6'") 235 str = QString("select uid from todolist where DueDate >= '%1-%2-%3' AND DueDate <= '%4-%5-%6'")
236 .arg(m_start.year() ).arg(m_start.month() ).arg( m_start.day() ) 236 .arg(m_start.year() ).arg(m_start.month() ).arg( m_start.day() )
237 .arg(m_end. year() ).arg(m_end. month() ).arg(m_end.day() ); 237 .arg(m_end. year() ).arg(m_end. month() ).arg(m_end.day() );
238 238
239 return str; 239 return str;
240 } 240 }
241}; 241};
242 242
243OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file ) 243OTodoAccessBackendSQL::OTodoAccessBackendSQL( const QString& file )
244 : OTodoAccessBackend(), m_dict(15), m_dirty(true) 244 : OTodoAccessBackend(), m_dict(15), m_dirty(true)
245{ 245{
246 QString fi = file; 246 QString fi = file;
247 if ( fi.isEmpty() ) 247 if ( fi.isEmpty() )
248 fi = Global::applicationFileName( "todolist", "todolist.db" ); 248 fi = Global::applicationFileName( "todolist", "todolist.db" );
249 OSQLManager man; 249 OSQLManager man;
250 m_driver = man.standard(); 250 m_driver = man.standard();
251 m_driver->setUrl(fi); 251 m_driver->setUrl(fi);
252 fillDict(); 252 fillDict();
253} 253}
254 254
255OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){ 255OTodoAccessBackendSQL::~OTodoAccessBackendSQL(){
256} 256}
257bool OTodoAccessBackendSQL::load(){ 257bool OTodoAccessBackendSQL::load(){
258 if (!m_driver->open() ) 258 if (!m_driver->open() )
259 return false; 259 return false;
260 260
261 CreateQuery creat; 261 CreateQuery creat;
262 OSQLResult res = m_driver->query(&creat ); 262 OSQLResult res = m_driver->query(&creat );
263 263
264 m_dirty = true; 264 m_dirty = true;
265 return true; 265 return true;
266} 266}
267bool OTodoAccessBackendSQL::reload(){ 267bool OTodoAccessBackendSQL::reload(){
268 return load(); 268 return load();
269} 269}
270 270
271bool OTodoAccessBackendSQL::save(){ 271bool OTodoAccessBackendSQL::save(){
272 return m_driver->close(); 272 return m_driver->close();
273} 273}
274QArray<int> OTodoAccessBackendSQL::allRecords()const { 274QArray<int> OTodoAccessBackendSQL::allRecords()const {
275 if (m_dirty ) 275 if (m_dirty )
276 update(); 276 update();
277 277
278 return m_uids; 278 return m_uids;
279} 279}
280QArray<int> OTodoAccessBackendSQL::queryByExample( const OTodo& , int ){ 280QArray<int> OTodoAccessBackendSQL::queryByExample( const OTodo& , int ){
281 QArray<int> ints(0); 281 QArray<int> ints(0);
282 return ints; 282 return ints;
283} 283}
284OTodo OTodoAccessBackendSQL::find(int uid ) const{ 284OTodo OTodoAccessBackendSQL::find(int uid ) const{
285 FindQuery query( uid ); 285 FindQuery query( uid );
286 return todo( m_driver->query(&query) ); 286 return todo( m_driver->query(&query) );
287 287
288} 288}
289#define CACHE 32
289OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, 290OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
290 uint cur, Frontend::CacheDirection dir ) const{ 291 uint cur, Frontend::CacheDirection dir ) const{
291 qWarning("searching for %d", uid ); 292 qWarning("searching for %d", uid );
292 QArray<int> search( 8 ); 293 QArray<int> search( CACHE );
293 uint size =0; 294 uint size =0;
294 OTodo to; 295 OTodo to;
295 296
296 // we try to cache 8 items 297 // we try to cache CACHE items
297 switch( dir ) { 298 switch( dir ) {
298 /* forward */ 299 /* forward */
299 case 0: 300 case 0:
300 for (uint i = cur; i < ints.count() && size < 8; i++ ) { 301 for (uint i = cur; i < ints.count() && size < CACHE; i++ ) {
301 qWarning("size %d %d", size, ints[i] ); 302 qWarning("size %d %d", size, ints[i] );
302 search[size] = ints[i]; 303 search[size] = ints[i];
303 size++; 304 size++;
304 } 305 }
305 break; 306 break;
306 /* reverse */ 307 /* reverse */
307 case 1: 308 case 1:
308 for (uint i = cur; i != 0 && size < 8; i-- ) { 309 for (uint i = cur; i != 0 && size < CACHE; i-- ) {
309 search[size] = ints[i]; 310 search[size] = ints[i];
310 size++; 311 size++;
311 } 312 }
312 break; 313 break;
313 } 314 }
314 search.resize( size ); 315 search.resize( size );
315 FindQuery query( search ); 316 FindQuery query( search );
316 OSQLResult res = m_driver->query( &query ); 317 OSQLResult res = m_driver->query( &query );
317 if ( res.state() != OSQLResult::Success ) 318 if ( res.state() != OSQLResult::Success )
318 return to; 319 return to;
319 320
320 return todo( res ); 321 return todo( res );
321} 322}
322void OTodoAccessBackendSQL::clear() { 323void OTodoAccessBackendSQL::clear() {
323 ClearQuery cle; 324 ClearQuery cle;
324 OSQLResult res = m_driver->query( &cle ); 325 OSQLResult res = m_driver->query( &cle );
325 CreateQuery qu; 326 CreateQuery qu;
326 res = m_driver->query(&qu); 327 res = m_driver->query(&qu);
327} 328}
328bool OTodoAccessBackendSQL::add( const OTodo& t) { 329bool OTodoAccessBackendSQL::add( const OTodo& t) {
329 InsertQuery ins( t ); 330 InsertQuery ins( t );
330 OSQLResult res = m_driver->query( &ins ); 331 OSQLResult res = m_driver->query( &ins );
331 332
332 if ( res.state() == OSQLResult::Failure ) 333 if ( res.state() == OSQLResult::Failure )
333 return false; 334 return false;
334 int c = m_uids.count(); 335 int c = m_uids.count();
335 m_uids.resize( c+1 ); 336 m_uids.resize( c+1 );
336 m_uids[c] = t.uid(); 337 m_uids[c] = t.uid();
337 338
338 return true; 339 return true;
339} 340}
340bool OTodoAccessBackendSQL::remove( int uid ) { 341bool OTodoAccessBackendSQL::remove( int uid ) {
341 RemoveQuery rem( uid ); 342 RemoveQuery rem( uid );
342 OSQLResult res = m_driver->query(&rem ); 343 OSQLResult res = m_driver->query(&rem );
343 344
344 if ( res.state() == OSQLResult::Failure ) 345 if ( res.state() == OSQLResult::Failure )
345 return false; 346 return false;
346 347
347 m_dirty = true; 348 m_dirty = true;
348 return true; 349 return true;
349} 350}
350/* 351/*
351 * FIXME better set query 352 * FIXME better set query
352 * but we need the cache for that 353 * but we need the cache for that
353 * now we remove 354 * now we remove
354 */ 355 */
355bool OTodoAccessBackendSQL::replace( const OTodo& t) { 356bool OTodoAccessBackendSQL::replace( const OTodo& t) {
356 remove( t.uid() ); 357 remove( t.uid() );
357 bool b= add(t); 358 bool b= add(t);
358 m_dirty = false; // we changed some stuff but the UID stayed the same 359 m_dirty = false; // we changed some stuff but the UID stayed the same
359 return b; 360 return b;
360} 361}
361QArray<int> OTodoAccessBackendSQL::overDue() { 362QArray<int> OTodoAccessBackendSQL::overDue() {
362 OverDueQuery qu; 363 OverDueQuery qu;
363 return uids( m_driver->query(&qu ) ); 364 return uids( m_driver->query(&qu ) );
364} 365}
365QArray<int> OTodoAccessBackendSQL::effectiveToDos( const QDate& s, 366QArray<int> OTodoAccessBackendSQL::effectiveToDos( const QDate& s,
366 const QDate& t, 367 const QDate& t,
367 bool u) { 368 bool u) {
368 EffQuery ef(s, t, u ); 369 EffQuery ef(s, t, u );
369 return uids (m_driver->query(&ef) ); 370 return uids (m_driver->query(&ef) );
370} 371}
371/* 372/*
372 * 373 *
373 */ 374 */
374QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder, 375QArray<int> OTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
375 int sortFilter, int cat ) { 376 int sortFilter, int cat ) {
376 qWarning("sorted %d, %d", asc, sortOrder ); 377 qWarning("sorted %d, %d", asc, sortOrder );
377 QString query; 378 QString query;
378 query = "select uid from todolist WHERE "; 379 query = "select uid from todolist WHERE ";
379 380
380 /* 381 /*
381 * Sort Filter stuff 382 * Sort Filter stuff
382 * not that straight forward 383 * not that straight forward
383 * 384 *
384 */ 385 */
385 /* Category */ 386 /* Category */
386 if ( sortFilter & 1 ) { 387 if ( sortFilter & 1 ) {
387 QString str; 388 QString str;
388 if (cat != 0 ) str = QString::number( cat ); 389 if (cat != 0 ) str = QString::number( cat );
389 query += " categories like '%" +str+"%' AND"; 390 query += " categories like '%" +str+"%' AND";
390 } 391 }
391 /* Show only overdue */ 392 /* Show only overdue */
392 if ( sortFilter & 2 ) { 393 if ( sortFilter & 2 ) {
393 QDate date = QDate::currentDate(); 394 QDate date = QDate::currentDate();
394 QString due; 395 QString due;
395 QString base; 396 QString base;
396 base = QString("DueDate <= '%1-%2-%3' AND completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() ); 397 base = QString("DueDate <= '%1-%2-%3' AND completed = 0").arg( date.year() ).arg( date.month() ).arg( date.day() );
397 query += " " + base + " AND"; 398 query += " " + base + " AND";
398 } 399 }
399 /* not show completed */ 400 /* not show completed */
400 if ( sortFilter & 4 ) { 401 if ( sortFilter & 4 ) {
401 query += " completed = 0 AND"; 402 query += " completed = 0 AND";
402 }else{ 403 }else{
403 query += " ( completed = 1 OR completed = 0) AND"; 404 query += " ( completed = 1 OR completed = 0) AND";
404 } 405 }
405 /* srtip the end */ 406 /* srtip the end */
406 query = query.remove( query.length()-3, 3 ); 407 query = query.remove( query.length()-3, 3 );
407 408
408 409
409 /* 410 /*
410 * sort order stuff 411 * sort order stuff
411 * quite straight forward 412 * quite straight forward
412 */ 413 */
413 query += "ORDER BY "; 414 query += "ORDER BY ";
414 switch( sortOrder ) { 415 switch( sortOrder ) {
415 /* completed */ 416 /* completed */
416 case 0: 417 case 0:
417 query += "completed"; 418 query += "completed";
418 break; 419 break;
419 case 1: 420 case 1:
420 query += "priority"; 421 query += "priority";
421 break; 422 break;
422 case 2: 423 case 2:
423 query += "description"; 424 query += "description";
424 break; 425 break;
425 case 3: 426 case 3:
426 query += "DueDate"; 427 query += "DueDate";
427 break; 428 break;
428 } 429 }
429 430
430 if ( !asc ) { 431 if ( !asc ) {
431 qWarning("not ascending!"); 432 qWarning("not ascending!");
432 query += " DESC"; 433 query += " DESC";
433 } 434 }
434 435
435 qWarning( query ); 436 qWarning( query );
436 OSQLRawQuery raw(query ); 437 OSQLRawQuery raw(query );
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
new file mode 100644
index 0000000..ac70ea0
--- a/dev/null
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -0,0 +1,192 @@
1#include <qfile.h>
2
3#include <qtopia/private/vobject_p.h>
4#include <qtopia/timeconversion.h>
5#include <qtopia/private/qfiledirect_p.h>
6
7#include "otodoaccessvcal.h"
8
9namespace {
10 static OTodo eventByVObj( VObject *obj ){
11 OTodo event;
12 VObject *ob;
13 QCString name;
14 // no uid, attendees, ... and no fun
15 // description
16 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){
17 name = vObjectStringZValue( ob );
18 event.setDescription( name );
19 }
20 // summary
21 if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) {
22 name = vObjectStringZValue( ob );
23 event.setSummary( name );
24 }
25 // completed
26 if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){
27 name = vObjectStringZValue( ob );
28 if( name == "COMPLETED" ){
29 event.setCompleted( true );
30 }else{
31 event.setCompleted( false );
32 }
33 }else
34 event.setCompleted( false );
35 // priority
36 if ((ob = isAPropertyOf(obj, VCPriorityProp))) {
37 name = vObjectStringZValue( ob );
38 bool ok;
39 event.setPriority(name.toInt(&ok) );
40 }
41 //due date
42 if((ob = isAPropertyOf(obj, VCDueProp)) ){
43 event.setHasDueDate( true );
44 name = vObjectStringZValue( ob );
45 event.setDueDate( TimeConversion::fromISO8601( name).date() );
46 }
47 // categories
48 if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){
49 name = vObjectStringZValue( ob );
50 qWarning("Categories:%s", name.data() );
51 }
52
53 event.setUid( 1 );
54 return event;
55 };
56 static VObject *vobjByEvent( const OTodo &event ) {
57 VObject *task = newVObject( VCTodoProp );
58 if( task == 0 )
59 return 0l;
60
61 if( event.hasDueDate() )
62 addPropValue( task, VCDueProp,
63 TimeConversion::toISO8601( event.dueDate() ) );
64
65 if( event.isCompleted() )
66 addPropValue( task, VCStatusProp, "COMPLETED");
67
68 QString string = QString::number(event.priority() );
69 addPropValue( task, VCPriorityProp, string.local8Bit() );
70
71 addPropValue( task, VCCategoriesProp,
72 event.idsToString( event.categories() ).local8Bit() );
73
74 addPropValue( task, VCDescriptionProp,
75 event.description().local8Bit() );
76
77 addPropValue( task, VCSummaryProp,
78 event.summary().local8Bit() );
79 return task;
80};
81}
82
83OTodoAccessVCal::OTodoAccessVCal( const QString& path )
84 : m_dirty(false), m_file( path )
85{
86}
87OTodoAccessVCal::~OTodoAccessVCal() {
88}
89bool OTodoAccessVCal::load() {
90 m_map.clear();
91 m_dirty = false;
92
93 VObject* vcal = 0l;
94 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
95 if (!vcal )
96 return false;
97
98 // Iterate over the list
99 VObjectIterator it;
100 VObject* vobj;
101
102 initPropIterator(&it, vcal);
103
104 while( moreIteration( &it ) ) {
105 vobj = ::nextVObject( &it );
106 QCString name = ::vObjectName( vobj );
107 if( name == VCTodoProp ){
108 OTodo to = eventByVObj( vobj );
109 m_map.insert( to.uid(), to );
110 }
111 }
112
113 // Should I do a delete vcal?
114
115 return true;
116}
117bool OTodoAccessVCal::reload() {
118 return load();
119}
120bool OTodoAccessVCal::save() {
121 if (!m_dirty )
122 return true;
123
124 QFileDirect file( m_file );
125 if (!file.open(IO_WriteOnly ) )
126 return false;
127
128 VObject *obj;
129 obj = newVObject( VCCalProp );
130 addPropValue( obj, VCVersionProp, "1.0" );
131 VObject *vo;
132 for(QMap<int, OTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
133 vo = vobjByEvent( it.data() );
134 addVObjectProp(obj, vo );
135 }
136 writeVObject( file.directHandle(), obj );
137 cleanVObject( obj );
138 cleanStrTbl();
139
140 m_dirty = false;
141 return true;
142}
143void OTodoAccessVCal::clear() {
144 m_map.clear();
145 m_dirty = true;
146}
147bool OTodoAccessVCal::add( const OTodo& to ) {
148 m_map.insert( to.uid(), to );
149 m_dirty = true;
150 return true;
151}
152bool OTodoAccessVCal::remove( int uid ) {
153 m_map.remove( uid );
154 m_dirty = true;
155 return true;
156}
157bool OTodoAccessVCal::replace( const OTodo& to ) {
158 m_map.replace( to.uid(), to );
159 m_dirty = true;
160 return true;
161}
162OTodo OTodoAccessVCal::find(int uid )const {
163 return m_map[uid];
164}
165QArray<int> OTodoAccessVCal::sorted( bool, int, int, int ) {
166 QArray<int> ar(0);
167 return ar;
168}
169QArray<int> OTodoAccessVCal::allRecords()const {
170 QArray<int> ar( m_map.count() );
171 QMap<int, OTodo>::ConstIterator it;
172 int i = 0;
173 for ( it = m_map.begin(); it != m_map.end(); ++it ) {
174 ar[i] = it.key();
175 i++;
176 }
177 return ar;
178}
179QArray<int> OTodoAccessVCal::queryByExample( const OTodo&, int ) {
180 QArray<int> ar(0);
181 return ar;
182}
183QArray<int> OTodoAccessVCal::effectiveToDos( const QDate& ,
184 const QDate& ,
185 bool ) {
186 QArray<int> ar(0);
187 return ar;
188}
189QArray<int> OTodoAccessVCal::overDue() {
190 QArray<int> ar(0);
191 return ar;
192}
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.h b/libopie2/opiepim/backend/otodoaccessvcal.h
new file mode 100644
index 0000000..4499a7e
--- a/dev/null
+++ b/libopie2/opiepim/backend/otodoaccessvcal.h
@@ -0,0 +1,35 @@
1#ifndef OPIE_OTODO_ACCESS_VCAL_H
2#define OPIE_OTODO_ACCESS_VCAL_H
3
4#include "otodoaccessbackend.h"
5
6class OTodoAccessVCal : public OTodoAccessBackend {
7public:
8 OTodoAccessVCal(const QString& );
9 ~OTodoAccessVCal();
10
11 bool load();
12 bool reload();
13 bool save();
14
15 QArray<int> allRecords()const;
16 QArray<int> queryByExample( const OTodo& t, int sort );
17 QArray<int> effectiveToDos( const QDate& start,
18 const QDate& end,
19 bool includeNoDates );
20 QArray<int> overDue();
21 QArray<int> sorted( bool asc, int sortOrder, int sortFilter,
22 int cat );
23 OTodo find(int uid)const;
24 void clear();
25 bool add( const OTodo& );
26 bool remove( int uid );
27 bool replace( const OTodo& );
28
29private:
30 bool m_dirty : 1;
31 QString m_file;
32 QMap<int, OTodo> m_map;
33};
34
35#endif