┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewcontainer.cpp
AgeCommit message (Collapse)Author
2026-01-22clang-tidy: avoid copy, use const referencesMéven Car
2026-01-22clang-tidy: use default for trivial constructorMéven Car
2026-01-14On Middle-click, allow to open scripts with the second appMéven Car
When holding shift when middle-clicking. Amends: a25f2cc67cbab7f001c883931a433f1841223a87 CCBUG: 496687
2026-01-10Use Q_ASSERT instead of Q_CHECK_PTR for plain checks of pointer valueFriedrich W. H. Kossebau
Q_CHECK_PTR (other than the name suggests) is intended only to check the success of memory allocations. Using it for any pointers instead can be misleading due to the "Out of memory" log printed in case of hits.
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-04dolphinview: On shift+middle-click, open file with third app for the open ↵Tomasz Kot
with list Added the feature to open the selected file with the third application from the associated applications list on shift and middle-click. Generalized the middle-click slot to open the file with the app on a specified index, since the behavior should be almost the same for those two actions. Similar to: d27ee07de7558470ef7b497fbe3d3504ce7cad07 BUG: 510237
2025-10-30GeneralViewSettingsPage: Improve the wording "Browse archives as folders"yu shuoqi
Replace the wording "Open archives as folder" to the wording "Browse archives as folders". BUG: 499782
2025-10-22dolphinviewcontainer: in middle-click file opening use targetUrlMéven Car
as file url to open, as does `slotItemActivated`. Allows to open files using the middle click, with protocols using `UDS_TARGET_URL` such as recentlyused://.
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-09-23GIT_SILENT: Don't duplicate headers between .h/.cppLaurent Montel
2025-08-18Use KFileItem::isExecutable() instead of creating a QFileInfoKai Uwe Broulik
KFileItem can give us this information since 6.0, no need to create a QFileInfo and stat'ing the file again.
2025-07-30Disable "Create folder" action if the location is not writableGleb Kasachou
Instead of hiding the action when the user lacks permission to create the folder, it is now shown in a disabled state. The tooltip is also updated to reflect the disabled state.
2025-07-30Apply 2 suggestion(s) to 1 file(s)Gleb Kasachou
Co-authored-by: Méven Car <[email protected]>
2025-07-30Add a check before offering to create folderGleb Kasachou
This commit adds a function that checks if a folder can be created at the url entered in the location bar. This prevents offering to create folders in locations where the user does not have write permissions.
2025-07-30Apply 2 suggestion(s) to 1 file(s)Gleb Kasachou
Co-authored-by: Méven Car <[email protected]>
2025-07-30Offer to mkpath when user goes to a nonexistent folderGleb Kasachou
This commit changes Dolphin's behavior when a nonexistent local path is entered into the location bar. Previously, an error message would pop up. This commit adds a button to that message that allows to create the path and navigate to it.
2025-04-24DolphinStatusBar: Fix premature text squeezingAkseli Lahtinen
The text would get squeezed and elided prematurely due to some clipping calculations and paddings created for the clipping. This slightly modifies the clipping code, that we extend the painted area and then clip off the excess, instead of moving the area to specific place and then clipping off the excess. This also makes sure the text width accounts for one extra character plus the clippings we do, so that text will always fit the statusbar. BUG: 503164
2025-04-19Add Filelight menu to Tools menuFelix Ernst
The menu for installing and launching Filelight was only available through the status bar free space info button until now. By default we do no longer show the free space info button because the status bar has been changed to show less information by default. This commit adds the "Manage Disk Space Usage" menu to the "Tools" menu in the menu bar so it is more discoverable for users.
2025-04-07Rewrite search integrationFelix Ernst
This huge commit is a nearly complete rewrite of the Dolphin search code. It implements most of the improved Dolphin search UI/UX as designed and discussed in a collaborative effort by Kristen McWilliam, Jin Liu, Andy Betts, Tagwerk, a few others and me. See https://invent.kde.org/system/dolphin/-/issues/46. # Notable changes - A toggle to change the search tool is provided as most contributors deemed that useful in https://invent.kde.org/system/dolphin/-/merge_requests/642#note_985112. - The default search is changed to filenamesearch for maximum reliability. - Removing all search parameters will take users back to the view state prior to starting a search instead of keeping the search results open. - The UI for choosing file types or modification dates has been made more powerful with more granularity and more options. - Most search parameters can be configured from a popup menu which gives us extra space for extra clarity. - Labels and help buttons as well as hyperlinks to settings makes sure the user always knows why some search parameters are unavailable in some contexts. - Chips show important search parameters while the popup is closed. They allow quickly removing filters. - The titles of the search and the input field placeholder message change to make clear whether file names or file contents are searched. - When the user actively switches the search tool, whether content should be searched, or whether to search everywhere, this is preserved for the initial state of the search bar when the user opens it the next time after restarting Dolphin. # Architecture - The new DolphinQuery class is independent of the UI and contains all search parameters modifiable in Dolphin as easy setters and getters. - DolphinQuery objects are also used to update the states of every component in the search UI. There is now a clear separation of UI and search configuration/DolphinQuery. - DolphinQuery is responsible for exporting to and importing from search URLs. - The search UI always reflects the currently configured DolphinQuery no matter if the user changed the UI to change the DolphinQuery or loaded a DolphinQuery/older search URL which then is reflected in the UI. - I tried to simplify all classes and their interaction between each other as much as possible. - I added some tests BUG: 386754 CCBUG: 435119 CCBUG: 458761 BUG: 446387 BUG: 470136 CCBUG: 471556 CCBUG: 475439 CCBUG: 477969 BUG: 480001 BUG: 483578 BUG: 488047 BUG: 488845 BUG: 500103 FIXED-IN: 25.08
2025-02-28Fix crash when opening new tab with searchAkseli Lahtinen
When new tab is opened and it has a search started, it tries to set the location URL to a navigator that is not yet necessarily assigned in memory: This is because the new tab is not active. The locationUrl will be changed properly when tab is activated. BUG:500101
2025-02-27statusbar: fix offset for selectionModeBottomBarAkseli Lahtinen
If selectionMode was running, statusbar would get hidden behind the selectionmode bottom bar. Instead of calculating offsets, just check for the view geometry bottom position and use that for the statusbar yPos.
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-11-27DolphinViewContainer: setSearchPath value only if searchBox is activeAkseli Lahtinen
Fixes a crash when searchbox is not active and tab gets renamed. I forgot to add this to merge request https://invent.kde.org/system/dolphin/-/merge_requests/864 CCBUG:496387
2024-11-27DolphinViewContainer: set searchPath on redirect, check for connected ↵Akseli Lahtinen
urlNavigator This fixes a dolphin crash if tab with a search box open gets its path changed while its not active. This patch adds a guard for the m_urlNavigatorConnected->setLocation, and makes sure the searchPath is set to the correct folder. BUG:496387
2024-11-25Switch to C++20Méven Car
2024-10-31Make Escape move focus from location bar to viewFelix Ernst
Pressing Escape on the location bar while in breadcrumb mode has no effect at all. This commit changes this to instead move the focus to the active view. This is more logical because a user pressing escape while having focus on the location bar is no longer interested in interacting and changing the location in the location bar. They most likely want to act on the current location instead.
2024-10-08Accessibility: Fix message boxes not being announcedFelix Ernst
This commit moves the focus to the message of newly shown passive messages when accessibility software is used. Moving focus to an object generally means that it will be announced, so this makes sure that users of accessibility software know when they are being notified of a change.
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-09-19Ignore trailing slashes when comparing place URLsWolfgang Müller
There's two locations where place URLs are compared in Dolphin. One is in DolphinContextMenu::placeExists, which determines whether or not to show an "Add to Places" context menu entry. The other one is in DolphinViewContainer::caption, which provides the place name for use in the window title, if applicable. Neither of these functions correctly normalize the URL to account for trailing slashes. Whilst placeExists() does not even attempt it, caption() was changed in 681d8bb6c (Fix wrong window titles, 2019-09-15) to support this using a regular expression. However, caption() fails to escape the URL before incorporating it in the regular expression, leading to failed matches and errors like the following when browsing to directories that do not happen to make up a valid regular expression: QString(View)::contains(): called on an invalid QRegularExpression object (pattern is '\A(?:file:///home/foo/[Z-A]/?)\z') Instead of relying on complex and possibly brittle regular expressions, use KFilePlacesModel's closestItem() function to find the closest matching URL and then finally check whether the normalized URLs match exactly.
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-24DolphinViewContainer: Check "title" URL query if no path is givenKai Uwe Broulik
Makes it consistent with `KUrlNavigator` which checks a "title" query if no path is given, e.g. in baloosearch
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-07-13Stop acting as admin when the authorization expiresFelix Ernst
Previously, the authorization just silently expired without any visible change. The surprise only came when the user tried to do any action, which immediately would show a password prompt. We don't want users to randomly type passwords into password prompts unexpectedly showing up. This commit avoids that. With this change, the view container visibly de-escalates privileges and shows a message explaining what happened. A method was implemented in kio-admin to make this possible. See: https://commits.kde.org/kio-admin/a2da29289d12ef845e2c1da17ed04c59f1c47762 This commit also improves some logic around the responsibility of hiding bars and activating view containers. This is also part of my project funded by the European Commission.
2024-07-08Improve Filelight installation UXFelix Ernst
Before this commit pressing the free space button when Filelight is not installed would show a singular action called "Install Filelight to View Disk Usage Statistics…". Pressing this button would open the store page for Filelight. This is an okay user experience, but we can do better. This commit makes it so pressing the free space button when Filelight is not installed shows an attractive UI that makes clear that freeing up disk space can be accomplished nicely by installing Filelight. The "Install Filelight…" button on this UI is connected to PackageKit directly, so we do not need to show a separate store like Discover and instead trigger an installation right then and there. For this, the recently introduced DolphinPackageInstaller KJob is used. Installation progress is reported through the status bar similar to the progress reporting of slowly loading directories or searches. Installation failure or success is ultimately shown within Dolphin as a passive notification above the view. On Microsoft Windows or when PackageKit is not available, the install button will only open a store page for Filelight. CCBUG: 477739
2024-07-04avoid need for activities libChristoph Cullmann
use KRecentFilesAction like Kate and others to signal used files/dirs could later be used to plug-in a recently used menu, too, if ever wanted avoids that this dependency could be missed and the functionality is not there, too
2024-06-24DolphinViewContainer: Use KMessageWidget::MessageType instead of own typeFelix Ernst
This slightly simplifies code and allows showing KMessageWidget::Positive message boxes.
2024-06-20Prevent inconsistent status bar progress reporting statesFelix Ernst
Merge setting title and progress percent into one method. This makes sure that the method can be called from all over the place and will still always show a consistent state instead of partially showing the progress percent for one progress but the label for a different one. This is to enable various tasks reporting progress at the same time in a way that doesn't lead to a confusing mess for users. Usually multiple tasks do not show progress at the same time, but when it happens this commit should make sure that the user experience is at least bearable. Allow not having a "Stop" button next to the progress report for tasks that cannot be stopped.
2024-05-21Haiku build fixesSchrijvers Luc
Co-authored-by: Gerasim Troeglazov <[email protected]>
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-13UrlNavigator: show a "lock" icon after the breadcrumb for read-only dirJin Liu
2024-05-11Add "Act as Administrator" toggle actionFelix Ernst
This commit adds an "Act as Administrator" toggle action to the View menu if kio-admin is installed. The action allows switching between acting as an admin with root-access or not. This was already possible in Dolphin when kio-admin is installed by editing the location bar directly. However this is somewhat unintuitive and there are no warnings at all about the dangers of acting as an administrator. This commit adds a warning dialog when triggering the action. It is somewhat explicit about the risks because this is in fact very dangerous. Furthermore, while acting on a view with administrative privileges, a bar above the view shows up that contains a warning. The bar can be closed to stop acting with elevated privileges. The warning dialog can be disabled and re-enabled from the Dolphin settings but only if the action is even available. There is a lot more to be done to further improve this feature both security-wise as well as when it comes to usability. But considering that we are already encouraging users to use this feature without any warnings at all, I feel like now is a good time to merge this. This work is part of a 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. As such, please contact me if you plan on doing related work so what you are doing doesn't collide with work I am being funded to do.
2024-03-13Animate most of the barsFelix Ernst
When a bar is toggled visible this usually happens because the user might want to use its functionality now. However, if bars appear without animation or at a location the user is not currently looking at, they might not notice that they have appeared at all. An animation makes it more likely that the user notices the change and can then use the newly made visible component. Another reason for animations for showing or hiding of components is that it can be disorienting for users when panels or bars suddenly appear or disappear without animation. There is no visible movement then, so the user might not know what happened if they didn't concentrate or blink at that moment. The newly appearing or disappearing component might also displace other components which can make it difficult to find what one was just looking at. These bars animate now after this change: - Search panel - Filter bar - Status bar This is implemented by extracting the animation code from SelectionMode::TopBar into a new abstract base class AnimatedHeightWidget. This class is now also used in SelectionMode::BottomBar and the animating code there was removed. These bars are left in Dolphin that stay without animation: - Menu bar (Would probably need to be implemented in KXmlGui) - Tool bar (Would probably need to be implemented in KXmlGui) - Tab bar (Needs a different appraoch because it already inherits QTabBar and therefore can not inherit AnimatedHeightWidget)
2023-12-22Set viewFocus when DolphinViewContainer state is consistentAkseli Lahtinen
Read Felix' comment here: https://invent.kde.org/system/dolphin/-/merge_requests/679#note_835657 In short: > The above change moves the `m_view->setFocus()` towards a point in time in > which `DolphinViewContainer`'s selection mode state is consistent again. BUG:478724
2023-11-30Fix building with activities after the kactivities -> plasma-activities renameAntonio Rojas
2023-11-10Set position of KMessageWidgetCarl Schwan
To use a more frameless style
2023-11-08Adapt to KConfigGroup name officially being a QString typeFriedrich W. H. Kossebau
GIT_SILENT
2023-11-06Port away from ResourceInstanceNicolas Fella
The information reported here isn't used by anything Instead only report that the url was accessed, which is used for things
2023-10-23DolphinViewContainer: Use Auto*Warning*HandlingEnabledKai Uwe Broulik
Errors are put in a KMessageWidget by us in slotOpenUrlFinished. Fixes regression from 40cc5f665d.
2023-10-22Mention invalid protocol nameKai Uwe Broulik
Especially when clicking on an archive which redirects to a special KIO worker, it can be handy to see the actual protocol name.
2023-10-05DolphinViewContainer: Keep search box open when URL is changedAmol Godbole
The search box was being automatically closed whenever the URL is changed. Keep the search box open if no search text had been entered when the URL was changed. BUG: 474951