Bug 494557 - Create a new partition: Wrong tab order if LUKS encryption is enabled
Summary: Create a new partition: Wrong tab order if LUKS encryption is enabled
Status: RESOLVED FIXED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 24.08.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-11 17:08 UTC by LaughingMan
Modified: 2024-10-12 23:29 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 LaughingMan 2024-10-11 17:08:09 UTC
STEPS TO REPRODUCE
1. Open the "Create a new partition" dialogue
2. Tick the "Encrypt with LUKS" check box
3. Press tab

OBSERVED RESULT
The focus switches to the "label" field.

EXPECTED RESULT
The focus switches to the newly shown "Enable LUKS2" check box.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3
Comment 1 Andrius Štikonas 2024-10-11 21:14:57 UTC
Git commit 81fc2370b8121dfe886e516443c72000de81e888 by Andrius Štikonas.
Committed on 11/10/2024 at 21:08.
Pushed by stikonas into branch 'master'.

Improve tab order in partition create dialog.

Unfortunately, there doesn't seem to be an easy way
to change tab order of KNewPasswordWidget.

M  +20   -17   src/gui/sizedialogwidgetbase.ui

https://invent.kde.org/system/partitionmanager/-/commit/81fc2370b8121dfe886e516443c72000de81e888
Comment 2 LaughingMan 2024-10-11 21:28:14 UTC
"Unfortunately, there doesn't seem to be an easy way to change tab order of KNewPasswordWidget."

Does that mean the tab order for the password field will still be wrong? :/

That's really the one I cared about more. Only noticed that the checkbox also has the wrong order while filing this report. Originally I tried to tab to the next text box after typing my password.
Comment 3 Andrius Štikonas 2024-10-11 21:38:39 UTC
(In reply to LaughingMan from comment #2)
> "Unfortunately, there doesn't seem to be an easy way to change tab order of
> KNewPasswordWidget."
> 
> Does that mean the tab order for the password field will still be wrong? :/
> 
> That's really the one I cared about more. Only noticed that the checkbox
> also has the wrong order while filing this report. Originally I tried to tab
> to the next text box after typing my password.

Unfortunately yes, but I don't see any way to specify tab order for it.

Qt designer didn't have any option to set order on it. I then tried to hack around .ui file manually, by adding tabstop there but it still didn't work (perhaps unsurprisingly).
Comment 4 Kevin Kofler 2024-10-12 12:32:39 UTC
Have you tried setting it programmatically from the code using QWidget::setTabOrder (https://doc.qt.io/qt-6/qwidget.html#setTabOrder)?

If that does not work, you can try to use QObject introspection to get the KPasswordLineEdit embedded in the KNewPasswordWidget:
KPasswordLineEdit *passwordLineEdit = m_EditPassphrase->findChild<KPasswordLineEdit *>(QString(), Qt::FindDirectChildrenOnly);
and then playing around with that, maybe:
m_EditPassphrase->setFocusProxy(passwordLineEdit);
setTabOrder(…, m_EditPassphrase); // now that it has a valid focus proxy set

I also think this needs to be reported against KNewPasswordWidget. All widgets ought to support setting the tab order.
Comment 5 Andrius Štikonas 2024-10-12 14:47:43 UTC
(In reply to Kevin Kofler from comment #4)
> Have you tried setting it programmatically from the code using
> QWidget::setTabOrder (https://doc.qt.io/qt-6/qwidget.html#setTabOrder)?
> 
> If that does not work, you can try to use QObject introspection to get the
> KPasswordLineEdit embedded in the KNewPasswordWidget:
> KPasswordLineEdit *passwordLineEdit =
> m_EditPassphrase->findChild<KPasswordLineEdit *>(QString(),
> Qt::FindDirectChildrenOnly);
> and then playing around with that, maybe:
> m_EditPassphrase->setFocusProxy(passwordLineEdit);
> setTabOrder(…, m_EditPassphrase); // now that it has a valid focus proxy set
> 
> I also think this needs to be reported against KNewPasswordWidget. All
> widgets ought to support setting the tab order.

Yeah, I agree. I'll open a bug against KNewPasswordWidget a bit later.
Comment 6 Andrius Štikonas 2024-10-12 23:29:19 UTC
Widgetsaddons bug: https://bugs.kde.org/show_bug.cgi?id=494624

Kevin, I think I tried setting  QWidget::setTabOrder yesterday if I remember correctly and it didn't work.
I have not tried to use QObject introspection yet, but let's see if #494624 gets some responses.