diff --git a/src/commands/CmdAppend.cpp b/src/commands/CmdAppend.cpp index 844ee0bb9..94977d626 100644 --- a/src/commands/CmdAppend.cpp +++ b/src/commands/CmdAppend.cpp @@ -67,6 +67,9 @@ int CmdAppend::execute (std::string& output) if (!modifications.size ()) throw std::string (STRING_CMD_MODIFY_NEED_TEXT); + // Accumulated project change notifications. + std::map projectChanges; + std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { @@ -84,7 +87,7 @@ int CmdAppend::execute (std::string& output) context.tdb2.modify (*task); ++count; feedback_affected (STRING_CMD_APPEND_TASK, *task); - context.footnote (onProjectChange (*task, true)); + projectChanges[task->get ("project")] = onProjectChange (*task, true); // Append to siblings. if (task->has ("parent")) @@ -117,6 +120,12 @@ int CmdAppend::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_APPEND_1 : STRING_CMD_APPEND_N, count); return rc; diff --git a/src/commands/CmdDelete.cpp b/src/commands/CmdDelete.cpp index f3848c474..1787a46d6 100644 --- a/src/commands/CmdDelete.cpp +++ b/src/commands/CmdDelete.cpp @@ -66,6 +66,9 @@ int CmdDelete::execute (std::string& output) // Apply the command line modifications to the new task. A3 modifications = context.a3.extract_modifications (); + // Accumulated project change notifications. + std::map projectChanges; + std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { @@ -99,7 +102,7 @@ int CmdDelete::execute (std::string& output) feedback_affected (STRING_CMD_DELETE_TASK, *task); feedback_unblocked (*task); dependencyChainOnComplete (*task); - context.footnote (onProjectChange (*task, true)); + projectChanges[task->get ("project")] = onProjectChange (*task, true); // Delete siblings. if (task->has ("parent")) @@ -150,6 +153,12 @@ int CmdDelete::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_DELETE_1 : STRING_CMD_DELETE_N, count); return rc; diff --git a/src/commands/CmdDone.cpp b/src/commands/CmdDone.cpp index 8f3aae51c..bc0568f65 100644 --- a/src/commands/CmdDone.cpp +++ b/src/commands/CmdDone.cpp @@ -65,6 +65,9 @@ int CmdDone::execute (std::string& output) // Apply the command line modifications to the new task. A3 modifications = context.a3.extract_modifications (); + // Accumulated project change notifications. + std::map projectChanges; + bool nagged = false; std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) @@ -100,7 +103,7 @@ int CmdDone::execute (std::string& output) if (!nagged) nagged = nag (*task); dependencyChainOnComplete (*task); - context.footnote (onProjectChange (*task, false)); + projectChanges[task->get ("project")] = onProjectChange (*task, false); } else { @@ -118,6 +121,12 @@ int CmdDone::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_DONE_1 : STRING_CMD_DONE_N, count); return rc; diff --git a/src/commands/CmdDuplicate.cpp b/src/commands/CmdDuplicate.cpp index e072a39d7..7caee03cb 100644 --- a/src/commands/CmdDuplicate.cpp +++ b/src/commands/CmdDuplicate.cpp @@ -65,6 +65,9 @@ int CmdDuplicate::execute (std::string& output) // Apply the command line modifications to the new task. A3 modifications = context.a3.extract_modifications (); + // Accumulated project change notifications. + std::map projectChanges; + std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { @@ -114,7 +117,7 @@ int CmdDuplicate::execute (std::string& output) if (context.verbose ("new-id")) std::cout << format (STRING_CMD_ADD_FEEDBACK, context.tdb2.next_id ()) + "\n"; - context.footnote (onProjectChange (*task, false)); + projectChanges[task->get ("project")] = onProjectChange (*task, false); } else { @@ -123,6 +126,12 @@ int CmdDuplicate::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_DUPLICATE_1 : STRING_CMD_DUPLICATE_N, count); return rc; diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 1d34f1cca..4033a23b6 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -317,9 +317,19 @@ int CmdInfo::execute (std::string& output) Column* col = context.columns[*att]; if (col) { - row = view.addRow (); - view.set (row, 0, col->label ()); - view.set (row, 1, task->get (*att)); + std::string value = task->get (*att); + if (value != "") + { + row = view.addRow (); + view.set (row, 0, col->label ()); + //view.set (row, 1, value); + + std::vector lines; + Color color; + col->render (lines, *task, 0, color); + join (value, " ", lines); + view.set (row, 1, value); + } } } } diff --git a/src/commands/CmdModify.cpp b/src/commands/CmdModify.cpp index 4236f32f1..c65a50890 100644 --- a/src/commands/CmdModify.cpp +++ b/src/commands/CmdModify.cpp @@ -67,6 +67,9 @@ int CmdModify::execute (std::string& output) if (!modifications.size ()) throw std::string (STRING_CMD_MODIFY_NEED_TEXT); + // Accumulated project change notifications. + std::map projectChanges; + std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { @@ -109,7 +112,7 @@ int CmdModify::execute (std::string& output) feedback_affected (STRING_CMD_MODIFY_TASK, *task); feedback_unblocked (*task); context.tdb2.modify (*task); - context.footnote (onProjectChange (before, *task)); + projectChanges[task->get ("project")] = onProjectChange (before, *task); // Task potentially has siblings - modify them. if (task->has ("parent")) @@ -129,7 +132,7 @@ int CmdModify::execute (std::string& output) feedback_affected (STRING_CMD_MODIFY_TASK_R, *sibling); feedback_unblocked (*sibling); context.tdb2.modify (*sibling); - context.footnote (onProjectChange (alternate, *sibling)); + projectChanges[sibling->get ("project")] = onProjectChange (alternate, *sibling); } } } @@ -149,7 +152,7 @@ int CmdModify::execute (std::string& output) updateRecurrenceMask (*child); context.tdb2.modify (*child); dependencyChainOnModify (alternate, *child); - context.footnote (onProjectChange (alternate, *child)); + projectChanges[child->get ("project")] = onProjectChange (alternate, *child); ++count; feedback_affected (STRING_CMD_MODIFY_TASK_R, *child); } @@ -164,6 +167,12 @@ int CmdModify::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_MODIFY_1 : STRING_CMD_MODIFY_N, count); return rc; diff --git a/src/commands/CmdPrepend.cpp b/src/commands/CmdPrepend.cpp index b86e78654..b64466b5b 100644 --- a/src/commands/CmdPrepend.cpp +++ b/src/commands/CmdPrepend.cpp @@ -67,6 +67,9 @@ int CmdPrepend::execute (std::string& output) if (!modifications.size ()) throw std::string (STRING_CMD_MODIFY_NEED_TEXT); + // Accumulated project change notifications. + std::map projectChanges; + std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { @@ -84,7 +87,7 @@ int CmdPrepend::execute (std::string& output) context.tdb2.modify (*task); ++count; feedback_affected (STRING_CMD_PREPEND_TASK, *task); - context.footnote (onProjectChange (*task, true)); + projectChanges[task->get ("project")] = onProjectChange (*task, true); // Prepend to siblings. if (task->has ("parent")) @@ -117,6 +120,12 @@ int CmdPrepend::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_PREPEND_1 : STRING_CMD_PREPEND_N, count); return rc; diff --git a/src/commands/CmdStart.cpp b/src/commands/CmdStart.cpp index f512857a0..792db843b 100644 --- a/src/commands/CmdStart.cpp +++ b/src/commands/CmdStart.cpp @@ -65,6 +65,9 @@ int CmdStart::execute (std::string& output) // Apply the command line modifications to the new task. A3 modifications = context.a3.extract_modifications (); + // Accumulated project change notifications. + std::map projectChanges; + bool nagged = false; std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) @@ -93,7 +96,7 @@ int CmdStart::execute (std::string& output) if (!nagged) nagged = nag (*task); dependencyChainOnStart (*task); - context.footnote (onProjectChange (*task, false)); + projectChanges[task->get ("project")] = onProjectChange (*task, false); } else { @@ -111,6 +114,12 @@ int CmdStart::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_START_1 : STRING_CMD_START_N, count); return rc; diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index 8ac862841..305db994a 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -64,6 +64,9 @@ int CmdStop::execute (std::string& output) // Apply the command line modifications to the new task. A3 modifications = context.a3.extract_modifications (); + // Accumulated project change notifications. + std::map projectChanges; + std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { @@ -89,7 +92,7 @@ int CmdStop::execute (std::string& output) ++count; feedback_affected (STRING_CMD_STOP_TASK, *task); dependencyChainOnStart (*task); - context.footnote (onProjectChange (*task, false)); + projectChanges[task->get ("project")] = onProjectChange (*task, false); } else { @@ -107,6 +110,12 @@ int CmdStop::execute (std::string& output) } } + // Now list the project changes. + std::map ::iterator i; + for (i = projectChanges.begin (); i != projectChanges.end (); ++i) + if (i->first != "") + context.footnote (i->second); + context.tdb2.commit (); feedback_affected (count == 1 ? STRING_CMD_STOP_1 : STRING_CMD_STOP_N, count); return rc;