- Removed obsolete 'undelete' string.
This commit is contained in:
Paul Beckingham 2009-06-30 18:35:06 -04:00
parent af7803ea27
commit ed49546eac
8 changed files with 50 additions and 18 deletions

View file

@ -54,7 +54,7 @@
223 zusammenfassung #summary
224 etikett #tags
225 zeitdatenblatt#timesheet
226 wiederherstellen #undelete
227 rücksetzen #undo
228 version #version

View file

@ -55,7 +55,7 @@
223 summary
224 tags
225 timesheet
226 undelete
227 undo
228 version
229 shell

View file

@ -54,7 +54,7 @@
223 sammanfattning #summary
224 taggar #tags
225 tidsrapport #timesheet
226 ångra borttagning #undelete
227 ångra #undo
228 version #version

View file

@ -180,10 +180,8 @@ std::string Context::dispatch ()
{
Timer t ("Context::dispatch");
int gcMod = 0; // Change occurred by way of gc.
std::string out;
// TODO Just look at this thing. It cries out for a dispatch table.
std::string out;
if (cmd.command == "projects") { out = handleProjects (); }
else if (cmd.command == "tags") { out = handleTags (); }
else if (cmd.command == "colors") { out = handleColor (); }
@ -215,8 +213,8 @@ std::string Context::dispatch ()
sequence.size ()) { out = handleModify (); }
// Command that display IDs and therefore need TDB::gc first.
else if (cmd.command == "next") { if (!inShadow) gcMod = tdb.gc (); out = handleReportNext (); }
else if (cmd.validCustom (cmd.command)) { if (!inShadow) gcMod = tdb.gc (); out = handleCustomReport (cmd.command); }
else if (cmd.command == "next") { if (!inShadow) tdb.gc (); out = handleReportNext (); }
else if (cmd.validCustom (cmd.command)) { if (!inShadow) tdb.gc (); out = handleCustomReport (cmd.command); }
// If the command is not recognized, display usage.
else { out = shortUsage (); }

View file

@ -61,7 +61,9 @@ extern Context context;
// | | +- TDB::update (T)
// | | |
// | | +- TDB::commit
// | | write all
// | | | write all
// | | |
// | | +- TDB::undo
// | |
// | +- TDB::unlock
// | [unlock]
@ -491,6 +493,23 @@ int TDB::nextId ()
////////////////////////////////////////////////////////////////////////////////
void TDB::undo ()
{
// TODO Load all undo.data
// TODO Load all pending.data
std::vector <Task> allPending;
// TODO Load all completed.data
std::vector <Task> allCompleted;
// TODO 'pop' last transaction
// TODO Locate 'new' task
// TODO Confirm
// TODO Overwrite 'old' task, or delete
// TODO Write all pending.data
// TODO Write all completed.data
// TODO Write all undo.data
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -208,7 +208,9 @@ std::string handleTags ()
////////////////////////////////////////////////////////////////////////////////
void handleUndo ()
{
context.tdb.lock (context.config.get ("locking", true));
context.tdb.undo ();
context.tdb.unlock ();
}
////////////////////////////////////////////////////////////////////////////////
@ -299,12 +301,11 @@ std::string handleVersion ()
std::string recognized =
" blanklines color color.active color.due color.overdue color.pri.H "
"color.pri.L color.pri.M color.pri.none color.recurring color.tagged "
"color.footnote color.header color.message color.debug confirmation curses "
"data.location dateformat debug default.command default.priority "
"defaultwidth displayweeknumber due echo.command locale locking "
"monthsperline nag next project shadow.command shadow.file shadow.notify "
"weekstart editor import.synonym.id import.synonym.uuid "
"longversion "
"color.footnote color.header color.debug confirmation curses data.location "
"dateformat debug default.command default.priority defaultwidth due locale "
"displayweeknumber echo.command locking monthsperline nag next project "
"shadow.command shadow.file shadow.notify weekstart editor import.synonym.id "
"import.synonym.uuid longversion "
#ifdef FEATURE_SHELL
"shell.prompt "
#endif
@ -681,14 +682,13 @@ std::string handleExport ()
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.loadPending (tasks, context.filter);
context.tdb.load (tasks, context.filter);
context.tdb.commit ();
context.tdb.unlock ();
foreach (task, tasks)
{
if (task->getStatus () != Task::recurring &&
task->getStatus () != Task::deleted)
if (task->getStatus () != Task::recurring)
{
out << task->composeCSV ().c_str ();
++count;

View file

@ -426,6 +426,20 @@ void spit (const std::string& file, const std::string& contents)
throw std::string ("Could not write file '") + file + "'"; // TODO i18n
}
////////////////////////////////////////////////////////////////////////////////
void spit (const std::string& file, const std::vector <std::string>& lines)
{
std::ofstream out (file.c_str ());
if (out.good ())
{
foreach (line, lines)
out << *line;
out.close ();
}
else
throw std::string ("Could not write file '") + file + "'"; // TODO i18n
}
////////////////////////////////////////////////////////////////////////////////
bool taskDiff (const Task& before, const Task& after)
{

View file

@ -73,6 +73,7 @@ std::string expandPath (const std::string&);
bool slurp (const std::string&, std::vector <std::string>&, bool trimLines = false);
bool slurp (const std::string&, std::string&, bool trimLines = false);
void spit (const std::string&, const std::string&);
void spit (const std::string&, const std::vector <std::string>&);
bool taskDiff (const Task&, const Task&);
std::string taskDifferences (const Task&, const Task&);