Re: Re: [PATCH] fix bad XML output when using todo recurrence

Paul Eggleton <[email protected]> Fri, 5 Jan 2007 17:51:34 +1300
Newsgroups gmane.comp.handhelds.opie.devel
Message-ID <[email protected]>
On Friday 05 January 2007 13:33, Erik Hovland wrote:
> Think you could:
> A) Rebase the patch against the top opie directory? Like
>    cvs diff -u libopie2/opiepim/backend/otodoaccessxml.cpp

Sorry about that. I guess I should do this for all of the other patches that 
haven't already gone in?

> B) Take out anything that is for style/format so that it is just the fix?
>
> I would be very appreciative. If I have it right the only real change was
> on line 580. Is that true?

Actually, spacing in the XML output was the whole problem - 
recurrence.toString() (libopie2/opiepim/core/opimrecurrence.cpp line 561) 
assumes pre-spacing and not post-spacing - it usually returns at line 
opimrecurrence.cpp line 581. I took the decision to change this function to 
match a similar function in odatebookaccessxml.cpp that also calls 
recurrence.toString(). 

We could just do a one-line fix if you'd prefer, but I think this is better 
for consistency.

Cheers,
Paul

_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
[email protected]
https://handhelds.org/mailman/listinfo/opie-devel
todo_recur_badxml2.patch (text/x-diff, 3.9 KB)
? libopie2/opiepim/backend/todo_recur_badxml.patch
Index: libopie2/opiepim/backend/otodoaccessxml.cpp
===================================================================
RCS file: /cvs/opie/libopie2/opiepim/backend/otodoaccessxml.cpp,v
retrieving revision 1.33
diff -u -B -b -r1.33 otodoaccessxml.cpp
--- libopie2/opiepim/backend/otodoaccessxml.cpp	28 Dec 2004 14:19:26 -0000	1.33
+++ libopie2/opiepim/backend/otodoaccessxml.cpp	5 Jan 2007 04:34:07 -0000
@@ -543,21 +543,21 @@
 QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
     QString str;
 
-    str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\" ";
-    str += "HasDate=\"" + QString::number( ev.hasDueDate() ) + "\" ";
-    str += "Priority=\"" + QString::number( ev.priority() ) + "\" ";
-    str += "Progress=\"" + QString::number(ev.progress() ) + "\" ";
-
-    str += "Categories=\"" + toString( ev.categories() ) + "\" ";
-    str += "Description=\"" + Qtopia::escapeString( ev.description() ) + "\" ";
-    str += "Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\" ";
+    str += "Completed=\"" + QString::number( ev.isCompleted() ) + "\"";
+    str += " HasDate=\"" + QString::number( ev.hasDueDate() ) + "\"";
+    str += " Priority=\"" + QString::number( ev.priority() ) + "\"";
+    str += " Progress=\"" + QString::number(ev.progress() ) + "\"";
+
+    str += " Categories=\"" + toString( ev.categories() ) + "\"";
+    str += " Description=\"" + Qtopia::escapeString( ev.description() ) + "\"";
+    str += " Summary=\"" + Qtopia::escapeString( ev.summary() ) + "\"";
 
     if ( ev.hasDueDate() ) {
-        str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" ";
-        str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" ";
-        str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" ";
+        str += " DateYear=\"" + QString::number( ev.dueDate().year() ) + "\"";
+        str += " DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\"";
+        str += " DateDay=\"" + QString::number( ev.dueDate().day() ) + "\"";
     }
-    str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
+    str += " Uid=\"" + QString::number( ev.uid() ) + "\"";
 
 // append the extra options
     /* FIXME Qtopia::Record this is currently not
@@ -570,18 +570,18 @@
     QMap<QString, QString> extras = ev.extras();
     QMap<QString, QString>::Iterator extIt;
     for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
-        str += extIt.key() + "=\"" +  extIt.data() + "\" ";
+        str += " " + extIt.key() + "=\"" +  extIt.data() + "\"";
     */
     // cross refernce
     if ( ev.hasRecurrence() ) {
         str += ev.recurrence().toString();
     }
     if ( ev.hasStartDate() )
-        str += "StartDate=\""+ OPimDateConversion::dateToString( ev.startDate() ) +"\" ";
+        str += " StartDate=\""+ OPimDateConversion::dateToString( ev.startDate() ) +"\"";
     if ( ev.hasCompletedDate() )
-        str += "CompletedDate=\""+ OPimDateConversion::dateToString( ev.completedDate() ) +"\" ";
+        str += " CompletedDate=\""+ OPimDateConversion::dateToString( ev.completedDate() ) +"\"";
     if ( ev.hasState() )
-        str += "State=\""+QString::number( ev.state().state() )+"\" ";
+        str += " State=\""+QString::number( ev.state().state() )+"\"";
 
     /*
      * save reminders and notifiers!
@@ -603,7 +603,7 @@
                 }
             }
             // now write the list
-            str += "Alarms=\""+als.join(";") +"\" ";
+            str += " Alarms=\""+als.join(";") +"\"";
         }
 
         /*
@@ -616,7 +616,7 @@
             for ( ; it != reminders.end(); ++it ) {
                 records << QString::number( (*it).recordUid() );
             }
-            str += "Reminders=\""+ records.join(";") +"\" ";
+            str += " Reminders=\""+ records.join(";") +"\"";
         }
     }
     str += customToXml( ev.toExtraMap() );