mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-09 09:40:37 +02:00
Columns
- Refactored column objects to contain a ::validate method, for the validation of incoming data. - Context.columns is now a vector of one of each column object, indexed by attribute name, for validation purposes.
This commit is contained in:
parent
a7d6b91ad3
commit
3c1c900b5b
38 changed files with 252 additions and 76 deletions
|
@ -40,6 +40,7 @@ extern Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDescription::ColumnDescription ()
|
||||
{
|
||||
_name = "description";
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = STRING_COLUMN_LABEL_DESC;
|
||||
|
@ -50,11 +51,17 @@ ColumnDescription::~ColumnDescription ()
|
|||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool ColumnDescription::validate (std::string& value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnDescription::measure (Task& task, int& minimum, int& maximum)
|
||||
{
|
||||
std::string description = task.get ("description");
|
||||
std::string description = task.get (_name);
|
||||
|
||||
// The text
|
||||
// <indent> <date> <anno>
|
||||
|
@ -127,7 +134,7 @@ void ColumnDescription::measure (Task& task, int& minimum, int& maximum)
|
|||
}
|
||||
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "description.", _style);
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -137,7 +144,7 @@ void ColumnDescription::render (
|
|||
int width,
|
||||
Color& color)
|
||||
{
|
||||
std::string description = task.get ("description");
|
||||
std::string description = task.get (_name);
|
||||
|
||||
// This is a description
|
||||
// <date> <anno>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue