summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/backend/task.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/backend/task.cpp b/library/backend/task.cpp
index e7d697d..f0a38f1 100644
--- a/library/backend/task.cpp
+++ b/library/backend/task.cpp
@@ -30,48 +30,49 @@
30 30
31using namespace Qtopia; 31using namespace Qtopia;
32UidGen Task::sUidGen( UidGen::Qtopia ); 32UidGen Task::sUidGen( UidGen::Qtopia );
33 33
34Task::Task() : Record(), mDue( FALSE ), 34Task::Task() : Record(), mDue( FALSE ),
35mDueDate( QDate::currentDate() ), 35mDueDate( QDate::currentDate() ),
36mCompleted( FALSE ), mPriority( 3 ), mDesc() 36mCompleted( FALSE ), mPriority( 3 ), mDesc()
37{ 37{
38} 38}
39 39
40Task::Task( const QMap<int, QString> &m ) : Record(), mDue( FALSE ), 40Task::Task( const QMap<int, QString> &m ) : Record(), mDue( FALSE ),
41mDueDate( QDate::currentDate() ), mCompleted( FALSE ), mPriority( 3 ), mDesc() 41mDueDate( QDate::currentDate() ), mCompleted( FALSE ), mPriority( 3 ), mDesc()
42{ 42{
43 //qDebug("Task::Task fromMap"); 43 //qDebug("Task::Task fromMap");
44 //dump( m ); 44 //dump( m );
45 for ( QMap<int,QString>::ConstIterator it = m.begin(); it != m.end();++it ) 45 for ( QMap<int,QString>::ConstIterator it = m.begin(); it != m.end();++it )
46 switch ( (TaskFields) it.key() ) { 46 switch ( (TaskFields) it.key() ) {
47 case HasDate: if ( *it == "1" ) mDue = TRUE; break; 47 case HasDate: if ( *it == "1" ) mDue = TRUE; break;
48 case Completed: setCompleted( *it == "1" ); break; 48 case Completed: setCompleted( *it == "1" ); break;
49 case TaskCategory: setCategories( idsFromString( *it ) ); break; 49 case TaskCategory: setCategories( idsFromString( *it ) ); break;
50 case TaskDescription: setDescription( *it ); break; 50 case TaskDescription: setDescription( *it ); break;
51 case Priority: setPriority( (*it).toInt() ); break; 51 case Priority: setPriority( (*it).toInt() ); break;
52 case Date: mDueDate = TimeConversion::fromString( (*it) ); break; 52 case Date: mDueDate = TimeConversion::fromString( (*it) ); break;
53 case TaskUid: setUid( (*it).toInt() ); break; 53 case TaskUid: setUid( (*it).toInt() ); break;
54 default: break;
54 } 55 }
55} 56}
56 57
57Task::~Task() 58Task::~Task()
58{ 59{
59} 60}
60 61
61QMap<int, QString> Task::toMap() const 62QMap<int, QString> Task::toMap() const
62{ 63{
63 QMap<int, QString> m; 64 QMap<int, QString> m;
64 m.insert( HasDate, hasDueDate() ? "1" : "0" ); 65 m.insert( HasDate, hasDueDate() ? "1" : "0" );
65 m.insert( Completed, isCompleted() ? "1" : "0" ); 66 m.insert( Completed, isCompleted() ? "1" : "0" );
66 m.insert( TaskCategory, idsToString( categories() ) ); 67 m.insert( TaskCategory, idsToString( categories() ) );
67 m.insert( TaskDescription, description() ); 68 m.insert( TaskDescription, description() );
68 m.insert( Priority, QString::number( priority() ) ); 69 m.insert( Priority, QString::number( priority() ) );
69 m.insert( Date, TimeConversion::toString( dueDate() ) ); 70 m.insert( Date, TimeConversion::toString( dueDate() ) );
70 m.insert( TaskUid, QString::number(uid()) ); 71 m.insert( TaskUid, QString::number(uid()) );
71 72
72 //qDebug("Task::toMap"); 73 //qDebug("Task::toMap");
73 //dump( m ); 74 //dump( m );
74 return m; 75 return m;
75} 76}
76 77
77void Task::save( QString& buf ) const 78void Task::save( QString& buf ) const