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.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp
index 6b10ec2..1e40c40 100644
--- a/libopie/tododb.cpp
+++ b/libopie/tododb.cpp
@@ -15,24 +15,25 @@ public:
FileToDoResource() {};
// FIXME better parsing
bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){
// prepare the XML
XMLElement *tasks = new XMLElement( );
tasks->setTagName("Tasks" );
for( QValueList<ToDoEvent>::ConstIterator it = m_todos.begin(); it != m_todos.end(); ++it ){
XMLElement::AttributeMap map;
XMLElement *task = new XMLElement();
map.insert( "Completed", QString::number((int)(*it).isCompleted() ) );
map.insert( "HasDate", QString::number((int)(*it).hasDate() ) );
map.insert( "Priority", QString::number( (*it).priority() ) );
+ map.insert( "Progress", QString::number( (*it).progress() ) );
map.insert( "Summary", (*it).summary() );
QArray<int> arrat = (*it).categories();
QString attr;
for(uint i=0; i < arrat.count(); i++ ){
attr.append(QString::number(arrat[i])+";" );
}
if(!attr.isEmpty() ) // remove the last ;
attr.remove(attr.length()-1, 1 );
map.insert( "Categories", attr );
//else
//map.insert( "Categories", QString::null );
map.insert( "Description", (*it).description() );
@@ -73,24 +74,31 @@ public:
element = element->nextChild();
continue;
}
qWarning("ToDoDB::load element tagName() : %s", element->tagName().latin1() );
QString dummy;
ToDoEvent event;
bool ok;
int dumInt;
// completed
dummy = element->attribute("Completed" );
dumInt = dummy.toInt(&ok );
if(ok ) event.setCompleted( dumInt == 0 ? false : true );
+ // progress
+ dummy = element->attribute("Progress" );
+ {
+ ushort dumShort = dummy.toUShort(&ok);
+ event.setProgress( dumShort );
+
+ }
// hasDate
dummy = element->attribute("HasDate" );
dumInt = dummy.toInt(&ok );
if(ok ) event.setHasDate( dumInt == 0 ? false: true );
// set the date
bool hasDa = dumInt;
if ( hasDa ) { //parse the date
int year, day, month = 0;
year = day = month;
// year
dummy = element->attribute("DateYear" );
dumInt = dummy.toInt(&ok );