summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/todoevent.cpp46
-rw-r--r--libopie/todoevent.h27
2 files changed, 73 insertions, 0 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp
index a5dba4f..5537b77 100644
--- a/libopie/todoevent.cpp
+++ b/libopie/todoevent.cpp
@@ -2,2 +2,4 @@
2#include <opie/todoevent.h> 2#include <opie/todoevent.h>
3
4
3#include <qpe/palmtopuidgen.h> 5#include <qpe/palmtopuidgen.h>
@@ -6,2 +8,8 @@
6 8
9#include <qpe/stringutil.h>
10#include <qpe/categories.h>
11#include <qpe/categoryselect.h>
12
13#include <qobject.h>
14
7ToDoEvent::ToDoEvent(const ToDoEvent &event ) 15ToDoEvent::ToDoEvent(const ToDoEvent &event )
@@ -113,2 +121,40 @@ bool ToDoEvent::isOverdue( )
113} 121}
122
123/*!
124 Returns a richt text string
125*/
126QString ToDoEvent::richText() const
127{
128 QString text;
129 QStringList catlist;
130
131 // Description of the todo
132 if ( !description().isEmpty() ){
133 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
134 text += Qtopia::escapeString(description() ) + "<br>";
135 }
136 text += "<b>" + QObject::tr( "Priority:") +" </b>"
137 + QString::number( priority() ) + "<br>";
138 if (hasDate() ){
139 text += "<b>" + QObject::tr( "Deadline:") + " </b>";
140 text += date().toString();
141 text += "<br>";
142 }
143
144 // Open database of all categories and get the list of
145 // the categories this todoevent belongs to.
146 // Then print them...
147 // I am not sure whether there is no better way doing this !?
148 Categories catdb;
149 catdb.load( categoryFileName() );
150 catlist = allCategories();
151
152 text += "<b>" + QObject::tr( "Category:") + "</b> ";
153 for ( QStringList::Iterator it = catlist.begin(); it != catlist.end(); ++it ) {
154 text += catdb.label ("todo", (*it).toInt());
155 }
156 text += "<br>";
157 return text;
158}
159
114bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ 160bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{
diff --git a/libopie/todoevent.h b/libopie/todoevent.h
index 0d477fd..40d8f0b 100644
--- a/libopie/todoevent.h
+++ b/libopie/todoevent.h
@@ -10,3 +10,13 @@ class ToDoEvent {
10 public: 10 public:
11 // priorities from Very low to very high
11 enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW }; 12 enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW };
13 /* Constructs a new ToDoEvent
14 @param completed Is the TodoEvent completed
15 @param priority What is the priority of this ToDoEvent
16 @param category Which category does it belong( uid )
17 @param description What is this ToDoEvent about
18 @param hasDate Does this Event got a deadline
19 @param date what is the deadline?
20 @param uid what is the UUID of this Event
21 **/
12 ToDoEvent( bool completed = false, int priority = NORMAL, 22 ToDoEvent( bool completed = false, int priority = NORMAL,
@@ -15,5 +25,20 @@ class ToDoEvent {
15 bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); 25 bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 );
26 /* Copy c'tor
27
28 **/
16 ToDoEvent(const ToDoEvent & ); 29 ToDoEvent(const ToDoEvent & );
30
31 /*
32 Is this event completed?
33 **/
17 bool isCompleted() const; 34 bool isCompleted() const;
35
36 /*
37 Does this Event have a deadline
38 **/
18 bool hasDate() const; 39 bool hasDate() const;
40
41 /*
42 What is the priority?
43 **/
19 int priority()const ; 44 int priority()const ;
@@ -24,2 +49,4 @@ class ToDoEvent {
24 49
50 QString richText() const;
51
25 int uid()const { return m_uid;}; 52 int uid()const { return m_uid;};