summaryrefslogtreecommitdiff
path: root/libopie
authorzecke <zecke>2003-05-12 13:12:45 (UTC)
committer zecke <zecke>2003-05-12 13:12:45 (UTC)
commit52b74f396416cc1b87d76a0541617512da22157a (patch) (unidiff)
treedbec31fb8b79cdb6fbe50f588aac280a8fdc2bfa /libopie
parent64f9f964ef690806378d639118f79539a8934d40 (diff)
downloadopie-52b74f396416cc1b87d76a0541617512da22157a.zip
opie-52b74f396416cc1b87d76a0541617512da22157a.tar.gz
opie-52b74f396416cc1b87d76a0541617512da22157a.tar.bz2
fix up OTodo::hasNotifiers
add a const notifiers() function and fix OPimNotifyManager::isEmpty
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimnotifymanager.cpp4
-rw-r--r--libopie/pim/otodo.cpp8
-rw-r--r--libopie/pim/otodo.h8
3 files changed, 17 insertions, 3 deletions
diff --git a/libopie/pim/opimnotifymanager.cpp b/libopie/pim/opimnotifymanager.cpp
index 49af757..06b5987 100644
--- a/libopie/pim/opimnotifymanager.cpp
+++ b/libopie/pim/opimnotifymanager.cpp
@@ -39,34 +39,36 @@ OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
39 return m_rem; 39 return m_rem;
40} 40}
41OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { 41OPimNotifyManager::Alarms OPimNotifyManager::alarms()const {
42 return m_al; 42 return m_al;
43} 43}
44void OPimNotifyManager::setAlarms( const Alarms& al) { 44void OPimNotifyManager::setAlarms( const Alarms& al) {
45 m_al = al; 45 m_al = al;
46} 46}
47void OPimNotifyManager::setReminders( const Reminders& rem) { 47void OPimNotifyManager::setReminders( const Reminders& rem) {
48 m_rem = rem; 48 m_rem = rem;
49} 49}
50/* FIXME!!! */ 50/* FIXME!!! */
51/** 51/**
52 * The idea is to check if the provider for our service 52 * The idea is to check if the provider for our service
53 * is online 53 * is online
54 * if it is we will use QCOP 54 * if it is we will use QCOP
55 * if not the Factory to get the backend... 55 * if not the Factory to get the backend...
56 * Qtopia1.6 services would be kewl to have here.... 56 * Qtopia1.6 services would be kewl to have here....
57 */ 57 */
58void OPimNotifyManager::registerNotify( const OPimNotify& ) { 58void OPimNotifyManager::registerNotify( const OPimNotify& ) {
59 59
60} 60}
61/* FIXME!!! */ 61/* FIXME!!! */
62/** 62/**
63 * same as above... 63 * same as above...
64 * Also implement Url model 64 * Also implement Url model
65 * have a MainWindow.... 65 * have a MainWindow....
66 */ 66 */
67void OPimNotifyManager::deregister( const OPimNotify& ) { 67void OPimNotifyManager::deregister( const OPimNotify& ) {
68 68
69} 69}
70bool OPimNotifyManager::isEmpty()const { 70bool OPimNotifyManager::isEmpty()const {
71 return ( m_rem.isEmpty() && m_al.isEmpty() ); 71 qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() );
72 if ( m_rem.isEmpty() && m_al.isEmpty() ) return true;
73 else return false;
72} 74}
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index f3df119..a29d88e 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -269,71 +269,77 @@ QString OTodo::toRichText() const
269 QString text; 269 QString text;
270 QStringList catlist; 270 QStringList catlist;
271 271
272 // Description of the todo 272 // Description of the todo
273 if ( !summary().isEmpty() ) { 273 if ( !summary().isEmpty() ) {
274 text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; 274 text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
275 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 275 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
276 } 276 }
277 if( !description().isEmpty() ){ 277 if( !description().isEmpty() ){
278 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 278 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
279 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 279 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
280 } 280 }
281 text += "<br><br><br>"; 281 text += "<br><br><br>";
282 282
283 text += "<b>" + QObject::tr( "Priority:") +" </b>" 283 text += "<b>" + QObject::tr( "Priority:") +" </b>"
284 + QString::number( priority() ) + " <br>"; 284 + QString::number( priority() ) + " <br>";
285 text += "<b>" + QObject::tr( "Progress:") + " </b>" 285 text += "<b>" + QObject::tr( "Progress:") + " </b>"
286 + QString::number( progress() ) + " %<br>"; 286 + QString::number( progress() ) + " %<br>";
287 if (hasDueDate() ){ 287 if (hasDueDate() ){
288 text += "<b>" + QObject::tr( "Deadline:") + " </b>"; 288 text += "<b>" + QObject::tr( "Deadline:") + " </b>";
289 text += dueDate().toString(); 289 text += dueDate().toString();
290 text += "<br>"; 290 text += "<br>";
291 } 291 }
292 292
293 text += "<b>" + QObject::tr( "Category:") + "</b> "; 293 text += "<b>" + QObject::tr( "Category:") + "</b> ";
294 text += categoryNames( "Todo List" ).join(", "); 294 text += categoryNames( "Todo List" ).join(", ");
295 text += "<br>"; 295 text += "<br>";
296 296
297 return text; 297 return text;
298} 298}
299bool OTodo::hasNotifiers()const { 299bool OTodo::hasNotifiers()const {
300 if (!data->notifiers) return false; 300 if (!data->notifiers) return false;
301 return data->notifiers->isEmpty(); 301 return !data->notifiers->isEmpty();
302} 302}
303OPimNotifyManager& OTodo::notifiers() { 303OPimNotifyManager& OTodo::notifiers() {
304 if (!data->notifiers ) 304 if (!data->notifiers )
305 data->notifiers = new OPimNotifyManager; 305 data->notifiers = new OPimNotifyManager;
306 return (*data->notifiers); 306 return (*data->notifiers);
307} 307}
308const OPimNotifyManager& OTodo::notifiers()const{
309 if (!data->notifiers )
310 data->notifiers = new OPimNotifyManager;
311
312 return (*data->notifiers);
313}
308 314
309bool OTodo::operator<( const OTodo &toDoEvent )const{ 315bool OTodo::operator<( const OTodo &toDoEvent )const{
310 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 316 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
311 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 317 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
312 if( hasDueDate() && toDoEvent.hasDueDate() ){ 318 if( hasDueDate() && toDoEvent.hasDueDate() ){
313 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 319 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
314 return priority() < toDoEvent.priority(); 320 return priority() < toDoEvent.priority();
315 }else{ 321 }else{
316 return dueDate() < toDoEvent.dueDate(); 322 return dueDate() < toDoEvent.dueDate();
317 } 323 }
318 } 324 }
319 return false; 325 return false;
320} 326}
321bool OTodo::operator<=(const OTodo &toDoEvent )const 327bool OTodo::operator<=(const OTodo &toDoEvent )const
322{ 328{
323 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 329 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
324 if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; 330 if( !hasDueDate() && toDoEvent.hasDueDate() ) return true;
325 if( hasDueDate() && toDoEvent.hasDueDate() ){ 331 if( hasDueDate() && toDoEvent.hasDueDate() ){
326 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 332 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
327 return priority() <= toDoEvent.priority(); 333 return priority() <= toDoEvent.priority();
328 }else{ 334 }else{
329 return dueDate() <= toDoEvent.dueDate(); 335 return dueDate() <= toDoEvent.dueDate();
330 } 336 }
331 } 337 }
332 return true; 338 return true;
333} 339}
334bool OTodo::operator>(const OTodo &toDoEvent )const 340bool OTodo::operator>(const OTodo &toDoEvent )const
335{ 341{
336 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; 342 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false;
337 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 343 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
338 if( hasDueDate() && toDoEvent.hasDueDate() ){ 344 if( hasDueDate() && toDoEvent.hasDueDate() ){
339 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 345 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index 0e7c73f..4d5ee36 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -146,72 +146,78 @@ public:
146 * the recurrance of this 146 * the recurrance of this
147 */ 147 */
148 ORecur recurrence()const; 148 ORecur recurrence()const;
149 149
150 /** 150 /**
151 * does this OTodo have a maintainer? 151 * does this OTodo have a maintainer?
152 */ 152 */
153 bool hasMaintainer()const; 153 bool hasMaintainer()const;
154 154
155 /** 155 /**
156 * the Maintainer of this OTodo 156 * the Maintainer of this OTodo
157 */ 157 */
158 OPimMaintainer maintainer()const; 158 OPimMaintainer maintainer()const;
159 159
160 /** 160 /**
161 * The description of the todo 161 * The description of the todo
162 */ 162 */
163 QString description()const; 163 QString description()const;
164 164
165 /** 165 /**
166 * A small summary of the todo 166 * A small summary of the todo
167 */ 167 */
168 QString summary() const; 168 QString summary() const;
169 169
170 /** 170 /**
171 * @reimplemented 171 * @reimplemented
172 * Return this todoevent in a RichText formatted QString 172 * Return this todoevent in a RichText formatted QString
173 */ 173 */
174 QString toRichText() const; 174 QString toRichText() const;
175 175
176 bool hasNotifiers()const; 176 bool hasNotifiers()const;
177 /* 177 /*
178 * check if the sharing is still fine!! -zecke 178 * FIXME check if the sharing is still fine!! -zecke
179 * ### CHECK If API is fine
179 */ 180 */
180 /** 181 /**
181 * return a reference to our notifiers... 182 * return a reference to our notifiers...
182 */ 183 */
183 OPimNotifyManager &notifiers(); 184 OPimNotifyManager &notifiers();
184 185
185 /** 186 /**
187 *
188 */
189 const OPimNotifyManager &notifiers()const;
190
191 /**
186 * reimplementations 192 * reimplementations
187 */ 193 */
188 QString type()const; 194 QString type()const;
189 QString toShortText()const; 195 QString toShortText()const;
190 QMap<QString, QString> toExtraMap()const; 196 QMap<QString, QString> toExtraMap()const;
191 QString recordField(int id )const; 197 QString recordField(int id )const;
192 198
193 /** 199 /**
194 * toMap puts all data into the map. int relates 200 * toMap puts all data into the map. int relates
195 * to ToDoEvent RecordFields enum 201 * to ToDoEvent RecordFields enum
196 */ 202 */
197 QMap<int, QString> toMap()const; 203 QMap<int, QString> toMap()const;
198 204
199 /** 205 /**
200 * Set if this Todo is completed 206 * Set if this Todo is completed
201 */ 207 */
202 void setCompleted(bool completed ); 208 void setCompleted(bool completed );
203 209
204 /** 210 /**
205 * set if this todo got an end data 211 * set if this todo got an end data
206 */ 212 */
207 void setHasDueDate( bool hasDate ); 213 void setHasDueDate( bool hasDate );
208 // FIXME we do not have these for start, completed 214 // FIXME we do not have these for start, completed
209 // cause we'll use the isNull() of QDate for figuring 215 // cause we'll use the isNull() of QDate for figuring
210 // out if it's has a date... 216 // out if it's has a date...
211 // decide what to do here? -zecke 217 // decide what to do here? -zecke
212 218
213 /** 219 /**
214 * Set the priority of the Todo 220 * Set the priority of the Todo
215 */ 221 */
216 void setPriority(int priority ); 222 void setPriority(int priority );
217 223