summaryrefslogtreecommitdiff
authorzecke <zecke>2003-05-07 17:49:07 (UTC)
committer zecke <zecke>2003-05-07 17:49:07 (UTC)
commitc13ada0f5e418b25b177e132ff2e1dfe7821577f (patch) (unidiff)
tree40e8d6cc67a1de638ef3c278fd827ba0cbea5b76
parentac895871f93dce9734189daf9cb95dbbda605096 (diff)
downloadopie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.zip
opie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.tar.gz
opie-c13ada0f5e418b25b177e132ff2e1dfe7821577f.tar.bz2
implement loading of Recurrence
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimnotifymanager.cpp3
-rw-r--r--libopie/pim/opimnotifymanager.h3
-rw-r--r--libopie/pim/orecur.cpp2
-rw-r--r--libopie/pim/otodoaccessxml.cpp72
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp72
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp3
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.h3
-rw-r--r--libopie2/opiepim/core/orecur.cpp2
8 files changed, 152 insertions, 8 deletions
diff --git a/libopie/pim/opimnotifymanager.cpp b/libopie/pim/opimnotifymanager.cpp
index be4a1c2..49af757 100644
--- a/libopie/pim/opimnotifymanager.cpp
+++ b/libopie/pim/opimnotifymanager.cpp
@@ -46,24 +46,27 @@ void OPimNotifyManager::setAlarms( const Alarms& al) {
46} 46}
47void OPimNotifyManager::setReminders( const Reminders& rem) { 47void OPimNotifyManager::setReminders( const Reminders& rem) {
48 m_rem = rem; 48 m_rem = rem;
49} 49}
50/* FIXME!!! */ 50/* FIXME!!! */
51/** 51/**
52 * The idea is to check if the provider for our service 52 * The idea is to check if the provider for our service
53 * is online 53 * is online
54 * if it is we will use QCOP 54 * if it is we will use QCOP
55 * if not the Factory to get the backend... 55 * if not the Factory to get the backend...
56 * Qtopia1.6 services would be kewl to have here.... 56 * Qtopia1.6 services would be kewl to have here....
57 */ 57 */
58void OPimNotifyManager::registerNotify( const OPimNotify& ) { 58void OPimNotifyManager::registerNotify( const OPimNotify& ) {
59 59
60} 60}
61/* FIXME!!! */ 61/* FIXME!!! */
62/** 62/**
63 * same as above... 63 * same as above...
64 * Also implement Url model 64 * Also implement Url model
65 * have a MainWindow.... 65 * have a MainWindow....
66 */ 66 */
67void OPimNotifyManager::deregister( const OPimNotify& ) { 67void OPimNotifyManager::deregister( const OPimNotify& ) {
68 68
69} 69}
70bool OPimNotifyManager::isEmpty()const {
71 return ( m_rem.isEmpty() && m_al.isEmpty() );
72}
diff --git a/libopie/pim/opimnotifymanager.h b/libopie/pim/opimnotifymanager.h
index 0eebc9b..0ac30a1 100644
--- a/libopie/pim/opimnotifymanager.h
+++ b/libopie/pim/opimnotifymanager.h
@@ -18,34 +18,37 @@ public:
18 /* we will cast it for you ;) */ 18 /* we will cast it for you ;) */
19 void add( const OPimNotify& ); 19 void add( const OPimNotify& );
20 void remove( const OPimNotify& ); 20 void remove( const OPimNotify& );
21 /* replaces all with this one! */ 21 /* replaces all with this one! */
22 void replace( const OPimNotify& ); 22 void replace( const OPimNotify& );
23 23
24 Reminders reminders()const; 24 Reminders reminders()const;
25 Alarms alarms()const; 25 Alarms alarms()const;
26 26
27 void setAlarms( const Alarms& ); 27 void setAlarms( const Alarms& );
28 void setReminders( const Reminders& ); 28 void setReminders( const Reminders& );
29 29
30 /* register is a Ansi C keyword... */ 30 /* register is a Ansi C keyword... */
31 /** 31 /**
32 * This function will register the Notify to the Alarm Server 32 * This function will register the Notify to the Alarm Server
33 * or datebook depending on the type of the notify 33 * or datebook depending on the type of the notify
34 */ 34 */
35 void registerNotify( const OPimNotify& ); 35 void registerNotify( const OPimNotify& );
36 36
37 /** 37 /**
38 * this will do the opposite.. 38 * this will do the opposite..
39 */ 39 */
40 void deregister( const OPimNotify& ); 40 void deregister( const OPimNotify& );
41 41
42
43 bool isEmpty()const;
44
42private: 45private:
43 Reminders m_rem; 46 Reminders m_rem;
44 Alarms m_al; 47 Alarms m_al;
45 48
46 class Private; 49 class Private;
47 Private *d; 50 Private *d;
48 51
49}; 52};
50 53
51#endif 54#endif
diff --git a/libopie/pim/orecur.cpp b/libopie/pim/orecur.cpp
index e3b45b4..eae1fdc 100644
--- a/libopie/pim/orecur.cpp
+++ b/libopie/pim/orecur.cpp
@@ -483,28 +483,28 @@ QString ORecur::toString()const {
483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; 483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\"";
484 if ( data->pos != 0 ) 484 if ( data->pos != 0 )
485 buf += " rposition=\"" + QString::number(data->pos ) + "\""; 485 buf += " rposition=\"" + QString::number(data->pos ) + "\"";
486 486
487 buf += " rfreq=\"" + QString::number( data->freq ) + "\""; 487 buf += " rfreq=\"" + QString::number( data->freq ) + "\"";
488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; 488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\"";
489 if ( data->hasEnd ) 489 if ( data->hasEnd )
490 buf += " enddt=\"" 490 buf += " enddt=\""
491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) 491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) )
492 + "\""; 492 + "\"";
493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; 493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\"";
494 494
495 if ( data->list.isEmpty() ) return buf; 495 if ( data->list.isEmpty() ) return buf;
496 // save exceptions list here!! 496 // save exceptions list here!!
497 ExceptionList::ConstIterator it; 497 ExceptionList::ConstIterator it;
498 ExceptionList list = data->list; 498 ExceptionList list = data->list;
499 buf += " exceptions=\""; 499 buf += " exceptions=\"";
500 QDate date; 500 QDate date;
501 for ( it = list.begin(); it != list.end(); ++it ) { 501 for ( it = list.begin(); it != list.end(); ++it ) {
502 date = (*it); 502 date = (*it);
503 if ( it != list.begin() ) buf += " "; 503 if ( it != list.begin() ) buf += " ";
504 504
505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); 505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
506 } 506 }
507 buf += "\""; 507 buf += "\" ";
508 508
509 return buf; 509 return buf;
510} 510}
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index c0d8dfc..71b6a7e 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -1,112 +1,137 @@
1#include <errno.h> 1#include <errno.h>
2#include <fcntl.h> 2#include <fcntl.h>
3 3
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include <sys/stat.h> 5#include <sys/stat.h>
6#include <sys/types.h> 6#include <sys/types.h>
7 7
8#include <unistd.h> 8#include <unistd.h>
9 9
10 10
11#include <qfile.h> 11#include <qfile.h>
12#include <qvector.h> 12#include <qvector.h>
13 13
14#include <qpe/global.h> 14#include <qpe/global.h>
15#include <qpe/stringutil.h> 15#include <qpe/stringutil.h>
16#include <qpe/timeconversion.h> 16#include <qpe/timeconversion.h>
17 17
18#include "otimezone.h"
18#include "orecur.h" 19#include "orecur.h"
19#include "otodoaccessxml.h" 20#include "otodoaccessxml.h"
20 21
21namespace { 22namespace {
23 time_t rp_end;
24 ORecur* rec;
25 ORecur *recur() {
26 if (!rec ) rec = new ORecur;
27 return rec;
28 }
29 int snd;
30 enum MoreAttributes {
31 FRType = OTodo::CompletedDate + 2,
32 FRWeekdays,
33 FRPosition,
34 FRFreq,
35 FRHasEndDate,
36 FREndDate,
37 FRStart,
38 FREnd
39 };
22 // FROM TT again 40 // FROM TT again
23char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) 41char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
24{ 42{
25 char needleChar; 43 char needleChar;
26 char haystackChar; 44 char haystackChar;
27 if (!needle || !haystack || !hLen || !nLen) 45 if (!needle || !haystack || !hLen || !nLen)
28 return 0; 46 return 0;
29 47
30 const char* hsearch = haystack; 48 const char* hsearch = haystack;
31 49
32 if ((needleChar = *needle++) != 0) { 50 if ((needleChar = *needle++) != 0) {
33 nLen--; //(to make up for needle++) 51 nLen--; //(to make up for needle++)
34 do { 52 do {
35 do { 53 do {
36 if ((haystackChar = *hsearch++) == 0) 54 if ((haystackChar = *hsearch++) == 0)
37 return (0); 55 return (0);
38 if (hsearch >= haystack + hLen) 56 if (hsearch >= haystack + hLen)
39 return (0); 57 return (0);
40 } while (haystackChar != needleChar); 58 } while (haystackChar != needleChar);
41 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); 59 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
42 hsearch--; 60 hsearch--;
43 } 61 }
44 return ((char *)hsearch); 62 return ((char *)hsearch);
45} 63}
46} 64}
47 65
48 66
49OTodoAccessXML::OTodoAccessXML( const QString& appName, 67OTodoAccessXML::OTodoAccessXML( const QString& appName,
50 const QString& fileName ) 68 const QString& fileName )
51 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) 69 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
52{ 70{
53 if (!fileName.isEmpty() ) 71 if (!fileName.isEmpty() )
54 m_file = fileName; 72 m_file = fileName;
55 else 73 else
56 m_file = Global::applicationFileName( "todolist", "todolist.xml" ); 74 m_file = Global::applicationFileName( "todolist", "todolist.xml" );
57} 75}
58OTodoAccessXML::~OTodoAccessXML() { 76OTodoAccessXML::~OTodoAccessXML() {
59 77
60} 78}
61bool OTodoAccessXML::load() { 79bool OTodoAccessXML::load() {
80 rec = 0;
62 m_opened = true; 81 m_opened = true;
63 m_changed = false; 82 m_changed = false;
64 /* initialize dict */ 83 /* initialize dict */
65 /* 84 /*
66 * UPDATE dict if you change anything!!! 85 * UPDATE dict if you change anything!!!
67 */ 86 */
68 QAsciiDict<int> dict(21); 87 QAsciiDict<int> dict(21);
69 dict.setAutoDelete( TRUE ); 88 dict.setAutoDelete( TRUE );
70 dict.insert("Categories" , new int(OTodo::Category) ); 89 dict.insert("Categories" , new int(OTodo::Category) );
71 dict.insert("Uid" , new int(OTodo::Uid) ); 90 dict.insert("Uid" , new int(OTodo::Uid) );
72 dict.insert("HasDate" , new int(OTodo::HasDate) ); 91 dict.insert("HasDate" , new int(OTodo::HasDate) );
73 dict.insert("Completed" , new int(OTodo::Completed) ); 92 dict.insert("Completed" , new int(OTodo::Completed) );
74 dict.insert("Description" , new int(OTodo::Description) ); 93 dict.insert("Description" , new int(OTodo::Description) );
75 dict.insert("Summary" , new int(OTodo::Summary) ); 94 dict.insert("Summary" , new int(OTodo::Summary) );
76 dict.insert("Priority" , new int(OTodo::Priority) ); 95 dict.insert("Priority" , new int(OTodo::Priority) );
77 dict.insert("DateDay" , new int(OTodo::DateDay) ); 96 dict.insert("DateDay" , new int(OTodo::DateDay) );
78 dict.insert("DateMonth" , new int(OTodo::DateMonth) ); 97 dict.insert("DateMonth" , new int(OTodo::DateMonth) );
79 dict.insert("DateYear" , new int(OTodo::DateYear) ); 98 dict.insert("DateYear" , new int(OTodo::DateYear) );
80 dict.insert("Progress" , new int(OTodo::Progress) ); 99 dict.insert("Progress" , new int(OTodo::Progress) );
81 dict.insert("Completed", new int(OTodo::Completed) ); 100 dict.insert("CompletedDate", new int(OTodo::CompletedDate) );
82 dict.insert("CrossReference", new int(OTodo::CrossReference) ); 101 dict.insert("CrossReference", new int(OTodo::CrossReference) );
83 dict.insert("State", new int(OTodo::State) ); 102 dict.insert("State", new int(OTodo::State) );
84 dict.insert("Recurrence", new int(OTodo::Recurrence) );
85 dict.insert("Alarms", new int(OTodo::Alarms) ); 103 dict.insert("Alarms", new int(OTodo::Alarms) );
86 dict.insert("Reminders", new int(OTodo::Reminders) ); 104 dict.insert("Reminders", new int(OTodo::Reminders) );
87 dict.insert("Notifiers", new int(OTodo::Notifiers) ); 105 dict.insert("Notifiers", new int(OTodo::Notifiers) );
88 dict.insert("Maintainer", new int(OTodo::Maintainer) ); 106 dict.insert("Maintainer", new int(OTodo::Maintainer) );
107 dict.insert("rtype", new int(FRType) );
108 dict.insert("rweekdays", new int(FRWeekdays) );
109 dict.insert("rposition", new int(FRPosition) );
110 dict.insert("rfreq", new int(FRFreq) );
111 dict.insert("start", new int(FRStart) );
112 dict.insert("rhasenddate", new int(FRHasEndDate) );
113 dict.insert("enddt", new int(FREndDate) );
89 114
90 // here the custom XML parser from TT it's GPL 115 // here the custom XML parser from TT it's GPL
91 // but we want to push OpiePIM... to TT..... 116 // but we want to push OpiePIM... to TT.....
92 // mmap part from zecke :) 117 // mmap part from zecke :)
93 int fd = ::open( QFile::encodeName(m_file).data(), O_RDONLY ); 118 int fd = ::open( QFile::encodeName(m_file).data(), O_RDONLY );
94 struct stat attribut; 119 struct stat attribut;
95 if ( fd < 0 ) return false; 120 if ( fd < 0 ) return false;
96 121
97 if ( fstat(fd, &attribut ) == -1 ) { 122 if ( fstat(fd, &attribut ) == -1 ) {
98 ::close( fd ); 123 ::close( fd );
99 return false; 124 return false;
100 } 125 }
101 void* map_addr = ::mmap(NULL, attribut.st_size, PROT_READ, MAP_SHARED, fd, 0 ); 126 void* map_addr = ::mmap(NULL, attribut.st_size, PROT_READ, MAP_SHARED, fd, 0 );
102 if ( map_addr == ( (caddr_t)-1) ) { 127 if ( map_addr == ( (caddr_t)-1) ) {
103 ::close(fd ); 128 ::close(fd );
104 return false; 129 return false;
105 } 130 }
106 /* advise the kernel who we want to read it */ 131 /* advise the kernel who we want to read it */
107 ::madvise( map_addr, attribut.st_size, MADV_SEQUENTIAL ); 132 ::madvise( map_addr, attribut.st_size, MADV_SEQUENTIAL );
108 /* we do not the file any more */ 133 /* we do not the file any more */
109 ::close( fd ); 134 ::close( fd );
110 135
111 char* dt = (char*)map_addr; 136 char* dt = (char*)map_addr;
112 int len = attribut.st_size; 137 int len = attribut.st_size;
@@ -160,50 +185,59 @@ bool OTodoAccessXML::load() {
160 i = j + 1; 185 i = j + 1;
161 186
162 QString str = (haveUtf ? QString::fromUtf8( value ) 187 QString str = (haveUtf ? QString::fromUtf8( value )
163 : QString::fromLatin1( value ) ); 188 : QString::fromLatin1( value ) );
164 if ( haveEnt ) 189 if ( haveEnt )
165 str = Qtopia::plainString( str ); 190 str = Qtopia::plainString( str );
166 191
167 /* 192 /*
168 * add key + value 193 * add key + value
169 */ 194 */
170 todo( &dict, ev, attr, str ); 195 todo( &dict, ev, attr, str );
171 196
172 } 197 }
173 /* 198 /*
174 * now add it 199 * now add it
175 */ 200 */
176 qWarning("End at %d", i ); 201 qWarning("End at %d", i );
177 if (m_events.contains( ev.uid() ) || ev.uid() == 0) { 202 if (m_events.contains( ev.uid() ) || ev.uid() == 0) {
178 ev.setUid( 1 ); 203 ev.setUid( 1 );
179 m_changed = true; 204 m_changed = true;
180 } 205 }
181 if ( ev.hasDueDate() ) { 206 if ( ev.hasDueDate() ) {
182 ev.setDueDate( QDate(m_year, m_month, m_day) ); 207 ev.setDueDate( QDate(m_year, m_month, m_day) );
183 } 208 }
209 if ( rec && rec->doesRecur() ) {
210 OTimeZone utc = OTimeZone::utc();
211 ORecur recu( *rec ); // call copy c'tor
212 recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() );
213 recu.setStart( ev.dueDate() );
214 ev.setRecurrence( recu );
215 }
184 m_events.insert(ev.uid(), ev ); 216 m_events.insert(ev.uid(), ev );
185 m_year = m_month = m_day = -1; 217 m_year = m_month = m_day = -1;
218 delete rec;
219 rec = 0;
186 } 220 }
187 221
188 munmap(map_addr, attribut.st_size ); 222 munmap(map_addr, attribut.st_size );
189 223
190 qWarning("counts %d records loaded!", m_events.count() ); 224 qWarning("counts %d records loaded!", m_events.count() );
191 return true; 225 return true;
192} 226}
193bool OTodoAccessXML::reload() { 227bool OTodoAccessXML::reload() {
194 m_events.clear(); 228 m_events.clear();
195 return load(); 229 return load();
196} 230}
197bool OTodoAccessXML::save() { 231bool OTodoAccessXML::save() {
198// qWarning("saving"); 232// qWarning("saving");
199 if (!m_opened || !m_changed ) { 233 if (!m_opened || !m_changed ) {
200// qWarning("not saving"); 234// qWarning("not saving");
201 return true; 235 return true;
202 } 236 }
203 QString strNewFile = m_file + ".new"; 237 QString strNewFile = m_file + ".new";
204 QFile f( strNewFile ); 238 QFile f( strNewFile );
205 if (!f.open( IO_WriteOnly|IO_Raw ) ) 239 if (!f.open( IO_WriteOnly|IO_Raw ) )
206 return false; 240 return false;
207 241
208 int written; 242 int written;
209 QString out; 243 QString out;
@@ -376,88 +410,120 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
376 break; 410 break;
377 case OTodo::DateYear: 411 case OTodo::DateYear:
378 m_year = val.toInt(); 412 m_year = val.toInt();
379 break; 413 break;
380 case OTodo::Progress: 414 case OTodo::Progress:
381 ev.setProgress( val.toInt() ); 415 ev.setProgress( val.toInt() );
382 break; 416 break;
383 case OTodo::CrossReference: 417 case OTodo::CrossReference:
384 { 418 {
385 /* 419 /*
386 * A cross refernce looks like 420 * A cross refernce looks like
387 * appname,id;appname,id 421 * appname,id;appname,id
388 * we need to split it up 422 * we need to split it up
389 */ 423 */
390 QStringList refs = QStringList::split(';', val ); 424 QStringList refs = QStringList::split(';', val );
391 QStringList::Iterator strIt; 425 QStringList::Iterator strIt;
392 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) { 426 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) {
393 int pos = (*strIt).find(','); 427 int pos = (*strIt).find(',');
394 if ( pos > -1 ) 428 if ( pos > -1 )
395 ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() ); 429 ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() );
396 430
397 } 431 }
398 break; 432 break;
399 } 433 }
434 /* Recurrence stuff below + post processing later */
435 case FRType:
436 if ( val == "Daily" )
437 recur()->setType( ORecur::Daily );
438 else if ( val == "Weekly" )
439 recur()->setType( ORecur::Weekly);
440 else if ( val == "MonthlyDay" )
441 recur()->setType( ORecur::MonthlyDay );
442 else if ( val == "MonthlyDate" )
443 recur()->setType( ORecur::MonthlyDate );
444 else if ( val == "Yearly" )
445 recur()->setType( ORecur::Yearly );
446 else
447 recur()->setType( ORecur::NoRepeat );
448 break;
449 case FRWeekdays:
450 recur()->setDays( val.toInt() );
451 break;
452 case FRPosition:
453 recur()->setPosition( val.toInt() );
454 break;
455 case FRFreq:
456 recur()->setFrequency( val.toInt() );
457 break;
458 case FRHasEndDate:
459 recur()->setHasEndDate( val.toInt() );
460 break;
461 case FREndDate: {
462 rp_end = (time_t) val.toLong();
463 break;
464 }
400 default: 465 default:
401 break; 466 break;
402 } 467 }
403} 468}
404QString OTodoAccessXML::toString( const OTodo& ev )const { 469QString OTodoAccessXML::toString( const OTodo& ev )const {
405 QString str; 470 QString str;
406 471
407 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 472 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
408 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 473 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
409 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 474 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
410 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 475 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
411 476
412 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 477 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
413 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 478 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
414 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 479 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
415 480
416 if ( ev.hasDueDate() ) { 481 if ( ev.hasDueDate() ) {
417 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; 482 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" ";
418 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; 483 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
419 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; 484 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
420 } 485 }
421// qWarning( "Uid %d", ev.uid() ); 486// qWarning( "Uid %d", ev.uid() );
422 str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; 487 str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
423 488
424// append the extra options 489// append the extra options
425 /* FIXME Qtopia::Record this is currently not 490 /* FIXME Qtopia::Record this is currently not
426 * possible you can set custom fields 491 * possible you can set custom fields
427 * but don' iterate over the list 492 * but don' iterate over the list
428 * I may do #define private protected 493 * I may do #define private protected
429 * for this case - cough --zecke 494 * for this case - cough --zecke
430 */ 495 */
431 /* 496 /*
432 QMap<QString, QString> extras = ev.extras(); 497 QMap<QString, QString> extras = ev.extras();
433 QMap<QString, QString>::Iterator extIt; 498 QMap<QString, QString>::Iterator extIt;
434 for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) 499 for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
435 str += extIt.key() + "=\"" + extIt.data() + "\" "; 500 str += extIt.key() + "=\"" + extIt.data() + "\" ";
436 */ 501 */
437 // cross refernce 502 // cross refernce
438 if ( ev.hasRecurrence() ) 503 if ( ev.hasRecurrence() ) {
439 str += ev.recurrence().toString(); 504 str += ev.recurrence().toString();
505 }
440 506
441 return str; 507 return str;
442} 508}
443QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 509QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
444 return Qtopia::Record::idsToString( ints ); 510 return Qtopia::Record::idsToString( ints );
445} 511}
446 512
447/* internal class for sorting 513/* internal class for sorting
448 * 514 *
449 * Inspired by todoxmlio.cpp from TT 515 * Inspired by todoxmlio.cpp from TT
450 */ 516 */
451 517
452struct OTodoXMLContainer { 518struct OTodoXMLContainer {
453 OTodo todo; 519 OTodo todo;
454}; 520};
455 521
456namespace { 522namespace {
457 inline QString string( const OTodo& todo) { 523 inline QString string( const OTodo& todo) {
458 return todo.summary().isEmpty() ? 524 return todo.summary().isEmpty() ?
459 todo.description().left(20 ) : 525 todo.description().left(20 ) :
460 todo.summary(); 526 todo.summary();
461 } 527 }
462 inline int completed( const OTodo& todo1, const OTodo& todo2) { 528 inline int completed( const OTodo& todo1, const OTodo& todo2) {
463 int ret = 0; 529 int ret = 0;
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index c0d8dfc..71b6a7e 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -1,112 +1,137 @@
1#include <errno.h> 1#include <errno.h>
2#include <fcntl.h> 2#include <fcntl.h>
3 3
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include <sys/stat.h> 5#include <sys/stat.h>
6#include <sys/types.h> 6#include <sys/types.h>
7 7
8#include <unistd.h> 8#include <unistd.h>
9 9
10 10
11#include <qfile.h> 11#include <qfile.h>
12#include <qvector.h> 12#include <qvector.h>
13 13
14#include <qpe/global.h> 14#include <qpe/global.h>
15#include <qpe/stringutil.h> 15#include <qpe/stringutil.h>
16#include <qpe/timeconversion.h> 16#include <qpe/timeconversion.h>
17 17
18#include "otimezone.h"
18#include "orecur.h" 19#include "orecur.h"
19#include "otodoaccessxml.h" 20#include "otodoaccessxml.h"
20 21
21namespace { 22namespace {
23 time_t rp_end;
24 ORecur* rec;
25 ORecur *recur() {
26 if (!rec ) rec = new ORecur;
27 return rec;
28 }
29 int snd;
30 enum MoreAttributes {
31 FRType = OTodo::CompletedDate + 2,
32 FRWeekdays,
33 FRPosition,
34 FRFreq,
35 FRHasEndDate,
36 FREndDate,
37 FRStart,
38 FREnd
39 };
22 // FROM TT again 40 // FROM TT again
23char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) 41char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
24{ 42{
25 char needleChar; 43 char needleChar;
26 char haystackChar; 44 char haystackChar;
27 if (!needle || !haystack || !hLen || !nLen) 45 if (!needle || !haystack || !hLen || !nLen)
28 return 0; 46 return 0;
29 47
30 const char* hsearch = haystack; 48 const char* hsearch = haystack;
31 49
32 if ((needleChar = *needle++) != 0) { 50 if ((needleChar = *needle++) != 0) {
33 nLen--; //(to make up for needle++) 51 nLen--; //(to make up for needle++)
34 do { 52 do {
35 do { 53 do {
36 if ((haystackChar = *hsearch++) == 0) 54 if ((haystackChar = *hsearch++) == 0)
37 return (0); 55 return (0);
38 if (hsearch >= haystack + hLen) 56 if (hsearch >= haystack + hLen)
39 return (0); 57 return (0);
40 } while (haystackChar != needleChar); 58 } while (haystackChar != needleChar);
41 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); 59 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
42 hsearch--; 60 hsearch--;
43 } 61 }
44 return ((char *)hsearch); 62 return ((char *)hsearch);
45} 63}
46} 64}
47 65
48 66
49OTodoAccessXML::OTodoAccessXML( const QString& appName, 67OTodoAccessXML::OTodoAccessXML( const QString& appName,
50 const QString& fileName ) 68 const QString& fileName )
51 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) 69 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
52{ 70{
53 if (!fileName.isEmpty() ) 71 if (!fileName.isEmpty() )
54 m_file = fileName; 72 m_file = fileName;
55 else 73 else
56 m_file = Global::applicationFileName( "todolist", "todolist.xml" ); 74 m_file = Global::applicationFileName( "todolist", "todolist.xml" );
57} 75}
58OTodoAccessXML::~OTodoAccessXML() { 76OTodoAccessXML::~OTodoAccessXML() {
59 77
60} 78}
61bool OTodoAccessXML::load() { 79bool OTodoAccessXML::load() {
80 rec = 0;
62 m_opened = true; 81 m_opened = true;
63 m_changed = false; 82 m_changed = false;
64 /* initialize dict */ 83 /* initialize dict */
65 /* 84 /*
66 * UPDATE dict if you change anything!!! 85 * UPDATE dict if you change anything!!!
67 */ 86 */
68 QAsciiDict<int> dict(21); 87 QAsciiDict<int> dict(21);
69 dict.setAutoDelete( TRUE ); 88 dict.setAutoDelete( TRUE );
70 dict.insert("Categories" , new int(OTodo::Category) ); 89 dict.insert("Categories" , new int(OTodo::Category) );
71 dict.insert("Uid" , new int(OTodo::Uid) ); 90 dict.insert("Uid" , new int(OTodo::Uid) );
72 dict.insert("HasDate" , new int(OTodo::HasDate) ); 91 dict.insert("HasDate" , new int(OTodo::HasDate) );
73 dict.insert("Completed" , new int(OTodo::Completed) ); 92 dict.insert("Completed" , new int(OTodo::Completed) );
74 dict.insert("Description" , new int(OTodo::Description) ); 93 dict.insert("Description" , new int(OTodo::Description) );
75 dict.insert("Summary" , new int(OTodo::Summary) ); 94 dict.insert("Summary" , new int(OTodo::Summary) );
76 dict.insert("Priority" , new int(OTodo::Priority) ); 95 dict.insert("Priority" , new int(OTodo::Priority) );
77 dict.insert("DateDay" , new int(OTodo::DateDay) ); 96 dict.insert("DateDay" , new int(OTodo::DateDay) );
78 dict.insert("DateMonth" , new int(OTodo::DateMonth) ); 97 dict.insert("DateMonth" , new int(OTodo::DateMonth) );
79 dict.insert("DateYear" , new int(OTodo::DateYear) ); 98 dict.insert("DateYear" , new int(OTodo::DateYear) );
80 dict.insert("Progress" , new int(OTodo::Progress) ); 99 dict.insert("Progress" , new int(OTodo::Progress) );
81 dict.insert("Completed", new int(OTodo::Completed) ); 100 dict.insert("CompletedDate", new int(OTodo::CompletedDate) );
82 dict.insert("CrossReference", new int(OTodo::CrossReference) ); 101 dict.insert("CrossReference", new int(OTodo::CrossReference) );
83 dict.insert("State", new int(OTodo::State) ); 102 dict.insert("State", new int(OTodo::State) );
84 dict.insert("Recurrence", new int(OTodo::Recurrence) );
85 dict.insert("Alarms", new int(OTodo::Alarms) ); 103 dict.insert("Alarms", new int(OTodo::Alarms) );
86 dict.insert("Reminders", new int(OTodo::Reminders) ); 104 dict.insert("Reminders", new int(OTodo::Reminders) );
87 dict.insert("Notifiers", new int(OTodo::Notifiers) ); 105 dict.insert("Notifiers", new int(OTodo::Notifiers) );
88 dict.insert("Maintainer", new int(OTodo::Maintainer) ); 106 dict.insert("Maintainer", new int(OTodo::Maintainer) );
107 dict.insert("rtype", new int(FRType) );
108 dict.insert("rweekdays", new int(FRWeekdays) );
109 dict.insert("rposition", new int(FRPosition) );
110 dict.insert("rfreq", new int(FRFreq) );
111 dict.insert("start", new int(FRStart) );
112 dict.insert("rhasenddate", new int(FRHasEndDate) );
113 dict.insert("enddt", new int(FREndDate) );
89 114
90 // here the custom XML parser from TT it's GPL 115 // here the custom XML parser from TT it's GPL
91 // but we want to push OpiePIM... to TT..... 116 // but we want to push OpiePIM... to TT.....
92 // mmap part from zecke :) 117 // mmap part from zecke :)
93 int fd = ::open( QFile::encodeName(m_file).data(), O_RDONLY ); 118 int fd = ::open( QFile::encodeName(m_file).data(), O_RDONLY );
94 struct stat attribut; 119 struct stat attribut;
95 if ( fd < 0 ) return false; 120 if ( fd < 0 ) return false;
96 121
97 if ( fstat(fd, &attribut ) == -1 ) { 122 if ( fstat(fd, &attribut ) == -1 ) {
98 ::close( fd ); 123 ::close( fd );
99 return false; 124 return false;
100 } 125 }
101 void* map_addr = ::mmap(NULL, attribut.st_size, PROT_READ, MAP_SHARED, fd, 0 ); 126 void* map_addr = ::mmap(NULL, attribut.st_size, PROT_READ, MAP_SHARED, fd, 0 );
102 if ( map_addr == ( (caddr_t)-1) ) { 127 if ( map_addr == ( (caddr_t)-1) ) {
103 ::close(fd ); 128 ::close(fd );
104 return false; 129 return false;
105 } 130 }
106 /* advise the kernel who we want to read it */ 131 /* advise the kernel who we want to read it */
107 ::madvise( map_addr, attribut.st_size, MADV_SEQUENTIAL ); 132 ::madvise( map_addr, attribut.st_size, MADV_SEQUENTIAL );
108 /* we do not the file any more */ 133 /* we do not the file any more */
109 ::close( fd ); 134 ::close( fd );
110 135
111 char* dt = (char*)map_addr; 136 char* dt = (char*)map_addr;
112 int len = attribut.st_size; 137 int len = attribut.st_size;
@@ -160,50 +185,59 @@ bool OTodoAccessXML::load() {
160 i = j + 1; 185 i = j + 1;
161 186
162 QString str = (haveUtf ? QString::fromUtf8( value ) 187 QString str = (haveUtf ? QString::fromUtf8( value )
163 : QString::fromLatin1( value ) ); 188 : QString::fromLatin1( value ) );
164 if ( haveEnt ) 189 if ( haveEnt )
165 str = Qtopia::plainString( str ); 190 str = Qtopia::plainString( str );
166 191
167 /* 192 /*
168 * add key + value 193 * add key + value
169 */ 194 */
170 todo( &dict, ev, attr, str ); 195 todo( &dict, ev, attr, str );
171 196
172 } 197 }
173 /* 198 /*
174 * now add it 199 * now add it
175 */ 200 */
176 qWarning("End at %d", i ); 201 qWarning("End at %d", i );
177 if (m_events.contains( ev.uid() ) || ev.uid() == 0) { 202 if (m_events.contains( ev.uid() ) || ev.uid() == 0) {
178 ev.setUid( 1 ); 203 ev.setUid( 1 );
179 m_changed = true; 204 m_changed = true;
180 } 205 }
181 if ( ev.hasDueDate() ) { 206 if ( ev.hasDueDate() ) {
182 ev.setDueDate( QDate(m_year, m_month, m_day) ); 207 ev.setDueDate( QDate(m_year, m_month, m_day) );
183 } 208 }
209 if ( rec && rec->doesRecur() ) {
210 OTimeZone utc = OTimeZone::utc();
211 ORecur recu( *rec ); // call copy c'tor
212 recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() );
213 recu.setStart( ev.dueDate() );
214 ev.setRecurrence( recu );
215 }
184 m_events.insert(ev.uid(), ev ); 216 m_events.insert(ev.uid(), ev );
185 m_year = m_month = m_day = -1; 217 m_year = m_month = m_day = -1;
218 delete rec;
219 rec = 0;
186 } 220 }
187 221
188 munmap(map_addr, attribut.st_size ); 222 munmap(map_addr, attribut.st_size );
189 223
190 qWarning("counts %d records loaded!", m_events.count() ); 224 qWarning("counts %d records loaded!", m_events.count() );
191 return true; 225 return true;
192} 226}
193bool OTodoAccessXML::reload() { 227bool OTodoAccessXML::reload() {
194 m_events.clear(); 228 m_events.clear();
195 return load(); 229 return load();
196} 230}
197bool OTodoAccessXML::save() { 231bool OTodoAccessXML::save() {
198// qWarning("saving"); 232// qWarning("saving");
199 if (!m_opened || !m_changed ) { 233 if (!m_opened || !m_changed ) {
200// qWarning("not saving"); 234// qWarning("not saving");
201 return true; 235 return true;
202 } 236 }
203 QString strNewFile = m_file + ".new"; 237 QString strNewFile = m_file + ".new";
204 QFile f( strNewFile ); 238 QFile f( strNewFile );
205 if (!f.open( IO_WriteOnly|IO_Raw ) ) 239 if (!f.open( IO_WriteOnly|IO_Raw ) )
206 return false; 240 return false;
207 241
208 int written; 242 int written;
209 QString out; 243 QString out;
@@ -376,88 +410,120 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
376 break; 410 break;
377 case OTodo::DateYear: 411 case OTodo::DateYear:
378 m_year = val.toInt(); 412 m_year = val.toInt();
379 break; 413 break;
380 case OTodo::Progress: 414 case OTodo::Progress:
381 ev.setProgress( val.toInt() ); 415 ev.setProgress( val.toInt() );
382 break; 416 break;
383 case OTodo::CrossReference: 417 case OTodo::CrossReference:
384 { 418 {
385 /* 419 /*
386 * A cross refernce looks like 420 * A cross refernce looks like
387 * appname,id;appname,id 421 * appname,id;appname,id
388 * we need to split it up 422 * we need to split it up
389 */ 423 */
390 QStringList refs = QStringList::split(';', val ); 424 QStringList refs = QStringList::split(';', val );
391 QStringList::Iterator strIt; 425 QStringList::Iterator strIt;
392 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) { 426 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) {
393 int pos = (*strIt).find(','); 427 int pos = (*strIt).find(',');
394 if ( pos > -1 ) 428 if ( pos > -1 )
395 ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() ); 429 ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() );
396 430
397 } 431 }
398 break; 432 break;
399 } 433 }
434 /* Recurrence stuff below + post processing later */
435 case FRType:
436 if ( val == "Daily" )
437 recur()->setType( ORecur::Daily );
438 else if ( val == "Weekly" )
439 recur()->setType( ORecur::Weekly);
440 else if ( val == "MonthlyDay" )
441 recur()->setType( ORecur::MonthlyDay );
442 else if ( val == "MonthlyDate" )
443 recur()->setType( ORecur::MonthlyDate );
444 else if ( val == "Yearly" )
445 recur()->setType( ORecur::Yearly );
446 else
447 recur()->setType( ORecur::NoRepeat );
448 break;
449 case FRWeekdays:
450 recur()->setDays( val.toInt() );
451 break;
452 case FRPosition:
453 recur()->setPosition( val.toInt() );
454 break;
455 case FRFreq:
456 recur()->setFrequency( val.toInt() );
457 break;
458 case FRHasEndDate:
459 recur()->setHasEndDate( val.toInt() );
460 break;
461 case FREndDate: {
462 rp_end = (time_t) val.toLong();
463 break;
464 }
400 default: 465 default:
401 break; 466 break;
402 } 467 }
403} 468}
404QString OTodoAccessXML::toString( const OTodo& ev )const { 469QString OTodoAccessXML::toString( const OTodo& ev )const {
405 QString str; 470 QString str;
406 471
407 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 472 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
408 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 473 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
409 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 474 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
410 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 475 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
411 476
412 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 477 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
413 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 478 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
414 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 479 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
415 480
416 if ( ev.hasDueDate() ) { 481 if ( ev.hasDueDate() ) {
417 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; 482 str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" ";
418 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; 483 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
419 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; 484 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
420 } 485 }
421// qWarning( "Uid %d", ev.uid() ); 486// qWarning( "Uid %d", ev.uid() );
422 str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; 487 str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
423 488
424// append the extra options 489// append the extra options
425 /* FIXME Qtopia::Record this is currently not 490 /* FIXME Qtopia::Record this is currently not
426 * possible you can set custom fields 491 * possible you can set custom fields
427 * but don' iterate over the list 492 * but don' iterate over the list
428 * I may do #define private protected 493 * I may do #define private protected
429 * for this case - cough --zecke 494 * for this case - cough --zecke
430 */ 495 */
431 /* 496 /*
432 QMap<QString, QString> extras = ev.extras(); 497 QMap<QString, QString> extras = ev.extras();
433 QMap<QString, QString>::Iterator extIt; 498 QMap<QString, QString>::Iterator extIt;
434 for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) 499 for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
435 str += extIt.key() + "=\"" + extIt.data() + "\" "; 500 str += extIt.key() + "=\"" + extIt.data() + "\" ";
436 */ 501 */
437 // cross refernce 502 // cross refernce
438 if ( ev.hasRecurrence() ) 503 if ( ev.hasRecurrence() ) {
439 str += ev.recurrence().toString(); 504 str += ev.recurrence().toString();
505 }
440 506
441 return str; 507 return str;
442} 508}
443QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 509QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
444 return Qtopia::Record::idsToString( ints ); 510 return Qtopia::Record::idsToString( ints );
445} 511}
446 512
447/* internal class for sorting 513/* internal class for sorting
448 * 514 *
449 * Inspired by todoxmlio.cpp from TT 515 * Inspired by todoxmlio.cpp from TT
450 */ 516 */
451 517
452struct OTodoXMLContainer { 518struct OTodoXMLContainer {
453 OTodo todo; 519 OTodo todo;
454}; 520};
455 521
456namespace { 522namespace {
457 inline QString string( const OTodo& todo) { 523 inline QString string( const OTodo& todo) {
458 return todo.summary().isEmpty() ? 524 return todo.summary().isEmpty() ?
459 todo.description().left(20 ) : 525 todo.description().left(20 ) :
460 todo.summary(); 526 todo.summary();
461 } 527 }
462 inline int completed( const OTodo& todo1, const OTodo& todo2) { 528 inline int completed( const OTodo& todo1, const OTodo& todo2) {
463 int ret = 0; 529 int ret = 0;
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp
index be4a1c2..49af757 100644
--- a/libopie2/opiepim/core/opimnotifymanager.cpp
+++ b/libopie2/opiepim/core/opimnotifymanager.cpp
@@ -46,24 +46,27 @@ void OPimNotifyManager::setAlarms( const Alarms& al) {
46} 46}
47void OPimNotifyManager::setReminders( const Reminders& rem) { 47void OPimNotifyManager::setReminders( const Reminders& rem) {
48 m_rem = rem; 48 m_rem = rem;
49} 49}
50/* FIXME!!! */ 50/* FIXME!!! */
51/** 51/**
52 * The idea is to check if the provider for our service 52 * The idea is to check if the provider for our service
53 * is online 53 * is online
54 * if it is we will use QCOP 54 * if it is we will use QCOP
55 * if not the Factory to get the backend... 55 * if not the Factory to get the backend...
56 * Qtopia1.6 services would be kewl to have here.... 56 * Qtopia1.6 services would be kewl to have here....
57 */ 57 */
58void OPimNotifyManager::registerNotify( const OPimNotify& ) { 58void OPimNotifyManager::registerNotify( const OPimNotify& ) {
59 59
60} 60}
61/* FIXME!!! */ 61/* FIXME!!! */
62/** 62/**
63 * same as above... 63 * same as above...
64 * Also implement Url model 64 * Also implement Url model
65 * have a MainWindow.... 65 * have a MainWindow....
66 */ 66 */
67void OPimNotifyManager::deregister( const OPimNotify& ) { 67void OPimNotifyManager::deregister( const OPimNotify& ) {
68 68
69} 69}
70bool OPimNotifyManager::isEmpty()const {
71 return ( m_rem.isEmpty() && m_al.isEmpty() );
72}
diff --git a/libopie2/opiepim/core/opimnotifymanager.h b/libopie2/opiepim/core/opimnotifymanager.h
index 0eebc9b..0ac30a1 100644
--- a/libopie2/opiepim/core/opimnotifymanager.h
+++ b/libopie2/opiepim/core/opimnotifymanager.h
@@ -18,34 +18,37 @@ public:
18 /* we will cast it for you ;) */ 18 /* we will cast it for you ;) */
19 void add( const OPimNotify& ); 19 void add( const OPimNotify& );
20 void remove( const OPimNotify& ); 20 void remove( const OPimNotify& );
21 /* replaces all with this one! */ 21 /* replaces all with this one! */
22 void replace( const OPimNotify& ); 22 void replace( const OPimNotify& );
23 23
24 Reminders reminders()const; 24 Reminders reminders()const;
25 Alarms alarms()const; 25 Alarms alarms()const;
26 26
27 void setAlarms( const Alarms& ); 27 void setAlarms( const Alarms& );
28 void setReminders( const Reminders& ); 28 void setReminders( const Reminders& );
29 29
30 /* register is a Ansi C keyword... */ 30 /* register is a Ansi C keyword... */
31 /** 31 /**
32 * This function will register the Notify to the Alarm Server 32 * This function will register the Notify to the Alarm Server
33 * or datebook depending on the type of the notify 33 * or datebook depending on the type of the notify
34 */ 34 */
35 void registerNotify( const OPimNotify& ); 35 void registerNotify( const OPimNotify& );
36 36
37 /** 37 /**
38 * this will do the opposite.. 38 * this will do the opposite..
39 */ 39 */
40 void deregister( const OPimNotify& ); 40 void deregister( const OPimNotify& );
41 41
42
43 bool isEmpty()const;
44
42private: 45private:
43 Reminders m_rem; 46 Reminders m_rem;
44 Alarms m_al; 47 Alarms m_al;
45 48
46 class Private; 49 class Private;
47 Private *d; 50 Private *d;
48 51
49}; 52};
50 53
51#endif 54#endif
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp
index e3b45b4..eae1fdc 100644
--- a/libopie2/opiepim/core/orecur.cpp
+++ b/libopie2/opiepim/core/orecur.cpp
@@ -483,28 +483,28 @@ QString ORecur::toString()const {
483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\""; 483 buf += " rweekdays=\"" + QString::number( static_cast<int>( data->days ) ) + "\"";
484 if ( data->pos != 0 ) 484 if ( data->pos != 0 )
485 buf += " rposition=\"" + QString::number(data->pos ) + "\""; 485 buf += " rposition=\"" + QString::number(data->pos ) + "\"";
486 486
487 buf += " rfreq=\"" + QString::number( data->freq ) + "\""; 487 buf += " rfreq=\"" + QString::number( data->freq ) + "\"";
488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\""; 488 buf += " rhasenddate=\"" + QString::number( static_cast<int>( data->hasEnd ) ) + "\"";
489 if ( data->hasEnd ) 489 if ( data->hasEnd )
490 buf += " enddt=\"" 490 buf += " enddt=\""
491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) ) 491 + QString::number( OTimeZone::utc().fromUTCDateTime( QDateTime( data->end, QTime(12,0,0) ) ) )
492 + "\""; 492 + "\"";
493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\""; 493 buf += " created=\"" + QString::number( OTimeZone::utc().fromUTCDateTime( data->create ) ) + "\"";
494 494
495 if ( data->list.isEmpty() ) return buf; 495 if ( data->list.isEmpty() ) return buf;
496 // save exceptions list here!! 496 // save exceptions list here!!
497 ExceptionList::ConstIterator it; 497 ExceptionList::ConstIterator it;
498 ExceptionList list = data->list; 498 ExceptionList list = data->list;
499 buf += " exceptions=\""; 499 buf += " exceptions=\"";
500 QDate date; 500 QDate date;
501 for ( it = list.begin(); it != list.end(); ++it ) { 501 for ( it = list.begin(); it != list.end(); ++it ) {
502 date = (*it); 502 date = (*it);
503 if ( it != list.begin() ) buf += " "; 503 if ( it != list.begin() ) buf += " ";
504 504
505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() ); 505 buf += QCString().sprintf("%04d%02d%02d", date.year(), date.month(), date.day() );
506 } 506 }
507 buf += "\""; 507 buf += "\" ";
508 508
509 return buf; 509 return buf;
510} 510}