From c61f7e6b8ffe5e1b846d20999e9c2763741d4c2f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 23 Aug 2015 20:36:06 -0400 Subject: [PATCH] Footnote: New 'recur' verbosity token --- ChangeLog | 4 ++++ NEWS | 4 ++++ doc/man/taskrc.5.in | 1 + src/Config.cpp | 2 +- src/Context.cpp | 5 +++-- src/l10n/deu-DEU.h | 3 +++ src/l10n/eng-USA.h | 3 +++ src/l10n/epo-RUS.h | 3 +++ src/l10n/esp-ESP.h | 3 +++ src/l10n/fra-FRA.h | 3 +++ src/l10n/ita-ITA.h | 3 +++ src/l10n/jpn-JPN.h | 3 +++ src/l10n/pol-POL.h | 3 +++ src/l10n/por-PRT.h | 3 +++ src/recur.cpp | 3 +++ test/recurrence.t | 16 ++++++++++++++++ 16 files changed, 59 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ad9b0bfe..89d8f5df5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -159,6 +159,10 @@ - Improved feedback for tasks that do not have ID (thanks to Tomas Babej). - Comma-separated lists of UUIDs can no longer be used as a filter. Use the space character instead. +- New 'recur' verbosity token generates a notification message when a recurring + task is created. +- New 'unwait' verbosity token generates a notification message when a waiting + task becomes visible. ------ current release --------------------------- diff --git a/NEWS b/NEWS index adc4119f1..17d205b01 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,10 @@ New configuration options in Taskwarrior 2.4.5 not have a value for the UDA ''. - A Cygwin fix means that now we can default 'search.case.sensitive' to 'yes', and all platforms are again equal. + - The new 'recur' verbosity token generates a message when a recurring task is + generated. + - The new 'unwait' verbosity token generates a message when a waiting task + becomes visible. Newly deprecated features in Taskwarrior 2.4.5 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index ab7ef0dc5..301259e01 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -275,6 +275,7 @@ control specific occasions when output is generated. This list may contain: sync Feedback about sync filter Shows the filter used in the command unwait Notification when a task leaves the 'waiting' state + recur Notification when a new recurrign task instance is created "affected", "new-id", "new-uuid" "project" and "unwait" imply "footnote". diff --git a/src/Config.cpp b/src/Config.cpp index f5e427c2b..e710505ce 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -79,7 +79,7 @@ std::string Config::_defaults = "#verbose=no # Provide regular feedback\n" "#verbose=nothing # Provide no feedback\n" "# # Comma-separated list. May contain any subset of:\n" - "#verbose=blank,header,footnote,label,new-id,new-uuid,affected,edit,special,project,sync,filter,unwait\n" + "#verbose=blank,header,footnote,label,new-id,new-uuid,affected,edit,special,project,sync,filter,unwait,recur\n" "confirmation=yes # Confirmation on delete, big changes\n" "recurrence=yes # Enable recurrence\n" "recurrence.confirmation=prompt # Confirmation for propagating changes among recurring tasks (yes/no/prompt)\n" diff --git a/src/Context.cpp b/src/Context.cpp index 09030b4c9..b763606a9 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -540,7 +540,8 @@ bool Context::verbose (const std::string& token) v != "project" && // v != "sync" && // v != "filter" && // - v != "unwait") // + v != "unwait" && // + v != "recur") // { // This list emulates rc.verbose=off in version 1.9.4. verbosity = {"blank", "label", "new-id", "edit"}; @@ -551,7 +552,7 @@ bool Context::verbose (const std::string& token) if (! verbosity.count ("footnote")) { // TODO: Some of these may not use footnotes yet. They should. - for (auto flag : {"affected", "new-id", "new-uuid", "project", "unwait"}) + for (auto flag : {"affected", "new-id", "new-uuid", "project", "unwait", "recur"}) { if (verbosity.count (flag)) { diff --git a/src/l10n/deu-DEU.h b/src/l10n/deu-DEU.h index 1c14a1adf..fe00e5129 100644 --- a/src/l10n/deu-DEU.h +++ b/src/l10n/deu-DEU.h @@ -880,6 +880,9 @@ #define STRING_TDB2_DIRTY_EXIT "Beende mit ungeschriebenen Änderungen auf {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "Dieser Report hat eine Mindestbreite von {1} und passt nicht in die Bildschirmbreite von {2}." diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index 93fd51cbd..2fa288608 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -878,6 +878,9 @@ #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "The report has a minimum width of {1} and does not fit in the available width of {2}." diff --git a/src/l10n/epo-RUS.h b/src/l10n/epo-RUS.h index 19877b362..721489c51 100644 --- a/src/l10n/epo-RUS.h +++ b/src/l10n/epo-RUS.h @@ -880,6 +880,9 @@ #define STRING_TDB2_DIRTY_EXIT "Eliranta kun neskribitajn ŝanĝojn al {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "La raporto havas larĝecminimumon {1}, al kio ne konformas la disponebla larĝeco {2}." diff --git a/src/l10n/esp-ESP.h b/src/l10n/esp-ESP.h index 48b85e663..19d3fb379 100644 --- a/src/l10n/esp-ESP.h +++ b/src/l10n/esp-ESP.h @@ -893,6 +893,9 @@ #define STRING_TDB2_DIRTY_EXIT "Saliendo con cambios sin escribir a {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "El informe tiene una anchura mínima de {1} y no cabe en la disponible, que es {2}." diff --git a/src/l10n/fra-FRA.h b/src/l10n/fra-FRA.h index b3c805bb7..1432ccdd4 100644 --- a/src/l10n/fra-FRA.h +++ b/src/l10n/fra-FRA.h @@ -880,6 +880,9 @@ #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "The report has a minimum width of {1} and does not fit in the available width of {2}." diff --git a/src/l10n/ita-ITA.h b/src/l10n/ita-ITA.h index aefe69a43..4b57ac200 100644 --- a/src/l10n/ita-ITA.h +++ b/src/l10n/ita-ITA.h @@ -879,6 +879,9 @@ #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "Il report ha larghezza minima di {1} e non entra nella larghezza disponibile di {2}." diff --git a/src/l10n/jpn-JPN.h b/src/l10n/jpn-JPN.h index cabc32725..aff2610af 100644 --- a/src/l10n/jpn-JPN.h +++ b/src/l10n/jpn-JPN.h @@ -880,6 +880,9 @@ #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "The report has a minimum width of {1} and does not fit in the available width of {2}." diff --git a/src/l10n/pol-POL.h b/src/l10n/pol-POL.h index 21a9ed0e0..6f652986c 100644 --- a/src/l10n/pol-POL.h +++ b/src/l10n/pol-POL.h @@ -880,6 +880,9 @@ #define STRING_TDB2_DIRTY_EXIT "Zamykanie z niezapisanymi zmianami w {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "Raport ma minimalną szerokość {1} i nie mieści się w dostępnej przestrzeni {2}." diff --git a/src/l10n/por-PRT.h b/src/l10n/por-PRT.h index 3275b5ec0..3a1481737 100644 --- a/src/l10n/por-PRT.h +++ b/src/l10n/por-PRT.h @@ -880,6 +880,9 @@ #define STRING_TDB2_DIRTY_EXIT "Saindo com modificações por gravar de {1}" #define STRING_TDB2_UNWAIT "Un-waiting task '{1}'" +// recur.cpp +#define STRING_RECUR_CREATE "Creating recurring task instance '{1}'" + // View #define STRING_VIEW_TOO_SMALL "O relatório tem uma largura mínima de {1} e não cabe na largura disponível {2}." diff --git a/src/recur.cpp b/src/recur.cpp index 182356c91..6874542b4 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -138,6 +138,9 @@ void handleRecurrence () { t.set ("mask", mask); context.tdb2.modify (t); + + if (context.verbose ("recur")) + context.footnote (format (STRING_RECUR_CREATE, t.get ("description"))); } } diff --git a/test/recurrence.t b/test/recurrence.t index 79749d9ed..05ef2043f 100755 --- a/test/recurrence.t +++ b/test/recurrence.t @@ -385,6 +385,22 @@ class TestUpgradeToRecurring(TestCase): code, out, err = self.t.runError("1 modify recur:weekly") self.assertIn("You cannot specify a recurring task without a due date.", err) +class TestRecurrenceNotification(TestCase): + def setUp(self): + """Executed before each test in the class""" + self.t = Task() + + def test_notification(self): + """Test notification on task creation""" + + self.t("add foo due:eow recur:daily") + + code, out, err = self.t("list") + self.assertIn("Creating recurring task instance 'foo'", err) + + code, out, err = self.t("list") + self.assertNotIn("Creating recurring task instance 'foo'", err) + # TODO Wait a recurring task # TODO Downgrade a recurring task to a regular task