lib: large reworking and fixing of the Task record class
commiteca6cf2d33a69f863f3aa4f6616d087043be164b
authorChris Frey <cdfrey@foursquare.net>
Fri, 6 Apr 2012 03:01:34 +0000 (5 23:01 -0400)
committerChris Frey <cdfrey@foursquare.net>
Fri, 6 Apr 2012 03:01:34 +0000 (5 23:01 -0400)
treebdd66797f2be909bfa59d0ff270eb18007222525
parenta758f4a60897b80885ca6677552f18d34e84f70a
lib: large reworking and fixing of the Task record class

Removed the due date flag and the new alarm flag bool variables, since
the Barry::TimeT class is capable of being invalid/valid with IsValid().
This makes testing for whether these times are present easier, by
checking one variable instead of two.

Removed the FieldLink loop from the BuildFields() function, with the
goal of creating records as closely accurate to the records we receive
as possible.  This was in a vain effort to work around the Tasks database
firmware bug in the device, but since it makes for better records, we're
keeping it for now.

Changed the Builder code to reuse the DueTime field for both StartTime
and DueTime.  In devices, the data we receive from a Task record seems
to always have StartTime == DueTime.  So when creating a record, the
user does not need to set StartTime with the very same data.  The library
will take care of it for them.

The AlarmType is now only written via the Builder if the AlarmTime exists.
The same with the DueTime and AlarmTime flags.  These flags are completely
hidden by the library now.  The application does not need to worry about
them.

Fixed the Clear() function, using real enum values to clear AlarmType,
PriorityFlag, and StatusFlag, instead of setting them all to 0.  This
is so that a Normal priority is set by default, instead of High.
Plus it is cleaner to use enum names instead of casting about with int
casts.

This commit also fixes other code that used to depend on the flags.
src/r_task.cc
src/r_task.h
src/s11n-boost.h
src/vtodo.cc