diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 0148a51e6..02f41e698 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -584,7 +584,7 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */) if (add_to_backlog) context.hooks.onAdd (task); - update (uuid, task, add_to_backlog, true); + update (task, add_to_backlog, true); } //////////////////////////////////////////////////////////////////////////////// @@ -602,12 +602,11 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */) context.hooks.onModify (original, task); } - update (uuid, task, add_to_backlog); + update (task, add_to_backlog); } //////////////////////////////////////////////////////////////////////////////// void TDB2::update ( - const std::string& uuid, Task& task, const bool add_to_backlog, const bool addition /* = false */) @@ -775,10 +774,10 @@ void TDB2::revert () // Modify other data files accordingly. std::vector p = pending.get_lines (); - revert_pending (p, uuid, current, prior); + revert_pending (p, uuid, prior); std::vector c = completed.get_lines (); - revert_completed (p, c, uuid, current, prior); + revert_completed (p, c, uuid, prior); std::vector b = backlog.get_lines (); revert_backlog (b, uuid, current, prior); @@ -837,7 +836,6 @@ void TDB2::revert_undo ( void TDB2::revert_pending ( std::vector & p, const std::string& uuid, - const std::string& current, const std::string& prior) { std::string uuid_att = "uuid:\"" + uuid + "\""; @@ -871,7 +869,6 @@ void TDB2::revert_completed ( std::vector & p, std::vector & c, const std::string& uuid, - const std::string& current, const std::string& prior) { std::string uuid_att = "uuid:\"" + uuid + "\""; diff --git a/src/TDB2.h b/src/TDB2.h index c72b0c528..4353a4ee5 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -138,12 +138,12 @@ public: private: void gather_changes (); - void update (const std::string&, Task&, const bool, const bool addition = false); + void update (Task&, const bool, const bool addition = false); bool verifyUniqueUUID (const std::string&); void show_diff (const std::string&, const std::string&, const std::string&); void revert_undo (std::vector &, std::string&, std::string&, std::string&, std::string&); - void revert_pending (std::vector &, const std::string&, const std::string&, const std::string&); - void revert_completed (std::vector &, std::vector &, const std::string&, const std::string&, const std::string&); + void revert_pending (std::vector &, const std::string&, const std::string&); + void revert_completed (std::vector &, std::vector &, const std::string&, const std::string&); void revert_backlog (std::vector &, const std::string&, const std::string&, const std::string&); public: diff --git a/src/calc.cpp b/src/calc.cpp index c22d3c2d2..e9056489e 100644 --- a/src/calc.cpp +++ b/src/calc.cpp @@ -39,7 +39,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// // Constants. -bool get (const std::string& name, Variant& value) +bool get (const std::string&, Variant&) { /* // An example, although a bad one because this is supported by default. diff --git a/src/columns/ColMask.cpp b/src/columns/ColMask.cpp index a00eb31c3..53b0dfa77 100644 --- a/src/columns/ColMask.cpp +++ b/src/columns/ColMask.cpp @@ -68,7 +68,7 @@ void ColumnMask::measure (Task& task, unsigned int& minimum, unsigned int& maxim void ColumnMask::render ( std::vector & lines, Task& task, - int width, + int, Color& color) { if (task.has (_name)) diff --git a/src/commands/CmdAnnotate.cpp b/src/commands/CmdAnnotate.cpp index 7709bfc13..b916c58b5 100644 --- a/src/commands/CmdAnnotate.cpp +++ b/src/commands/CmdAnnotate.cpp @@ -53,7 +53,7 @@ CmdAnnotate::CmdAnnotate () } //////////////////////////////////////////////////////////////////////////////// -int CmdAnnotate::execute (std::string& output) +int CmdAnnotate::execute (std::string&) { int rc = 0; int count = 0; @@ -84,7 +84,7 @@ int CmdAnnotate::execute (std::string& output) task.modify (Task::modAnnotate, true); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { context.tdb2.modify (task); ++count; diff --git a/src/commands/CmdAppend.cpp b/src/commands/CmdAppend.cpp index b2db54890..15221d6f9 100644 --- a/src/commands/CmdAppend.cpp +++ b/src/commands/CmdAppend.cpp @@ -53,7 +53,7 @@ CmdAppend::CmdAppend () } //////////////////////////////////////////////////////////////////////////////// -int CmdAppend::execute (std::string& output) +int CmdAppend::execute (std::string&) { int rc = 0; int count = 0; @@ -84,7 +84,7 @@ int CmdAppend::execute (std::string& output) task.modify (Task::modAppend, true); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { context.tdb2.modify (task); ++count; diff --git a/src/commands/CmdContext.cpp b/src/commands/CmdContext.cpp index 9a335b120..ac168bd5b 100644 --- a/src/commands/CmdContext.cpp +++ b/src/commands/CmdContext.cpp @@ -68,9 +68,9 @@ int CmdContext::execute (std::string& output) if (subcommand == "define") rc = defineContext (words, out); else if (subcommand == "delete") rc = deleteContext (words, out); - else if (subcommand == "list") rc = listContexts (words, out); - else if (subcommand == "none") rc = unsetContext (words, out); - else if (subcommand == "show") rc = showContext (words, out); + else if (subcommand == "list") rc = listContexts (out); + else if (subcommand == "none") rc = unsetContext (out); + else if (subcommand == "show") rc = showContext (out); else rc = setContext (words, out); } @@ -229,7 +229,7 @@ int CmdContext::deleteContext (const std::vector & words, std::stri // Invoked with: task context list // Example: task context list // -int CmdContext::listContexts (const std::vector & words, std::stringstream& out) +int CmdContext::listContexts (std::stringstream& out) { int rc = 0; std::vector contexts = getContexts(); @@ -321,7 +321,7 @@ int CmdContext::setContext (const std::vector & words, std::strings // Invoked with: task context show // Example: task context show // -int CmdContext::showContext (const std::vector & words, std::stringstream& out) +int CmdContext::showContext (std::stringstream& out) { std::string currentContext = context.config.get ("context"); @@ -346,7 +346,7 @@ int CmdContext::showContext (const std::vector & words, std::string // Invoked with: task context none // Example: task context none // -int CmdContext::unsetContext (const std::vector & words, std::stringstream& out) +int CmdContext::unsetContext (std::stringstream& out) { int rc = 0; int status = CmdConfig::unsetConfigVariable ("context", false); diff --git a/src/commands/CmdContext.h b/src/commands/CmdContext.h index d06b8f934..414b39dce 100644 --- a/src/commands/CmdContext.h +++ b/src/commands/CmdContext.h @@ -35,14 +35,14 @@ class CmdContext : public Command public: CmdContext (); int execute (std::string&); - std::string joinWords (const std::vector & words, unsigned int from, unsigned int to = 0); + std::string joinWords (const std::vector &, unsigned int, unsigned int = 0); static std::vector getContexts (); - int defineContext (const std::vector & words, std::stringstream& out); - int deleteContext (const std::vector & words, std::stringstream& out); - int listContexts (const std::vector & words, std::stringstream& out); - int setContext (const std::vector & words, std::stringstream& out); - int showContext (const std::vector & words, std::stringstream& out); - int unsetContext (const std::vector & words, std::stringstream& out); + int defineContext (const std::vector &, std::stringstream&); + int deleteContext (const std::vector &, std::stringstream&); + int listContexts (std::stringstream&); + int setContext (const std::vector &, std::stringstream&); + int showContext (std::stringstream&); + int unsetContext (std::stringstream&); }; class CmdCompletionContext : public Command diff --git a/src/commands/CmdDelete.cpp b/src/commands/CmdDelete.cpp index df03e3c8c..1523f0fe1 100644 --- a/src/commands/CmdDelete.cpp +++ b/src/commands/CmdDelete.cpp @@ -54,7 +54,7 @@ CmdDelete::CmdDelete () } //////////////////////////////////////////////////////////////////////////////// -int CmdDelete::execute (std::string& output) +int CmdDelete::execute (std::string&) { int rc = 0; int count = 0; @@ -94,7 +94,7 @@ int CmdDelete::execute (std::string& output) if (! task.has ("end")) task.setAsNow ("end"); - if (permission (task, question, filtered.size ())) + if (permission (question, filtered.size ())) { updateRecurrenceMask (task); ++count; diff --git a/src/commands/CmdDenotate.cpp b/src/commands/CmdDenotate.cpp index 88c6bbe7c..b4e0706f2 100644 --- a/src/commands/CmdDenotate.cpp +++ b/src/commands/CmdDenotate.cpp @@ -53,7 +53,7 @@ CmdDenotate::CmdDenotate () } //////////////////////////////////////////////////////////////////////////////// -int CmdDenotate::execute (std::string& output) +int CmdDenotate::execute (std::string&) { int rc = 0; int count = 0; @@ -130,7 +130,7 @@ int CmdDenotate::execute (std::string& output) task.id, task.get ("description")); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { ++count; context.tdb2.modify (task); diff --git a/src/commands/CmdDone.cpp b/src/commands/CmdDone.cpp index 805c3b8c7..8556216e6 100644 --- a/src/commands/CmdDone.cpp +++ b/src/commands/CmdDone.cpp @@ -53,7 +53,7 @@ CmdDone::CmdDone () } //////////////////////////////////////////////////////////////////////////////// -int CmdDone::execute (std::string& output) +int CmdDone::execute (std::string&) { int rc = 0; int count = 0; @@ -97,7 +97,7 @@ int CmdDone::execute (std::string& output) task.addAnnotation (context.config.get ("journal.time.stop.annotation")); } - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { updateRecurrenceMask (task); context.tdb2.modify (task); diff --git a/src/commands/CmdDuplicate.cpp b/src/commands/CmdDuplicate.cpp index 3aa90449a..2eb555724 100644 --- a/src/commands/CmdDuplicate.cpp +++ b/src/commands/CmdDuplicate.cpp @@ -53,7 +53,7 @@ CmdDuplicate::CmdDuplicate () } //////////////////////////////////////////////////////////////////////////////// -int CmdDuplicate::execute (std::string& output) +int CmdDuplicate::execute (std::string&) { int rc = 0; int count = 0; @@ -105,8 +105,7 @@ int CmdDuplicate::execute (std::string& output) dup.modify (Task::modAnnotate); - if (permission (dup, - format (STRING_CMD_DUPLICATE_CONFIRM, + if (permission (format (STRING_CMD_DUPLICATE_CONFIRM, task.id, task.get ("description")), filtered.size ())) diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 5aa070d90..7cb3b7109 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -65,7 +65,7 @@ CmdEdit::CmdEdit () // Introducing the Silver Bullet. This feature is the catch-all fixative for // various other ills. This is like opening up the hood and going in with a // wrench. To be used sparingly. -int CmdEdit::execute (std::string& output) +int CmdEdit::execute (std::string&) { // Filter the tasks. handleRecurrence (); diff --git a/src/commands/CmdExec.cpp b/src/commands/CmdExec.cpp index 10e860004..ca50ca029 100644 --- a/src/commands/CmdExec.cpp +++ b/src/commands/CmdExec.cpp @@ -50,7 +50,7 @@ CmdExec::CmdExec () } //////////////////////////////////////////////////////////////////////////////// -int CmdExec::execute (std::string& output) +int CmdExec::execute (std::string&) { std::string command_line; join (command_line, " ", context.cli2.getWords ()); diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index df48db9f5..ed84190f2 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -55,7 +55,7 @@ CmdImport::CmdImport () } //////////////////////////////////////////////////////////////////////////////// -int CmdImport::execute (std::string& output) +int CmdImport::execute (std::string&) { int rc = 0; int count = 0; diff --git a/src/commands/CmdModify.cpp b/src/commands/CmdModify.cpp index 9f9626aa4..7fea872b1 100644 --- a/src/commands/CmdModify.cpp +++ b/src/commands/CmdModify.cpp @@ -53,7 +53,7 @@ CmdModify::CmdModify () } //////////////////////////////////////////////////////////////////////////////// -int CmdModify::execute (std::string& output) +int CmdModify::execute (std::string&) { int rc = 0; int count = 0; @@ -91,7 +91,7 @@ int CmdModify::execute (std::string& output) task.get ("uuid"), task.get ("description")); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { count += modifyAndUpdate (before, task, &projectChanges); } diff --git a/src/commands/CmdPrepend.cpp b/src/commands/CmdPrepend.cpp index e9d1596b6..d3a8cba14 100644 --- a/src/commands/CmdPrepend.cpp +++ b/src/commands/CmdPrepend.cpp @@ -53,7 +53,7 @@ CmdPrepend::CmdPrepend () } //////////////////////////////////////////////////////////////////////////////// -int CmdPrepend::execute (std::string& output) +int CmdPrepend::execute (std::string&) { int rc = 0; int count = 0; @@ -84,7 +84,7 @@ int CmdPrepend::execute (std::string& output) task.modify (Task::modPrepend, true); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { context.tdb2.modify (task); ++count; diff --git a/src/commands/CmdStart.cpp b/src/commands/CmdStart.cpp index 4db72bb22..da1690b52 100644 --- a/src/commands/CmdStart.cpp +++ b/src/commands/CmdStart.cpp @@ -53,7 +53,7 @@ CmdStart::CmdStart () } //////////////////////////////////////////////////////////////////////////////// -int CmdStart::execute (std::string& output) +int CmdStart::execute (std::string&) { int rc = 0; int count = 0; @@ -95,7 +95,7 @@ int CmdStart::execute (std::string& output) if (context.config.getBoolean ("journal.time")) task.addAnnotation (context.config.get ("journal.time.start.annotation")); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { updateRecurrenceMask (task); context.tdb2.modify (task); diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index feb55a38b..7ca2638e0 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -52,7 +52,7 @@ CmdStop::CmdStop () } //////////////////////////////////////////////////////////////////////////////// -int CmdStop::execute (std::string& output) +int CmdStop::execute (std::string&) { int rc = 0; int count = 0; @@ -87,7 +87,7 @@ int CmdStop::execute (std::string& output) if (context.config.getBoolean ("journal.time")) task.addAnnotation (context.config.get ("journal.time.stop.annotation")); - if (permission (task, taskDifferences (before, task) + question, filtered.size ())) + if (permission (taskDifferences (before, task) + question, filtered.size ())) { updateRecurrenceMask (task); context.tdb2.modify (task); diff --git a/src/commands/CmdUndo.cpp b/src/commands/CmdUndo.cpp index 484353a10..6ec119407 100644 --- a/src/commands/CmdUndo.cpp +++ b/src/commands/CmdUndo.cpp @@ -49,7 +49,7 @@ CmdUndo::CmdUndo () } //////////////////////////////////////////////////////////////////////////////// -int CmdUndo::execute (std::string& output) +int CmdUndo::execute (std::string&) { context.tdb2.revert (); return 0; diff --git a/src/commands/CmdUnique.cpp b/src/commands/CmdUnique.cpp index 3a2fca135..3a5099c61 100644 --- a/src/commands/CmdUnique.cpp +++ b/src/commands/CmdUnique.cpp @@ -25,7 +25,6 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include #include #include #include @@ -88,7 +87,7 @@ int CmdUnique::execute (std::string& output) // Generate list of unique values. for (auto& value : values) - std::cout << value << "\n"; + output += value + "\n"; context.headers.clear (); return 0; diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 1b857d34b..4b2baa739 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -312,7 +312,6 @@ Command::Category Command::category () const // rc.confirmation // this->_read_only bool Command::permission ( - const Task& task, const std::string& question, unsigned int quantity) { diff --git a/src/commands/Command.h b/src/commands/Command.h index 70c3cb7b9..39bbe7468 100644 --- a/src/commands/Command.h +++ b/src/commands/Command.h @@ -71,7 +71,7 @@ public: virtual int execute (std::string&) = 0; protected: - bool permission (const Task&, const std::string&, unsigned int); + bool permission (const std::string&, unsigned int); static const std::map categoryNames; protected: