- Localized more files.
This commit is contained in:
Paul Beckingham 2011-07-01 22:55:46 -04:00
parent 59ccad5b62
commit 72fa53ad3d
2 changed files with 14 additions and 10 deletions

View file

@ -25,9 +25,12 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <sstream> #define L10N // Localization complete.
#include <Context.h> #include <Context.h>
#include <main.h> #include <main.h>
#include <text.h>
#include <i18n.h>
#include <CmdCount.h> #include <CmdCount.h>
extern Context context; extern Context context;
@ -37,7 +40,7 @@ CmdCount::CmdCount ()
{ {
_keyword = "count"; _keyword = "count";
_usage = "task count [<filter>]"; _usage = "task count [<filter>]";
_description = "Shows only the number of matching tasks."; _description = STRING_CMD_COUNT_USAGE;
_read_only = true; _read_only = true;
_displays_id = false; _displays_id = false;
} }
@ -45,26 +48,26 @@ CmdCount::CmdCount ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdCount::execute (std::string& output) int CmdCount::execute (std::string& output)
{ {
/* // Get all the tasks.
// Scan the pending tasks, applying any filter.
std::vector <Task> tasks; std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking")); context.tdb.lock (context.config.getBoolean ("locking"));
handleRecurrence (); handleRecurrence ();
context.tdb.load (tasks, context.filter); context.tdb.load (tasks);
context.tdb.commit (); context.tdb.commit ();
context.tdb.unlock (); context.tdb.unlock ();
// Apply filter.
std::vector <Task> filtered;
filter (tasks, filtered);
// Find number of matching tasks. Skip recurring parent tasks. // Find number of matching tasks. Skip recurring parent tasks.
int count = 0; int count = 0;
std::vector <Task>::iterator it; std::vector <Task>::iterator it;
for (it = tasks.begin (); it != tasks.end (); ++it) for (it = filtered.begin (); it != filtered.end (); ++it)
if (it->getStatus () != Task::recurring) if (it->getStatus () != Task::recurring)
++count; ++count;
std::stringstream out; output = format (count) + "\n";
out << count << "\n";
output = out.str ();
*/
return 0; return 0;
} }

View file

@ -253,6 +253,7 @@
#define STRING_CMD_SUMMARY_REMAINING "Remaining" #define STRING_CMD_SUMMARY_REMAINING "Remaining"
#define STRING_CMD_SUMMARY_AVG_AGE "Avg age" #define STRING_CMD_SUMMARY_AVG_AGE "Avg age"
#define STRING_CMD_SUMMARY_COMPLETE "Complete" #define STRING_CMD_SUMMARY_COMPLETE "Complete"
#define STRING_CMD_COUNT_USAGE "Shows only the number of matching tasks."
// Config // Config
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake." #define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."