-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 13 |
1 files changed, 8 insertions, 5 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 @@ -111,17 +111,25 @@ bool OTodoAccessXML::load() { * 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(); } @@ -334,21 +342,16 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev, 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() ) + "\" "; |