fix: double-click trigger inline renaming
Original commit message(s)
plasma-integration: Folder picker: disable inline rename; expand/collapse via activation (Qt5/Qt6)
- Set NoEditTriggers and disable expandsOnDoubleClick in KFileTreeView
- Keep expansion driven by QAbstractItemView::activated in KDirSelectDialog
- Scope limited to Plasma Integration folder picker; KIO dialogs unchanged
Reason for the change
When using the folder selection dialog through the portal path (e.g. VSCode → xdg-desktop-portal-kde → QFileDialog → Plasma Integration), double-clicking a folder could trigger inline rename instead of expanding/collapsing when the system is set to “Double-click to open.” This conflicts with KDirSelectDialog’s existing logic that toggles expansion via the activated signal.
Root cause:
-
QTreeViewdefaults allow editing on double-click and may also auto-expand on double-click. - In directory-only selection, rename is not a desired action and competes with activation-driven expansion.
Fix:
- In
KFileTreeView(Qt5/Qt6), explicitly disable inline editing withsetEditTriggers(QAbstractItemView::NoEditTriggers)and disable implicit expand withsetExpandsOnDoubleClick(false). - Expansion remains driven solely by
activated, which already connects toslotExpand(index)inKDirSelectDialog.
Why this is correct:
- Aligns Plasma Integration folder picker behavior with KIO’s folder dialogs (which constrain editing vs activation).
- Prevents unexpected rename operations in a dialog whose purpose is selecting a folder, not managing it.
- Honors the platform SingleClick setting via the
activatedpath, and avoids double-toggling from implicit expand.
Test plan
Manual:
- Toggle System Settings → General Behavior → Click behavior (Single-click vs Double-click).
- From a sandboxed app (e.g. VSCode), File → Open Folder.
- Verify:
- Double-click expands/collapses items; no rename editor appears.
- Single-click mode continues to expand/collapse via activation as expected.
- KIO-based dialogs (non-portal) remain unchanged.
Screenshots or screen recordings
N/A; no visual changes beyond interaction correction.
Bugs fixed
Edited by Kendrick Ha