allways delete the previousChar?
    Jaime 
    jtamate at gmail.com
       
    Sat Oct  8 17:19:11 BST 2011
    
    
  
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.
    
    
More information about the calligra-devel
mailing list