Portability: Updated to make main re-entrant()

- New INSTALL instructions to emscripten, and AUTHORS for contribution.
This commit is contained in:
Mark Scannell 2018-01-31 19:45:07 -05:00 committed by Paul Beckingham
parent cae3f06b7d
commit 7af6db4c17
112 changed files with 960 additions and 1147 deletions

View file

@ -36,8 +36,6 @@
#define STRING_CMD_DELETE_TASK_R "Deleting recurring task {1} '{2}'."
#define STRING_CMD_DELETE_CONFIRM_R "This is a recurring task. Do you want to delete all pending recurrences of this same task?"
extern Context context;
////////////////////////////////////////////////////////////////////////////////
CmdDelete::CmdDelete ()
{
@ -67,7 +65,7 @@ int CmdDelete::execute (std::string&)
filter.subset (filtered);
if (filtered.size () == 0)
{
context.footnote ("No tasks specified.");
Context::getContext ().footnote ("No tasks specified.");
return 1;
}
@ -95,21 +93,21 @@ int CmdDelete::execute (std::string&)
{
updateRecurrenceMask (task);
++count;
context.tdb2.modify (task);
Context::getContext ().tdb2.modify (task);
feedback_affected ("Deleting task {1} '{2}'.", task);
feedback_unblocked (task);
dependencyChainOnComplete (task);
if (context.verbose ("project"))
if (Context::getContext ().verbose ("project"))
projectChanges[task.get ("project")] = onProjectChange (task);
// Delete siblings.
if (task.has ("parent"))
{
if ((context.config.get ("recurrence.confirmation") == "prompt"
if ((Context::getContext ().config.get ("recurrence.confirmation") == "prompt"
&& confirm (STRING_CMD_DELETE_CONFIRM_R)) ||
context.config.getBoolean ("recurrence.confirmation"))
Context::getContext ().config.getBoolean ("recurrence.confirmation"))
{
std::vector <Task> siblings = context.tdb2.siblings (task);
std::vector <Task> siblings = Context::getContext ().tdb2.siblings (task);
for (auto& sibling : siblings)
{
sibling.modify (Task::modAnnotate);
@ -118,7 +116,7 @@ int CmdDelete::execute (std::string&)
sibling.setAsNow ("end");
updateRecurrenceMask (sibling);
context.tdb2.modify (sibling);
Context::getContext ().tdb2.modify (sibling);
feedback_affected (STRING_CMD_DELETE_TASK_R, sibling);
feedback_unblocked (sibling);
++count;
@ -126,21 +124,21 @@ int CmdDelete::execute (std::string&)
// Delete the parent
Task parent;
context.tdb2.get (task.get ("parent"), parent);
Context::getContext ().tdb2.get (task.get ("parent"), parent);
parent.setStatus (Task::deleted);
if (! parent.has ("end"))
parent.setAsNow ("end");
context.tdb2.modify (parent);
Context::getContext ().tdb2.modify (parent);
}
}
// Task potentially has child tasks - optionally delete them.
else
{
std::vector <Task> children = context.tdb2.children (task);
std::vector <Task> children = Context::getContext ().tdb2.children (task);
if (children.size () &&
(context.config.getBoolean ("recurrence.confirmation") ||
(Context::getContext ().config.getBoolean ("recurrence.confirmation") ||
confirm (STRING_CMD_DELETE_CONFIRM_R)))
{
for (auto& child : children)
@ -151,7 +149,7 @@ int CmdDelete::execute (std::string&)
child.setAsNow ("end");
updateRecurrenceMask (child);
context.tdb2.modify (child);
Context::getContext ().tdb2.modify (child);
feedback_affected (STRING_CMD_DELETE_TASK_R, child);
feedback_unblocked (child);
++count;
@ -180,7 +178,7 @@ int CmdDelete::execute (std::string&)
// Now list the project changes.
for (const auto& change : projectChanges)
if (change.first != "")
context.footnote (change.second);
Context::getContext ().footnote (change.second);
feedback_affected (count == 1 ? "Deleted {1} task." : "Deleted {1} tasks.", count);