┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.cpp
AgeCommit message (Collapse)Author
2025-10-03DolphinViewContainer, DolphinView: Fix incorrect view activation when ↵Wendi Gan
renaming folder Issue: In a split-view tab, if a folder is opened in the left view and its parent folder is opened in the right view, renaming the folder from the right view activates the left view. Reason: When renaming the folder, the emitted `DolphinView::urlChanged` will invoke `KUrlNavigator::setLocationUrl()`, which finally calls `DolphinViewContainer::setActive()` and activates the left view. Change: - Temporarily disconnect the `DolphinUrlNavigator::activated` signal to avoid activation of `DolphinViewContainer`. - Force inactivate `DolphinUrlNavigator`.
2025-10-03DolphinTabPage, DolphinView: Fix duplicate folder for MTP deviceWendi Gan
Issue: When opening an MTP device via the sidebar, Dolphin shows one "Internal shared storage" folder. However, clicking the entry again results in a duplicate folder being displayed. This regression was introduced by !865 (commit 6c7c047). Reason: The URL of an MTP device in the sidebar is `mtp:udi=/org/kde/solid/udev/sys/devices/...`. When clicking to open the MTP device, it is redirected to `mtp:/...`. - On the first click (no cache), `KCoreDirListerCache::slotUpdateResult()` calls `KCoreDirListerPrivate::emitItems()`. - On the second click (with cache), `KCoreDirListerCache::slotRedirection()` first calls `KCoreDirListerPrivate::emitItems()`. Besides, `DolphinTabPage::slotViewUrlRedirection()` calls `KCoreDirLister::openUrl()`, which triggers `CachedItemsJob::start()`, and eventually calls `KCoreDirListerPrivate::emitItems()` again. As a result, two `KCoreDirLister::itemsAdded` signals are emitted, causing `m_pendingItemsToInsert` to be appended twice. --- BUG 496414: Need to rename folder twice to make it reflect in the tab title. Reason: `m_url` is updated after emitting the `DolphinView::redirection` signal. It triggers `DolphinTabWidget::tabUrlChanged()`, which still uses the old URL and thus resets the tab title incorrectly. --- Change: - Revert the change in `DolphinTabPage::slotViewUrlRedirection()`. - Update `m_url` before `DolphinView::redirection` to fix BUG 496414. - Emit `DolphinView::urlChanged` signal to refresh the navigator of the inactive view. BUG: 506634 CCBUG: 497313 CCBUG: 496414
2025-09-21dolphinview: position the focus after the last removed fileMéven Car
Previously, the code could misposition the selection after removal if the last file in the view was removed and several files were selected. And since it didn't clear the selection, the previous selection influence the selection. Instead clear the selection and position only the focus, either on the next item after the last index, or the last item still in the view if the last item was removed. BUG: 504490
2025-09-11dolphinview: add preferred sort order for rolesNathan Williams
BUG: 425457 This commit ensures that both the menu and column headers in table view will have the same default sorting (ascending/descending) for each role. It also saves the user's preferences for each role throughout the session. Previously, sorting by "Modified" would always sort by "Oldest First." If the user then changed to "Newest First" and sorted again by "Name," files would be sorted in reverse alphabetical order (Z-A). Now, sorting by "Modified" defaults to "Newest First." If a user switches between multiple roles, the default for each role will be used unless the user changes to a non-default sort order. In that case, the user's preference will be applied. Defaults: **Descending Order:** Time-based roles - modificationtime - creationtime - accesstime - deletiontime - imageDateTime - releaseYear Size/dimension roles - size - width - height - pageCount - wordCount - lineCount Quality/Quantity roles - rating - duration - bitrate - frameRate **Ascending order:** - Text based roles (A-Z) - All other roles
2025-08-26Warn when renaming a file would change its file typeKai Uwe Broulik
While the file's content won't change, applications may no longer recognize it.
2025-08-19dolphinview: use QString::slice with Qt > 6.8Luc Schrijvers
QString::slice is preferable when available, as it does not allocate. Amends db92361e10f356ed0d1bf2dc7ea3453086ce876c
2025-08-17Fix Qt < 6.8 errorLuc Schrijvers
2025-07-02DolphinView: display errorMessage when copy errors occursMéven Car
when copying multiple files. CopyJob skip those by default (CopyJobPrivate::slotSubError), and emits warning. Hook this to errorMessage. We would need to improve this as only the last error Message will be visible. BUG: 506282
2025-07-02DolphinView: display errorMessage when copy errors occursMéven Car
when copying multiple files. CopyJob skip those by default (CopyJobPrivate::slotSubError), and emits warning. Hook this to errorMessage. We would need to improve this as only the last error Message will be visible. BUG: 506282
2025-06-29DolphinView: use correct slot as trashjob resultsMéven Car
When using the Delete action.
2025-05-28dolphinview: Add a dynamic view optionVictor Blanchard
Added a 'dynamic view' option, which allows to switch from a 'compact' or 'details' view to an 'icons' view if most of the files in the directory are images or videos. It reverts to the previous view mode when we switch to a directory which doesn't meet that criteria. The view mode is only changed once so users don't have to undo that for specific folders when they don't want icon view. A setting is added in the "Display style" section of the general view setting page. BUG: 491139
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-05-02dolphinview: fix crashMéven Car
Correctly find the last element in the list instead of the one after the last Amends: 0464ea82a6850f58805bc4d6fc1df5369d83c3df BUG: 503610
2025-04-29Clazy fixMéven Car
2025-04-26DolphinView: Don't end anchored selection in updateSelectionStateAkseli Lahtinen
Do not end anchored selection when selection state is updated, such as when Dolphin is started with --select "thing.txt" flag. If we end here, and user wants to press shift to select from current item to X items, this would cause the anchored selection to start from the clicked item, not from the first selected item. BUG: 503221
2025-04-23DolphinView: If contextmenu is requested, abort twoClicksRenamingAkseli Lahtinen
When using single click to select, user can double click the file to start renaming it. If user at the same time also opens context menu, user can delete the file while the renaming prompt is open, which causes weirdness. This patch makes sure we abort the double click renaming when context menu is requested. BUG: 503185
2025-02-27dolphinview: Add widget parameter to elided QToolTip::showTextAkseli Lahtinen
Without this parameter the QToolTip can not always determine what is the parent, so it will create a toplevel window in those cases. Make sure we have dolphinview itself as a widget there, so QToolTip and thus QtWayland can resolve what is the parent. This avoids creating random windows when opening a tooltip. BUG:500009
2025-02-24Add smaller statusbar and set it as defaultAkseli Lahtinen
- Statusbar has three modes: Small, FullWidth and Disabled - FullWidth is the original statusbar - Small is the new default statusbar - This statusbar overlays on top of the items instead of taking space - It changes size according to content - Disabled turns statusbar completely off - Zoom slider and space information is only shown in full-width statusbar - Space information is now always on - If user navigates with keyboard, or scrolls to selection, the scrolling will take the statusbar into account - This makes sure the statusbar does not cover any items Related discussion: https://invent.kde.org/system/dolphin/-/issues/50
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-19dolphinview: Update thumbnail on filename changeAkseli Lahtinen
If filename of an item was updated previously, it would modify the model before the file was actually changed. This led to the model calling a signal that would try to run a previewjob, but since the filename is not actually changed yet on disk, it would fail. This patch moves the model updating after copyjob. Copyjob will take care of the file renaming if there is already existing file. We just need to update the model correctly after the job has succeeded. BUG:497555
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-11-25Switch to C++20Méven Car
2024-11-25DolphinView: fix typos in signal connectionMéven Car
NO_CHANGELOG
2024-11-21DolphinView: beginAnchoredSelection after setSelected in selectNextItemAkseli Lahtinen
Currently when next item is set selected, it's not set as an anchor. This means that shift-click will not select items between the selection and the next item, and instead behaves like ctrl-click. This is rather inconsistent behavior. We should set the next selected item as an anchor so that shift-click will work: This change starts the `beginAnchoredSelection` process after `setSelection`. For example, if user trashes an item and the next item is selected, shift-click would stop working. BUG:495371
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-27ViewProperties: Store view properties in extended file attributesMéven Car
Existing settings are converted. Works on most FS except FAT/exFAT which fallback to .directory files. If the extended file attributes (in ADS in Windows) can't be saved, they are saved to file as before. BUG: 322922 You can see file xattr using for instance for Unix filesystems: getfattr -d /home/meven
2024-10-12dolphinview: when rename dialog finishes, immediately update the model and ↵Jin Liu
the selection On sucessful return of the rename dialog, we update the model and the selection immediately to reflect the new name. This is to avoid the short duration after the rename during which the selection is lost. Currently, after the rename dialog finishes, the selection is briefly lost for about 1 second until the view automatically refreshes. This patch updates the model and selection immediately after the dialog finishes, so the renamed file is still selected. BUG: 481717
2024-10-12dolphinview: after inline renaming, immediately update the selectionJin Liu
Currently, the inline renaming updates the model and the list of selected files (m_selectedUrls) immediately after the user presses enter, but the selection in the view is not immediately updated. This results in the selection to be briefly lost for about 1 second until the view automatically refreshes. This patch updates the selection immediately after the user presses enter, so the renamed file is still selected. BUG: 481717
2024-10-11dolphinview: add error message when renaming failed in dialog modeJin Liu
BUG: 481561
2024-10-08DolphinViewContainer: Delay changing the urlAmol Godbole
KCoreDirLister::itemsDeleted() signal is being emitted twice for the same url. This results in Dolphin displaying an incorrect location. Delay changing the url instead of delaying DolphinView::currentDirectoryRemoved() so that the check for current directory being removed in KFileItemModel::slotItemsDeleted() occurs correctly, while still ensuring that KCoreDirLister is not prematurely modified. BUG: 492277, BUG: 473377
2024-08-19Fix middle-click not following the "Open archives as folder" settingJin Liu
Previous to this commit middle-clicking an archive would always open it in a new tab. This contradicts the recent change d27ee07de7558470ef7b497fbe3d3504ce7cad07 which made it so middle-click would open an item in the second application that is available to open a file. With this commit, middle-clicking will treat the archive like a folder only when GeneralSettings::browseThroughArchives is enabled or when there is no second application available. Otherwise middle-click will open the archive in the second available application.
2024-07-22Notify users if authorization is required to proceedFelix Ernst
Previous to this commit entering a folder without read access would show the non-descriptive error message "Could not enter folder". If the user actually is not allowed to view the contents of the folder, this is indeed true and this commit will preserve this message as is. However, if an admin protocol is installed, users can actually view the contents of most folders after authorizing themselves as administrators. So this commit changes the error message in those specific circumstances to instead read "Authorization required to enter this folder." and provide a button to authorize themselves. This button is the "Act as Administrator" action. If no admin protocol is installed, this commit has no effect. The idea for this change came from Harald Sitter. I receive funding for changes like this by the Next Generation Internet Initiative, which (as I understand it) will no longer provide funds for future projects like this if the current EU draft budget goes through as it is.
2024-05-08view: Add setting to trigger user set action with double clickGeorge Florea Bănuș
Default action is select-all.
2024-05-04DolphinView: Update selection on newly created item(s)Anthony Fieroni
Adjust paste to url to new KF6 signals BUG: 476670 Signed-off-by: Anthony Fieroni <[email protected]>
2024-04-09Fix saving sort role after change from headerFelix Ernst
This is a partial revert of 5186f09cabf0af4b0683e75b0bcde1061f84a67e. That commit tried to simplify code, however this lead to the saving of view properties being skipped, introducing the linked bug. The issue is that by the time the slotSortRoleChangedFromHeader() method is called, the model already changed its sort role. Therefore the check if the new role is identical to the old sort role fails and no saving would occur. With this partial revert the header will continue to change the sort role itself (which allows a minor optimization of not double sorting when also changing the sort order at the same time). The method slotSortRoleChangedFromHeader() is then only responsible for saving that change in the ViewProperties and telling the SortBy menu in the user interface that the sorting has changed. BUG: 480246
2024-01-16Fix: "empty folder" placeholder text eating mouse eventsJin Liu
BUG: 441070
2024-01-14Never emit the fileMiddleClickActivated signal if isTabsForFilesEnabled is trueStefano Crocco
Commit d27ee07d makes it impossible for applications embedding Dolphin part (for example, Konqueror) to react to middle mouse click on a file. If I understand correctly (I'm not familiar with Dolphin code) the `fileMiddleClickActivated` signal is connected with a slot in `DolphinViewContainer`, which is only used by Dolphin itself and not by `DolphinPart`. The result is that middle clicking on a file (except archives) from a Dolphin part has no effect. To avoid this situation, I removed the check for `!archiveProtocolIsEmpty()` in the `else if` condition. This way, if `isTabsForFilesEnabled()` is `true`, which should be true if and only if the view is inside a `DolphinPart`, the `activeTabRequested` or `tabRequested` signal will be emitted, allowing the embedding application to respond however it wants. When the view is inside the Dolphin application, instead, `isTabsForFilesEnabled()` will always be `false`, so the new behavior will be used.
2024-01-14DolphinView: Use SingleShot and Queued ConnectionsAmol Godbole
A minor refactor where Qt::SingleShotConnection has been utilized. Also, signal delay using QTimer has been replaced with a Qt::QueuedConnection.
2024-01-13Always automatically choose a new file name while duplicatingEugene Popov
Since now when duplicating items we automatically generate a name for the new item, we can do the same if an item with that name already exists. BUG: 475410
2024-01-06DolphinView: merge update functions into set functionsMéven Car
NO_CHANGELOG
2023-12-18DolphinView: Ensure to update the whole viewState after a job created filesMéven Car
BUG: 476670
2023-11-29Set style to nullptr before painting listviewAkseli Lahtinen
Resolves any possible dangling pointers if application style is changed after toggling the selection mode BUG:477288
2023-11-21dolphinview: Fix right-click on header whilst unfocusedOliver Beard
When the window is unfocused, there's no activeWindow and right-clicking on the header causes the menu to appear with window decorations.
2023-11-21dolphinview: Change case of status bar textOliver Beard
We should use lower case for this text, matching other strings (properties dialog, information panel).
2023-10-24Merge branch 'master' into kf6Nicolas Fella
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-10-12DolphinView: get rid of writeStateChanged signal in setActive()Amol Godbole
The signal writeStateChanged() was not working because it is not connected to slotWriteStateChanged() slots when the active view changes. Replace the signal with direct calls to the slots. Also, do not delay openRequest signal in DolphinSearchBox::slotSearchTextChanged. It's no longer required. BUG: 440366
2023-10-05Merge branch 'master' into kf6Nate Graham
2023-10-05Fix accessibility ancestor treeFelix Ernst
Before this commit, KItemListViewAccessible would always return nullptr as its parent. This meant that accessibility software would have to guess to which window/hierarchy the KItemListView belongs to. Guessing shouldn't be necessary here. This commit makes sure that the KItemListView always returns a sensible parent in the accessible hierarchy. It does so by explicitly setting the accessible parent for every KItemListView after construction in the DolphinView contructor. Since KItemListView now always knows about its accessible parent, the accessibleInterfaceFactory can always ask the KItemListView for that information when constructing the QAccessibleInterfaces. Fixes https://invent.kde.org/system/dolphin/-/issues/47.