summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/otodo.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/otodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/otodo.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 38b93f7..5a18c37 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -7,48 +7,53 @@
7#include <qpe/palmtopuidgen.h> 7#include <qpe/palmtopuidgen.h>
8#include <qpe/stringutil.h> 8#include <qpe/stringutil.h>
9#include <qpe/palmtoprecord.h> 9#include <qpe/palmtoprecord.h>
10#include <qpe/stringutil.h> 10#include <qpe/stringutil.h>
11#include <qpe/categories.h> 11#include <qpe/categories.h>
12#include <qpe/categoryselect.h> 12#include <qpe/categoryselect.h>
13 13
14 14
15#include "opimstate.h" 15#include "opimstate.h"
16#include "orecur.h" 16#include "orecur.h"
17#include "opimmaintainer.h" 17#include "opimmaintainer.h"
18#include "opimnotifymanager.h" 18#include "opimnotifymanager.h"
19#include "opimresolver.h" 19#include "opimresolver.h"
20 20
21#include "otodo.h" 21#include "otodo.h"
22 22
23 23
24struct OTodo::OTodoData : public QShared { 24struct OTodo::OTodoData : public QShared {
25 OTodoData() : QShared() { 25 OTodoData() : QShared() {
26 recur = 0; 26 recur = 0;
27 state = 0; 27 state = 0;
28 maintainer = 0; 28 maintainer = 0;
29 notifiers = 0; 29 notifiers = 0;
30 }; 30 };
31 ~OTodoData() {
32 delete recur;
33 delete maintainer;
34 delete notifiers;
35 }
31 36
32 QDate date; 37 QDate date;
33 bool isCompleted:1; 38 bool isCompleted:1;
34 bool hasDate:1; 39 bool hasDate:1;
35 int priority; 40 int priority;
36 QString desc; 41 QString desc;
37 QString sum; 42 QString sum;
38 QMap<QString, QString> extra; 43 QMap<QString, QString> extra;
39 ushort prog; 44 ushort prog;
40 OPimState *state; 45 OPimState *state;
41 ORecur *recur; 46 ORecur *recur;
42 OPimMaintainer *maintainer; 47 OPimMaintainer *maintainer;
43 QDate start; 48 QDate start;
44 QDate completed; 49 QDate completed;
45 OPimNotifyManager *notifiers; 50 OPimNotifyManager *notifiers;
46}; 51};
47 52
48OTodo::OTodo(const OTodo &event ) 53OTodo::OTodo(const OTodo &event )
49 : OPimRecord( event ), data( event.data ) 54 : OPimRecord( event ), data( event.data )
50{ 55{
51 data->ref(); 56 data->ref();
52// qWarning("ref up"); 57// qWarning("ref up");
53} 58}
54OTodo::~OTodo() { 59OTodo::~OTodo() {
@@ -253,66 +258,65 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) {
253} 258}
254bool OTodo::isOverdue( ) 259bool OTodo::isOverdue( )
255{ 260{
256 if( data->hasDate && !data->isCompleted) 261 if( data->hasDate && !data->isCompleted)
257 return QDate::currentDate() > data->date; 262 return QDate::currentDate() > data->date;
258 return false; 263 return false;
259} 264}
260void OTodo::setProgress(ushort progress ) 265void OTodo::setProgress(ushort progress )
261{ 266{
262 changeOrModify(); 267 changeOrModify();
263 data->prog = progress; 268 data->prog = progress;
264} 269}
265QString OTodo::toShortText() const { 270QString OTodo::toShortText() const {
266 return summary(); 271 return summary();
267} 272}
268/*! 273/*!
269 Returns a richt text string 274 Returns a richt text string
270*/ 275*/
271QString OTodo::toRichText() const 276QString OTodo::toRichText() const
272{ 277{
273 QString text; 278 QString text;
274 QStringList catlist; 279 QStringList catlist;
275 280
276 // summary 281 // summary
277 text += "<b><h3><img src=\"todo/TodoList\">"; 282 text += "<b><h3><img src=\"todo/TodoList\"> ";
278 if ( !summary().isEmpty() ) { 283 if ( !summary().isEmpty() ) {
279 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" ); 284 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
280 } 285 }
281 text += "</h3></b><br><hr><br>"; 286 text += "</h3></b><br><hr><br>";
282 287
283 // description 288 // description
284 if( !description().isEmpty() ){ 289 if( !description().isEmpty() ){
285 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 290 text += "<b>" + QObject::tr( "Notes:" ) + "</b><br>";
286 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 291 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
287 } 292 }
288 293
289 // priority 294 // priority
290 int priorityval = priority(); 295 int priorityval = priority();
291 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" + 296 text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
292 QString::number( priorityval ) + "\">"; 297 QString::number( priorityval ) + "\"> ";
293// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" + 298
294// QString::number( priority() ) + "\"><br>";
295 switch ( priorityval ) 299 switch ( priorityval )
296 { 300 {
297 case 1 : text += QObject::tr( "Very high" ); 301 case 1 : text += QObject::tr( "Very high" );
298 break; 302 break;
299 case 2 : text += QObject::tr( "High" ); 303 case 2 : text += QObject::tr( "High" );
300 break; 304 break;
301 case 3 : text += QObject::tr( "Normal" ); 305 case 3 : text += QObject::tr( "Normal" );
302 break; 306 break;
303 case 4 : text += QObject::tr( "Low" ); 307 case 4 : text += QObject::tr( "Low" );
304 break; 308 break;
305 case 5 : text += QObject::tr( "Very low" ); 309 case 5 : text += QObject::tr( "Very low" );
306 break; 310 break;
307 }; 311 };
308 text += "<br>"; 312 text += "<br>";
309 313
310 // progress 314 // progress
311 text += "<b>" + QObject::tr( "Progress:") + " </b>" 315 text += "<b>" + QObject::tr( "Progress:") + " </b>"
312 + QString::number( progress() ) + " %<br>"; 316 + QString::number( progress() ) + " %<br>";
313 317
314 // due date 318 // due date
315 if (hasDueDate() ){ 319 if (hasDueDate() ){
316 QDate dd = dueDate(); 320 QDate dd = dueDate();
317 int off = QDate::currentDate().daysTo( dd ); 321 int off = QDate::currentDate().daysTo( dd );
318 322