Bug 485430 - Rename file with F2: initial keyboard focus should be in the filename text field
Summary: Rename file with F2: initial keyboard focus should be in the filename text field
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: 24.02.1
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 11:38 UTC by Frank Steinmetzger
Modified: 2024-05-05 02:50 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Steinmetzger 2024-04-12 11:38:23 UTC
When I rename an image with F2, a little dialog opens in which I can enter the new filename.
Currently, the initial keyboard focus sits on one of the buttons, so I need to press Tab first. It would be more efficient if the focus were in the input field in which to enter the new filename. Bonus point: highlight only the basename part of the filename, i.e. without the file extension (if one exists) and its dot, like Dolphin does.

Regards

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.8.2-arch2-1 (64-bit)
Graphics Platform: X11
Comment 1 Bug Janitor Service 2024-04-25 19:47:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/gwenview/-/merge_requests/267
Comment 2 ratijas 2024-04-29 18:57:57 UTC
Can confirm the bug and the fix. I'm pretty sure it used to just work in past. Something must've changed in Qt.

> Bonus point: highlight only the basename part of the filename, i.e. without the file extension (if one exists) and its dot, like Dolphin does.

It does. However, only if the focus is initially on the field.
Comment 3 ratijas 2024-04-29 19:16:52 UTC
> Bonus point: highlight only the basename part of the filename, i.e. without the file extension (if one exists) and its dot, like Dolphin does.

The implementation of QLineEdit is quite hardcoded when it comes to selection management.

- It forcefully deselects text when it loses focus:

    Qt::FocusReason reason = e->reason();
    if (reason != Qt::ActiveWindowFocusReason &&
        reason != Qt::PopupFocusReason)
        deselect();

- and selects all text when it gains the focus back:

        else if (!d->control->hasSelectedText())
            selectAll();
Comment 4 ratijas 2024-04-29 20:34:22 UTC
Git commit 34a8f9c15d3e02de6c876b2a345d4cc27dffb002 by ivan tkachenko, on behalf of Alistair Barrow.
Committed on 29/04/2024 at 20:20.
Pushed by ratijas into branch 'master'.

Focus the QLineEdit when showing the rename dialog

M  +1    -0    app/renamedialog.cpp

https://invent.kde.org/graphics/gwenview/-/commit/34a8f9c15d3e02de6c876b2a345d4cc27dffb002
Comment 5 Bug Janitor Service 2024-05-05 02:47:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/gwenview/-/merge_requests/270
Comment 6 Nate Graham 2024-05-05 02:50:09 UTC
Git commit 174fcb49893b76ce3799d631641377d22badd353 by Nate Graham, on behalf of Alistair Barrow.
Committed on 05/05/2024 at 02:47.
Pushed by ngraham into branch 'release/24.05'.

Focus the QLineEdit when showing the rename dialog


(cherry picked from commit 34a8f9c15d3e02de6c876b2a345d4cc27dffb002)

M  +1    -0    app/renamedialog.cpp

https://invent.kde.org/graphics/gwenview/-/commit/174fcb49893b76ce3799d631641377d22badd353