summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-18 03:07:09 (UTC)
committer zecke <zecke>2002-10-18 03:07:09 (UTC)
commit86b3550348cf896b568e98d21da577c3f35a1a4a (patch) (unidiff)
tree865a24eb260564d502b933a9af105871d2da6d0f
parent218bc4583c545db50f3475930d61b1c76aca3fbd (diff)
downloadopie-86b3550348cf896b568e98d21da577c3f35a1a4a.zip
opie-86b3550348cf896b568e98d21da577c3f35a1a4a.tar.gz
opie-86b3550348cf896b568e98d21da577c3f35a1a4a.tar.bz2
Hi Stefan,
this commit should fix your problems... The XML todo backend was doing some stuff wrong with sorted Records. I even have a Comment describing this behaviour which is from the current POV wrong.. need to check my brain what I though this should do
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccessxml.cpp24
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp24
2 files changed, 38 insertions, 10 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 3b4cab2..7a55c67 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -106,33 +106,33 @@ bool OTodoAccessXML::load() {
106 : QString::fromLatin1( value ) ); 106 : QString::fromLatin1( value ) );
107 if ( haveEnt ) 107 if ( haveEnt )
108 str = Qtopia::plainString( str ); 108 str = Qtopia::plainString( str );
109 109
110 /* 110 /*
111 * add key + value 111 * add key + value
112 */ 112 */
113 todo( &dict, ev, attr, str ); 113 todo( &dict, ev, attr, str );
114 114
115 } 115 }
116 /* 116 /*
117 * now add it 117 * now add it
118 */ 118 */
119 m_events.insert(ev.uid(), ev ); 119 m_events.insert(ev.uid(), ev );
120 } 120 }
121 121
122 qWarning("counts %d", m_events.count() ); 122 qWarning("counts %d records loaded!", m_events.count() );
123 return true; 123 return true;
124} 124}
125bool OTodoAccessXML::reload() { 125bool OTodoAccessXML::reload() {
126 return load(); 126 return load();
127} 127}
128bool OTodoAccessXML::save() { 128bool OTodoAccessXML::save() {
129// qWarning("saving"); 129// qWarning("saving");
130 if (!m_opened || !m_changed ) { 130 if (!m_opened || !m_changed ) {
131// qWarning("not saving"); 131// qWarning("not saving");
132 return true; 132 return true;
133 } 133 }
134 QString strNewFile = m_file + ".new"; 134 QString strNewFile = m_file + ".new";
135 QFile f( strNewFile ); 135 QFile f( strNewFile );
136 if (!f.open( IO_WriteOnly|IO_Raw ) ) 136 if (!f.open( IO_WriteOnly|IO_Raw ) )
137 return false; 137 return false;
138 138
@@ -505,45 +505,59 @@ public:
505 } 505 }
506 private: 506 private:
507 bool m_asc; 507 bool m_asc;
508 int m_sort; 508 int m_sort;
509 509
510}; 510};
511 511
512QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, 512QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
513 int sortFilter, int cat ) { 513 int sortFilter, int cat ) {
514 qWarning("sorted! %d cat", cat); 514 qWarning("sorted! %d cat", cat);
515 OTodoXMLVector vector(m_events.count(), asc,sortOrder ); 515 OTodoXMLVector vector(m_events.count(), asc,sortOrder );
516 QMap<int, OTodo>::Iterator it; 516 QMap<int, OTodo>::Iterator it;
517 int item = 0; 517 int item = 0;
518 518
519 bool bCat = sortFilter & 1 ? true : false; 519 bool bCat = sortFilter & 1 ? true : false;
520 bool bOnly = sortFilter & 2 ? true : false; 520 bool bOnly = sortFilter & 2 ? true : false;
521 bool comp = sortFilter & 4 ? true : false;
521 for ( it = m_events.begin(); it != m_events.end(); ++it ) { 522 for ( it = m_events.begin(); it != m_events.end(); ++it ) {
522 523
523 /* show category */ 524 /* show category */
524 if ( bCat && cat != 0) 525 if ( bCat && cat != 0)
525 if (!(*it).categories().contains( cat ) ) 526 if (!(*it).categories().contains( cat ) ) {
527 qWarning("category mis match");
526 continue; 528 continue;
527 /* isOverdue but we should not show overdue */ 529 }
528 if ( (*it).isOverdue() && !bOnly ) 530 /* isOverdue but we should not show overdue - why?*/
531/* if ( (*it).isOverdue() && !bOnly ) {
532 qWarning("item is overdue but !bOnly");
533 continue;
534 }
535*/
536 if ( !(*it).isOverdue() && bOnly ) {
537 qWarning("item is not overdue but bOnly checked");
529 continue; 538 continue;
530 if ( !(*it).isOverdue() && bOnly ) 539 }
540
541 if ((*it).isCompleted() && comp ) {
542 qWarning("completed continue!");
531 continue; 543 continue;
544 }
532 545
533 546
534 OTodoXMLContainer* con = new OTodoXMLContainer(); 547 OTodoXMLContainer* con = new OTodoXMLContainer();
535 con->todo = (*it); 548 con->todo = (*it);
536 vector.insert(item, con ); 549 vector.insert(item, con );
537 item++; 550 item++;
538 } 551 }
552 qWarning("XXX %d Items added", item);
539 vector.resize( item ); 553 vector.resize( item );
540 /* sort it now */ 554 /* sort it now */
541 vector.sort(); 555 vector.sort();
542 /* now get the uids */ 556 /* now get the uids */
543 QArray<int> array( vector.count() ); 557 QArray<int> array( vector.count() );
544 for (uint i= 0; i < vector.count(); i++ ) { 558 for (uint i= 0; i < vector.count(); i++ ) {
545 array[i] = ( vector.at(i) )->todo.uid(); 559 array[i] = ( vector.at(i) )->todo.uid();
546 } 560 }
547 qWarning("array count = %d %d", array.count(), vector.count() ); 561 qWarning("array count = %d %d", array.count(), vector.count() );
548 return array; 562 return array;
549}; 563};
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 3b4cab2..7a55c67 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -106,33 +106,33 @@ bool OTodoAccessXML::load() {
106 : QString::fromLatin1( value ) ); 106 : QString::fromLatin1( value ) );
107 if ( haveEnt ) 107 if ( haveEnt )
108 str = Qtopia::plainString( str ); 108 str = Qtopia::plainString( str );
109 109
110 /* 110 /*
111 * add key + value 111 * add key + value
112 */ 112 */
113 todo( &dict, ev, attr, str ); 113 todo( &dict, ev, attr, str );
114 114
115 } 115 }
116 /* 116 /*
117 * now add it 117 * now add it
118 */ 118 */
119 m_events.insert(ev.uid(), ev ); 119 m_events.insert(ev.uid(), ev );
120 } 120 }
121 121
122 qWarning("counts %d", m_events.count() ); 122 qWarning("counts %d records loaded!", m_events.count() );
123 return true; 123 return true;
124} 124}
125bool OTodoAccessXML::reload() { 125bool OTodoAccessXML::reload() {
126 return load(); 126 return load();
127} 127}
128bool OTodoAccessXML::save() { 128bool OTodoAccessXML::save() {
129// qWarning("saving"); 129// qWarning("saving");
130 if (!m_opened || !m_changed ) { 130 if (!m_opened || !m_changed ) {
131// qWarning("not saving"); 131// qWarning("not saving");
132 return true; 132 return true;
133 } 133 }
134 QString strNewFile = m_file + ".new"; 134 QString strNewFile = m_file + ".new";
135 QFile f( strNewFile ); 135 QFile f( strNewFile );
136 if (!f.open( IO_WriteOnly|IO_Raw ) ) 136 if (!f.open( IO_WriteOnly|IO_Raw ) )
137 return false; 137 return false;
138 138
@@ -505,45 +505,59 @@ public:
505 } 505 }
506 private: 506 private:
507 bool m_asc; 507 bool m_asc;
508 int m_sort; 508 int m_sort;
509 509
510}; 510};
511 511
512QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, 512QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
513 int sortFilter, int cat ) { 513 int sortFilter, int cat ) {
514 qWarning("sorted! %d cat", cat); 514 qWarning("sorted! %d cat", cat);
515 OTodoXMLVector vector(m_events.count(), asc,sortOrder ); 515 OTodoXMLVector vector(m_events.count(), asc,sortOrder );
516 QMap<int, OTodo>::Iterator it; 516 QMap<int, OTodo>::Iterator it;
517 int item = 0; 517 int item = 0;
518 518
519 bool bCat = sortFilter & 1 ? true : false; 519 bool bCat = sortFilter & 1 ? true : false;
520 bool bOnly = sortFilter & 2 ? true : false; 520 bool bOnly = sortFilter & 2 ? true : false;
521 bool comp = sortFilter & 4 ? true : false;
521 for ( it = m_events.begin(); it != m_events.end(); ++it ) { 522 for ( it = m_events.begin(); it != m_events.end(); ++it ) {
522 523
523 /* show category */ 524 /* show category */
524 if ( bCat && cat != 0) 525 if ( bCat && cat != 0)
525 if (!(*it).categories().contains( cat ) ) 526 if (!(*it).categories().contains( cat ) ) {
527 qWarning("category mis match");
526 continue; 528 continue;
527 /* isOverdue but we should not show overdue */ 529 }
528 if ( (*it).isOverdue() && !bOnly ) 530 /* isOverdue but we should not show overdue - why?*/
531/* if ( (*it).isOverdue() && !bOnly ) {
532 qWarning("item is overdue but !bOnly");
533 continue;
534 }
535*/
536 if ( !(*it).isOverdue() && bOnly ) {
537 qWarning("item is not overdue but bOnly checked");
529 continue; 538 continue;
530 if ( !(*it).isOverdue() && bOnly ) 539 }
540
541 if ((*it).isCompleted() && comp ) {
542 qWarning("completed continue!");
531 continue; 543 continue;
544 }
532 545
533 546
534 OTodoXMLContainer* con = new OTodoXMLContainer(); 547 OTodoXMLContainer* con = new OTodoXMLContainer();
535 con->todo = (*it); 548 con->todo = (*it);
536 vector.insert(item, con ); 549 vector.insert(item, con );
537 item++; 550 item++;
538 } 551 }
552 qWarning("XXX %d Items added", item);
539 vector.resize( item ); 553 vector.resize( item );
540 /* sort it now */ 554 /* sort it now */
541 vector.sort(); 555 vector.sort();
542 /* now get the uids */ 556 /* now get the uids */
543 QArray<int> array( vector.count() ); 557 QArray<int> array( vector.count() );
544 for (uint i= 0; i < vector.count(); i++ ) { 558 for (uint i= 0; i < vector.count(); i++ ) {
545 array[i] = ( vector.at(i) )->todo.uid(); 559 array[i] = ( vector.at(i) )->todo.uid();
546 } 560 }
547 qWarning("array count = %d %d", array.count(), vector.count() ); 561 qWarning("array count = %d %d", array.count(), vector.count() );
548 return array; 562 return array;
549}; 563};