[calligra] libs/main: Add a warning about weird shortcut context initialization in the KoView

Dmitry Kazakov dimula73 at gmail.com
Fri Jan 31 07:14:06 GMT 2014


Git commit 818245e7f0b387abe0244a2d65017914ee75fc8c by Dmitry Kazakov.
Committed on 31/01/2014 at 07:12.
Pushed by dkazakov into branch 'master'.

Add a warning about weird shortcut context initialization in the KoView

I don't know why this is done, this code was added back in 2007. Effectively,
it changes the context of three shortcuts only (undo, redo, and active author).
The rest will be added with the default context, which is Qt::WindowShortcut.

CCMAIL:calligra-devel at kde.org
CCMAIL:kimageshop at kde.org

M  +8    -1    libs/main/KoView.cpp

http://commits.kde.org/calligra/818245e7f0b387abe0244a2d65017914ee75fc8c

diff --git a/libs/main/KoView.cpp b/libs/main/KoView.cpp
index 8960cbe..89bd944 100644
--- a/libs/main/KoView.cpp
+++ b/libs/main/KoView.cpp
@@ -194,8 +194,15 @@ KoView::KoView(KoPart *part, KoDocument *document, QWidget *parent)
     }
 
     actionCollection()->addAssociatedWidget(this);
-    foreach(QAction* action, actionCollection()->actions())
+
+    /**
+     * WARNING: This code changes the context of global shortcuts
+     *          only. All actions added later will have the default
+     *          context, which is Qt::WindowShortcut!
+     */
+    foreach(QAction* action, actionCollection()->actions()) {
         action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    }
 }
 
 KoView::~KoView()



More information about the calligra-devel mailing list