evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
10.78k stars 503 forks source link

Default action on pressing enter should be "Apply" not "Reset" #963

Closed julikaiba closed 1 year ago

julikaiba commented 1 year ago

When creating or editing a rule, pressing enter currently defaults to pressing "reset" which deletes every entry in the rule. This is unintuitive. In most programs enter confirms and saves changes, so this should be considered as the default action here as well.

gustavo-iniguez-goya commented 1 year ago

Hi @julikaiba ,

Thank you reporting this issue. I've changed the default selected button to Save.

The behaviour was configured automatically by Qt. On my computers the default button was Help instead of Reset.

For future reference, this is how it decides which button is the default one:

If you want a specific button to be default you need to call setDefault() on it yourself. However, if there is no default button set and to preserve which button is the default button across platforms when using the autoDefault property, the first push button with the accept role is made the default button when the QDialogButtonBox is shown,

Previously we used a QDialogButtonBox.Apply button that has the ApplyRole role, so Qt didn't use it as the default button. On the other hand QDialogButtonBox.Save has the AcceptRole

https://doc.qt.io/qtforpython-5/PySide2/QtWidgets/QDialogButtonBox.html#PySide2.QtWidgets.PySide2.QtWidgets.QDialogButtonBox.ButtonRole