┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewcontainer.cpp
AgeCommit message (Collapse)Author
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
2023-09-04Restore the URL when DolphinSearchBox is clearedAmol Godbole
Currently, the URL navigator is not updated when the search box is cleared. This MR restores the URL, by closing and reopening the box. The call for emitting closeRequest() on pressing Esc has been replaced with emitCloseRequest(). The wait duration before starting a search has been reduced to 500ms to increase responsiveness. Also, the bugfix for BUG: 423328 is slightly incorrect and causes the search term to not be displayed when opening a saved search for the first time. As a better solution for this bug, DolphinSearchBox::setText() now updates the text only if the text has changed. BUG: 473775
2023-08-28Clean obsolete ifdefs since dolphin requires KF 5.101+Méven Car
2023-08-24Special case file opening with middle click for executable scriptsMéven Car
Since the first action would launch the script, we can use the first application associated to open the file.
2023-08-23On middle-click, open file with the second application for the file mimeMéven Car
FEATURE: 390631
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-06-29Use ellipsis everywhere instead of three dotsTem PQD
Better for screen readers etc.
2023-06-28Move focus from hiding selection mode bars to viewFelix Ernst
When a user exits selection mode for example by clicking the "Exit Selection Mode" button, the bar is closed but the focus doesn't return to the view which would be expected. This commit actively moves the focus to the view in such a scenario. BUG: 469621
2023-06-13Settings Add ViewModes > Content displayMéven Car
This does not move the settings location in files though. baby step for https://invent.kde.org/system/dolphin/-/issues/36
2023-02-25Save a in-thread stat call each time the context menu is displayedMéven Car
2023-02-05Add clang-format and format code as in FrameworksSerg Podtynnyi
2023-01-25Clear filter bar on clicking current folder in placesSerg Podtynnyi
Reset the filter bar when user clicks on the current folder in places list, also rename slot function to be more clear. BUG: 259382
2022-11-29Exit the deleted directory when it is removedMéven Car
If current directory is a local file, try to find nearest dir ancestor and open it. Display warning to the user.
2022-10-11Remove unused includesLaurent Montel
2022-10-11port to KIO::createDefaultJobUiDelegateLaurent Montel
2022-09-26Add missing include (needed for building qt6)Laurent Montel
2022-09-26Remove unused includesLaurent Montel