Hi,

  There is something wrong here, there are two ifs and the same action
is taken in the true and the false part.
  This was found by a new check in cppcheck, but really amazing.

void KoTextEditor::deleteChar(MoveOperation direction, bool
trackChanges, KoShapeController *shapeController)
{
    if (isEditProtected()) {
        return;
    }

    if (trackChanges) {
        if (direction == PreviousChar) {
            addCommand(new
ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::PreviousChar,
                                                      d->document,
                                                      shapeController));
        }
        else {
            addCommand(new
ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::PreviousChar,
                                                      d->document,
                                                      shapeController));
        }
    }
    else {
        if (direction == PreviousChar) {
            addCommand(new DeleteCommand(DeleteCommand::PreviousChar,
                                         d->document,
                                         shapeController));
        }
        else {
            addCommand(new DeleteCommand(DeleteCommand::PreviousChar,
                                         d->document,
                                         shapeController));
        }
    }
}

Best Regards.
_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel

Reply via email to