[PATCH] KXMLGUIFactory/KActionCollection - Fix resetting shortcuts to default value

Robert Knight robertknight at gmail.com
Tue Jul 22 04:30:09 BST 2008


Hello,

I found a bug that can occur when resetting the shortcut for an action
from a custom shortcut back to its default value in multi-document
applications like Kate and Konsole.

When editing shortcuts, the action collection for the current document
is added to the KShortcutsDialog.  After the user accepts the dialog,
the updated shortcuts are automatically applied to the current document
actions but the actions for the other documents need to be updated as
well.  Kate's approach, which I take it is correct, is to iterate
through each document's KXMLGUIClient and call reloadXML() to refresh
the shortcuts.

The problem is that KXMLGUIFactory only sets the shortcut of an existing
action if there is a "shortcut" attribute defined for it in the
ActionProperties section of the XML document.  When resetting a shortcut
to the default value, this attribute is deleted from the document and so
the action's shortcut is not reset when reloadXML is called.  The result
is that the shortcuts for actions that are not in the active document or
window are not updated until the application is restarted.

The attached patch adds support for a "default" value for the 'shortcut'
attribute which causes the KAction's ActiveShortcut to be set to the
value of the DefaultShortcut.  

Please review.  Incidentally - do we have a review board for kdelibs
patches?

Regards,
Robert.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdeui_fix_resetting_shortcut_to_default.patch
Type: text/x-patch
Size: 3652 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080722/0f47933a/attachment.bin>


More information about the kde-core-devel mailing list