summaryrefslogtreecommitdiff
path: root/libopie/tododb.cpp
Side-by-side diff
Diffstat (limited to 'libopie/tododb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/tododb.cpp20
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
@@ -197,10 +197,30 @@ void ToDoDB::removeEvent( const ToDoEvent &event )
{
m_todos.remove( 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()
{
load();
}
+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 )
{
m_fileName =file;