summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2002-10-18 14:09:14 (UTC)
committer zecke <zecke>2002-10-18 14:09:14 (UTC)
commit461113126af82cd6343eedab36ecabb4253780ee (patch) (unidiff)
tree3176b63dd7f99c58138f237805c88db334fd4a38 /libopie2
parenta574a09dd7b24091a4d2093c8b046ccd32e78d63 (diff)
downloadopie-461113126af82cd6343eedab36ecabb4253780ee.zip
opie-461113126af82cd6343eedab36ecabb4253780ee.tar.gz
opie-461113126af82cd6343eedab36ecabb4253780ee.tar.bz2
Add a small quirk mode... for testing
Fix parsing of due Date We can not rely that HasDate is past the dates.. do the final QDate generation just before adding the OTodo
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 7a55c67..385fd27 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -107,25 +107,33 @@ bool OTodoAccessXML::load() {
107 if ( haveEnt ) 107 if ( haveEnt )
108 str = Qtopia::plainString( str ); 108 str = Qtopia::plainString( str );
109 109
110 /* 110 /*
111 * add key + value 111 * add key + value
112 */ 112 */
113 todo( &dict, ev, attr, str ); 113 todo( &dict, ev, attr, str );
114 114
115 } 115 }
116 /* 116 /*
117 * now add it 117 * now add it
118 */ 118 */
119 if (m_events.contains( ev.uid() ) || ev.uid() == 0) {
120 ev.setUid( 1 );
121 m_changed = true;
122 }
123 if ( ev.hasDueDate() ) {
124 ev.setDueDate( QDate(m_year, m_month, m_day) );
125 }
119 m_events.insert(ev.uid(), ev ); 126 m_events.insert(ev.uid(), ev );
127 m_year = m_month = m_day = -1;
120 } 128 }
121 129
122 qWarning("counts %d records loaded!", m_events.count() ); 130 qWarning("counts %d records loaded!", m_events.count() );
123 return true; 131 return true;
124} 132}
125bool OTodoAccessXML::reload() { 133bool OTodoAccessXML::reload() {
126 return load(); 134 return load();
127} 135}
128bool OTodoAccessXML::save() { 136bool OTodoAccessXML::save() {
129// qWarning("saving"); 137// qWarning("saving");
130 if (!m_opened || !m_changed ) { 138 if (!m_opened || !m_changed ) {
131// qWarning("not saving"); 139// qWarning("not saving");
@@ -330,29 +338,24 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
330 } 338 }
331 case OTodo::HasAlarmDateTime: 339 case OTodo::HasAlarmDateTime:
332 ev.setHasAlarmDateTime( val.toInt() ); 340 ev.setHasAlarmDateTime( val.toInt() );
333 break; 341 break;
334 case OTodo::AlarmDateTime: { 342 case OTodo::AlarmDateTime: {
335 /* this sounds better ;) zecke */ 343 /* this sounds better ;) zecke */
336 ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) ); 344 ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) );
337 break; 345 break;
338 } 346 }
339 default: 347 default:
340 break; 348 break;
341 } 349 }
342
343 if ( ev.hasDueDate() ) {
344 QDate date( m_year, m_month, m_day );
345 ev.setDueDate( date );
346 }
347} 350}
348QString OTodoAccessXML::toString( const OTodo& ev )const { 351QString OTodoAccessXML::toString( const OTodo& ev )const {
349 QString str; 352 QString str;
350 353
351 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; 354 str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
352 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; 355 str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
353 str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; 356 str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
354 str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; 357 str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
355 358
356 str += "Categories=\"" + toString( ev.categories() ) + "\" "; 359 str += "Categories=\"" + toString( ev.categories() ) + "\" ";
357 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; 360 str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
358 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 361 str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";