From 72fa53ad3d1389d8ab1aae37752085bdfd12a352 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 1 Jul 2011 22:55:46 -0400 Subject: [PATCH] I18N - Localized more files. --- src/commands/CmdCount.cpp | 23 +++++++++++++---------- src/en-US.h | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/commands/CmdCount.cpp b/src/commands/CmdCount.cpp index c7cab47b5..c84fc02df 100644 --- a/src/commands/CmdCount.cpp +++ b/src/commands/CmdCount.cpp @@ -25,9 +25,12 @@ // //////////////////////////////////////////////////////////////////////////////// -#include +#define L10N // Localization complete. + #include #include +#include +#include #include extern Context context; @@ -37,7 +40,7 @@ CmdCount::CmdCount () { _keyword = "count"; _usage = "task count []"; - _description = "Shows only the number of matching tasks."; + _description = STRING_CMD_COUNT_USAGE; _read_only = true; _displays_id = false; } @@ -45,26 +48,26 @@ CmdCount::CmdCount () //////////////////////////////////////////////////////////////////////////////// int CmdCount::execute (std::string& output) { -/* - // Scan the pending tasks, applying any filter. + // Get all the tasks. std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - context.tdb.load (tasks, context.filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); + // Apply filter. + std::vector filtered; + filter (tasks, filtered); + // Find number of matching tasks. Skip recurring parent tasks. int count = 0; std::vector ::iterator it; - for (it = tasks.begin (); it != tasks.end (); ++it) + for (it = filtered.begin (); it != filtered.end (); ++it) if (it->getStatus () != Task::recurring) ++count; - std::stringstream out; - out << count << "\n"; - output = out.str (); -*/ + output = format (count) + "\n"; return 0; } diff --git a/src/en-US.h b/src/en-US.h index 02f72be68..05a3fd2a4 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -253,6 +253,7 @@ #define STRING_CMD_SUMMARY_REMAINING "Remaining" #define STRING_CMD_SUMMARY_AVG_AGE "Avg age" #define STRING_CMD_SUMMARY_COMPLETE "Complete" +#define STRING_CMD_COUNT_USAGE "Shows only the number of matching tasks." // Config #define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."