- Added 'modified' attribute in ::validate, if not already present. This is not
  strictly necessary, but it is good to be explicit.
This commit is contained in:
Paul Beckingham 2014-09-07 23:24:07 -04:00
parent 5ce317bb48
commit fe549094e3
3 changed files with 46 additions and 36 deletions

View file

@ -184,9 +184,9 @@ std::string Task::statusToText (Task::status s)
////////////////////////////////////////////////////////////////////////////////
void Task::setEntry ()
{
char entryTime[16];
sprintf (entryTime, "%u", (unsigned int) time (NULL));
set ("entry", entryTime);
char now[16];
sprintf (now, "%u", (unsigned int) time (NULL));
set ("entry", now);
recalc_urgency = true;
}
@ -194,9 +194,9 @@ void Task::setEntry ()
////////////////////////////////////////////////////////////////////////////////
void Task::setEnd ()
{
char endTime[16];
sprintf (endTime, "%u", (unsigned int) time (NULL));
set ("end", endTime);
char now[16];
sprintf (now, "%u", (unsigned int) time (NULL));
set ("end", now);
recalc_urgency = true;
}
@ -204,9 +204,9 @@ void Task::setEnd ()
////////////////////////////////////////////////////////////////////////////////
void Task::setStart ()
{
char startTime[16];
sprintf (startTime, "%u", (unsigned int) time (NULL));
set ("start", startTime);
char now[16];
sprintf (now, "%u", (unsigned int) time (NULL));
set ("start", now);
recalc_urgency = true;
}
@ -1492,6 +1492,10 @@ void Task::validate (bool applyDefault /* = true */)
(! has ("end") || get ("end") == ""))
setEnd ();
// Provide an entry date unless user already specified one.
if (!has ("modified") || get ("modified") == "")
setModified ();
if (applyDefault)
{
// Override with default.project, if not specified.