┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistcontroller.cpp
AgeCommit message (Collapse)Author
2026-02-05KItemListController: Use entire row for drag and drop if highlightEntireRow ↵Akseli Lahtinen
is true Currently when dragging and dropping items in Details view, even if the "Open files and folders" setting is set "By clicking anywhere on the row", drag and drop still behaves differently. Instead, make the drag and drop follow the setting: If clicking anywhere on the row causes actions, so should dropping anywhere on the row. BUG: 515439
2026-01-21Add keyboard anchor assignments to mouse eventsTomasz Kot
The mouse events need to modify the keyboard anchor assignments as well, because selecting an item with a mouse and then navigating with keyboard wouldn't follow the same selection. BUG: 508609
2025-11-12Revert "Avoid implicitly selecting items"Nate Graham
This reverts commit 122fee5625f0285ec4ebda79162c72390989eb2a. This behavior change was well-intentioned, but has significant usability and speed drawbacks that have not been addressed: - Keyboard-driven folder manipulation became slower - Unexpected behavioral differences when opening files with the pointer compared to when opening them with the keyboard introduced inconsistency and cognitive load - Unexpected opening of selection mode during fast operation introduced the potential for confusion and additional errors - Dolphin's behavior became inconsistent with that of other file managers users may be accustomed to The bug tracker, discuss.kde.org, and Reddit are full of complaints about this change. It's been a year now; I think it's clear that many Dolphin users have not gotten used to and accepted it. I have to count myself as one of them, I'm afraid. I've tried to get used to it for a year, but I just have not been able to. I don't believe the benefits of this change outweigh the drawbacks, so let's revert it. 24d859cf19e90fa22ed687b36a68231625c1bd80 was explicitly mentioned as a thing that should also be reverted in this case, but it's already been done. BUG: 494125 BUG: 511966 CCBUG: 424723 CCBUG: 492404 FIXED-IN: 25.12.0
2025-11-10dolphin: improve keyboard search behavior for repeated charactersweinan li
The original keyboard search implementation had a limitation when dealing with files containing repeated characters like 44.txt. When typing 44, it would trigger rapid navigation to the next item starting with 4 instead of matching the full string 44. This patch introduces a smarter search strategy: 1. First attempt full string matching for exact file names 2. If full match fails and user is typing repeating characters, fall back to rapid navigation using either: - Last successful search string (for extended searches like 444 -> 4444) - First character only (original rapid navigation behavior) The changes include: - Modified changeCurrentItem signal to include a found parameter for search result feedback - Added m_lastSuccessfulSearch to track successful searches for better fallback behavior - Used Qt::DirectConnection to ensure synchronous execution for immediate result feedback This provides better user experience when searching for files with repeated characters while maintaining the rapid navigation feature for quick browsing. BUG: 501851
2025-06-20New selection effectsAkseli Lahtinen
This adds a new selection effect that is similar to what we have in QtQuick file item views. There are also changes to some usability: Instead of only the icon and text being the clickable area in icon and details mode, the whole selection is now the clickable area. Otherwise the usability should stay the same, it's mostly a visual change. See also: https://invent.kde.org/teams/vdg/issues/-/issues/94
2025-05-09DolphinView: Remove -1 interval, add setAutoActivationEnabledAkseli Lahtinen
In future Qt versions, Qt Timers do not allow negative intervals. Instead, they will be changed to 1. Related Qt commit: https://github.com/qt/qtbase/commit/f1f610bc67bfd5c2ef31270a6945e7bae93b5e4a Instead of relying on the interval, use a boolean variable to check if the autoactivation is enabled or not.
2025-02-22kitemlistkeyboardsearchmanager: smarter search start positionYifan Zhu
Search from the next position for new search and special repeated key search. Otherwise search from the current position, which is current selected item if something is selected or in selection mode, and 0 (the beginning) otherwise. Test plan: - create directory with files ab1, ab2, and ab3 - click ab2, and press escape to deselect - type ab; verify that ab1 is selected - wait a while, type ab again, verify that ab2 is selected - wait a while, type ab again, verify that ab3 is selected - click ab1, type ab, verify that ab2 is selected BUG: 422951
2024-12-29Mirror details view mode for right-to-left languagesFelix Ernst
This commit implements mirroring of the details view mode for right-to- left languages. This is the last of the Dolphin view modes which did not adapt to right-to-left languages correctly. Implementation-wise this is mostly about adapting the math so all the information is placed correctly no matter the view mode or layout direction. While most of the view actually changes the painting code for right-to-left languages, for the column header I decided to keep the logic left-to-right and instead reverse the order of the role columns. To implement this mirroring I needed to rework quite a bit of logic, so I used the opportunity to fix some bugs/behaviur quirks: - Left and right padding is now saved and restored separately instead of only saving the left padding - Changing the right padding no longer disables "automatic column resizing". - The grip handles for column resizing can now be grabbed when near the grip handle instead of only allowing grabbing when slightly to the left of the grip. - Role column headers now only show a hover highlight effect when the mouse cursor is actually above that role and not above the grip handle or the padding. - There is now a soft-boarder when shrinking the right padding so shrinking the padding "below zero width" will no longer immediately clear automatic resize behaviour. So now it is possible to simply remove the right padding by resizing it to zero width. BUG: 449211 BUG: 495942 # Acknowledgement This work is part of a my project funded through the NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology.
2024-12-29Have special keyboard controls in selection modeFelix Ernst
Prior to this commit keyboard controls and behaviour of Dolphin's main view were identical no matter if selection mode was enabled or not. While selection mode makes it impossible to accidentally clear the selection by singular mouse clicks, any press of an arrow key on the keyboard would still clear the full selection which goes against selection mode's objective. Furthermore, keyboard-only users had no reason to ever enable selection mode because it made no difference to them. This commit changes this by offering a changed control scheme for key presses while in selection mode. Arrow key presses without modifier now only move focus between items but do no longer clear or change the selection. Similarly, Page Up/Down, Home, and End key presses only move keyboard focus. Enter, Return, and Space key presses now only toggle the selection for the current item. The above controls are however mostly unchanged when combining them with Modifier keys like Shift or Control. The type-ahead feature is also changed in selection mode to only move keyboard focus without changing the selection. This way keyboard users are less likely to clear their selection by mistake. Regression tests are added for these selection mode controls. The code changes to change this keyboard behaviour are quite minimal. Most of the added code is for making selection mode accessible. That's because we need to make sure the changed control scheme is properly announced and communicated or a blind user will be left utterly confused why the normal keyboard controls "stopped working". Enabling or disabling selection mode is announced to accessibility software. Furthermore whenever focus goes to the main view, the selection mode state is also mentioned when active. BUG: 458091
2024-12-05Adapt to Orca 47Felix Ernst
The screen reader Orca has seen some fundamental changes between Orca 46 and Orca 47. While they are improvements overall, they do require changes to Dolphin to preserve the intended user experience for Orca users. The biggest change is perhaps that Orca will now not only announce changes to the currently focused item, but also of its parent, which means we do not need to pass focus around between file items and the main view within Dolphin, but can keep focus on the file items most of the time. This commit implements this. The only exception of when we cannot have focus on the items within the main view is when the current location is empty or not loaded yet. Only then is the focus moved to the view itself and the placeholderMessage is announced. This commit worsens the UX for users of Orca 46 or older, so this should only be merged once most users are on Orca 47 or later.
2024-10-28Overhaul main view accessibilityFelix Ernst
This commit brings the main view of Dolphin into a usable state accessibility-wise. Users of screen readers should have a way better experience while browsing files and folders and navigating along the file system hierarchy. This commit fixes most of the remaining already-identified accessibility issues listed in https://invent.kde.org/teams/accessibility/collaboration/-/issues/28, but not all. Namely, these should now be fixed: 1. Orca should read the element type in dolphin (file, folder, device, link to folder, link to file) 2. Orca should read complete label in icon and compact view mode, currently it only speaks the name, but there could be additional information like the number of elements or the file size. 3. Orca is not able to announce Selecting / Unselecting files in Dolphin. It also never announces how many items are selected in total. (Announcing the total selection can be done by reading out the view element or by pressing the Tab key to get to the status bar with the relevant information.) 4. Dolphin opens on the home directory, but Orca doesn't tell you so. Consider enclosing the area in a frame/panel which updates its accessible name each time you modify the current path by entering or leaving a directory. 5. I don't know what the folder presentation widget is, but it should be presented as a grid view. Currently, we have a terrible experience because the entire row of folders is read at once, with no indication that we can move left and right with the arrows to go between the elements of a row. When I found that out, however, I discovered that when you're on the last icon of the first row and press right arrow, you get to the first icon of the next row, but that's not announced, instead, the whole row is announced at once 6. Orca should announce the current elements instead of "layered pane" when the Folder / File view gets the focus in dolphin 7. Orca reads only name in Table View only of Dolphin 8. Items are sometimes confusingly announced as "collapsed" in contexts in which there is no concept of collapsing/expanding e.g. in icon view mode. A lot of code was moved around and renamed. The three accessibility classes, which all used to be in the same file, are moved into separate files. *Acknowledgement* Thanks to Christian Hempfling and bgt lover for testing as well as originally identifying a lot of the pain points being addressed here. This work is part of a my project funded through the NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology. https://kde.org/announcements/2024_ngi_openletter/
2024-10-17kitemlistcontroller: process forward/back buttons when double-clickingWolfgang Müller
Tapping the forward or back mouse buttons quickly enough makes Dolphin interpret the action as a double-click of the button in question and handle it in mouseDoubleClickEvent() instead of its normal button handler. This means that certain button presses might seem delayed or "swallowed" when quickly navigating forwards or backwards through the history. Since a double-click of the forward or back button is currently meaningless, fix this by emitting a normal mouseButtonPressed event for those buttons in the double-click handler and skipping any further event processing. Co-authored-by: Felix Ernst <[email protected]> CCBUG: 485295
2024-07-31Kitemlistcontroller: only accept doubleclick for left mouse buttonMéven Car
Add test for double-click activation. BUG: 485295
2024-05-18Avoid implicitly selecting itemsFelix Ernst
Items should only be selected if the user wants to act on them. However, previous to this commit we sometimes selected items even when there is no reason to assume that the user would like to act on them. Such selections are dangerous because they make it more likely that the user manipulates items by accident which they never even explicitly selected. Example: The "Up" action is used to navigate to the parent folder. This will implicitly select the folder one emerged from after opening the parent folder, so just one accidental press of the Delete key will lead to data loss if the press goes unnoticed. This scenario would have been avoided if no folder had been selected automatically. The above example becomes even more dangerous if the user is acting with elevated privileges. The following implicit selections of items are being removed: - Selecting items that are being activated - Selecting folders one emerges from Even though these items will no longer be selected after these actions, they will still be marked as current. The only downside I see is that our indication of which item is "current" is a lot weaker than the selection highlight, so it might be more difficult to spot which folder one has emerged from. However, this could be counter-acted with some other temporary indication if this really turns out to be a problem. The only downside I see is that our indication of which item is "current" is a lot weaker than the selection highlight, so it might be more difficult to spot which folder one has emerged from. However, this could be counter-acted with some other temporary indication if this really turns out to be a problem. BUG: 424723
2024-05-08view: Add setting to trigger user set action with double clickGeorge Florea Bănuș
Default action is select-all.
2024-04-05KItemListController: don't create rubber band for a right click in an empty ↵Amol Godbole
region Rubber band was being incorrectly created for a right click in an empty region. Handle this case in KItemListController::onPress(). BUG: 484881
2024-04-04kitemlist: don't open dir when double-click on expand arrowMéven Car
BUG: 484688
2024-03-27Better support for RTLEugene Popov
This MR fixes some issues related to RTL scripts: - wrong layout in Compact View mode - broken horizontal scrolling in Icon View and Details View modes - broken navigation with left and right arrow keys in Details View mode BUG: 484012 BUG: 449493
2024-03-25Fix right-mouse click crashes on WindowsJulius Künzel
2024-03-09KItemListController::onPress: remove unused screenPos argumentMéven Car
NO_CHANGELOG
2024-03-08Start autoActivationTimer only if hovering over a directoryAkseli Lahtinen
Before starting autoActivationTimer, check that we're hovering the item on top of a directory. If we don't check for it, the the autoActivationTimer will try to open the hovered item in it's default application, which can be distracting and break the actual action the user was trying to do, like moving the file to a directory. BUG:479960
2024-02-23Add drag-open animationFelix Ernst
This commit adds an animation for folders that makes clear that they will open or expand soon. This is the case when the option to open folders during drag operations is enabled and a user drags an item on top of a folder. The animation goes like this: - Replace the folder's icon with the "folder-open" icon - Go back to the folder's original icon - Replace the folder's icon with the "folder-open" icon once more
2024-01-30Improve arrow key navigation for right-to-left languagesFelix Ernst
While using right-to-left languages most of Dolphin is mirrored. However, the logic of what happens when the arrow keys are pressed to move between items in the main view was never adapted to account for that. Basically nothing works as expected because of this. It's more like dealing with a psychopath who misinterprets every command you give: Left is right, right is left, up is most of the time right but sometimes not, down is most the time left but sometimes not. This commit fixes and adapts the logic if a right-to-left layout is used. This fully fixes icon view mode and improves compact view mode, though compact view mode still has more issues which aren't addressed here. This work for the benefit of the minority that use right-to-left languages both in Europe and the world is sponsored by NLnet and the European Commission which I think is beautfiul. BUG: 453933
2023-11-18Make main view react to context menu eventsFelix Ernst
Before this commit, Dolphin's main view would not react to any context menu events. It only showed context menus based on hard-coded mouse or keyboard events i.e. mouse right-click and presses of the "Menu" key. This commit removes those hard-coded reactions and instead makes it so the view shows a context menu whenever a QContextMenuEvent is received. Therefore, a context menu will now be opened when any platform- or system-specific context menu triggers are invoked e.g. the Shift+F10 keyboard shortcut. Aside from this, the only side-effect is a partial removal of an unrelated bug: Previously, the hover highlight on items was never cleared when the header column in details view mode was hovered. With this commit, the hover is now correctly cleared most of the time.
2023-10-23Fix rubberband selection on icon in icon view modeFelix Ernst
As an unintended side-effect of d9a18b04ea0b1b4e427f45083fdc0cdec87cbbfd items would no longer be selected in icon view mode when the selection rectangle intersected with the item's icon. This commit fixes this.
2023-10-17KItemListView: add view position in scrollToItem()Amol Godbole
An item, on being scrolled to, is always located at the nearest edge of the view. This is not always convenient. Allow specifying where the item should be positioned with respect to the view in scrollToItem(). BUG: 423884
2023-09-23selection: fix rubberband verticesMarco Savelli
2023-09-23selection: select-on-rubberband-on-row as new defaultMarco Savelli
Sets a rectangular, non-full-width rubberband as the new default. User selection is made wherever the rubberband intersects with the row.
2023-08-01Enter selection mode by tap-and-holding an already selected itemSteffen Hartleib
Allow entering selection mode by touching an already selected item. BUG: 462778
2023-07-27Avoid unwanted drag and drop actionSteffen Hartleib
Use the screen position for a touch event to calculate the start drag distance. BUG: 464594
2023-07-05Add explicit moc includes to sources for moc-covered headersFriedrich W. H. Kossebau
* speeds up incremental builds as changes to a header will not always need the full mocs_compilation.cpp for all the target's headers rebuild, while having a moc file sourced into a source file only adds minor extra costs, due to small own code and the used headers usually already covered by the source file, being for the same class/struct * seems to not slow down clean builds, due to empty mocs_compilation.cpp resulting in those quickly processed, while the minor extra cost of the sourced moc files does not outweigh that in summary. Measured times actually improved by some percent points. (ideally CMake would just skip empty mocs_compilation.cpp & its object file one day) * enables compiler to see all methods of a class in same compilation unit to do some sanity checks * potentially more inlining in general, due to more in the compilation unit * allows to keep using more forward declarations in the header, as with the moc code being sourced into the cpp file there definitions can be ensured and often are already for the needs of the normal class methods
2023-05-26Expand or collapse all selected folders on Key Right/LeftMéven Car
CCBUG: 196772
2023-04-25Fix activating the Selection Mode with a keyboard shortcutEugene Popov
If a spacebar is used as a keyboard shortcut to activate the Selection Mode, then allow this shortcut to be triggered only if the view has a keyboard focus. BUG: 465489
2023-03-16Prevent dragging on non-writable directoriesMéven Car
KFileItemModel::supportsDroppin now returns the rootItem when -1 is passed and checks for write access.
2023-02-05Add clang-format and format code as in FrameworksSerg Podtynnyi
2023-01-11Make space shortcut for selection mode view-local instead of globalFelix Ernst
Before this commit, the "Space" keyboard shortcut was bound to triggering selection mode by default. After this commit, pressing "Space" will only trigger selection mode when the file view area has keyboard focus. Pros: + Other buttons in the UI can be triggered with Space once again just like it is expected from an accessibility point of view. + "Type-ahead" searching works once more when typing the space char for file names containing such a space char. Cons: - "Space" can no longer be used to add the currently underlined item to the selection. Instead "Ctrl+Space" needs to be used. (However, this is the current status anyway unless a user has manually unbound "Space" as a shortcut from Selection Mode.) - The Selection Mode action will no longer show "Space" as its shortcut in menus. Overall, I see solutions to all of these problems, but they seem over-engineered for the issues they are trying to solve, so I believe this somewhat small commit is the best solution for now. BUG: 458282 BUG: 458281 CCBUG: 463048 FIXED-IN: 23.04
2022-10-08Replace context menu on long press with selection modeMarco Martin
on long touch (and not on mouse press) don't pop up the context menu anymore but enter selection mode, similar behavior to mobile applications. the full context menu is still available from the actions toolbar appearing in selection mode
2022-09-26Remove unused includesLaurent Montel
2022-08-27This commit removes the ability to enter selection mode byFelix Ernst
click-and-holding with a pointing device like a mouse. This functionality was originally implemented because it seemed useful to save users the effort of entering selection mode explicitly by using its corresponding action. However, click-and-holding to trigger anything is not really an expected behaviour. (This contrasts with touch devices where press-and-holding is common to trigger something.) Aside from the above reasoning, the click-and-hold behaviour was also buggy so that selection mode was entered in a couple of situations that weren't strictly about click-and-holding. So this commit removes the functionality and the bugs. BUG: 457973 BUG: 458129 CCBUG: 457975
2022-08-14Simplify implementation of mouse long-press detectionFelix Ernst
Now uses the same method as for touch long-press detection.
2022-08-14Address Nate's UX feedback: Episode 2Felix Ernst
- Make Esc leave selection mode and have it only clear selection when already outside selection mode. - Let translators know that the "More" overflow button should only have a short text on it. - Fix a crash that happened when any code tried to exit selection mode even though selection mode had never been enabled to begin with.
2022-08-14Make touch tap to select items work in selection modeFelix Ernst
Thanks to Steffen Hartleib for the help.
2022-08-14Improve naming consistency and leave mode on EscapeFelix Ernst
2022-08-14Keep working towards a reviewable stateFelix Ernst
- Various code improvements - Smoother animations - The bottom bar in General Mode only becomes visible if items are currently selected - Removed the selection mode action from the default toolbar since it can already be toggled in various ways - More documentation - Some cleaning
2022-08-14Add Selection ModeFelix Ernst
The selection mode action is a checkable toggle action named "Select Files and Folders" which has "Space" as the default shortcut. In selection mode a bottom bar with contextual actions is shown. These should mostly mirror the actions which are available through the right-click context menu aka DolphinContextMenu. Resizing of the window might make a overflow button appear in the bottom selection mode bar. This commit makes press and hold in the view activate selection mode. This behaviour is not triggered if the press and hold is used to either start a rubberband selection or a drag operation within a short time. The length of the short timeframe is defined by a QStyleHint. This is currently not implemented in touch because I can't test it. Mix the selection mode bars' background colors using a nice combination of colors from the current color scheme BUG: 427202
2022-07-11portalize drag urlsHarald Sitter
this enables sandboxed application to receive drop events
2022-06-16Don't consider drops on a row as drops on the row's itemFelix Ernst
Since d3839617193e92463806580699caa595c892b8a6 in details view mode clicking anywhere within the row is considered a click on the item. That commit also changed it so that dropping files anywhere inside a row would make it so the files are received by the folder of that row. This commit reverts the drop behaviour to be identical to the old one. I am having trouble explaining why this is better because one can look at it in different ways. Bottom line is that one doesn't really feel like one is dropping files inside a folder unless the mouse cursor is actually directly above a folder's icon or name. Another argument is that it is normal behaviour to just throw files onto an application and the files then being opened by it. Having potentially large parts of the view area covered by the rows of folders means that there has to be more of a conscious effort to not drop the files inside one of the folders by accident while with this commit one has to aim precisely onto a folder to do it intentionally. CCBUG: 453700
2022-05-27Remove hover highlight before opening view context menuFelix Ernst
If one was fast to open the right-click context menu on the row of an item in details view mode, the hover highlight would persist while the context menu for the view was open. This one-liner makes it so the highlight on the row is always removed before the right-click context menu for the view is opened so it is as clear as possible that the newly opened context menu has no relation to the fileItem.
2022-05-27Fix paste on row while in details view modeFelix Ernst
Before this change, right-clicking the row of an unselected item in details view mode would be in a weird state: - It didn't really count as a click on the item because the item didn't get selected by this click before opening the context menu. - It didn't really count as a click on the view background either because the actions that showed up depended on the item in that row. This commit fixes this by considering a right-click in the same row as an unselected item as a click on the view background. The behaviour of right-clicking the icon or name of a file directly is unchanged. This fixes the following bugs: - The Paste action that shows up when right-clicking in the unselected row of a folder now works (instead of doing nothing). It now pastes the clipboard contents onto the view background. - When right-clicking the unselected row of a file (not a folder) a Paste action once again shows up.
2022-04-20Don't deselect on Ctrl+Right-ClickFelix Ernst
(Part of my work towards !273) Currently, when items are selected and a user right-clicks a selected item while having the Ctrl key pressed down, the item is first deselected and then a context menu is opened that doesn't involve the item that was just deselected. This is slightly confusing because normally one right-clicks an item to see its context menu. Right-click being able to deselect an item seems like unintended functionality in the first place but in this scenario it also means that the intended opening of a context menu for the pressed item doesn't even happen. There is a good chance that nobody is even aware of this behaviour because the normal way to deselect an item would be to Ctrl+Left-Click if anything. Why would someone choose to open a context menu and deselect items in a single step? Why would they have selected an item they don't want to open a context menu for in the first place? Because of a discussion in this merge request deselecting on Ctrl+Middle-Click was also removed for consistency with Ctrl+Right-Click and Ctrl+Shift+Middle-Click. This commit also makes a later implementation of a selection mode more straightforward.