author | drw <drw> | 2005-02-16 19:45:54 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-16 19:45:54 (UTC) |
commit | 28feca2d605de0bd5a1ccf2217dfef2a17466307 (patch) (unidiff) | |
tree | 0badbaa8bbbecfbe0541f1686572e12c2b8f383a | |
parent | 5ad21664e5db417a18682903a660f4651c68ff12 (diff) | |
download | opie-28feca2d605de0bd5a1ccf2217dfef2a17466307.zip opie-28feca2d605de0bd5a1ccf2217dfef2a17466307.tar.gz opie-28feca2d605de0bd5a1ccf2217dfef2a17466307.tar.bz2 |
Fix for bug #1542 - todo crashes when priority < 1 or > 5
-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, | |||
108 | const QString &description, | 108 | const QString &description, |
109 | ushort progress, | 109 | ushort progress, |
110 | bool hasDate, QDate date, int uid ) | 110 | bool hasDate, QDate date, int uid ) |
111 | : OPimRecord( uid ) | 111 | : OPimRecord( uid ) |
112 | { | 112 | { |
113 | setCategories( category ); | 113 | setCategories( category ); |
114 | 114 | ||
115 | data = new OPimTodoData; | 115 | data = new OPimTodoData; |
116 | 116 | ||
117 | data->date = date; | 117 | data->date = date; |
118 | data->isCompleted = completed; | 118 | data->isCompleted = completed; |
119 | data->hasDate = hasDate; | 119 | data->hasDate = hasDate; |
120 | if ( priority < 1 ) | ||
121 | priority = 1; | ||
122 | else if ( priority > 5 ) | ||
123 | priority = 5; | ||
120 | data->priority = priority; | 124 | data->priority = priority; |
121 | data->sum = summary; | 125 | data->sum = summary; |
122 | data->prog = progress; | 126 | data->prog = progress; |
123 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 127 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
124 | } | 128 | } |
125 | 129 | ||
126 | 130 | ||
127 | OPimTodo::OPimTodo( bool completed, int priority, | 131 | OPimTodo::OPimTodo( bool completed, int priority, |
128 | const QStringList &category, | 132 | const QStringList &category, |
129 | const QString& summary, | 133 | const QString& summary, |
130 | const QString &description, | 134 | const QString &description, |
131 | ushort progress, | 135 | ushort progress, |
132 | bool hasDate, QDate date, int uid ) | 136 | bool hasDate, QDate date, int uid ) |
133 | : OPimRecord( uid ) | 137 | : OPimRecord( uid ) |
134 | { | 138 | { |
135 | setCategories( idsFromString( category.join( ";" ) ) ); | 139 | setCategories( idsFromString( category.join( ";" ) ) ); |
136 | 140 | ||
137 | data = new OPimTodoData; | 141 | data = new OPimTodoData; |
138 | 142 | ||
139 | data->date = date; | 143 | data->date = date; |
140 | data->isCompleted = completed; | 144 | data->isCompleted = completed; |
141 | data->hasDate = hasDate; | 145 | data->hasDate = hasDate; |
146 | if ( priority < 1 ) | ||
147 | priority = 1; | ||
148 | else if ( priority > 5 ) | ||
149 | priority = 5; | ||
142 | data->priority = priority; | 150 | data->priority = priority; |
143 | data->sum = summary; | 151 | data->sum = summary; |
144 | data->prog = progress; | 152 | data->prog = progress; |
145 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 153 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
146 | } | 154 | } |
147 | 155 | ||
148 | 156 | ||
149 | bool OPimTodo::match( const QRegExp ®Exp ) const | 157 | bool OPimTodo::match( const QRegExp ®Exp ) const |
150 | { | 158 | { |
151 | if ( QString::number( data->priority ).find( regExp ) != -1 ) | 159 | if ( QString::number( data->priority ).find( regExp ) != -1 ) |
152 | { | 160 | { |
153 | setLastHitField( Priority ); | 161 | setLastHitField( Priority ); |
@@ -330,24 +338,28 @@ void OPimTodo::setDescription( const QString &desc ) | |||
330 | 338 | ||
331 | 339 | ||
332 | void OPimTodo::setSummary( const QString& sum ) | 340 | void OPimTodo::setSummary( const QString& sum ) |
333 | { | 341 | { |
334 | changeOrModify(); | 342 | changeOrModify(); |
335 | data->sum = sum; | 343 | data->sum = sum; |
336 | } | 344 | } |
337 | 345 | ||
338 | 346 | ||
339 | void OPimTodo::setPriority( int prio ) | 347 | void OPimTodo::setPriority( int prio ) |
340 | { | 348 | { |
341 | changeOrModify(); | 349 | changeOrModify(); |
350 | if ( prio < 1 ) | ||
351 | prio = 1; | ||
352 | else if ( prio > 5 ) | ||
353 | prio = 5; | ||
342 | data->priority = prio; | 354 | data->priority = prio; |
343 | } | 355 | } |
344 | 356 | ||
345 | 357 | ||
346 | void OPimTodo::setDueDate( const QDate& date ) | 358 | void OPimTodo::setDueDate( const QDate& date ) |
347 | { | 359 | { |
348 | changeOrModify(); | 360 | changeOrModify(); |
349 | data->date = date; | 361 | data->date = date; |
350 | } | 362 | } |
351 | 363 | ||
352 | 364 | ||
353 | void OPimTodo::setStartDate( const QDate& date ) | 365 | void OPimTodo::setStartDate( const QDate& date ) |