diff --git a/src/TDB2.cpp b/src/TDB2.cpp index c730b4659..dcb886ee9 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -154,11 +154,22 @@ void TDB2::unlock () //////////////////////////////////////////////////////////////////////////////// // Returns number of filtered tasks. +// Note: tasks.clear () is deliberately not called, to allow the combination of +// multiple files. int TDB2::load (std::vector & tasks, Filter& filter) { - // Note: tasks.clear () is deliberately not called, to allow the combination - // of multiple files. + loadPending (tasks, filter); + loadCompleted (tasks, filter); + return tasks.size (); +} + +//////////////////////////////////////////////////////////////////////////////// +// Returns number of filtered tasks. +// Note: tasks.clear () is deliberately not called, to allow the combination of +// multiple files. +int TDB2::loadPending (std::vector & tasks, Filter& filter) +{ std::string file; int line_number; @@ -185,6 +196,34 @@ int TDB2::load (std::vector & tasks, Filter& filter) ++line_number; } + } + } + + catch (std::string& e) + { + std::stringstream s; + s << " int " << file << " at line " << line_number; + throw e + s.str (); + } + + return tasks.size (); +} + +//////////////////////////////////////////////////////////////////////////////// +// Returns number of filtered tasks. +// Note: tasks.clear () is deliberately not called, to allow the combination of +// multiple files. +int TDB2::loadCompleted (std::vector & tasks, Filter& filter) +{ + std::string file; + int line_number; + + try + { + char line[T_LINE_MAX]; + foreach (location, mLocations) + { + std::cout << "# location.path: " << location->path << std::endl; // TODO If the filter contains Status:x where x is not deleted or // completed, then this can be skipped. diff --git a/src/TDB2.h b/src/TDB2.h index b8010e56f..984ad6cc0 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -51,6 +51,8 @@ public: void unlock (); int load (std::vector &, Filter&); + int loadPending (std::vector &, Filter&); + int loadCompleted (std::vector &, Filter&); void add (Task&); void update (Task&, Task&); int commit (); diff --git a/src/command.cpp b/src/command.cpp index 4f8585a03..54d0e6319 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -98,7 +98,7 @@ std::string handleProjects () std::vector tasks; context.tdb.lock (context.config.get ("locking", true)); - int quantity = context.tdb.load (tasks, context.filter); + int quantity = context.tdb.loadPending (tasks, context.filter); context.tdb.unlock (); // Scan all the tasks for their project name, building a map using project @@ -155,7 +155,7 @@ std::string handleTags () std::vector tasks; context.tdb.lock (context.config.get ("locking", true)); - int quantity = context.tdb.load (tasks, context.filter); + int quantity = context.tdb.loadPending (tasks, context.filter); context.tdb.unlock (); // Scan all the tasks for their project name, building a map using project