summaryrefslogtreecommitdiff
path: root/libopie/tododb.cpp
Unidiff
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
@@ -196,12 +196,32 @@ void ToDoDB::editEvent( const ToDoEvent &event )
196void ToDoDB::removeEvent( const ToDoEvent &event ) 196void ToDoDB::removeEvent( const ToDoEvent &event )
197{ 197{
198 m_todos.remove( event ); 198 m_todos.remove( event );
199} 199}
200void ToDoDB::replaceEvent(const ToDoEvent &event )
201{
202 QValueList<ToDoEvent>::Iterator it;
203 int uid = event.uid();
204 // == is not overloaded as we would like :( so let's search for the uid
205 for(it = m_todos.begin(); it != m_todos.end(); ++it ){
206 if( (*it).uid() == uid ){
207 m_todos.remove( (*it) );
208 break; // should save us the iterate is now borked
209 }
210 }
211 m_todos.append(event);
212}
200void ToDoDB::reload() 213void ToDoDB::reload()
201{ 214{
202 load(); 215 load();
203} 216}
217void ToDoDB::mergeWith(const QValueList<ToDoEvent>& events )
218{
219 QValueList<ToDoEvent>::ConstIterator it;
220 for( it = events.begin(); it != events.end(); ++it ){
221 replaceEvent( (*it) );
222 }
223}
204void ToDoDB::setFileName(const QString &file ) 224void ToDoDB::setFileName(const QString &file )
205{ 225{
206 m_fileName =file; 226 m_fileName =file;
207} 227}