mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Enhancement - add
- Modified Record::get* methods to be const. - Implemented TDB2::add. - Renamed Task::valid to Task::validate. - Implemented Task::setEntry to default creation time. - Fixed bug where TDB2 was opening files "rw" instead of "r+".
This commit is contained in:
parent
8728312da6
commit
7b9cb12308
8 changed files with 70 additions and 55 deletions
16
src/Task.cpp
16
src/Task.cpp
|
@ -95,6 +95,14 @@ std::string Task::statusToText (Task::status s)
|
|||
return "pending";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::setEntry ()
|
||||
{
|
||||
char entryTime[16];
|
||||
sprintf (entryTime, "%u", (unsigned int) time (NULL));
|
||||
set ("entry", entryTime);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Task::status Task::getStatus ()
|
||||
{
|
||||
|
@ -102,7 +110,7 @@ Task::status Task::getStatus ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::setSatus (Task::status status)
|
||||
void Task::setStatus (Task::status status)
|
||||
{
|
||||
set ("status", statusToText (status));
|
||||
}
|
||||
|
@ -422,12 +430,14 @@ void Task::removeTag (const std::string& tag)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::valid () const
|
||||
void Task::validate () const
|
||||
{
|
||||
// TODO Verify until > due
|
||||
// TODO Verify entry < until, due, start, end
|
||||
// TODO If name == "recur", then Duration::valid (value).
|
||||
return true;
|
||||
|
||||
if (get ("description") == "")
|
||||
throw std::string ("Cannot add a task that is blank, or contains <CR> or <LF> characters.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue