[PATCH] Add {un,re}do actions to edit menu

Guillermo E. Martinez guillermo.e.martinez at oracle.com
Mon Apr 25 17:00:39 BST 2022


Hello Umbrello team,

This patch encourage to use standard location and shortcuts
for {un,re}do actions.

Please, if you have comments don't hesitate to let me know :-)

Kind Rgerads,
Guillermo


This patch add support to use of standard location and shortcuts
for {un,re}do actions.

	* umbrello/uml.cpp (UMLApp::initActions): Use `KStandardAction::
	{un,re}do' to create {un,re}do actions, adding a tooltip to
	describe them.
---
 umbrello/uml.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/umbrello/uml.cpp b/umbrello/uml.cpp
index c3d5b4fda..850e208c4 100644
--- a/umbrello/uml.cpp
+++ b/umbrello/uml.cpp
@@ -316,8 +316,9 @@ void UMLApp::initActions()
 #endif
     QAction* fileQuit = KStandardAction::quit(this, SLOT(slotFileQuit()), actionCollection());
 
-    editUndo = m_pUndoStack->createUndoAction(actionCollection());
-    editRedo = m_pUndoStack->createRedoAction(actionCollection());
+    editUndo = KStandardAction::undo(this, SLOT(slotEditUndo()), actionCollection());
+    editRedo = KStandardAction::redo(this, SLOT(slotEditRedo()), actionCollection());
+
 #if QT_VERSION >= 0x040600
     editUndo->setPriority(QAction::LowPriority);   // icon only
     editRedo->setPriority(QAction::LowPriority);   // icon only
@@ -431,6 +432,9 @@ void UMLApp::initActions()
     editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard"));
     editCopy->setToolTip(i18n("Copies the selected section to the clipboard"));
     editPaste->setToolTip(i18n("Pastes the contents of the clipboard"));
+    editUndo->setToolTip(i18n("Undo last action"));
+    editRedo->setToolTip(i18n("Redo last undone action"));
+
     preferences->setToolTip(i18n("Set the default program preferences"));
 
     deleteSelectedWidget = actionCollection()->addAction(QLatin1String("delete_selected"));
-- 
2.35.1



More information about the umbrello-devel mailing list