From 2135cb141df91bfa85910ce6c3022840211a16e7 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 16 Jul 2011 14:22:12 -0400 Subject: [PATCH] Task Validation - Shifted test for priority values from Att.cpp to Task.cpp. --- src/Task.cpp | 9 +++++++++ src/en-US.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/Task.cpp b/src/Task.cpp index 4dd3c8ee3..db5086c50 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -952,6 +952,15 @@ void Task::validate () const if (has ("wait") && getStatus () == Task::recurring) throw std::string (STRING_TASK_VALID_WAIT_RECUR); + + if (has ("priority")) + { + std::string priority - get ("priority"); + if (priority != "H" && + priority != "M" && + priority != "L") + throw format (STRING_TASK_VALID_PRIORITY, priority); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/en-US.h b/src/en-US.h index 0bb1ee4e0..998a02f92 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -420,6 +420,7 @@ #define STRING_TASK_VALID_UNTIL "You cannot specify an until date for a non-recurring task." #define STRING_TASK_VALID_RECUR "A recurrence value must be valid." #define STRING_TASK_VALID_WAIT_RECUR "You cannot create a task that is both waiting and recurring." +#define STRING_TASK_VALID_PRIORITY "Priority values may be 'H', 'M' or 'L', not '{1}'." // Taskmod