Added conditional execution of undo and redo depending on whether a
model can undo or can redo.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>