Bug 327959 - Find uses keyboard shortcut does nothing
Summary: Find uses keyboard shortcut does nothing
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: contextbrowser (show other bugs)
Version: 1.5.1
Platform: unspecified Linux
: NOR normal
Target Milestone: 1.6.0
Assignee: kdevelop-bugs-null
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-11-22 23:18 UTC by Jon Mease
Modified: 2013-12-01 15:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Mease 2013-11-22 23:18:00 UTC
When the "Find uses" action is bound to a keystroke (Such as Ctrl+M), executing that keystroke has no effect.

Reproducible: Always

Steps to Reproduce:
1. Open Settings -> Configure Shortcuts
2. Assign a custom keyboard shortcut to the "Find Uses" action (Such as Ctrl+M)
3. Back in the editor in a C++ file, move the text cursor onto a variable or method.
4. Enter the keystroke configured in step 2.
Actual Results:  
Nothing happens

Expected Results:  
The code browser window should pop open and search for uses of the variable or method under the text cursor.

If I hover my mouse cursor over the variable and select "Show uses" from the documentation popup I do get the expected results (the code browser window opens and searches for uses of the variable).
Comment 1 Kevin Funk 2013-11-27 07:41:22 UTC
Same for me.
Comment 2 Jon Mease 2013-11-27 16:43:00 UTC
A description of my understanding of the problem and a potential fix are posted here https://git.reviewboard.kde.org/r/114130/.
Comment 3 Milian Wolff 2013-12-01 15:10:57 UTC
Git commit 154ee459768d6dc7cd6ebbfb10e8abcf48c3dd98 by Milian Wolff, on behalf of Jon Mease.
Committed on 01/12/2013 at 15:04.
Pushed by mwolff into branch '1.6'.

Fix "Find uses" action when invoked via shortcut.

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.

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 DeclarationPointer
for the item under the cursor and used 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.
REVIEW: 114130

M  +23   -6    plugins/contextbrowser/contextbrowser.cpp

http://commits.kde.org/kdevplatform/154ee459768d6dc7cd6ebbfb10e8abcf48c3dd98