author | zecke <zecke> | 2002-04-23 12:04:28 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-23 12:04:28 (UTC) |
commit | 367304a610dd618ad45ddce8256ba4d7d8ded442 (patch) (unidiff) | |
tree | c73838ac2bb496f6233ac6b793d5b17c867efbdb /libopie/todoevent.cpp | |
parent | 3197bbef89e9001929d826a8cbe39d675bcf7917 (diff) | |
download | opie-367304a610dd618ad45ddce8256ba4d7d8ded442.zip opie-367304a610dd618ad45ddce8256ba4d7d8ded442.tar.gz opie-367304a610dd618ad45ddce8256ba4d7d8ded442.tar.bz2 |
ToDoEvent::richText() added
this patch came from Stefan Eilers
is that the right place for it or does it belong into
the todo app itself?
-rw-r--r-- | libopie/todoevent.cpp | 46 |
1 files changed, 46 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 | |||
@@ -1,8 +1,16 @@ | |||
1 | 1 | ||
2 | #include <opie/todoevent.h> | 2 | #include <opie/todoevent.h> |
3 | |||
4 | |||
3 | #include <qpe/palmtopuidgen.h> | 5 | #include <qpe/palmtopuidgen.h> |
4 | #include <qpe/stringutil.h> | 6 | #include <qpe/stringutil.h> |
5 | #include <qpe/palmtoprecord.h> | 7 | #include <qpe/palmtoprecord.h> |
6 | 8 | ||
9 | #include <qpe/stringutil.h> | ||
10 | #include <qpe/categories.h> | ||
11 | #include <qpe/categoryselect.h> | ||
12 | |||
13 | #include <qobject.h> | ||
14 | |||
7 | ToDoEvent::ToDoEvent(const ToDoEvent &event ) | 15 | ToDoEvent::ToDoEvent(const ToDoEvent &event ) |
8 | { | 16 | { |
@@ -112,4 +120,42 @@ bool ToDoEvent::isOverdue( ) | |||
112 | return false; | 120 | return false; |
113 | } | 121 | } |
122 | |||
123 | /*! | ||
124 | Returns a richt text string | ||
125 | */ | ||
126 | QString 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 | |||
114 | bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ | 160 | bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ |
115 | if( !hasDate() && !toDoEvent.hasDate() ) return true; | 161 | if( !hasDate() && !toDoEvent.hasDate() ) return true; |