-rw-r--r-- | libopie2/opiepim/core/opimtodo.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/opimtodo.cpp b/libopie2/opiepim/core/opimtodo.cpp index 16ca987..5bdc648 100644 --- a/libopie2/opiepim/core/opimtodo.cpp +++ b/libopie2/opiepim/core/opimtodo.cpp @@ -108,46 +108,54 @@ OPimTodo::OPimTodo( bool completed, int priority, const QString &description, ushort progress, bool hasDate, QDate date, int uid ) : OPimRecord( uid ) { setCategories( category ); data = new OPimTodoData; data->date = date; data->isCompleted = completed; data->hasDate = hasDate; + if ( priority < 1 ) + priority = 1; + else if ( priority > 5 ) + priority = 5; data->priority = priority; data->sum = summary; data->prog = progress; data->desc = Qtopia::simplifyMultiLineSpace( description ); } OPimTodo::OPimTodo( bool completed, int priority, const QStringList &category, const QString& summary, const QString &description, ushort progress, bool hasDate, QDate date, int uid ) : OPimRecord( uid ) { setCategories( idsFromString( category.join( ";" ) ) ); data = new OPimTodoData; data->date = date; data->isCompleted = completed; data->hasDate = hasDate; + if ( priority < 1 ) + priority = 1; + else if ( priority > 5 ) + priority = 5; data->priority = priority; data->sum = summary; data->prog = progress; data->desc = Qtopia::simplifyMultiLineSpace( description ); } bool OPimTodo::match( const QRegExp ®Exp ) const { if ( QString::number( data->priority ).find( regExp ) != -1 ) { setLastHitField( Priority ); @@ -330,24 +338,28 @@ void OPimTodo::setDescription( const QString &desc ) void OPimTodo::setSummary( const QString& sum ) { changeOrModify(); data->sum = sum; } void OPimTodo::setPriority( int prio ) { changeOrModify(); + if ( prio < 1 ) + prio = 1; + else if ( prio > 5 ) + prio = 5; data->priority = prio; } void OPimTodo::setDueDate( const QDate& date ) { changeOrModify(); data->date = date; } void OPimTodo::setStartDate( const QDate& date ) |