mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 16:53:08 +02:00
Bug Fix - #171
- Fixed bug that caused redundant information to be displayed when the "done" command was run. Thanks to John Florian.
This commit is contained in:
parent
84f48fd056
commit
9095934bc0
3 changed files with 17 additions and 14 deletions
|
@ -25,6 +25,7 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include "Permission.h"
|
#include "Permission.h"
|
||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -43,7 +44,7 @@ Permission::Permission ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool Permission::confirmed (const std::string& question)
|
bool Permission::confirmed (const Task& task, const std::string& question)
|
||||||
{
|
{
|
||||||
if (!needConfirmation)
|
if (!needConfirmation)
|
||||||
return true;
|
return true;
|
||||||
|
@ -51,6 +52,14 @@ bool Permission::confirmed (const std::string& question)
|
||||||
if (allConfirmed)
|
if (allConfirmed)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
std::cout << std::endl
|
||||||
|
<< "Task "
|
||||||
|
<< task.id
|
||||||
|
<< " \""
|
||||||
|
<< task.get ("description")
|
||||||
|
<< "\""
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
int answer = confirm3 (question);
|
int answer = confirm3 (question);
|
||||||
if (answer == 2)
|
if (answer == 2)
|
||||||
allConfirmed = true;
|
allConfirmed = true;
|
||||||
|
@ -58,6 +67,7 @@ bool Permission::confirmed (const std::string& question)
|
||||||
if (answer > 0)
|
if (answer > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#define INCLUDED_PERMISSION
|
#define INCLUDED_PERMISSION
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "Task.h"
|
||||||
|
|
||||||
class Permission
|
class Permission
|
||||||
{
|
{
|
||||||
|
@ -38,7 +39,7 @@ public:
|
||||||
|
|
||||||
void bigChange () { needConfirmation = true; }
|
void bigChange () { needConfirmation = true; }
|
||||||
void bigSequence () { needConfirmation = true; }
|
void bigSequence () { needConfirmation = true; }
|
||||||
bool confirmed (const std::string&);
|
bool confirmed (const Task&, const std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool needConfirmation;
|
bool needConfirmation;
|
||||||
|
|
|
@ -763,9 +763,7 @@ std::string handleDone ()
|
||||||
|
|
||||||
if (taskDiff (before, *task))
|
if (taskDiff (before, *task))
|
||||||
{
|
{
|
||||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
if (permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||||
std::string question = taskDifferences (before, *task) + "Are you sure?";
|
|
||||||
if (permission.confirmed (question))
|
|
||||||
{
|
{
|
||||||
context.tdb.update (*task);
|
context.tdb.update (*task);
|
||||||
|
|
||||||
|
@ -909,9 +907,7 @@ std::string handleModify ()
|
||||||
|
|
||||||
if (taskDiff (before, *other))
|
if (taskDiff (before, *other))
|
||||||
{
|
{
|
||||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
if (changes && permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||||
std::string question = taskDifferences (before, *other) + "Are you sure?";
|
|
||||||
if (changes && permission.confirmed (question))
|
|
||||||
{
|
{
|
||||||
context.tdb.update (*other);
|
context.tdb.update (*other);
|
||||||
++count;
|
++count;
|
||||||
|
@ -970,9 +966,7 @@ std::string handleAppend ()
|
||||||
|
|
||||||
if (taskDiff (before, *other))
|
if (taskDiff (before, *other))
|
||||||
{
|
{
|
||||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
if (changes && permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||||
std::string question = taskDifferences (before, *other) + "Are you sure?";
|
|
||||||
if (changes && permission.confirmed (question))
|
|
||||||
{
|
{
|
||||||
context.tdb.update (*other);
|
context.tdb.update (*other);
|
||||||
|
|
||||||
|
@ -1257,9 +1251,7 @@ std::string handleAnnotate ()
|
||||||
|
|
||||||
if (taskDiff (before, *task))
|
if (taskDiff (before, *task))
|
||||||
{
|
{
|
||||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
if (permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||||
std::string question = taskDifferences (before, *task) + "Are you sure?";
|
|
||||||
if (permission.confirmed (question))
|
|
||||||
{
|
{
|
||||||
context.tdb.update (*task);
|
context.tdb.update (*task);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue