summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/otodoaccessxml.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessxml.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp65
1 files changed, 35 insertions, 30 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index cce6111..3e06d88 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -26,6 +26,25 @@
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29
30/* OPIE */
31#include <opie2/opimdateconversion.h>
32#include <opie2/opimstate.h>
33#include <opie2/opimtimezone.h>
34#include <opie2/opimnotifymanager.h>
35#include <opie2/opimrecurrence.h>
36#include <opie2/otodoaccessxml.h>
37#include <opie2/odebug.h>
38
39#include <qpe/global.h>
40#include <qpe/stringutil.h>
41#include <qpe/timeconversion.h>
42
43/* QT */
44#include <qfile.h>
45#include <qvector.h>
46
47/* STD */
29#include <errno.h> 48#include <errno.h>
30#include <fcntl.h> 49#include <fcntl.h>
31 50
@@ -36,20 +55,6 @@
36#include <unistd.h> 55#include <unistd.h>
37 56
38 57
39#include <qfile.h>
40#include <qvector.h>
41
42#include <qpe/global.h>
43#include <qpe/stringutil.h>
44#include <qpe/timeconversion.h>
45
46#include <opie2/opimdateconversion.h>
47#include <opie2/opimstate.h>
48#include <opie2/opimtimezone.h>
49#include <opie2/opimnotifymanager.h>
50#include <opie2/opimrecurrence.h>
51#include <opie2/otodoaccessxml.h>
52
53using namespace Opie; 58using namespace Opie;
54 59
55namespace { 60namespace {
@@ -177,7 +182,7 @@ bool OPimTodoAccessXML::load() {
177 while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) { 182 while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) {
178 i = point -dt; 183 i = point -dt;
179 i+= strLen; 184 i+= strLen;
180 qWarning("Found a start at %d %d", i, (point-dt) ); 185 owarn << "Found a start at " << i << " " << (point-dt) << "" << oendl;
181 186
182 OPimTodo ev; 187 OPimTodo ev;
183 m_year = m_month = m_day = 0; 188 m_year = m_month = m_day = 0;
@@ -233,7 +238,7 @@ bool OPimTodoAccessXML::load() {
233 /* 238 /*
234 * now add it 239 * now add it
235 */ 240 */
236 qWarning("End at %d", i ); 241 owarn << "End at " << i << "" << oendl;
237 if (m_events.contains( ev.uid() ) || ev.uid() == 0) { 242 if (m_events.contains( ev.uid() ) || ev.uid() == 0) {
238 ev.setUid( 1 ); 243 ev.setUid( 1 );
239 m_changed = true; 244 m_changed = true;
@@ -256,7 +261,7 @@ bool OPimTodoAccessXML::load() {
256 261
257 munmap(map_addr, attribut.st_size ); 262 munmap(map_addr, attribut.st_size );
258 263
259 qWarning("counts %d records loaded!", m_events.count() ); 264 owarn << "counts " << m_events.count() << " records loaded!" << oendl;
260 return true; 265 return true;
261} 266}
262bool OPimTodoAccessXML::reload() { 267bool OPimTodoAccessXML::reload() {
@@ -264,9 +269,9 @@ bool OPimTodoAccessXML::reload() {
264 return load(); 269 return load();
265} 270}
266bool OPimTodoAccessXML::save() { 271bool OPimTodoAccessXML::save() {
267// qWarning("saving"); 272// owarn << "saving" << oendl;
268 if (!m_opened || !m_changed ) { 273 if (!m_opened || !m_changed ) {
269// qWarning("not saving"); 274// owarn << "not saving" << oendl;
270 return true; 275 return true;
271 } 276 }
272 QString strNewFile = m_file + ".new"; 277 QString strNewFile = m_file + ".new";
@@ -307,7 +312,7 @@ bool OPimTodoAccessXML::save() {
307 f.close(); 312 f.close();
308 313
309 if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) { 314 if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) {
310// qWarning("error renaming"); 315// owarn << "error renaming" << oendl;
311 QFile::remove( strNewFile ); 316 QFile::remove( strNewFile );
312 } 317 }
313 318
@@ -345,7 +350,7 @@ void OPimTodoAccessXML::clear() {
345 m_events.clear(); 350 m_events.clear();
346} 351}
347bool OPimTodoAccessXML::add( const OPimTodo& todo ) { 352bool OPimTodoAccessXML::add( const OPimTodo& todo ) {
348// qWarning("add"); 353// owarn << "add" << oendl;
349 m_changed = true; 354 m_changed = true;
350 m_events.insert( todo.uid(), todo ); 355 m_events.insert( todo.uid(), todo );
351 356
@@ -404,13 +409,13 @@ QArray<int> OPimTodoAccessXML::overDue() {
404/* private */ 409/* private */
405void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev, 410void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
406 const QCString& attr, const QString& val) { 411 const QCString& attr, const QString& val) {
407// qWarning("parse to do from XMLElement" ); 412// owarn << "parse to do from XMLElement" << oendl;
408 413
409 int *find=0; 414 int *find=0;
410 415
411 find = (*dict)[ attr.data() ]; 416 find = (*dict)[ attr.data() ];
412 if (!find ) { 417 if (!find ) {
413// qWarning("Unknown option" + it.key() ); 418// owarn << "Unknown option" + it.key() << oendl;
414 ev.setCustomField( attr, val ); 419 ev.setCustomField( attr, val );
415 return; 420 return;
416 } 421 }
@@ -463,8 +468,8 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
463 QStringList als = QStringList::split(";", val ); 468 QStringList als = QStringList::split(";", val );
464 for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { 469 for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) {
465 QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty 470 QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
466 qWarning("alarm: %s", alarm.join("___").latin1() ); 471 owarn << "alarm: " << alarm.join("___") << "" << oendl;
467 qWarning("alarm[0]: %s %s", alarm[0].latin1(), OPimDateConversion::dateTimeFromString( alarm[0] ).toString().latin1() ); 472 owarn << "alarm[0]: " << alarm[0] << " " << OPimDateConversion::dateTimeFromString( alarm[0] ).toString() << "" << oendl;
468 OPimAlarm al( alarm[2].toInt(), OPimDateConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() ); 473 OPimAlarm al( alarm[2].toInt(), OPimDateConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
469 manager.add( al ); 474 manager.add( al );
470 } 475 }
@@ -537,11 +542,11 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
537namespace { 542namespace {
538QString customToXml(const QMap<QString, QString>& customMap ) 543QString customToXml(const QMap<QString, QString>& customMap )
539{ 544{
540 //qWarning(QString("writing custom %1").arg(customMap.count())); 545 //owarn << QString("writing custom %1").arg(customMap.count()) << oendl;
541 QString buf(" "); 546 QString buf(" ");
542 for ( QMap<QString, QString>::ConstIterator cit = customMap.begin(); 547 for ( QMap<QString, QString>::ConstIterator cit = customMap.begin();
543 cit != customMap.end(); ++cit) { 548 cit != customMap.end(); ++cit) {
544 // qWarning(".ITEM."); 549// owarn << ".ITEM." << oendl;
545 buf += cit.key(); 550 buf += cit.key();
546 buf += "=\""; 551 buf += "=\"";
547 buf += Qtopia::escapeString(cit.data()); 552 buf += Qtopia::escapeString(cit.data());
@@ -570,7 +575,7 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
570 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; 575 str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
571 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; 576 str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
572 } 577 }
573// qWarning( "Uid %d", ev.uid() ); 578// owarn << "Uid " << ev.uid() << "" << oendl;
574 str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; 579 str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
575 580
576// append the extra options 581// append the extra options
@@ -617,7 +622,7 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
617 } 622 }
618 } 623 }
619 // now write the list 624 // now write the list
620 qWarning("als: %s", als.join("____________").latin1() ); 625 owarn << "als: " << als.join("____________") << "" << oendl;
621 str += "Alarms=\""+als.join(";") +"\" "; 626 str += "Alarms=\""+als.join(";") +"\" ";
622 } 627 }
623 628
@@ -838,7 +843,7 @@ QArray<int> OPimTodoAccessXML::sorted( bool asc, int sortOrder,
838 } 843 }
839 /* isOverdue but we should not show overdue - why?*/ 844 /* isOverdue but we should not show overdue - why?*/
840/* if ( (*it).isOverdue() && !bOnly ) { 845/* if ( (*it).isOverdue() && !bOnly ) {
841 qWarning("item is overdue but !bOnly"); 846 owarn << "item is overdue but !bOnly" << oendl;
842 continue; 847 continue;
843 } 848 }
844*/ 849*/