summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/oprocess.h2
-rw-r--r--libopie/tododb.cpp8
-rw-r--r--libopie/todoevent.cpp21
-rw-r--r--libopie/todoevent.h11
4 files changed, 37 insertions, 5 deletions
diff --git a/libopie/oprocess.h b/libopie/oprocess.h
index ce3c87d..fd726b4 100644
--- a/libopie/oprocess.h
+++ b/libopie/oprocess.h
@@ -23,9 +23,9 @@
23// version 0.3.1, Jan 8th 1998 23// version 0.3.1, Jan 8th 1998
24// 24//
25// (C) Christian Czezatke 25// (C) Christian Czezatke
26// e9025461@student.tuwien.ac.at 26// e9025461@student.tuwien.ac.at
27// Ported by Holger Freyther 27// Ported by Holger Freyther to the Open Palmtop Integrated Environment
28// 28//
29 29
30#ifndef __kprocess_h__ 30#ifndef __kprocess_h__
31#define __kprocess_h__ 31#define __kprocess_h__
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp
index 6b10ec2..1e40c40 100644
--- a/libopie/tododb.cpp
+++ b/libopie/tododb.cpp
@@ -23,8 +23,9 @@ public:
23 XMLElement *task = new XMLElement(); 23 XMLElement *task = new XMLElement();
24 map.insert( "Completed", QString::number((int)(*it).isCompleted() ) ); 24 map.insert( "Completed", QString::number((int)(*it).isCompleted() ) );
25 map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); 25 map.insert( "HasDate", QString::number((int)(*it).hasDate() ) );
26 map.insert( "Priority", QString::number( (*it).priority() ) ); 26 map.insert( "Priority", QString::number( (*it).priority() ) );
27 map.insert( "Progress", QString::number( (*it).progress() ) );
27 map.insert( "Summary", (*it).summary() ); 28 map.insert( "Summary", (*it).summary() );
28 QArray<int> arrat = (*it).categories(); 29 QArray<int> arrat = (*it).categories();
29 QString attr; 30 QString attr;
30 for(uint i=0; i < arrat.count(); i++ ){ 31 for(uint i=0; i < arrat.count(); i++ ){
@@ -81,8 +82,15 @@ public:
81 // completed 82 // completed
82 dummy = element->attribute("Completed" ); 83 dummy = element->attribute("Completed" );
83 dumInt = dummy.toInt(&ok ); 84 dumInt = dummy.toInt(&ok );
84 if(ok ) event.setCompleted( dumInt == 0 ? false : true ); 85 if(ok ) event.setCompleted( dumInt == 0 ? false : true );
86 // progress
87 dummy = element->attribute("Progress" );
88 {
89 ushort dumShort = dummy.toUShort(&ok);
90 event.setProgress( dumShort );
91
92 }
85 // hasDate 93 // hasDate
86 dummy = element->attribute("HasDate" ); 94 dummy = element->attribute("HasDate" );
87 dumInt = dummy.toInt(&ok ); 95 dumInt = dummy.toInt(&ok );
88 if(ok ) event.setHasDate( dumInt == 0 ? false: true ); 96 if(ok ) event.setHasDate( dumInt == 0 ? false: true );
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp
index fb7073c..b35ac9d 100644
--- a/libopie/todoevent.cpp
+++ b/libopie/todoevent.cpp
@@ -20,16 +20,18 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event )
20ToDoEvent::ToDoEvent(bool completed, int priority, 20ToDoEvent::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;
27 m_isCompleted = completed; 28 m_isCompleted = completed;
28 m_hasDate = hasDate; 29 m_hasDate = hasDate;
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();
35 uid = uidgen->generate(); 37 uid = uidgen->generate();
@@ -77,8 +79,12 @@ QString ToDoEvent::extra(const QString& )const
77QString ToDoEvent::summary() const 79QString ToDoEvent::summary() const
78{ 80{
79 return m_sum; 81 return m_sum;
80} 82}
83ushort ToDoEvent::progress() const
84{
85 return m_prog;
86}
81void ToDoEvent::insertCategory(const QString &str ) 87void ToDoEvent::insertCategory(const QString &str )
82{ 88{
83 m_category.append( str ); 89 m_category.append( str );
84} 90}
@@ -138,9 +144,12 @@ bool ToDoEvent::isOverdue( )
138 if( m_hasDate ) 144 if( m_hasDate )
139 return QDate::currentDate() > m_date; 145 return QDate::currentDate() > m_date;
140 return false; 146 return false;
141} 147}
142 148void 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*/
146QString ToDoEvent::richText() const 155QString ToDoEvent::richText() const
@@ -152,12 +161,14 @@ QString ToDoEvent::richText() const
152 if ( !description().isEmpty() ){ 161 if ( !description().isEmpty() ){
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();
163 text += "<br>"; 174 text += "<br>";
@@ -185,9 +196,9 @@ QString ToDoEvent::richText() const
185} 196}
186 197
187bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ 198bool 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();
193 }else{ 204 }else{
@@ -237,8 +248,9 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const
237} 248}
238bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const 249bool 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 &&
244 m_category == toDoEvent.m_category && 256 m_category == toDoEvent.m_category &&
@@ -256,8 +268,9 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
256 m_category = item.m_category; 268 m_category = item.m_category;
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
263 276
diff --git a/libopie/todoevent.h b/libopie/todoevent.h
index 7454241..de4623f 100644
--- a/libopie/todoevent.h
+++ b/libopie/todoevent.h
@@ -25,8 +25,9 @@ class ToDoEvent {
25 ToDoEvent( bool completed = false, int priority = NORMAL, 25 ToDoEvent( bool completed = false, int priority = NORMAL,
26 const QStringList &category = QStringList(), 26 const QStringList &category = QStringList(),
27 const QString &summary = QString::null , 27 const QString &summary = QString::null ,
28 const QString &description = QString::null, 28 const QString &description = QString::null,
29 ushort progress = 0,
29 bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); 30 bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 );
30 /* Copy c'tor 31 /* Copy c'tor
31 32
32 **/ 33 **/
@@ -46,8 +47,12 @@ class ToDoEvent {
46 What is the priority? 47 What is the priority?
47 **/ 48 **/
48 int priority()const ; 49 int priority()const ;
49 50
51 /**
52 * progress as ushort 0, 20, 40, 60, 80 or 100%
53 */
54 ushort progress() const;
50 /* 55 /*
51 All category numbers as QString in a List 56 All category numbers as QString in a List
52 **/ 57 **/
53 QStringList allCategories()const; 58 QStringList allCategories()const;
@@ -114,8 +119,13 @@ class ToDoEvent {
114 */ 119 */
115 void setPriority(int priority ); 120 void setPriority(int priority );
116 121
117 /** 122 /**
123 * Set the progress.
124 */
125 void setProgress( ushort progress );
126
127 /**
118 * set the end date 128 * set the end date
119 */ 129 */
120 void setDate( QDate date ); 130 void setDate( QDate date );
121 void setDescription(const QString& ); 131 void setDescription(const QString& );
@@ -144,8 +154,9 @@ class ToDoEvent {
144 QString m_desc; 154 QString m_desc;
145 QString m_sum; 155 QString m_sum;
146 QMap<QString, QString> m_extra; 156 QMap<QString, QString> m_extra;
147 int m_uid; 157 int m_uid;
158 ushort m_prog;
148}; 159};
149 160
150 161
151#endif 162#endif