author | zecke <zecke> | 2002-04-15 20:53:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-15 20:53:57 (UTC) |
commit | e010d922ac415558e5efd35e69e39e45908b5501 (patch) (side-by-side diff) | |
tree | 7b6dac3a82613fdefb15c818541891f577ecf48d /libopie/tododb.cpp | |
parent | 15244683bb97d303d0d3b6104b46a9b429aaed85 (diff) | |
download | opie-e010d922ac415558e5efd35e69e39e45908b5501.zip opie-e010d922ac415558e5efd35e69e39e45908b5501.tar.gz opie-e010d922ac415558e5efd35e69e39e45908b5501.tar.bz2 |
updates?
too much to remember
-rw-r--r-- | libopie/tododb.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index 3f6dc30..4d6711d 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp @@ -199,2 +199,15 @@ void ToDoDB::removeEvent( const ToDoEvent &event ) } +void ToDoDB::replaceEvent(const ToDoEvent &event ) +{ + QValueList<ToDoEvent>::Iterator it; + int uid = event.uid(); + // == is not overloaded as we would like :( so let's search for the uid + for(it = m_todos.begin(); it != m_todos.end(); ++it ){ + if( (*it).uid() == uid ){ + m_todos.remove( (*it) ); + break; // should save us the iterate is now borked + } + } + m_todos.append(event); +} void ToDoDB::reload() @@ -203,2 +216,9 @@ void ToDoDB::reload() } +void ToDoDB::mergeWith(const QValueList<ToDoEvent>& events ) +{ + QValueList<ToDoEvent>::ConstIterator it; + for( it = events.begin(); it != events.end(); ++it ){ + replaceEvent( (*it) ); + } +} void ToDoDB::setFileName(const QString &file ) |