Add libkundo2 to Calligra

Review Request #101414 - Created May 22, 2011 and submitted

Alexander Potashev
kundo2 is a fork of Qt's Undo Framework (QUndoStack, QUndoView, ...).
It contains two bugfixes the are going to be available only in Qt 4.8:

To start using kundo2, one should port Calligra to it. This can be done
by adding target_link_libraries(... kundo2) into CMakeLists.txt files
for all modules from Calligra that use Qt Undo Framework, and by
switching from QUndo**** classes to KUndo2**** classes.
(switching to KUndo2 classes can easily be done by using a script)
Script for forward and backward porting:

After Calligra starts requiring Qt 4.8+, this library can be removed,
because it has no advantages over Qt's Undo Framework 4.8.
It compiles.
Boudewijn Rempt
Okay, apart from the explicit linking everywhere, I'm fine with this change.
Jarosław Staniek
Hi, please consider adding this patch to avoid infinite recursion. Needed at least on g++ is (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292].

diff --git a/libs/kundo2/kundo2stack.cpp b/libs/kundo2/kundo2stack.cpp
index 6af1d05..658df1f 100644
--- a/libs/kundo2/kundo2stack.cpp
+++ b/libs/kundo2/kundo2stack.cpp
@@ -1062,7 +1062,7 @@ bool KUndo2QStack::isActive() const
 QAction* KUndo2QStack::createRedoAction(KActionCollection* actionCollection, const QString& actionName)
-    QAction* action = createRedoAction(actionCollection);
+    QAction* action = createRedoAction(static_cast<QObject*>(actionCollection));
     if(actionName.isEmpty()) {
@@ -1081,7 +1081,7 @@ QAction* KUndo2QStack::createRedoAction(KActionCollection* actionCollection, con
 QAction* KUndo2QStack::createUndoAction(KActionCollection* actionCollection, const QString& actionName)
-    QAction* action = createUndoAction(actionCollection);
+    QAction* action = createUndoAction(static_cast<QObject*>(actionCollection));
     if(actionName.isEmpty()) {
  1. Fixed differently in "master" branch.