- Task now supports a default project and priority for new tasks, via

the new "default.project" and "default.priority" configuration variables
  (thanks to Vincent Fleuranceau).
This commit is contained in:
Paul Beckingham 2008-09-12 12:14:26 -04:00
parent 4380c7c712
commit 4f8f044644
6 changed files with 32 additions and 1 deletions

View file

@ -16,6 +16,9 @@ represents a feature release, and the Z represents a patch.
(thanks to Vincent Fleuranceau)
+ Task now allows mixed case attribute names (pri:, PRI:, Pri: ...) and
commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau)
+ Task now supports a default project and priority for new tasks, via
the new "default.project" and "default.priority" configuration variables
(thanks to Vincent Fleuranceau)
------ old releases ------------------------------

View file

@ -248,6 +248,16 @@
<dd>
Colors any task where the description contains X.
</dd>
<dt>default.project</dt>
<dd>
Provides a default project name for the "task add ..." command.
</dd>
<dt>default.priority</dt>
<dd>
Provides a default priority for the "task add ..." command.
</dd>
</div>
<br />

View file

@ -100,6 +100,9 @@
color is disabled (thanks to Vincent Fleuranceau).
<li>Task now allows mixed case attribute names (pri:, PRI:, Pri: ...)
and commands (add, ADD, Add ...) (thanks to Vincent Fleuranceau).
<li>Task now supports a default project and priority for new tasks, via
the new "default.project" and "default.priority" configuration variables
(thanks to Vincent Fleuranceau).
</ul>
<p>

View file

@ -66,6 +66,20 @@ void handleAdd (const TDB& tdb, T& task, Config& conf)
task.setAttribute ("mask", "");
}
/**/
// Override with default.project, if not specified.
if (task.getAttribute ("project") == "")
task.setAttribute ("project", conf.get ("default.project", ""));
// Override with default.priority, if not specified.
if (task.getAttribute ("priority") == "")
{
std::string defaultPriority = conf.get ("default.priority", "");
if (validPriority (defaultPriority))
task.setAttribute ("priority", defaultPriority);
}
/**/
if (task.getDescription () == "")
throw std::string ("Cannot add a blank task.");

View file

@ -208,7 +208,7 @@ bool validDate (std::string& date, Config& conf)
}
////////////////////////////////////////////////////////////////////////////////
static bool validPriority (const std::string& input)
bool validPriority (const std::string& input)
{
if (input != "H" &&
input != "M" &&

View file

@ -55,6 +55,7 @@ for (typeof (c) *foreach_p = & (c); \
// parse.cpp
void parse (std::vector <std::string>&, std::string&, T&, Config&);
bool validPriority (const std::string&);
bool validDate (std::string&, Config&);
// task.cpp