TDB2 - Recurrence

- Re-enabled the recurrence handling code and converted from TDB to
  TDB2.  Time for some difficult TDB2 work.  But first, coffee.
This commit is contained in:
Paul Beckingham 2011-08-14 10:19:59 -04:00
parent f3f6cd260a
commit 1f58856299
3 changed files with 3 additions and 1729 deletions

File diff suppressed because it is too large Load diff

View file

@ -110,75 +110,5 @@ private:
int _id;
};
/*
#include <Location.h>
#include <Filter.h>
#include <Task.h>
// Length of longest line.
#define T_LINE_MAX 32768
class TDB
{
public:
TDB (); // Default constructor
~TDB (); // Destructor
TDB (const TDB&);
TDB& operator= (const TDB&);
void clear ();
void location (const std::string&);
void lock (bool lockFile = true);
void unlock ();
int load (std::vector <Task>&, Filter&);
int loadPending (std::vector <Task>&, Filter&);
int loadCompleted (std::vector <Task>&, Filter&);
const std::vector <Task>& getAllPending ();
const std::vector <Task>& getAllNew ();
const std::vector <Task>& getAllCompleted ();
const std::vector <Task>& getAllModified ();
void add (const Task&); // Single task add to pending
void update (const Task&); // Single task update to pending
int commit (); // Write out all tasks
int gc (); // Clean up pending
int nextId ();
void undo ();
void merge (const std::string&);
std::string uuid (int) const;
int id (const std::string&) const;
private:
FILE* openAndLock (const std::string&);
void writeUndo (const Task&, FILE*);
void writeUndo (const Task&, const Task&, FILE*);
bool uuidAlreadyUsed (const std::string&);
bool uuidAlreadyUsed (const std::string&, const std::vector <Task>&);
private:
std::vector <Location> mLocations;
bool mLock;
bool mAllOpenAndLocked;
int mId;
std::vector <Task> mPending; // Contents of pending.data
std::vector <Task> mCompleted; // Contents of pending.data
std::vector <Task> mNew; // Uncommitted new tasks
std::vector <Task> mModified; // Uncommitted modified tasks
std::map <int, std::string> mI2U; // ID -> UUID map
std::map <std::string, int> mU2I; // UUID -> ID map
};
*/
#endif
////////////////////////////////////////////////////////////////////////////////

View file

@ -65,7 +65,6 @@ void handleRecurrence ()
{
if (t->getStatus () == Task::recurring)
{
/*
// Generate a list of due dates for this recurring task, regardless of
// the mask.
std::vector <Date> due;
@ -77,7 +76,7 @@ void handleRecurrence ()
// Determine the end date.
t->setEnd ();
t->setStatus (Task::deleted);
context.tdb.update (*t);
context.tdb2.modify (*t);
continue;
}
@ -129,7 +128,7 @@ void handleRecurrence ()
modified.push_back (rec);
// Add the new task to the DB.
context.tdb.add (rec);
context.tdb2.add (rec);
}
++i;
@ -139,9 +138,8 @@ void handleRecurrence ()
if (changed)
{
t->set ("mask", mask);
context.tdb.update (*t);
context.tdb2.modify (*t);
}
*/
}
else
modified.push_back (*t);