Silver Bullet - Complete
- Entry works - Start works - End works
This commit is contained in:
47
src/edit.cpp
47
src/edit.cpp
@@ -238,13 +238,12 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// entry
|
// entry
|
||||||
/*
|
|
||||||
value = findDate (conf, after, "Created:");
|
value = findDate (conf, after, "Created:");
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("entry").c_str ()));
|
|
||||||
Date edited (::atoi (value.c_str ()));
|
Date edited (::atoi (value.c_str ()));
|
||||||
|
|
||||||
|
Date original (::atoi (task.getAttribute ("entry").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Creation date modified." << std::endl;
|
std::cout << "Creation date modified." << std::endl;
|
||||||
@@ -252,17 +251,17 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "Cannot remove creation date." << std::endl;
|
throw std::string ("Cannot remove creation date");
|
||||||
*/
|
|
||||||
|
|
||||||
// start
|
// start
|
||||||
/*
|
value = findDate (conf, after, "Started:");
|
||||||
value = findDate (conf, after, "Start:");
|
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("start").c_str ()));
|
|
||||||
Date edited (::atoi (value.c_str ()));
|
Date edited (::atoi (value.c_str ()));
|
||||||
|
|
||||||
|
if (task.getAttribute ("start") != "")
|
||||||
|
{
|
||||||
|
Date original (::atoi (task.getAttribute ("start").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Start date modified." << std::endl;
|
std::cout << "Start date modified." << std::endl;
|
||||||
@@ -271,36 +270,46 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("start").c_str ()));
|
std::cout << "Start date modified." << std::endl;
|
||||||
Date edited (::atoi (value.c_str ()));
|
task.setAttribute ("start", value);
|
||||||
|
}
|
||||||
if (!original.sameDay (edited))
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
|
if (task.getAttribute ("start") != "")
|
||||||
|
{
|
||||||
|
std::cout << "Start date removed." << std::endl;
|
||||||
|
task.removeAttribute ("start");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Cannot remove start date." << std::endl;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// end
|
// end
|
||||||
/*
|
|
||||||
value = findDate (conf, after, "Ended:");
|
value = findDate (conf, after, "Ended:");
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
Date original (::atoi (task.getAttribute ("end").c_str ()));
|
|
||||||
Date edited (::atoi (value.c_str ()));
|
Date edited (::atoi (value.c_str ()));
|
||||||
|
|
||||||
|
if (task.getAttribute ("end") != "")
|
||||||
|
{
|
||||||
|
Date original (::atoi (task.getAttribute ("end").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Done date modified." << std::endl;
|
std::cout << "Done date modified." << std::endl;
|
||||||
task.setAttribute ("end", value);
|
task.setAttribute ("end", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (task.getStatus () != T::deleted)
|
||||||
|
throw std::string ("Cannot set a done date on a pending task.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (task.getAttribute ("end") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Done date removed." << std::endl;
|
std::cout << "Done date removed." << std::endl;
|
||||||
|
task.setStatus (T::pending);
|
||||||
task.removeAttribute ("end");
|
task.removeAttribute ("end");
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
|
|
||||||
// due
|
// due
|
||||||
value = findDate (conf, after, "Due:");
|
value = findDate (conf, after, "Due:");
|
||||||
@@ -393,7 +402,11 @@ static void parseTask (Config& conf, T& task, const std::string& after)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Recurrence removed." << std::endl;
|
std::cout << "Recurrence removed." << std::endl;
|
||||||
|
task.setStatus (T::pending);
|
||||||
task.removeAttribute ("recur");
|
task.removeAttribute ("recur");
|
||||||
|
task.removeAttribute ("until");
|
||||||
|
task.removeAttribute ("mask");
|
||||||
|
task.removeAttribute ("imask");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user