Skip to content

Fix Alt key handling for menubar toggle and enable Save button on non-data changes#13058

Open
xboxones1 wants to merge 2 commits intokeepassxreboot:developfrom
xboxones1:fix/minnor-fix
Open

Fix Alt key handling for menubar toggle and enable Save button on non-data changes#13058
xboxones1 wants to merge 2 commits intokeepassxreboot:developfrom
xboxones1:fix/minnor-fix

Conversation

@xboxones1
Copy link
Copy Markdown
Contributor

  1. Fix menubar toggle to react only on Alt
    Menubar visibility previously reacted to any key combination involving Alt (e.g. Shift+Alt for keyboard layout switch or Alt+Arrow for moving entries).
    Now it only toggles when Alt is pressed and released alone, preventing unintended menu activation during shortcuts.
  2. Fixes Change role of automatically save database on non-data changes #9751. Enable Save button on non-data changes without marking database modified.

Testing strategy

Manually

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

@droidmonkey droidmonkey self-requested a review April 17, 2026 02:33
@droidmonkey droidmonkey requested a review from Copilot April 17, 2026 02:35
@droidmonkey droidmonkey added user interface pr: bugfix Pull request fixes a bug labels Apr 17, 2026
@droidmonkey droidmonkey added this to the v2.8.0 milestone Apr 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines two GUI behaviors in KeePassXC’s main window: (1) preventing unintended menubar toggling by only reacting to a standalone Alt press/release, and (2) enabling the Save action for “non-data” changes (e.g., UI state changes) without marking the database as modified, addressing #9751.

Changes:

  • Track whether Alt was pressed alone and only toggle the hidden menubar on an Alt-only press/release sequence.
  • Enable the Database → Save action when the database has non-data changes and auto-saving those changes is disabled.
  • Stop marking the database “modified” for non-data changes (instead notifying UI via signals).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/gui/MainWindow.h Adds state to track Alt-only key usage for menubar toggle behavior.
src/gui/MainWindow.cpp Updates Save enablement logic to consider non-data changes; refines menubar toggle key handling.
src/gui/DatabaseWidget.cpp Adjusts handling of non-data change events to avoid marking the DB modified.

Comment on lines 1903 to 1906
// Force mark the database modified if we are not auto-saving non-data changes
if (!config()->get(Config::AutoSaveNonDataChanges).toBool()) {
m_db->markAsModified();
emit databaseNonDataChanged();
}
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DatabaseWidget already relays Database::databaseNonDataChanged to its own databaseNonDataChanged signal in connectDatabaseSignals(). Emitting databaseNonDataChanged() again here will fire the signal twice for the same underlying change (and therefore call MainWindow::updateMenuActionState() twice via the action multiplexer). Consider removing this extra emit, or alternatively stop relaying the database signal and emit conditionally only from this slot.

Also, the comment above no longer matches the behavior (it mentions marking the DB modified, but the code now only emits a signal).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: bugfix Pull request fixes a bug user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change role of automatically save database on non-data changes

3 participants