Review Request 114130: A potential fix for Bug 327959

Jon Mease jon.mease at gmail.com
Thu Nov 28 09:37:33 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/114130/
-----------------------------------------------------------

(Updated Nov. 28, 2013, 9:37 a.m.)


Review request for KDevelop.


Changes
-------

Fixed target branch.


Bugs: 327959
    http://bugs.kde.org/show_bug.cgi?id=327959


Repository: kdevplatform


Description
-------

Bug Summary: When the "Find uses" action is bound to a keystroke (Such as Ctrl+M), executing that keystroke has no effect even though executing "Find Uses" from the context menu works as expected.

Problem:  The ContextBrowserPlugin::findUses() function relies on the sender() object being a QAction whose data() is an IndexedDeclaration.  The setData() method for this QAction is only called in the ContextBrowserPlugin::contextMenuExtension() function, however this function is not called when the Find Uses action is invoked with a keyboard shortcut.

Potential Solution:  As a potential solution, this patch removes the calls to setData() and data() on the QAction.  Instead, I copied the cursorDeclaration() function that is used in quickopenplugin.cpp.  This function returns a Declaration for the item under the cursor, which I then wrap in an IndexedDeclaration and use in place of the prior result of data() on the QAction.

This solution fixes the bug, and preserves the past behavior of Find Uses from the context menu and the documentation popup.

Questions: Is there a better way to fix this?  Is there an appropriate place to put the cursorDeclaration() function so that it can be used by multiple plugins without copying it?


Diffs
-----

  plugins/contextbrowser/contextbrowser.cpp a2124f7 

Diff: http://git.reviewboard.kde.org/r/114130/diff/


Testing
-------

I bound the Find Uses action to Ctrl+M and tested it on a variety of C++ source files.  When the cursor is not on a declaration the shortcut does nothing and when the cursor is on a declaration the find uses window is displayed.  I also tested that executing 'Find Uses' from the context menu and 'Show Uses' from the documentation popup behave as before.


Thanks,

Jon Mease

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20131128/3c0b5d79/attachment.html>


More information about the KDevelop-devel mailing list