- Added support for shadow.notify to indicate when the shadow file is updated
- Fixed description validation bug that allowed \n, \r and \f in a description, then rendered the pending.data file unparseable
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -7,12 +7,15 @@ represents a feature release, and the Z represents a patch.
|
|||||||
|
|
||||||
------ current release ---------------------------
|
------ current release ---------------------------
|
||||||
|
|
||||||
1.4.3 (10/9/2008)
|
1.4.3 (10/24/2008)
|
||||||
+ Fixed misleading task count at bottom on "info" report.
|
+ Fixed misleading task count at bottom on "info" report
|
||||||
+ Added support for a shadow file that contains a plain text task report,
|
+ Added support for a shadow file that contains a plain text task report,
|
||||||
with the "shadow.file" and "shadow.command" configuration variables.
|
with the "shadow.file" and "shadow.command" configuration variables
|
||||||
The shadow file is automatically updated whenever the task database
|
The shadow file is automatically updated whenever the task database
|
||||||
changes. Useful for integrating with "Samurize".
|
changes. Useful for integrating with "Samurize"
|
||||||
|
+ Task now displays a message whenever a shadow file is updated, if the
|
||||||
|
"shadow.notify" configuration variable is set "on"
|
||||||
|
+ Bug: adding a task with a \n, \r or \f in it now fails properly
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -322,6 +322,12 @@ ID Project Pri Description
|
|||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt>shadow.notify</dt>
|
||||||
|
<dd>
|
||||||
|
When this value is set to "on", task will display a message
|
||||||
|
whenever the shadow file is updated by some task command.
|
||||||
|
</dd>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -94,13 +94,16 @@
|
|||||||
-->
|
-->
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4>New in version 1.4.3 (9/18/2008)</h4>
|
<h4>New in version 1.4.3 (10/24/2008)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed misleading task count at bottom of "info" report.
|
<li>Fixed misleading task count at bottom of "info" report.
|
||||||
<li>Added support for a shadow file that contains a plain text task report,
|
<li>Added support for a shadow file that contains a plain text task report,
|
||||||
with the "shadow.file" and "shadow.command" configuration variables.
|
with the "shadow.file" and "shadow.command" configuration variables.
|
||||||
The shadow file is automatically updated whenever the task database
|
The shadow file is automatically updated whenever the task database
|
||||||
changes. Useful for integrating with "Samurize".
|
changes. Useful for integrating with "Samurize".
|
||||||
|
<li>Task now displays a message whenever a shadow file is updated, if the
|
||||||
|
"shadow.notify" configuration variable is set "on".
|
||||||
|
<li>Fixed bug whereby adding a task with a \n, \r or \f dit not fail properly.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ void Config::createDefault (const std::string& home)
|
|||||||
fprintf (out, "#color.tag.bug=yellow\n");
|
fprintf (out, "#color.tag.bug=yellow\n");
|
||||||
fprintf (out, "#color.project.home=on_green\n");
|
fprintf (out, "#color.project.home=on_green\n");
|
||||||
fprintf (out, "#color.keyword.car=on_blue\n");
|
fprintf (out, "#color.keyword.car=on_blue\n");
|
||||||
|
fprintf (out, "#shadow.file=%s/shadow.txt\n", dataDir.c_str ());
|
||||||
|
fprintf (out, "#shadow.command=list\n");
|
||||||
|
fprintf (out, "#shadow.notify=on\n");
|
||||||
|
fprintf (out, "#default.command=list\n");
|
||||||
|
|
||||||
fclose (out);
|
fclose (out);
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void handleAdd (TDB& tdb, T& task, Config& conf)
|
|||||||
|
|
||||||
// Disallow blank descriptions.
|
// Disallow blank descriptions.
|
||||||
if (task.getDescription () == "")
|
if (task.getDescription () == "")
|
||||||
throw std::string ("Cannot add a blank task.");
|
throw std::string ("Cannot add a task that is blank, or contains <CR> or <LF> characters.");
|
||||||
|
|
||||||
if (!tdb.addT (task))
|
if (!tdb.addT (task))
|
||||||
throw std::string ("Could not create new task.");
|
throw std::string ("Could not create new task.");
|
||||||
|
|||||||
@@ -284,10 +284,21 @@ static bool validTag (const std::string& input)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
static bool validDescription (const std::string& input)
|
static bool validDescription (const std::string& input)
|
||||||
{
|
{
|
||||||
if (input.length () > 0)
|
/*
|
||||||
|
if (input.length () > 0 &&
|
||||||
|
input.find ("\r") == std::string::npos &&
|
||||||
|
input.find ("\f") == std::string::npos &&
|
||||||
|
input.find ("\n") == std::string::npos)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
|
if (input.length () == 0) return false;
|
||||||
|
if (input.find ("\r") != std::string::npos) return false;
|
||||||
|
if (input.find ("\f") != std::string::npos) return false;
|
||||||
|
if (input.find ("\n") != std::string::npos) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
11
src/task.cpp
11
src/task.cpp
@@ -679,13 +679,10 @@ void updateRecurrenceMask (
|
|||||||
// Using gTdb and gConf, generate a report.
|
// Using gTdb and gConf, generate a report.
|
||||||
void onChangeCallback ()
|
void onChangeCallback ()
|
||||||
{
|
{
|
||||||
std::cout << "--- callback" << std::endl;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (gConf && gTdb)
|
if (gConf && gTdb)
|
||||||
{
|
{
|
||||||
std::cout << "--- valid globals" << std::endl;
|
|
||||||
|
|
||||||
// Determine if shadow file is enabled.
|
// Determine if shadow file is enabled.
|
||||||
std::string shadowFile = expandPath (gConf->get ("shadow.file"));
|
std::string shadowFile = expandPath (gConf->get ("shadow.file"));
|
||||||
if (shadowFile != "")
|
if (shadowFile != "")
|
||||||
@@ -695,8 +692,6 @@ void onChangeCallback ()
|
|||||||
gConf->set ("curses", "off");
|
gConf->set ("curses", "off");
|
||||||
gConf->set ("color", "off");
|
gConf->set ("color", "off");
|
||||||
|
|
||||||
std::cout << "--- shadowFile " << shadowFile<< std::endl;
|
|
||||||
|
|
||||||
// Run report. Use shadow.command, using default.command as a fallback
|
// Run report. Use shadow.command, using default.command as a fallback
|
||||||
// with "list" as a default.
|
// with "list" as a default.
|
||||||
std::string command = gConf->get ("shadow.command",
|
std::string command = gConf->get ("shadow.command",
|
||||||
@@ -714,13 +709,15 @@ void onChangeCallback ()
|
|||||||
else
|
else
|
||||||
throw std::string ("Could not write file '") + shadowFile + "'";
|
throw std::string ("Could not write file '") + shadowFile + "'";
|
||||||
|
|
||||||
std::cout << "--- Complete " << std::endl;
|
|
||||||
|
|
||||||
gConf->set ("curses", oldCurses);
|
gConf->set ("curses", oldCurses);
|
||||||
gConf->set ("color", oldColor);
|
gConf->set ("color", oldColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("No specified shadow file '") + shadowFile + "'.";
|
throw std::string ("No specified shadow file '") + shadowFile + "'.";
|
||||||
|
|
||||||
|
// Optionally display a notification that the shadow file was updated.
|
||||||
|
if (gConf->get (std::string ("shadow.notify"), false))
|
||||||
|
std::cout << "[Shadow file '" << shadowFile << "' updated]" << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Internal error (TDB/Config).");
|
throw std::string ("Internal error (TDB/Config).");
|
||||||
|
|||||||
Reference in New Issue
Block a user