diff --git a/NEWS b/NEWS index e5776dda2..a32027b59 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,8 @@ New Features in taskwarrior 2.4.3 - - + - UDA string attributes with allowable values can now define their sort order. + - The 'priority' attribute is now a UDA, configured by default. New commands in taskwarrior 2.4.3 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 7f238b8f8..ce8c794a1 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -320,10 +320,10 @@ This is useful for preventing large-scale unintended changes. .TP .B nag=You have more urgent tasks. -This may be a string of text, or blank. It is used as a prompt when a task is -started or completed that is not considered high priority. Default value is: -You have more urgent tasks. It is a gentle reminder that you are contradicting -your own priority settings. +This may be a string of text, or blank. It is used as a prompt when a task is +started of completed, when there are other tasks with a higher urgency. +Default value is: 'You have more urgent tasks'. +It is a gentle reminder that you are contradicting your own urgency settings. .TP .B list.all.projects=yes @@ -828,18 +828,6 @@ Task has at least one tag. .B color.recurring Task is recurring. .br -.B color.pri.H -Task has priority H. -.br -.B color.pri.M -Task has priority M. -.br -.B color.pri.L -Task has priority L. -.br -.B color.pri.none -Task has no priority. -.br .B color.completed Task is completed. .br @@ -1058,10 +1046,6 @@ Urgency inherited from dependency chain .RS Urgency coefficient for due dates .RE -.B urgency.priority.coefficient=6.0 -.RS -Urgency coefficient for priorities -.RE .B urgency.waiting.coefficient=-3.0 .RS Urgency coefficient for waiting status @@ -1124,13 +1108,6 @@ Provides a default project name for the .I task add command, if you don't specify one. The default is blank. -.TP -.B -default.priority=M -Provides a default priority for the -.I task add -command, if you don't specify one. The default is blank. - .TP .B default.due=... @@ -1336,19 +1313,36 @@ Provides a default report label for the UDA called ''. For type 'string' UDAs only, this provides a comma-separated list of acceptable values. In this example, the '' UDA may only contain values 'A', 'B', or 'C', but may also contain no value. + +Note that the order of the value is important, and denotes the sort order from +highest ('A') to lowest ('C'). + +Note that a blank value is permitted. +.RE + +.TP +.B uda..default=... +.RS +Provides a default value for the UDA called ''. .RE .TP .B Example 'estimate' UDA This example shows an 'estimate' UDA that stores specific values for the size -of a task. +of a task. Note the blank value after 'trivial'. .RS .B uda.estimate.type=string .br .B uda.estimate.label=Size Estimate .br -.B uda.estimate.values=trivial,small,medium,large,huge +.B uda.estimate.values=huge,large,medium,small,trivial, +.RE + +.RS +Note that the value are sorted + + huge > large > medium > small > trivial > '' .RE .SS CONTEXT diff --git a/src/Config.cpp b/src/Config.cpp index ce1d956ac..a10fd71d2 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -147,7 +147,6 @@ std::string Config::_defaults = "urgency.next.coefficient=15.0 # Urgency coefficient for 'next' special tag\n" "urgency.due.coefficient=12.0 # Urgency coefficient for due dates\n" "urgency.blocking.coefficient=8.0 # Urgency coefficient for blocking tasks\n" - "urgency.priority.coefficient=6.0 # Urgency coefficient for priorities\n" "urgency.active.coefficient=4.0 # Urgency coefficient for active tasks\n" "urgency.scheduled.coefficient=5.0 # Urgency coefficient for scheduled tasks\n" "urgency.age.coefficient=2.0 # Urgency coefficient for age\n" @@ -192,11 +191,11 @@ std::string Config::_defaults = "# Project\n" "color.project.none=\n" "\n" - "# Priority\n" - "color.pri.H=color255\n" - "color.pri.L=color245\n" - "color.pri.M=color250\n" - "color.pri.none=\n" + "# Priority UDA\n" + "color.uda.priority.H=color255\n" + "color.uda.priority.L=color245\n" + "color.uda.priority.M=color250\n" + "color.uda.priority.none=\n" "\n" "# Tags\n" "color.tag.next=rgb440\n" @@ -267,11 +266,11 @@ std::string Config::_defaults = "# Project\n" "color.project.none=\n" "\n" - "# Priority\n" - "color.pri.H=bold white\n" - "color.pri.M=white\n" - "color.pri.L=\n" - "color.pri.none=\n" + "# Priority UDA\n" + "color.uda.priority.H=bold white\n" + "color.uda.priority.M=white\n" + "color.uda.priority.L=\n" + "color.uda.priority.none=\n" "\n" "# Tags\n" "color.tag.next=bold yellow\n" @@ -319,13 +318,22 @@ std::string Config::_defaults = "color.undo.before=red\n" "\n" #endif + "# UDA priority\n" + "uda.priority.type=string # UDA priority is a string type\n" + "uda.priority.label=Priority # UDA priority has a display label'\n" + "uda.priority.values=H,M,L, # UDA priority values are 'H', 'M', 'L' or ''\n" + " # UDA priority sorting is 'H' > 'M' > 'L' > '' (highest to lowest)\n" + "#uda.priority.default=M # UDA priority default value of 'M'\n" + "urgency.uda.priority.H.coefficient=6.0 # UDA priority coefficient for value 'H'\n" + "urgency.uda.priority.M.coefficient=3.9 # UDA priority coefficient for value 'M'\n" + "urgency.uda.priority.L.coefficient=1.8 # UDA priority coefficient for value 'L'\n" + "\n" "# Here is the rule precedence order, highest to lowest.\n" "# Note that these are just the color rule names, without the leading 'color.'\n" "# and any trailing '.value'.\n" "rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,pri.\n" "\n" "#default.project=foo # Default project for 'add' command\n" - "#default.priority=M # Default priority for 'add' command\n" "#default.due=eom # Default due date for 'add' command\n" "default.command=next # When no arguments are specified\n" "\n" diff --git a/src/Context.cpp b/src/Context.cpp index e6a453daf..bd1da239f 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -633,7 +633,6 @@ void Context::staticInitialization () CLI::minimumMatchLength = config.getInteger ("abbreviation.minimum"); Task::defaultProject = config.get ("default.project"); - Task::defaultPriority = config.get ("default.priority"); Task::defaultDue = config.get ("default.due"); Task::searchCaseSensitive = Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive"); @@ -660,7 +659,6 @@ void Context::staticInitialization () for (i = columns.begin (); i != columns.end (); ++i) Task::attributes[i->first] = i->second->type (); - Task::urgencyPriorityCoefficient = config.getReal ("urgency.priority.coefficient"); Task::urgencyProjectCoefficient = config.getReal ("urgency.project.coefficient"); Task::urgencyActiveCoefficient = config.getReal ("urgency.active.coefficient"); Task::urgencyScheduledCoefficient = config.getReal ("urgency.scheduled.coefficient"); diff --git a/src/Task.cpp b/src/Task.cpp index 15875733f..353491f73 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -65,14 +65,12 @@ static const float epsilon = 0.000001; #endif std::string Task::defaultProject = ""; -std::string Task::defaultPriority = ""; std::string Task::defaultDue = ""; bool Task::searchCaseSensitive = true; bool Task::regex = false; std::map Task::attributes; std::map Task::coefficients; -float Task::urgencyPriorityCoefficient = 0.0; float Task::urgencyProjectCoefficient = 0.0; float Task::urgencyActiveCoefficient = 0.0; float Task::urgencyScheduledCoefficient = 0.0; @@ -1396,14 +1394,6 @@ void Task::validate (bool applyDefault /* = true */) set ("project", Task::defaultProject); } - // Override with default.priority, if not specified. - if (Task::defaultPriority != "" && - ! has ("priority")) - { - if (context.columns["priority"]->validate (Task::defaultPriority)) - set ("priority", Task::defaultPriority); - } - // Override with default.due, if not specified. if (Task::defaultDue != "" && ! has ("due")) @@ -1489,17 +1479,6 @@ void Task::validate (bool applyDefault /* = true */) throw std::string (format (STRING_TASK_VALID_RECUR, value)); } } - - // Priorities must be valid. - if (has ("priority")) - { - std::string priority = get ("priority"); - if (priority != "H" && - priority != "M" && - priority != "L" && - priority != "") - throw format (STRING_TASK_VALID_PRIORITY, priority); - } } //////////////////////////////////////////////////////////////////////////////// @@ -1657,7 +1636,6 @@ float Task::urgency_c () const { float value = 0.0; #ifdef PRODUCT_TASKWARRIOR - value += fabsf (Task::urgencyPriorityCoefficient) > epsilon ? (urgency_priority () * Task::urgencyPriorityCoefficient) : 0.0; value += fabsf (Task::urgencyProjectCoefficient) > epsilon ? (urgency_project () * Task::urgencyProjectCoefficient) : 0.0; value += fabsf (Task::urgencyActiveCoefficient) > epsilon ? (urgency_active () * Task::urgencyActiveCoefficient) : 0.0; value += fabsf (Task::urgencyScheduledCoefficient) > epsilon ? (urgency_scheduled () * Task::urgencyScheduledCoefficient) : 0.0; @@ -1744,18 +1722,6 @@ float Task::urgency () return urgency_value; } -//////////////////////////////////////////////////////////////////////////////// -float Task::urgency_priority () const -{ - const std::string& value = get_ref ("priority"); - - if (value == "H") return 1.0; - else if (value == "M") return 0.65; - else if (value == "L") return 0.3; - - return 0.0; -} - //////////////////////////////////////////////////////////////////////////////// float Task::urgency_inherit () const { @@ -1777,7 +1743,6 @@ float Task::urgency_inherit () const v += it->urgency_annotations (); v += it->urgency_due (); v += it->urgency_next (); - v += it->urgency_priority (); v += it->urgency_scheduled (); v += it->urgency_waiting (); diff --git a/src/Task.h b/src/Task.h index 4cbc06fb1..dae2a73d0 100644 --- a/src/Task.h +++ b/src/Task.h @@ -37,14 +37,12 @@ class Task : public std::map { public: static std::string defaultProject; - static std::string defaultPriority; static std::string defaultDue; static bool searchCaseSensitive; static bool regex; static std::map attributes; // name -> type static std::map coefficients; static std::map > customOrder; - static float urgencyPriorityCoefficient; static float urgencyProjectCoefficient; static float urgencyActiveCoefficient; static float urgencyScheduledCoefficient; @@ -165,7 +163,6 @@ private: const std::string decode (const std::string&) const; public: - float urgency_priority () const; float urgency_project () const; float urgency_active () const; float urgency_scheduled () const; diff --git a/src/Variant.cpp b/src/Variant.cpp index 6b4c9793e..51f389ec0 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -315,14 +315,6 @@ bool Variant::operator< (const Variant& other) const return left._string < right._string; case type_string: - if (left.source () == "priority" || right.source () == "priority") - { - if (left._string != "H" && right._string == "H") return true; - else if (left._string == "L" && right._string == "M") return true; - else if (left._string == "" && right._string != "") return true; - else return false; - } - else { if (left._string == right._string) return false; @@ -474,15 +466,6 @@ bool Variant::operator<= (const Variant& other) const return left._string <= right._string; case type_string: - if (left.source () == "priority" || right.source () == "priority") - { - if (left._string == right._string ) return true; - else if ( right._string == "H") return true; - else if (left._string == "L" && right._string == "M") return true; - else if (left._string == "" ) return true; - else return false; - } - else { if (left._string == right._string) return true; @@ -634,14 +617,6 @@ bool Variant::operator> (const Variant& other) const return left._string > right._string; case type_string: - if (left.source () == "priority" || right.source () == "priority") - { - if (left._string == "H" && right._string != "H") return true; - else if (left._string == "M" && right._string == "L") return true; - else if (left._string != "" && right._string == "") return true; - else return false; - } - else { if (left._string == right._string) return false; @@ -793,15 +768,6 @@ bool Variant::operator>= (const Variant& other) const return left._string >= right._string; case type_string: - if (left.source () == "priority" || right.source () == "priority") - { - if (left._string == right._string ) return true; - else if (left._string == "H" ) return true; - else if (left._string == "M" && right._string == "L") return true; - else if ( right._string == "" ) return true; - else return false; - } - else { if (left._string == right._string) return true; diff --git a/src/args.cpp b/src/args.cpp index bce3c07d5..872c583e4 100644 --- a/src/args.cpp +++ b/src/args.cpp @@ -135,7 +135,6 @@ int main (int argc, const char** argv) cli.entity ("attribute", "mask"); cli.entity ("attribute", "modified"); cli.entity ("attribute", "parent"); - cli.entity ("attribute", "priority"); cli.entity ("attribute", "project"); cli.entity ("attribute", "recur"); cli.entity ("attribute", "scheduled"); diff --git a/src/columns/CMakeLists.txt b/src/columns/CMakeLists.txt index e1e1a5637..25088a398 100644 --- a/src/columns/CMakeLists.txt +++ b/src/columns/CMakeLists.txt @@ -17,7 +17,6 @@ set (columns_SRCS Column.cpp Column.h ColMask.cpp ColMask.h ColModified.cpp ColModified.h ColParent.cpp ColParent.h - ColPriority.cpp ColPriority.h ColProject.cpp ColProject.h ColRecur.cpp ColRecur.h ColScheduled.cpp ColScheduled.h diff --git a/src/columns/ColPriority.cpp b/src/columns/ColPriority.cpp deleted file mode 100644 index faf31084e..000000000 --- a/src/columns/ColPriority.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include - -extern Context context; - -//////////////////////////////////////////////////////////////////////////////// -ColumnPriority::ColumnPriority () -{ - _name = "priority"; - _type = "string"; - _style = "short"; - _label = STRING_COLUMN_LABEL_PRI; - - _styles.push_back ("short"); - _styles.push_back ("long"); - - _examples.push_back ("H"); - _examples.push_back ("High"); -} - -//////////////////////////////////////////////////////////////////////////////// -ColumnPriority::~ColumnPriority () -{ -} - -//////////////////////////////////////////////////////////////////////////////// -// Allow lower case, but implicitly convert. -bool ColumnPriority::validate (std::string& value) -{ - if (value == "h") { value = "H"; return true; } - else if (value == "m") { value = "M"; return true; } - else if (value == "l") { value = "L"; return true; } - - return value == "H" || value == "M" || value == "L" || value == ""; -} - -//////////////////////////////////////////////////////////////////////////////// -// Overriden so that style <----> label are linked. -// Note that you can not determine which gets called first. -void ColumnPriority::setStyle (const std::string& value) -{ - _style = value; - - if (_style == "long" && _label == STRING_COLUMN_LABEL_PRI) - _label = STRING_COLUMN_LABEL_PRIORITY; -} - -//////////////////////////////////////////////////////////////////////////////// -// Set the minimum and maximum widths for the value. -void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& maximum) -{ - minimum = maximum = 0; - if (task.has (_name)) - { - std::string priority = task.get (_name); - - if (priority == "") - minimum = maximum = 0; - else - minimum = maximum = 1; - - if (_style == "long") - { - if (priority == "H") minimum = maximum = 4; - else if (priority == "M") minimum = maximum = 6; - else if (priority == "L") minimum = maximum = 3; - } - else if (_style != "default" && - _style != "short") - throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style); - } -} - -//////////////////////////////////////////////////////////////////////////////// -void ColumnPriority::render ( - std::vector & lines, - Task& task, - int width, - Color& color) -{ - if (task.has (_name)) - { - std::string priority = task.get (_name); - if (_style == "long") - { - if (priority == "H") priority = "High"; - else if (priority == "M") priority = "Medium"; - else if (priority == "L") priority = "Low"; - } - - lines.push_back (color.colorize (leftJustify (priority, width))); - } -} - -//////////////////////////////////////////////////////////////////////////////// -std::string ColumnPriority::modify (std::string& value) -{ - if (value == "h") value = "H"; - else if (value == "m") value = "M"; - else if (value == "l") value = "L"; - - return value; -} - -//////////////////////////////////////////////////////////////////////////////// -bool ColumnPriority::can_modify () -{ - return true; -} - -//////////////////////////////////////////////////////////////////////////////// - diff --git a/src/columns/ColPriority.h b/src/columns/ColPriority.h deleted file mode 100644 index afd836480..000000000 --- a/src/columns/ColPriority.h +++ /dev/null @@ -1,53 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_COLPRIORITY -#define INCLUDED_COLPRIORITY - -#include -#include -#include -#include -#include - -class ColumnPriority : public Column -{ -public: - ColumnPriority (); - ~ColumnPriority (); - - bool validate (std::string&); - void setStyle (const std::string&); - void measure (Task&, unsigned int&, unsigned int&); - void render (std::vector &, Task&, int, Color&); - std::string modify (std::string&); - bool can_modify (); - -private: -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index d37d9ba7f..101977825 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -88,7 +87,6 @@ Column* Column::factory (const std::string& name, const std::string& report) else if (column_name == "mask") c = new ColumnMask (); else if (column_name == "modified") c = new ColumnModified (); else if (column_name == "parent") c = new ColumnParent (); - else if (column_name == "priority") c = new ColumnPriority (); else if (column_name == "project") c = new ColumnProject (); else if (column_name == "recur") c = new ColumnRecur (); else if (column_name == "scheduled") c = new ColumnScheduled (); @@ -131,7 +129,6 @@ void Column::factory (std::map & all) c = new ColumnMask (); all[c->_name] = c; c = new ColumnModified (); all[c->_name] = c; c = new ColumnParent (); all[c->_name] = c; - c = new ColumnPriority (); all[c->_name] = c; c = new ColumnProject (); all[c->_name] = c; c = new ColumnRecur (); all[c->_name] = c; c = new ColumnScheduled (); all[c->_name] = c; diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 06d2c844e..8672e8011 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -206,8 +206,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat) << "# Status: " << ucFirst (Task::statusToText (task.getStatus ())) << "\n" // L10N safe ucFirst. << "# Mask: " << task.get ("mask") << "\n" << "# iMask: " << task.get ("imask") << "\n" - << " Project: " << task.get ("project") << "\n" - << " Priority: " << task.get ("priority") << "\n"; + << " Project: " << task.get ("project") << "\n"; std::vector tags; task.getTags (tags); @@ -343,25 +342,6 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string } } - // priority - value = findValue (after, "\n Priority:"); - if (task.get ("priority") != value) - { - if (value != "") - { - if (context.columns["priority"]->validate (value)) - { - context.footnote (STRING_EDIT_PRIORITY_MOD); - task.set ("priority", value); - } - } - else - { - context.footnote (STRING_EDIT_PRIORITY_DEL); - task.remove ("priority"); - } - } - // tags value = findValue (after, "\n Tags:"); std::vector tags; diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 5f5b4747a..da2b0e0a0 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -150,14 +150,6 @@ int CmdInfo::execute (std::string& output) view.set (row, 1, task->get ("project")); } - // priority - if (task->has ("priority")) - { - row = view.addRow (); - view.set (row, 0, STRING_COLUMN_LABEL_PRIORITY); - view.set (row, 1, task->get ("priority")); - } - // dependencies: blocked { std::vector blocked; @@ -420,7 +412,6 @@ int CmdInfo::execute (std::string& output) urgencyDetails.add (Column::factory ("string", "")); // Result urgencyTerm (urgencyDetails, "project", task->urgency_project (), Task::urgencyProjectCoefficient); - urgencyTerm (urgencyDetails, "priority", task->urgency_priority (), Task::urgencyPriorityCoefficient); urgencyTerm (urgencyDetails, "active", task->urgency_active (), Task::urgencyActiveCoefficient); urgencyTerm (urgencyDetails, "scheduled", task->urgency_scheduled (), Task::urgencyScheduledCoefficient); urgencyTerm (urgencyDetails, "waiting", task->urgency_waiting (), Task::urgencyWaitingCoefficient); diff --git a/src/commands/CmdProjects.cpp b/src/commands/CmdProjects.cpp index 1c69929cb..4e45dfae3 100644 --- a/src/commands/CmdProjects.cpp +++ b/src/commands/CmdProjects.cpp @@ -82,7 +82,6 @@ int CmdProjects::execute (std::string& output) std::map unique; bool no_project = false; std::string project; - std::string priority; std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 2d33a4ead..f7481b7f6 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -142,7 +142,6 @@ int CmdShow::execute (std::string& output) " debug.tls" " default.command" " default.due" - " default.priority" " default.project" " defaultheight" " defaultwidth" @@ -200,7 +199,6 @@ int CmdShow::execute (std::string& output) " urgency.inherit.coefficient" " urgency.due.coefficient" " urgency.next.coefficient" - " urgency.priority.coefficient" " urgency.project.coefficient" " urgency.tags.coefficient" " urgency.waiting.coefficient" @@ -367,15 +365,6 @@ int CmdShow::execute (std::string& output) out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.holidays", calendarholidays) << "\n"; - // Check for bad values in rc.default.priority. - std::string defaultPriority = context.config.get ("default.priority"); - if (defaultPriority != "H" && - defaultPriority != "M" && - defaultPriority != "L" && - defaultPriority != "") - out << format (STRING_CMD_SHOW_CONFIG_ERROR, "default.priority", defaultPriority) - << "\n"; - // Verify installation. This is mentioned in the documentation as the way // to ensure everything is properly installed. diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 4aa4ee12c..0f2821e11 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -86,7 +86,6 @@ #include #include -#include #include extern Context context; diff --git a/src/l10n/deu-DEU.h b/src/l10n/deu-DEU.h index 7d4491b8f..5db4fe064 100644 --- a/src/l10n/deu-DEU.h +++ b/src/l10n/deu-DEU.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Hinzugefügt" #define STRING_COLUMN_LABEL_AGE "Alter" #define STRING_COLUMN_LABEL_ID "ID" -#define STRING_COLUMN_LABEL_PRI "Pri" -#define STRING_COLUMN_LABEL_PRIORITY "Priorität" #define STRING_COLUMN_LABEL_PROJECT "Projekt" #define STRING_COLUMN_LABEL_UNTIL "Bis" #define STRING_COLUMN_LABEL_WAIT "Aufgeschoben" @@ -708,8 +706,6 @@ #define STRING_EDIT_PROJECT_MOD "Projekt geändert." #define STRING_EDIT_PROJECT_DEL "Projekt gelöscht." -#define STRING_EDIT_PRIORITY_MOD "Wichtigkeit geändert." -#define STRING_EDIT_PRIORITY_DEL "Wichtigkeit gelöscht." #define STRING_EDIT_DESC_MOD "Beschreibung geändert." #define STRING_EDIT_DESC_REMOVE_ERR "Beschreibung kann nicht entfernt werden." #define STRING_EDIT_ENTRY_REMOVE_ERR "Erstelldatum kann nicht entfernt werden." @@ -874,7 +870,6 @@ #define STRING_TASK_VALID_BEFORE "Warnung: Das '{1}'-Datum ist nach dem '{2}'-Datum." #define STRING_TASK_VALID_REC_DUE "Wiederholende Aufgaben müssen eine Fälligkeit besitzen." #define STRING_TASK_VALID_RECUR "Wiederhol-Periode '{1}' ist ungültig." -#define STRING_TASK_VALID_PRIORITY "Die Wichtigkeit kann die Werte 'H', 'M' oder 'L' annehmen, nicht jedoch '{1}'." #define STRING_TASK_SAFETY_VALVE "Dieser Befehl hat keinen Filter und wird alle Aufgaben verändern. Sind Sie sicher?" #define STRING_TASK_SAFETY_FAIL "Befehl an Ausführung gehindert." #define STRING_TASK_SAFETY_ALLOW "Kein Filter angegeben, und durch den konfigurierten 'allow.empty.filter'-Wert wurde keine Aktion durchgeführt." @@ -1029,4 +1024,7 @@ #define STRING_UTIL_KIBIBYTES "KiB" #define STRING_UTIL_BYTES "B" +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index ffa9968c7..a6add6df4 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Added" #define STRING_COLUMN_LABEL_AGE "Age" #define STRING_COLUMN_LABEL_ID "ID" -#define STRING_COLUMN_LABEL_PRI "Pri" -#define STRING_COLUMN_LABEL_PRIORITY "Priority" #define STRING_COLUMN_LABEL_PROJECT "Project" #define STRING_COLUMN_LABEL_UNTIL "Until" #define STRING_COLUMN_LABEL_WAIT "Wait" @@ -708,8 +706,6 @@ #define STRING_EDIT_PROJECT_MOD "Project modified." #define STRING_EDIT_PROJECT_DEL "Project deleted." -#define STRING_EDIT_PRIORITY_MOD "Priority modified." -#define STRING_EDIT_PRIORITY_DEL "Priority deleted." #define STRING_EDIT_DESC_MOD "Description modified." #define STRING_EDIT_DESC_REMOVE_ERR "Cannot remove description." #define STRING_EDIT_ENTRY_REMOVE_ERR "Cannot remove creation date." @@ -874,7 +870,6 @@ #define STRING_TASK_VALID_BEFORE "Warning: You have specified that the '{1}' date is after the '{2}' date." #define STRING_TASK_VALID_REC_DUE "A recurring task must also have a 'due' date." #define STRING_TASK_VALID_RECUR "The recurrence value '{1}' is not valid." -#define STRING_TASK_VALID_PRIORITY "Priority values may be 'H', 'M' or 'L', not '{1}'." #define STRING_TASK_SAFETY_VALVE "This command has no filter, and will modify all tasks. Are you sure?" #define STRING_TASK_SAFETY_FAIL "Command prevented from running." #define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken." @@ -1026,4 +1021,7 @@ #define STRING_UTIL_KIBIBYTES "KiB" #define STRING_UTIL_BYTES "B" +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/epo-RUS.h b/src/l10n/epo-RUS.h index 8b231086e..05270fdc3 100644 --- a/src/l10n/epo-RUS.h +++ b/src/l10n/epo-RUS.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Kreita" #define STRING_COLUMN_LABEL_AGE "Aĝo" #define STRING_COLUMN_LABEL_ID "ID" -#define STRING_COLUMN_LABEL_PRI "Gr" -#define STRING_COLUMN_LABEL_PRIORITY "Graveco" #define STRING_COLUMN_LABEL_PROJECT "Projekto" #define STRING_COLUMN_LABEL_UNTIL "Ĝis" #define STRING_COLUMN_LABEL_WAIT "Atendu" @@ -708,8 +706,6 @@ #define STRING_EDIT_PROJECT_MOD "Modifis la projekton." #define STRING_EDIT_PROJECT_DEL "Viŝis la projekton." -#define STRING_EDIT_PRIORITY_MOD "Modifis la gravecon." -#define STRING_EDIT_PRIORITY_DEL "Viŝis la gravecon." #define STRING_EDIT_DESC_MOD "Modifis la priskribon." #define STRING_EDIT_DESC_REMOVE_ERR "Ne povis viŝi la priskribon." #define STRING_EDIT_ENTRY_REMOVE_ERR "Ne povis viŝi la krean daton." @@ -874,7 +870,6 @@ #define STRING_TASK_VALID_BEFORE "Averto: Vi specifis daton '{1}' post dato '{2}'." #define STRING_TASK_VALID_REC_DUE "Reokazanta tasko devas ankaŭ havi daton 'due'." #define STRING_TASK_VALID_RECUR "Reokaz-valoro '{1}' ne estas valida." -#define STRING_TASK_VALID_PRIORITY "Gravec-valoro povas esti 'H', 'M', aŭ 'L', sed ne '{1}'." #define STRING_TASK_SAFETY_VALVE "Tiu komando ne havas filtrilo, do ĝi modifos ĉian taskon. Ĉu vi estas certa?" #define STRING_TASK_SAFETY_FAIL "Antaŭmalebligis komandon." #define STRING_TASK_SAFETY_ALLOW "Vi ne specifis filtrilon. Laŭ la valoro 'allow.empty.filter', ne faros nenion." @@ -1026,4 +1021,7 @@ #define STRING_UTIL_KIBIBYTES "KiB" #define STRING_UTIL_BYTES "B" +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/esp-ESP.h b/src/l10n/esp-ESP.h index cba68f585..2d199f1ad 100644 --- a/src/l10n/esp-ESP.h +++ b/src/l10n/esp-ESP.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Añadida" #define STRING_COLUMN_LABEL_AGE "Edad" #define STRING_COLUMN_LABEL_ID "ID" // |esp-ESP|==|eng-USA| -#define STRING_COLUMN_LABEL_PRI "Pri" // |esp-ESP|==|eng-USA| -#define STRING_COLUMN_LABEL_PRIORITY "Prioridad" #define STRING_COLUMN_LABEL_PROJECT "Proyecto" #define STRING_COLUMN_LABEL_UNTIL "Hasta" #define STRING_COLUMN_LABEL_WAIT "Espera" @@ -717,8 +715,6 @@ #define STRING_EDIT_PROJECT_MOD "Proyecto modificado." #define STRING_EDIT_PROJECT_DEL "Proyecto eliminado." -#define STRING_EDIT_PRIORITY_MOD "Prioridad modificada." -#define STRING_EDIT_PRIORITY_DEL "Prioridad eliminada." #define STRING_EDIT_DESC_MOD "Descripción modificada." #define STRING_EDIT_DESC_REMOVE_ERR "No se puede eliminar la descripción." #define STRING_EDIT_ENTRY_REMOVE_ERR "No se puede eliminar la fecha de creación." @@ -883,7 +879,6 @@ #define STRING_TASK_VALID_BEFORE "Advertencia: ha especificado que la fecha '{1}' es después de la fecha '{2}'." #define STRING_TASK_VALID_REC_DUE "Una tarea recurrente debe tener también una fecha de vencimiento." #define STRING_TASK_VALID_RECUR "El valor de recurrencia '{1}' no es válido." -#define STRING_TASK_VALID_PRIORITY "Valores de prioridad pueden ser 'H', 'M' o 'L', no '{1}'." #define STRING_TASK_SAFETY_VALVE "Este comando no tiene filtro, y modificará todas las tareas. ¿Está seguro?" #define STRING_TASK_SAFETY_FAIL "Se impidió la ejecución del comando." #define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken." @@ -1051,4 +1046,7 @@ #define STRING_UTIL_KIBIBYTES "KiB" // |esp-ESP|==|eng-USA| #define STRING_UTIL_BYTES "B" // |esp-ESP|==|eng-USA| +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/fra-FRA.h b/src/l10n/fra-FRA.h index f2f1ebe50..0537cd846 100644 --- a/src/l10n/fra-FRA.h +++ b/src/l10n/fra-FRA.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Ajoutée" #define STRING_COLUMN_LABEL_AGE "Age" #define STRING_COLUMN_LABEL_ID "ID" -#define STRING_COLUMN_LABEL_PRI "Pri" -#define STRING_COLUMN_LABEL_PRIORITY "Priorité" #define STRING_COLUMN_LABEL_PROJECT "Projet" #define STRING_COLUMN_LABEL_UNTIL "Until" #define STRING_COLUMN_LABEL_WAIT "Attente" @@ -707,8 +705,6 @@ #define STRING_EDIT_PROJECT_MOD "Projet modifié." #define STRING_EDIT_PROJECT_DEL "Projet supprimé." -#define STRING_EDIT_PRIORITY_MOD "Priorité modifiée." -#define STRING_EDIT_PRIORITY_DEL "Priorité supprimée." #define STRING_EDIT_DESC_MOD "Description modifiée." #define STRING_EDIT_DESC_REMOVE_ERR "Impossible de supprimer la description." #define STRING_EDIT_ENTRY_REMOVE_ERR "Impossible de supprimer la date de création." @@ -873,7 +869,6 @@ #define STRING_TASK_VALID_BEFORE "Warning: You have specified that the '{1}' date is after the '{2}' date." #define STRING_TASK_VALID_REC_DUE "A recurring task must also have a 'due' date." #define STRING_TASK_VALID_RECUR "The recurrence value '{1}' is not valid." -#define STRING_TASK_VALID_PRIORITY "Priority values may be 'H', 'M' or 'L', not '{1}'." #define STRING_TASK_SAFETY_VALVE "This command has no filter, and will modify all tasks. Are you sure?" #define STRING_TASK_SAFETY_FAIL "Command prevented from running." #define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken." @@ -1025,4 +1020,7 @@ #define STRING_UTIL_KIBIBYTES "kio" #define STRING_UTIL_BYTES "o" +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/ita-ITA.h b/src/l10n/ita-ITA.h index 358da09a0..c149967c1 100644 --- a/src/l10n/ita-ITA.h +++ b/src/l10n/ita-ITA.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Aggiunto" #define STRING_COLUMN_LABEL_AGE "Età" #define STRING_COLUMN_LABEL_ID "ID" -#define STRING_COLUMN_LABEL_PRI "Pri" -#define STRING_COLUMN_LABEL_PRIORITY "Priorità" #define STRING_COLUMN_LABEL_PROJECT "Progetto" #define STRING_COLUMN_LABEL_UNTIL "Fino a" #define STRING_COLUMN_LABEL_WAIT "Attesa" @@ -707,8 +705,6 @@ #define STRING_EDIT_PROJECT_MOD "Progetto modificato." #define STRING_EDIT_PROJECT_DEL "Progetto cancellato." -#define STRING_EDIT_PRIORITY_MOD "Progetto modificato." -#define STRING_EDIT_PRIORITY_DEL "Priorità cancellata." #define STRING_EDIT_DESC_MOD "Descrizione modificata." #define STRING_EDIT_DESC_REMOVE_ERR "Impossibile rimuovere la descrizione." #define STRING_EDIT_ENTRY_REMOVE_ERR "Impossibile rimuovere la data di creazione." @@ -873,7 +869,6 @@ #define STRING_TASK_VALID_BEFORE "Warning: data '{1}' con valore successivo alla data '{2}'." #define STRING_TASK_VALID_REC_DUE "Un task periodico deve avere una data di scadenza." #define STRING_TASK_VALID_RECUR "Il valore di periodicità '{1}' non è valido." -#define STRING_TASK_VALID_PRIORITY "I valori di priorità possono essere 'H', 'M' o 'L', non '{1}'." #define STRING_TASK_SAFETY_VALVE "Questo comando non ha filtro, e modificherà tutti i task. Sicuro?" #define STRING_TASK_SAFETY_FAIL "Prevenuta l'esecuzione del comando." #define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken." @@ -1025,4 +1020,7 @@ #define STRING_UTIL_KIBIBYTES "Kb" #define STRING_UTIL_BYTES "B" +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/pol-POL.h b/src/l10n/pol-POL.h index e313f2fad..a11e5a878 100644 --- a/src/l10n/pol-POL.h +++ b/src/l10n/pol-POL.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Dodane" #define STRING_COLUMN_LABEL_AGE "Wiek" #define STRING_COLUMN_LABEL_ID "ID" -#define STRING_COLUMN_LABEL_PRI "Pri" -#define STRING_COLUMN_LABEL_PRIORITY "Priorytet" #define STRING_COLUMN_LABEL_PROJECT "Projekt" #define STRING_COLUMN_LABEL_UNTIL "Do" #define STRING_COLUMN_LABEL_WAIT "Czeka" @@ -708,8 +706,6 @@ #define STRING_EDIT_PROJECT_MOD "Projekt zmieniony." #define STRING_EDIT_PROJECT_DEL "Projekt usunięty." -#define STRING_EDIT_PRIORITY_MOD "Priorytet zmieniony." -#define STRING_EDIT_PRIORITY_DEL "Priorytet usunięty." #define STRING_EDIT_DESC_MOD "Opis zmieniony." #define STRING_EDIT_DESC_REMOVE_ERR "Nie można usunąć opisu." #define STRING_EDIT_ENTRY_REMOVE_ERR "Nie można usunąć daty utworzenia." @@ -874,7 +870,6 @@ #define STRING_TASK_VALID_BEFORE "Uwaga: podałeś datę '{1}' jako datę po '{2}'." #define STRING_TASK_VALID_REC_DUE "Zadanie cykliczne musi posiadać datę zakończenia." #define STRING_TASK_VALID_RECUR "Wartość '{1}' określająca okres zadania jest niepoprawna." -#define STRING_TASK_VALID_PRIORITY "Poprawne wartości określające priorytet to 'H', 'M' lub 'L', nie '{1}'." #define STRING_TASK_SAFETY_VALVE "Nie nałożono filtra, wszystkie zadania zostaną poddane modyfikacji. Czy chcesz kontynuować?" #define STRING_TASK_SAFETY_FAIL "Niedopuszczono do wykonania polecenia." #define STRING_TASK_SAFETY_ALLOW "Brak filtra, z aktywną flagą 'allow.empty.filter', nie podjęto akcji." @@ -1026,4 +1021,7 @@ #define STRING_UTIL_KIBIBYTES "KiB" #define STRING_UTIL_BYTES "B" +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/l10n/por-PRT.h b/src/l10n/por-PRT.h index 64c9ca459..0a419f7c2 100644 --- a/src/l10n/por-PRT.h +++ b/src/l10n/por-PRT.h @@ -204,8 +204,6 @@ #define STRING_COLUMN_LABEL_ADDED "Adicionada" #define STRING_COLUMN_LABEL_AGE "Idade" #define STRING_COLUMN_LABEL_ID "ID" // |por-PRT|==|eng-USA| -#define STRING_COLUMN_LABEL_PRI "Pri" // |por-PRT|==|eng-USA| -#define STRING_COLUMN_LABEL_PRIORITY "Prioridade" #define STRING_COLUMN_LABEL_PROJECT "Projeto" #define STRING_COLUMN_LABEL_UNTIL "Até" #define STRING_COLUMN_LABEL_WAIT "Adiada" @@ -708,8 +706,6 @@ #define STRING_EDIT_PROJECT_MOD "Projeto modificado." #define STRING_EDIT_PROJECT_DEL "Projeto removido." -#define STRING_EDIT_PRIORITY_MOD "Prioridade modificada." -#define STRING_EDIT_PRIORITY_DEL "Prioridade removida." #define STRING_EDIT_DESC_MOD "Descrição modificada." #define STRING_EDIT_DESC_REMOVE_ERR "Não é possível remover a descrição." #define STRING_EDIT_ENTRY_REMOVE_ERR "Não é possível remover a data de criação." @@ -874,7 +870,6 @@ #define STRING_TASK_VALID_BEFORE "Aviso: Especificou que a data de '{1}' é posterior à data de '{2}'." #define STRING_TASK_VALID_REC_DUE "Uma tarefa recorrente necessita de uma data de vencimento." #define STRING_TASK_VALID_RECUR "O valor de recorrência '{1}' não é válido." -#define STRING_TASK_VALID_PRIORITY "Valores de prioridade podem ser 'A', 'M' ou 'B', não '{1}'." #define STRING_TASK_SAFETY_VALVE "Este comando não possui um filtro e irá modificar todas as tarefas. Tem a certeza?" #define STRING_TASK_SAFETY_FAIL "Execução do comando abortada." #define STRING_TASK_SAFETY_ALLOW "Não especificou um filtro e com o valor de 'allow.empty.filter', nenhuma ação foi tomada." @@ -1026,4 +1021,7 @@ #define STRING_UTIL_KIBIBYTES "KiB" // |por-PRT|==|eng-USA| #define STRING_UTIL_BYTES "B" // |por-PRT|==|eng-USA| +// Legacy +#define STRING_LEGACY_PRIORITY "Legacy attribute found. Please change '{1}' to '{2}'." + #endif diff --git a/src/legacy.cpp b/src/legacy.cpp index dc124558c..9adcb9efc 100644 --- a/src/legacy.cpp +++ b/src/legacy.cpp @@ -54,6 +54,21 @@ void legacyColumnMap (std::string& name) // 2014-01-26: recurrence_indicator --> recur.indicator Mapping removed // 2014-01-26: tag_indicator --> tags.indicator Mapping removed // 2014-01-26: description_only --> description.desc Mapping removed + + // One-time initialization, on demand. + static std::map legacyMap; + if (! legacyMap.size ()) + { + legacyMap["priority."] = "priority"; + } + + // If a legacy column was used, complain about it, but modify it anyway. + std::map ::iterator found = legacyMap.find (name); + if (found != legacyMap.end ()) + { + context.footnote (format (STRING_LEGACY_PRIORITY, name, found->second)); + name = found->second; + } } //////////////////////////////////////////////////////////////////////////////// @@ -71,6 +86,21 @@ void legacySortColumnMap (std::string& name) // 2014-01-26: recurrence_indicator --> recur Mapping removed // 2014-01-26: tag_indicator --> tags Mapping removed // 2014-01-26: description_only --> description Mapping removed + + // One-time initialization, on demand. + static std::map legacyMap; + if (! legacyMap.size ()) + { + legacyMap["priority."] = "priority"; + } + + // If a legacy column was used, complain about it, but modify it anyway. + std::map ::iterator found = legacyMap.find (name); + if (found != legacyMap.end ()) + { + context.footnote (format (STRING_LEGACY_PRIORITY, name, found->second)); + name = found->second; + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/rules.cpp b/src/rules.cpp index a4edafcf8..593ee72a9 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -111,34 +111,6 @@ static void colorizeTagged (Task& task, const Color& base, Color& c) c.blend (base); } -//////////////////////////////////////////////////////////////////////////////// -static void colorizePriorityL (Task& task, const Color& base, Color& c) -{ - if (task.get ("priority") == "L") - c.blend (base); -} - -//////////////////////////////////////////////////////////////////////////////// -static void colorizePriorityM (Task& task, const Color& base, Color& c) -{ - if (task.get ("priority") == "M") - c.blend (base); -} - -//////////////////////////////////////////////////////////////////////////////// -static void colorizePriorityH (Task& task, const Color& base, Color& c) -{ - if (task.get ("priority") == "H") - c.blend (base); -} - -//////////////////////////////////////////////////////////////////////////////// -static void colorizePriorityNone (Task& task, const Color& base, Color& c) -{ - if (task.get ("priority") == "") - c.blend (base); -} - //////////////////////////////////////////////////////////////////////////////// static void colorizeActive (Task& task, const Color& base, Color& c) { @@ -329,10 +301,6 @@ void autoColorize (Task& task, Color& c) if (*r == "color.blocked") colorizeBlocked (task, base, c); else if (*r == "color.blocking") colorizeBlocking (task, base, c); else if (*r == "color.tagged") colorizeTagged (task, base, c); - else if (*r == "color.pri.L") colorizePriorityL (task, base, c); - else if (*r == "color.pri.M") colorizePriorityM (task, base, c); - else if (*r == "color.pri.H") colorizePriorityH (task, base, c); - else if (*r == "color.pri.none") colorizePriorityNone (task, base, c); else if (*r == "color.active") colorizeActive (task, base, c); else if (*r == "color.scheduled") colorizeScheduled (task, base, c); else if (*r == "color.until") colorizeUntil (task, base, c); diff --git a/src/sort.cpp b/src/sort.cpp index eac6b1ca3..ea04bbfb8 100644 --- a/src/sort.cpp +++ b/src/sort.cpp @@ -79,8 +79,6 @@ static bool sort_compare (int left, int right) int right_number; float left_real; float right_real; - char left_char; - char right_char; std::vector ::iterator k; for (k = global_keys.begin (); k != global_keys.end (); ++k) @@ -133,25 +131,6 @@ static bool sort_compare (int left, int right) : (left_string > right_string); } - // Priority. - else if (field == "priority") - { - left_char = ((*global_data)[left].get (field))[0]; - right_char = ((*global_data)[right].get (field))[0]; - - if (left_char == right_char) - continue; - - if (ascending) - return (left_char == '\0' && right_char != '\0') || - (left_char == 'L' && (right_char == 'M' || right_char == 'H')) || - (left_char == 'M' && right_char == 'H'); - - return (left_char != '\0' && right_char == '\0') || - (left_char == 'M' && right_char == 'L') || - (left_char == 'H' && (right_char == 'M' || right_char == 'L')); - } - // Due Date. else if (field == "due") { diff --git a/test/bug.860.t b/test/bug.860.t deleted file mode 100755 index 1f4ea02b6..000000000 --- a/test/bug.860.t +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## -## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez. -## -## Permission is hereby granted, free of charge, to any person obtaining a copy -## of this software and associated documentation files (the "Software"), to deal -## in the Software without restriction, including without limitation the rights -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -## copies of the Software, and to permit persons to whom the Software is -## furnished to do so, subject to the following conditions: -## -## The above copyright notice and this permission notice shall be included -## in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -## SOFTWARE. -## -## http://www.opensource.org/licenses/mit-license.php -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 1; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -use File::Basename; -my $ut = basename ($0); -my $rc = $ut . '.rc'; - -# Create the rc file. -if (open my $fh, '>', $rc) -{ - print $fh "data.location=.\n"; - close $fh; -} - -# Bug 869: lower case priorities aren't accepted. -qx{../src/task rc:$rc add foo pri:h 2>&1}; -my $output = qx{../src/task rc:$rc 1 info 2>&1}; -like ($output, qr/Priority\s+H/, "$ut: pri:h --> pri:H"); - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data), $rc; -exit 0; - diff --git a/test/bug.990.t b/test/bug.990.t deleted file mode 100755 index 6204bc36f..000000000 --- a/test/bug.990.t +++ /dev/null @@ -1,61 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## -## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez. -## -## Permission is hereby granted, free of charge, to any person obtaining a copy -## of this software and associated documentation files (the "Software"), to deal -## in the Software without restriction, including without limitation the rights -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -## copies of the Software, and to permit persons to whom the Software is -## furnished to do so, subject to the following conditions: -## -## The above copyright notice and this permission notice shall be included -## in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -## SOFTWARE. -## -## http://www.opensource.org/licenses/mit-license.php -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 1; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -use File::Basename; -my $ut = basename ($0); -my $rc = $ut . '.rc'; - -# Create the rc file. -if (open my $fh, '>', $rc) -{ - print $fh "data.location=.\n", - "color.pri.L=green\n", - "color.tagged=red\n", - "_forcecolor=1\n", - "rule.precedence.color=pri.,tagged\n"; - close $fh; -} - -# Bug that colored any task with both priority:L and a tag as though -# rc.color.tagged had a higher precedence than rc.color.pri.L, which it is not. - -qx{../src/task rc:$rc add test +test pri:L 2>&1}; -my $output = qx{../src/task rc:$rc list 2>&1}; -like ($output, qr/ \033\[32m .* test .* \033\[0m /x, "$ut: Colored with the priority color, which has precedence over the tagged color"); - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data), $rc; -exit 0; - diff --git a/test/custom.priority_long.t b/test/custom.priority_long.t deleted file mode 100755 index aa1fb623a..000000000 --- a/test/custom.priority_long.t +++ /dev/null @@ -1,61 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## -## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez. -## -## Permission is hereby granted, free of charge, to any person obtaining a copy -## of this software and associated documentation files (the "Software"), to deal -## in the Software without restriction, including without limitation the rights -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -## copies of the Software, and to permit persons to whom the Software is -## furnished to do so, subject to the following conditions: -## -## The above copyright notice and this permission notice shall be included -## in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -## SOFTWARE. -## -## http://www.opensource.org/licenses/mit-license.php -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 4; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -# Create the rc file. -if (open my $fh, '>', 'pri.rc') -{ - print $fh "data.location=.\n", - "report.foo.description=DESC\n", - "report.foo.columns=id,priority.long\n", - "report.foo.labels=ID,Pri\n", - "report.foo.sort=id+\n"; - close $fh; -} - -# Generate the usage screen, and locate the custom report on it. -qx{../src/task rc:pri.rc add one pri:H 2>&1}; -qx{../src/task rc:pri.rc add two pri:M 2>&1}; -qx{../src/task rc:pri.rc add three pri:L 2>&1}; - -my $output = qx{../src/task rc:pri.rc foo 2>&1}; -like ($output, qr/ID.+Pri/, 'priority.long indicator heading'); -like ($output, qr/1\s+High/, 'priority.long High'); -like ($output, qr/2\s+Medium/, 'priority.long Medium'); -like ($output, qr/3\s+Low/, 'priority.long Low'); - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data pri.rc); -exit 0; - diff --git a/test/default.t b/test/default.t index 3e5f693b3..ff22af258 100755 --- a/test/default.t +++ b/test/default.t @@ -39,7 +39,7 @@ if (open my $fh, '>', 'default.rc') print $fh "data.location=.\n", "default.command=list\n", "default.project=PROJECT\n", - "default.priority=M\n", + "uda.priority.default=M\n", "default.due=eom\n", "dateformat=m/d/Y\n"; close $fh; diff --git a/test/view.t.cpp b/test/view.t.cpp index a78e5903f..a5f59cfe0 100644 --- a/test/view.t.cpp +++ b/test/view.t.cpp @@ -114,7 +114,7 @@ int main (int argc, char** argv) view.add (Column::factory ("id", report)); view.add (Column::factory ("uuid.short", report)); view.add (Column::factory ("project", report)); - view.add (Column::factory ("priority.long", report)); + view.add (Column::factory ("priority", report)); view.add (Column::factory ("tags", report)); view.add (Column::factory ("tags.count", report)); view.add (Column::factory ("description", report));