-rw-r--r-- | libopie/todoevent.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index fb7073c..b35ac9d 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp | |||
@@ -21,6 +21,7 @@ ToDoEvent::ToDoEvent(bool completed, int priority, | |||
21 | const QStringList &category, | 21 | const QStringList &category, |
22 | const QString& summary, | 22 | const QString& summary, |
23 | const QString &description, | 23 | const QString &description, |
24 | ushort progress, | ||
24 | bool hasDate, QDate date, int uid ) | 25 | bool hasDate, QDate date, int uid ) |
25 | { | 26 | { |
26 | m_date = date; | 27 | m_date = date; |
@@ -29,6 +30,7 @@ ToDoEvent::ToDoEvent(bool completed, int priority, | |||
29 | m_priority = priority; | 30 | m_priority = priority; |
30 | m_category = category; | 31 | m_category = category; |
31 | m_sum = summary; | 32 | m_sum = summary; |
33 | m_prog = progress; | ||
32 | m_desc = Qtopia::simplifyMultiLineSpace(description ); | 34 | m_desc = Qtopia::simplifyMultiLineSpace(description ); |
33 | if (uid == -1 ) { | 35 | if (uid == -1 ) { |
34 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); | 36 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); |
@@ -78,6 +80,10 @@ QString ToDoEvent::summary() const | |||
78 | { | 80 | { |
79 | return m_sum; | 81 | return m_sum; |
80 | } | 82 | } |
83 | ushort ToDoEvent::progress() const | ||
84 | { | ||
85 | return m_prog; | ||
86 | } | ||
81 | void ToDoEvent::insertCategory(const QString &str ) | 87 | void ToDoEvent::insertCategory(const QString &str ) |
82 | { | 88 | { |
83 | m_category.append( str ); | 89 | m_category.append( str ); |
@@ -139,7 +145,10 @@ bool ToDoEvent::isOverdue( ) | |||
139 | return QDate::currentDate() > m_date; | 145 | return QDate::currentDate() > m_date; |
140 | return false; | 146 | return false; |
141 | } | 147 | } |
142 | 148 | void ToDoEvent::setProgress(ushort progress ) | |
149 | { | ||
150 | m_prog = progress; | ||
151 | } | ||
143 | /*! | 152 | /*! |
144 | Returns a richt text string | 153 | Returns a richt text string |
145 | */ | 154 | */ |
@@ -153,10 +162,12 @@ QString ToDoEvent::richText() const | |||
153 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | 162 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; |
154 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 163 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
155 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 164 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
156 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 165 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br><br><br>"; |
157 | } | 166 | } |
158 | text += "<b>" + QObject::tr( "Priority:") +" </b>" | 167 | text += "<b>" + QObject::tr( "Priority:") +" </b>" |
159 | + QString::number( priority() ) + "<br>"; | 168 | + QString::number( priority() ) + " <br>"; |
169 | text += "<b>" + QObject::tr( "Progress:") + " </b>" | ||
170 | + QString::number( progress() ) + " %<br>"; | ||
160 | if (hasDate() ){ | 171 | if (hasDate() ){ |
161 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; | 172 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; |
162 | text += date().toString(); | 173 | text += date().toString(); |
@@ -186,7 +197,7 @@ QString ToDoEvent::richText() const | |||
186 | 197 | ||
187 | bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ | 198 | bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ |
188 | if( !hasDate() && !toDoEvent.hasDate() ) return true; | 199 | if( !hasDate() && !toDoEvent.hasDate() ) return true; |
189 | if( !hasDate() && toDoEvent.hasDate() ) return true; | 200 | if( !hasDate() && toDoEvent.hasDate() ) return false; |
190 | if( hasDate() && toDoEvent.hasDate() ){ | 201 | if( hasDate() && toDoEvent.hasDate() ){ |
191 | if( date() == toDoEvent.date() ){ // let's the priority decide | 202 | if( date() == toDoEvent.date() ){ // let's the priority decide |
192 | return priority() < toDoEvent.priority(); | 203 | return priority() < toDoEvent.priority(); |
@@ -238,6 +249,7 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const | |||
238 | bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const | 249 | bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const |
239 | { | 250 | { |
240 | if( m_priority == toDoEvent.m_priority && | 251 | if( m_priority == toDoEvent.m_priority && |
252 | m_priority == toDoEvent.m_prog && | ||
241 | m_isCompleted == toDoEvent.m_isCompleted && | 253 | m_isCompleted == toDoEvent.m_isCompleted && |
242 | m_hasDate == toDoEvent.m_hasDate && | 254 | m_hasDate == toDoEvent.m_hasDate && |
243 | m_date == toDoEvent.m_date && | 255 | m_date == toDoEvent.m_date && |
@@ -257,6 +269,7 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) | |||
257 | m_desc = item.m_desc; | 269 | m_desc = item.m_desc; |
258 | m_uid = item.m_uid; | 270 | m_uid = item.m_uid; |
259 | m_sum = item.m_sum; | 271 | m_sum = item.m_sum; |
272 | m_prog = item.m_prog; | ||
260 | return *this; | 273 | return *this; |
261 | } | 274 | } |
262 | 275 | ||