Silver Bullet - Snapshot
- Annotations working - recur working - parent working - fg working - bg working
This commit is contained in:
39
src/edit.cpp
39
src/edit.cpp
@@ -164,7 +164,11 @@ static std::string formatTask (Config& conf, T task)
|
|||||||
std::map <time_t, std::string> annotations;
|
std::map <time_t, std::string> annotations;
|
||||||
task.getAnnotations (annotations);
|
task.getAnnotations (annotations);
|
||||||
foreach (anno, annotations)
|
foreach (anno, annotations)
|
||||||
before << " Annotation: " << anno->first << " " << anno->second << std::endl;
|
{
|
||||||
|
Date dt (anno->first);
|
||||||
|
before << " Annotation: " << dt.toString (conf.get ("dateformat", "m/d/Y"))
|
||||||
|
<< " " << anno->second << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
before << " Annotation: " << std::endl
|
before << " Annotation: " << std::endl
|
||||||
<< " Annotation: " << std::endl
|
<< " Annotation: " << std::endl
|
||||||
@@ -346,15 +350,24 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// recur
|
// recur
|
||||||
/*
|
|
||||||
value = findValue (after, "Recur:");
|
value = findValue (after, "Recur:");
|
||||||
if (value != task.getAttribute ("recur") &&
|
if (value != task.getAttribute ("recur"))
|
||||||
validDuration (value))
|
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
|
{
|
||||||
|
if (validDuration (value))
|
||||||
{
|
{
|
||||||
std::cout << "Recurrence modified." << std::endl;
|
std::cout << "Recurrence modified." << std::endl;
|
||||||
|
if (task.getAttribute ("due") != "")
|
||||||
|
{
|
||||||
task.setAttribute ("recur", value);
|
task.setAttribute ("recur", value);
|
||||||
|
task.setStatus (T::recurring);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::string ("A recurring task must have a due date.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::string ("Not a valid recurrence duration.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -362,10 +375,8 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
task.removeAttribute ("recur");
|
task.removeAttribute ("recur");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// parent
|
// parent
|
||||||
/*
|
|
||||||
value = findValue (after, "Parent:");
|
value = findValue (after, "Parent:");
|
||||||
if (value != task.getAttribute ("parent"))
|
if (value != task.getAttribute ("parent"))
|
||||||
{
|
{
|
||||||
@@ -380,10 +391,8 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
task.removeAttribute ("parent");
|
task.removeAttribute ("parent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// fg
|
// fg
|
||||||
/*
|
|
||||||
value = findValue (after, "Foreground color:");
|
value = findValue (after, "Foreground color:");
|
||||||
if (value != task.getAttribute ("fg"))
|
if (value != task.getAttribute ("fg"))
|
||||||
{
|
{
|
||||||
@@ -398,10 +407,8 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
task.removeAttribute ("fg");
|
task.removeAttribute ("fg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// bg
|
// bg
|
||||||
/*
|
|
||||||
value = findValue (after, "Background color:");
|
value = findValue (after, "Background color:");
|
||||||
if (value != task.getAttribute ("bg"))
|
if (value != task.getAttribute ("bg"))
|
||||||
{
|
{
|
||||||
@@ -416,10 +423,8 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
task.removeAttribute ("bg");
|
task.removeAttribute ("bg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Annotations
|
// Annotations
|
||||||
/*
|
|
||||||
std::map <time_t, std::string> annotations;
|
std::map <time_t, std::string> annotations;
|
||||||
std::string::size_type found = 0;
|
std::string::size_type found = 0;
|
||||||
while ((found = after.find ("Annotation:", found)) != std::string::npos)
|
while ((found = after.find ("Annotation:", found)) != std::string::npos)
|
||||||
@@ -430,20 +435,20 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
if (eol != std::string::npos)
|
if (eol != std::string::npos)
|
||||||
{
|
{
|
||||||
std::string value = trim (after.substr (
|
std::string value = trim (after.substr (
|
||||||
found + 11,
|
found,
|
||||||
eol - (found + 11)), "\t ");
|
eol - found), "\t ");
|
||||||
|
|
||||||
std::string::size_type gap = value.find (" ");
|
std::string::size_type gap = value.find (" ");
|
||||||
|
if (gap != std::string::npos)
|
||||||
|
{
|
||||||
Date when (value.substr (0, gap));
|
Date when (value.substr (0, gap));
|
||||||
std::string text = trim (value.substr (gap, std::string::npos), "\t ");
|
std::string text = trim (value.substr (gap, std::string::npos), "\t ");
|
||||||
|
|
||||||
annotations[when.toEpoch ()] = text;
|
annotations[when.toEpoch ()] = text;
|
||||||
std::cout << "annotation '" << when.toString () << "':''" << std::endl;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task.setAnnotations (annotations);
|
task.setAnnotations (annotations);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ for (typeof (c) *foreach_p = & (c); \
|
|||||||
void parse (std::vector <std::string>&, std::string&, T&, Config&);
|
void parse (std::vector <std::string>&, std::string&, T&, Config&);
|
||||||
bool validPriority (const std::string&);
|
bool validPriority (const std::string&);
|
||||||
bool validDate (std::string&, Config&);
|
bool validDate (std::string&, Config&);
|
||||||
|
bool validDuration (std::string&);
|
||||||
void loadCustomReports (Config&);
|
void loadCustomReports (Config&);
|
||||||
bool isCustomReport (const std::string&);
|
bool isCustomReport (const std::string&);
|
||||||
void allCustomReports (std::vector <std::string>&);
|
void allCustomReports (std::vector <std::string>&);
|
||||||
|
|||||||
Reference in New Issue
Block a user