-rw-r--r-- | library/backend/task.cpp | 1 |
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 @@ -6,96 +6,97 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qpe/task.h> #include <qregexp.h> #include <qstring.h> #include <qpe/recordfields.h> #include "vobject_p.h" #include "timeconversion.h" #include "qfiledirect_p.h" #include <stdio.h> using namespace Qtopia; UidGen Task::sUidGen( UidGen::Qtopia ); Task::Task() : Record(), mDue( FALSE ), mDueDate( QDate::currentDate() ), mCompleted( FALSE ), mPriority( 3 ), mDesc() { } Task::Task( const QMap<int, QString> &m ) : Record(), mDue( FALSE ), mDueDate( QDate::currentDate() ), mCompleted( FALSE ), mPriority( 3 ), mDesc() { //qDebug("Task::Task fromMap"); //dump( m ); for ( QMap<int,QString>::ConstIterator it = m.begin(); it != m.end();++it ) switch ( (TaskFields) it.key() ) { case HasDate: if ( *it == "1" ) mDue = TRUE; break; case Completed: setCompleted( *it == "1" ); break; case TaskCategory: setCategories( idsFromString( *it ) ); break; case TaskDescription: setDescription( *it ); break; case Priority: setPriority( (*it).toInt() ); break; case Date: mDueDate = TimeConversion::fromString( (*it) ); break; case TaskUid: setUid( (*it).toInt() ); break; + default: break; } } Task::~Task() { } QMap<int, QString> Task::toMap() const { QMap<int, QString> m; m.insert( HasDate, hasDueDate() ? "1" : "0" ); m.insert( Completed, isCompleted() ? "1" : "0" ); m.insert( TaskCategory, idsToString( categories() ) ); m.insert( TaskDescription, description() ); m.insert( Priority, QString::number( priority() ) ); m.insert( Date, TimeConversion::toString( dueDate() ) ); m.insert( TaskUid, QString::number(uid()) ); //qDebug("Task::toMap"); //dump( m ); return m; } void Task::save( QString& buf ) const { buf += " Completed=\""; // qDebug( "writing %d", complete ); buf += QString::number( (int)mCompleted ); buf += "\""; buf += " HasDate=\""; // qDebug( "writing %d", ); buf += QString::number( (int)mDue ); buf += "\""; buf += " Priority=\""; // qDebug ("writing %d", prior ); buf += QString::number( mPriority ); buf += "\""; buf += " Categories=\""; buf += Qtopia::Record::idsToString( categories() ); buf += "\""; buf += " Description=\""; // qDebug( "writing note %s", note.latin1() ); buf += Qtopia::escapeString( mDesc ); buf += "\""; if ( mDue ) { // qDebug("saving ymd %d %d %d", mDueDate.year(), mDueDate.month(), // mDueDate.day() ); buf += " DateYear=\""; |