summaryrefslogtreecommitdiff
path: root/libopie
authorzecke <zecke>2002-03-19 19:20:30 (UTC)
committer zecke <zecke>2002-03-19 19:20:30 (UTC)
commitebbdb5c4f1c01881bd09f02d9efaa434a073a788 (patch) (side-by-side diff)
tree9cf900b90df734248ec26d7860b427c397d148f9 /libopie
parentc23db0c35b77cc1656ac8822ca948e73c50e8ee6 (diff)
downloadopie-ebbdb5c4f1c01881bd09f02d9efaa434a073a788.zip
opie-ebbdb5c4f1c01881bd09f02d9efaa434a073a788.tar.gz
opie-ebbdb5c4f1c01881bd09f02d9efaa434a073a788.tar.bz2
Make multiple backends possible
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/tododb.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp
index 91331d0..e440dfc 100644
--- a/libopie/tododb.cpp
+++ b/libopie/tododb.cpp
@@ -117,49 +117,49 @@ public:
//}
}else {
qWarning("could not load" );
}
delete root;
return m_todos;
}
};
}
ToDoDB::ToDoDB(const QString &fileName = QString::null, ToDoResource *res ){
m_fileName = fileName;
if( fileName.isEmpty() && res == 0 ){
m_fileName = Global::applicationFileName("todolist","todolist.xml");;
//qWarning("%s", m_fileName.latin1() );
}else if(res == 0 ){ // let's create a ToDoResource for xml
res = new FileToDoResource();
}
m_res = res;
load();
}
ToDoDB::~ToDoDB()
{
-
+ delete m_res;
}
QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from, const QDate &to,
bool all )
{
QValueList<ToDoEvent> events;
for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){
if( (*it).hasDate() ){
if( (*it).date() >= from && (*it).date() <= to )
events.append( (*it) );
}else if( all ){
events.append( (*it) );
}
}
return events;
}
QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from,
bool all)
{
return effectiveToDos( from, QDate::currentDate(), all );
}
QValueList<ToDoEvent> ToDoDB::overDue()
{
QValueList<ToDoEvent> events;
for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){
@@ -178,38 +178,38 @@ void ToDoDB::addEvent( const ToDoEvent &event )
}
void ToDoDB::editEvent( const ToDoEvent &event )
{
m_todos.remove( event );
m_todos.append( event );
}
void ToDoDB::removeEvent( const ToDoEvent &event )
{
m_todos.remove( event );
}
void ToDoDB::reload()
{
load();
}
void ToDoDB::setFileName(const QString &file )
{
m_fileName =file;
}
QString ToDoDB::fileName()const
{
return m_fileName;
}
void ToDoDB::load()
{
-
+ m_todos = m_res->load( m_fileName );
}
bool ToDoDB::save()
{
return m_res->save( m_fileName, m_todos );
}