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:
1654
src/TDB2.cpp
1654
src/TDB2.cpp
File diff suppressed because it is too large
Load Diff
70
src/TDB2.h
70
src/TDB2.h
@@ -110,75 +110,5 @@ private:
|
|||||||
int _id;
|
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
|
#endif
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ void handleRecurrence ()
|
|||||||
{
|
{
|
||||||
if (t->getStatus () == Task::recurring)
|
if (t->getStatus () == Task::recurring)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
// Generate a list of due dates for this recurring task, regardless of
|
// Generate a list of due dates for this recurring task, regardless of
|
||||||
// the mask.
|
// the mask.
|
||||||
std::vector <Date> due;
|
std::vector <Date> due;
|
||||||
@@ -77,7 +76,7 @@ void handleRecurrence ()
|
|||||||
// Determine the end date.
|
// Determine the end date.
|
||||||
t->setEnd ();
|
t->setEnd ();
|
||||||
t->setStatus (Task::deleted);
|
t->setStatus (Task::deleted);
|
||||||
context.tdb.update (*t);
|
context.tdb2.modify (*t);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ void handleRecurrence ()
|
|||||||
modified.push_back (rec);
|
modified.push_back (rec);
|
||||||
|
|
||||||
// Add the new task to the DB.
|
// Add the new task to the DB.
|
||||||
context.tdb.add (rec);
|
context.tdb2.add (rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
@@ -139,9 +138,8 @@ void handleRecurrence ()
|
|||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
t->set ("mask", mask);
|
t->set ("mask", mask);
|
||||||
context.tdb.update (*t);
|
context.tdb2.modify (*t);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
modified.push_back (*t);
|
modified.push_back (*t);
|
||||||
|
|||||||
Reference in New Issue
Block a user