diff --git a/src/Att.cpp b/src/Att.cpp index 0124a208a..b49e63a29 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -187,20 +187,6 @@ bool Att::valid (const std::string& input) const return false; } -//////////////////////////////////////////////////////////////////////////////// -// TODO Obsolete -bool Att::validName (const std::string& name) -{ - if (validModifiableName (name)) - return true; - - for (unsigned int i = 0; i < NUM_INTERNAL_NAMES; ++i) - if (name == internalNames[i]) - return true; - - return false; -} - //////////////////////////////////////////////////////////////////////////////// bool Att::validModifiableName (const std::string& name) { diff --git a/src/Att.h b/src/Att.h index f84db7d2e..6bc83a592 100644 --- a/src/Att.h +++ b/src/Att.h @@ -44,7 +44,6 @@ public: ~Att (); bool valid (const std::string&) const; - static bool validName (const std::string&); static bool validModifiableName (const std::string&); static bool validNameValue (const std::string&, const std::string&, const std::string&); static bool validNameValue (std::string&, std::string&, std::string&); diff --git a/src/Config.cpp b/src/Config.cpp index d9195a3bd..08ebc9e32 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -162,8 +162,7 @@ void Config::createDefault (const std::string& home) fprintf (out, "# description_only\n"); // TODO i18n fprintf (out, "# Description: This report is ...\n"); // TODO i18n fprintf (out, "# Sort: due+,priority-,project+\n"); // TODO i18n - fprintf (out, "# Filter: pro:x pri:H +bug\n"); // TODO i18n - fprintf (out, "# Limit: 10\n"); // TODO i18n + fprintf (out, "# Filter: pro:x pri:H +bug limit:10\n"); // TODO i18n fprintf (out, "report.long.description=Lists all task, all data, matching the specified criteria\n"); // TODO i18n fprintf (out, "report.long.columns=id,project,priority,entry,start,due,recur,age,tags,description\n"); // TODO i18n diff --git a/src/Context.cpp b/src/Context.cpp index 7791bce6d..fdaad2355 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -539,6 +539,12 @@ void Context::autoFilter (Task& t, Filter& f) header ("auto filter: " + att->first + ".startswith:" + att->second.value ()); } + // The limit attribute does not participate in filtering, and needs to be + // specifically handled in handleCustomReport. + else if (att->first == "limit") + { + } + // Every task has a unique uuid by default, and it shouldn't be included. // The mechanism for filtering on tags is +/-, not tags:foo which // means that there can only be one tag, "foo". diff --git a/src/custom.cpp b/src/custom.cpp index 32bc5c512..65f526a6a 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -90,6 +90,10 @@ std::string handleCustomReport (const std::string& report) context.sequence.combine (sequence); + // Allow limit to be overridden by the command line. + if (!context.task.has ("limit") && task.has ("limit")) + context.task.set ("limit", task.get ("limit")); + foreach (att, filter) context.filter.push_back (*att); } @@ -462,15 +466,10 @@ std::string handleCustomReport (const std::string& report) // Limit the number of rows according to the report definition. int maximum = context.config.get (std::string ("report.") + report + ".limit", (int)0); - // If the custom report has a defined limit, then allow an override, which - // will show up as a single ID sequence. - // If the custom report has a defined limit, then allow a numeric override. - // This is an integer specified on the command line (task oldest 4), which is - // parsed as an ID. - if (context.config.get (std::string ("report.") + report + ".limit", (int)0) != 0) - if (context.sequence.size () == 1) - maximum = context.sequence[0]; + // This is an integer specified as a filter (limit:10). + if (context.task.has ("limit")) + maximum = ::atoi (context.task.get ("limit").c_str ()); std::stringstream out; if (table.rowCount ())