mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdEdit
- Converted from OldDuration to Duration.
This commit is contained in:
parent
e73d19152e
commit
9693a724f2
2 changed files with 8 additions and 7 deletions
|
@ -321,7 +321,7 @@ bool Duration::parse (const std::string& input, std::string::size_type& start)
|
||||||
if (durations[i].unit == unit)
|
if (durations[i].unit == unit)
|
||||||
{
|
{
|
||||||
seconds = durations[i].seconds;
|
seconds = durations[i].seconds;
|
||||||
_secs = static_cast <int> (quantity * static_cast <double> (seconds));
|
_secs = static_cast <int> (quantity * static_cast <double> (seconds));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <OldDuration.h>
|
#include <Duration.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <Filter.h>
|
#include <Filter.h>
|
||||||
#include <Nibbler.h>
|
#include <Nibbler.h>
|
||||||
|
@ -150,7 +150,7 @@ std::string CmdEdit::formatDuration (
|
||||||
std::string value = task.get (attribute);
|
std::string value = task.get (attribute);
|
||||||
if (value.length ())
|
if (value.length ())
|
||||||
{
|
{
|
||||||
OldDuration dur (value);
|
Duration dur (value);
|
||||||
value = dur.formatSeconds ();
|
value = dur.formatSeconds ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,8 +536,9 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
OldDuration d;
|
Duration d;
|
||||||
if (d.valid (value))
|
std::string::size_type idx = 0;
|
||||||
|
if (d.parse (value, idx))
|
||||||
{
|
{
|
||||||
context.footnote (STRING_EDIT_RECUR_MOD);
|
context.footnote (STRING_EDIT_RECUR_MOD);
|
||||||
if (task.get ("due") != "")
|
if (task.get ("due") != "")
|
||||||
|
@ -677,7 +678,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
||||||
if ((task.get (col->first) != value) && (type != "date" ||
|
if ((task.get (col->first) != value) && (type != "date" ||
|
||||||
(task.get (col->first) != Date (value, dateformat).toEpochString ())) &&
|
(task.get (col->first) != Date (value, dateformat).toEpochString ())) &&
|
||||||
(type != "duration" ||
|
(type != "duration" ||
|
||||||
(task.get (col->first) != (std::string) OldDuration (value) )))
|
(task.get (col->first) != (std::string) Duration (value) )))
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
|
@ -704,7 +705,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
||||||
}
|
}
|
||||||
else if (type == "duration")
|
else if (type == "duration")
|
||||||
{
|
{
|
||||||
OldDuration d (value);
|
Duration d (value);
|
||||||
task.set (col->first, (time_t) d);
|
task.set (col->first, (time_t) d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue