Bug 1411191 - Custom actions do not work in qgit 2.6
Summary: Custom actions do not work in qgit 2.6
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qgit
Version: 25
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Dan Horák
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-09 02:15 UTC by Kevin Kofler
Modified: 2018-07-16 11:34 UTC (History)
1 user (show)

Fixed In Version: qgit-2.6-4.fc25 qgit-2.6-4.fc24 qgit-2.6-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-20 17:53:45 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
qgit-2.6-fix-custom-actions.patch (497 bytes, patch)
2017-01-09 02:15 UTC, Kevin Kofler
no flags Details | Diff

Description Kevin Kofler 2017-01-09 02:15:08 UTC
Created attachment 1238549 [details]
qgit-2.6-fix-custom-actions.patch

Description of problem:
Custom actions do not work in qgit 2.6 (they do nothing), a regression compared to earlier releases. This seems to be due to a behavior change in Qt 5 compared to Qt 4: QAction::text() now includes the automatically generated "&" for the keyboard shortcut. Therefore, it does not match the name of the action, and the action is not found. The attached patch solves this issue by removing the offending "&" sign.

Version-Release number of selected component (if applicable):
qgit-2.6-3.fc24
qgit-2.6-3.fc25
qgit-2.6-3.fc26

How reproducible:
Always

Steps to Reproduce:
1. Create a custom action in the dialog.
2. Try to run it.

Actual results:
Nothing happens.

Expected results:
The action is executed.

Additional info:
Patch attached.

Comment 1 Fedora Update System 2017-01-11 12:21:35 UTC
qgit-2.6-4.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-98f2f3bf3a

Comment 2 Fedora Update System 2017-01-11 12:21:42 UTC
qgit-2.6-4.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-2037955c6f

Comment 3 Fedora Update System 2017-01-11 12:21:47 UTC
qgit-2.6-4.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-226d58d15e

Comment 4 Fedora Update System 2017-01-12 07:51:15 UTC
qgit-2.6-4.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-98f2f3bf3a

Comment 5 Fedora Update System 2017-01-12 07:52:27 UTC
qgit-2.6-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-226d58d15e

Comment 6 Fedora Update System 2017-01-12 08:49:06 UTC
qgit-2.6-4.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-2037955c6f

Comment 7 Fedora Update System 2017-01-20 17:53:45 UTC
qgit-2.6-4.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2017-01-20 18:18:32 UTC
qgit-2.6-4.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2017-01-27 02:18:15 UTC
qgit-2.6-4.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Dan Horák 2017-06-19 15:58:07 UTC
Kevin, could you open a pull request at https://github.com/tibirna/qgit for this problem? Seems the fix haven't get in yet.

Comment 11 Kevin Kofler 2017-06-19 18:05:22 UTC
Well, I had some discussion with Cristian Tibirna, but he did not like my patch and it died out there.

His first reply:

> Please, help me understand what happens here. I don't think keyboard shortcuts 
> are added automatically. User has to explicitly put the "&" in the action 
> name. But then, the name is saved with the & in it. And as such. it should 
> match as is.
>
> What exactly happens here.
>
> (Of course, the patch is very simple. The only problem is that it would make 
> the removal of "&" happen even when the user actually wants to put an explicit 
> & in the action name -- e.g. "Commit & Push").

and then (the quoted quote is from me, the regular quote from him):

> > No, I did not add any '&'. That is exactly why the action names do not
> > match: the name is saved without any '&' (because there was none), but
> > QAction decides to assign a keyboard shortcut and QAction::text() returns
> > the text with the automatically assigned shortcut (i.e., with the '&'
> > added). Qt 4 did not do that, but Qt 5 does.
>
> Since I can't reproduce this, I searched a bit and I fell on this:
> http://stackoverflow.com/questions/32688153/how-to-disable-automatic-mnemonics-in-a-qt-application-on-kde
>
> So, it is not normal Qt behaviour, it is an additional KDE thing.
>
> In this context, I believe the right patch would be to attempt to remove the 
> ampersand *only* after having checked for the pristine text first.
>
> The best thing, given how CustomActions in QGit is intended to function would 
> be to either:
> 1) store the original text and its associated QAction as a map, and never 
> check for the text in the QAction for the purposes of identifying the action 
> from the menu event only or
> 2) disable the KDE plugin for the CustomActions menu specifically
>
> But I guess both would be more work.

and I don't think anything has happened since.

Comment 12 Dan Horák 2017-06-20 08:29:31 UTC
OK, I'll keep your fix in the package until there is something better in upstream.

Comment 13 Dan Horák 2018-07-16 11:34:59 UTC
Looks to me that https://github.com/tibirna/qgit/commit/7b8f1ff9ce16bc2d8457362df2017bc0ffe65458 is the upstream fix for this issue, so I'm going to drop the downstream patch in the 2.8 update.


Note You need to log in before you can comment on or make changes to this bug.