Feature #571 - Special tag feedback

- The verbosity token 'special' now controls whether the feedback is provided
  when special tags are added to a task.
- Added new 'special' verbosity token documentation to man page.
- Added missing 'next' special tag to man page.
- Added new localized strings for describing special tags.
This commit is contained in:
Paul Beckingham 2012-01-29 18:28:07 -05:00
parent bf9e14f581
commit 5609711d47
9 changed files with 39 additions and 1 deletions

View file

@ -82,7 +82,7 @@ std::string Config::_defaults =
"verbose=yes # Provide maximal feedback\n"
"#verbose=no # Provide minimal feedback\n"
"#verbose=list # Comma-separated list. May contain any subset of:\n"
"#verbose=blank,header,footnote,label,new-id,affected,edit\n"
"#verbose=blank,header,footnote,label,new-id,affected,edit,special\n"
"confirmation=yes # Confirmation on delete, big changes\n"
"echo.command=yes # Details on command just run. Deprecated\n"
"annotations=full # Level of verbosity for annotations: full, sparse or none\n"

View file

@ -520,7 +520,10 @@ void Command::modify_task (
A3::extract_tag (arg._raw, type, value);
if (type == '+')
{
task.addTag (value);
feedback_special_tags (task, value);
}
else
task.removeTag (value);
}

View file

@ -680,6 +680,10 @@
#define STRING_FEEDBACK_ANN_WAS_MOD "Annotation changed to '{1}'."
#define STRING_FEEDBACK_NOP "No changes will be made."
#define STRING_FEEDBACK_WAS_NOP "No changes made."
#define STRING_FEEDBACK_TAG_NOCOLOR "The 'nocolor' special tag will disable color rules for this task."
#define STRING_FEEDBACK_TAG_NONAG "The 'nonag' special tag will prevent nagging when this task is modified."
#define STRING_FEEDBACK_TAG_NOCAL "The 'nocal' special tag will keep this task off the calendar report."
#define STRING_FEEDBACK_TAG_NEXT "The 'next' special tag will boost the urgency of this task so it appears on the 'next' report."
// File
#define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'."

View file

@ -340,4 +340,29 @@ void feedback_affected (const std::string& effect, const Task& task)
}
////////////////////////////////////////////////////////////////////////////////
// Implements feedback when adding special tags to a task.
void feedback_special_tags (const Task& task, const std::string& tag)
{
if (context.verbose ("special"))
{
std::string msg;
std::string explanation;
if (tag == "nocolor") msg = STRING_FEEDBACK_TAG_NOCOLOR;
else if (tag == "nonag") msg = STRING_FEEDBACK_TAG_NONAG;
else if (tag == "nocal") msg = STRING_FEEDBACK_TAG_NOCAL;
else if (tag == "next") msg = STRING_FEEDBACK_TAG_NEXT;
if (msg.length ())
{
if (task.id)
std::cout << format (msg, task.id)
<< "\n";
else
std::cout << format (msg, task.get ("uuid"))
<< "\n";
}
}
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -77,6 +77,7 @@ std::string renderAttribute (const std::string&, const std::string&);
void feedback_affected (const std::string&);
void feedback_affected (const std::string&, int);
void feedback_affected (const std::string&, const Task&);
void feedback_special_tags (const Task&, const std::string&);
// sort.cpp
void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);