author | zecke <zecke> | 2002-10-18 14:09:14 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-18 14:09:14 (UTC) |
commit | 461113126af82cd6343eedab36ecabb4253780ee (patch) (side-by-side diff) | |
tree | 3176b63dd7f99c58138f237805c88db334fd4a38 | |
parent | a574a09dd7b24091a4d2093c8b046ccd32e78d63 (diff) | |
download | opie-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
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 13 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessxml.cpp | 13 |
2 files changed, 16 insertions, 10 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index 7a55c67..385fd27 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp @@ -107,25 +107,33 @@ bool OTodoAccessXML::load() { if ( haveEnt ) str = Qtopia::plainString( str ); /* * add key + value */ todo( &dict, ev, attr, str ); } /* * now add it */ + if (m_events.contains( ev.uid() ) || ev.uid() == 0) { + ev.setUid( 1 ); + m_changed = true; + } + if ( ev.hasDueDate() ) { + ev.setDueDate( QDate(m_year, m_month, m_day) ); + } m_events.insert(ev.uid(), ev ); + m_year = m_month = m_day = -1; } qWarning("counts %d records loaded!", m_events.count() ); return true; } bool OTodoAccessXML::reload() { return load(); } bool OTodoAccessXML::save() { // qWarning("saving"); if (!m_opened || !m_changed ) { // qWarning("not saving"); @@ -330,29 +338,24 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, } case OTodo::HasAlarmDateTime: ev.setHasAlarmDateTime( val.toInt() ); break; case OTodo::AlarmDateTime: { /* this sounds better ;) zecke */ ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) ); break; } default: break; } - - if ( ev.hasDueDate() ) { - QDate date( m_year, m_month, m_day ); - ev.setDueDate( date ); - } } QString OTodoAccessXML::toString( const OTodo& ev )const { QString str; str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; str += "Categories=\"" + toString( ev.categories() ) + "\" "; str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; 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() { if ( haveEnt ) str = Qtopia::plainString( str ); /* * add key + value */ todo( &dict, ev, attr, str ); } /* * now add it */ + if (m_events.contains( ev.uid() ) || ev.uid() == 0) { + ev.setUid( 1 ); + m_changed = true; + } + if ( ev.hasDueDate() ) { + ev.setDueDate( QDate(m_year, m_month, m_day) ); + } m_events.insert(ev.uid(), ev ); + m_year = m_month = m_day = -1; } qWarning("counts %d records loaded!", m_events.count() ); return true; } bool OTodoAccessXML::reload() { return load(); } bool OTodoAccessXML::save() { // qWarning("saving"); if (!m_opened || !m_changed ) { // qWarning("not saving"); @@ -330,29 +338,24 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, } case OTodo::HasAlarmDateTime: ev.setHasAlarmDateTime( val.toInt() ); break; case OTodo::AlarmDateTime: { /* this sounds better ;) zecke */ ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) ); break; } default: break; } - - if ( ev.hasDueDate() ) { - QDate date( m_year, m_month, m_day ); - ev.setDueDate( date ); - } } QString OTodoAccessXML::toString( const OTodo& ev )const { QString str; str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" "; str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" "; str += "Priority=\"" + QString::number( ev.priority() ) + "\" "; str += "Progress=\"" + QString::number(ev.progress() ) + "\" "; str += "Categories=\"" + toString( ev.categories() ) + "\" "; str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" "; str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" "; |