diff --git a/ChangeLog b/ChangeLog index 2fab7833e..50837bee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -188,6 +188,8 @@ (thanks to Owen Clarke). + Fixed bug #808, which generated compiler warnings on Solarix (thanks to Owen Clarke). + + Fixed bug #822, #845, which generated incorrect IDs (thanks to Matt Kraai and + Michelle Crane). + Fixed bug #831, which prevented some date fields from being properly parsed. + Fixed bug #835, which prevented hierarchical projects from being recognized. + Fixed bug #839, which caused problems when recurrence frequencies of '1m' diff --git a/src/TDB2.cpp b/src/TDB2.cpp index f60bf2390..7745e3911 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -64,6 +64,7 @@ TF2::TF2 () , _loaded_tasks (false) , _loaded_lines (false) , _loaded_contents (false) +, _has_ids (false) , _contents ("") { } @@ -300,8 +301,10 @@ void TF2::load_tasks () ++line_number; Task task (*i); - // Every task gets an ID. - task.id = context.tdb2.next_id (); + // Some tasks gets an ID. + if (_has_ids) + task.id = context.tdb2.next_id (); + _tasks.push_back (task); // Maintain mapping for ease of link/dependency resolution. @@ -399,6 +402,12 @@ int TF2::id (const std::string& uuid) return 0; } +//////////////////////////////////////////////////////////////////////////////// +void TF2::has_ids () +{ + _has_ids = true; +} + //////////////////////////////////////////////////////////////////////////////// // Completely wipe it all clean. void TF2::clear () @@ -411,8 +420,9 @@ void TF2::clear () _contents = ""; - // Note that the actual file name is deliberately not cleared. + // Note that the actual file name, and _has_ids are deliberately not cleared. //_file._data = ""; + //_has_ids = false; _tasks.clear (); _added_tasks.clear (); @@ -481,6 +491,8 @@ TDB2::TDB2 () : _location ("") , _id (1) { + // Mark the pending file as the only one that has ID numbers. + pending.has_ids (); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/TDB2.h b/src/TDB2.h index b6f23a1e1..d25ed4f49 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -63,6 +63,7 @@ public: std::string uuid (int); int id (const std::string&); + void has_ids (); void clear (); const std::string dump (); @@ -72,6 +73,7 @@ public: bool _loaded_tasks; bool _loaded_lines; bool _loaded_contents; + bool _has_ids; std::vector _tasks; std::vector _added_tasks; std::vector _modified_tasks;