Review Request 114130: A potential fix for Bug 327959

Jon Mease jon.mease at gmail.com
Sun Dec 1 01:24:38 UTC 2013


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

(Updated Dec. 1, 2013, 1:24 a.m.)


Review request for KDevelop.


Changes
-------

Updates for v1.6 based on Milian's review.


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 (updated)
-----

  plugins/contextbrowser/contextbrowser.cpp 5c27756 

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/20131201/1f0e4e2d/attachment.html>


More information about the KDevelop-devel mailing list