Alexander Lohnau [Mon, 16 Sep 2024 19:31:22 +0000 (21:31 +0200)]
Dolphinpart: Define KPart capabilities instead of deprecated ServiceTypes
By now, Konqueror uses the new mechanism introduced in
https://invent.kde.org/frameworks/kparts/-/merge_requests/86.
Thus, we can avoid using the deprecated SeviceTypes which are also
removed from the official KPluginMetaData API.
Wolfgang Müller [Thu, 19 Sep 2024 09:46:09 +0000 (11:46 +0200)]
Ignore trailing slashes when comparing place URLs
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.
dolphintrash.cpp: Update trash dir on device changes
Make sure we update the trash directory when storage devices are added/changed.
This ensures that whenever a mounted device, for example
USB stick is mounted/unmounted, the contents are properly
updated in the trash folder as well.
Otherwise the trash folder and USB stick trash folder will get
out of sync, making the trash folder behavior unpredictable.
Akseli Lahtinen [Fri, 30 Aug 2024 10:54:56 +0000 (10:54 +0000)]
settings: Fix the Use Current Location button
During the Dolphin settings revamp
(https://invent.kde.org/system/dolphin/-/commit/489b56b68bb29e81337e115c490eea4403001b71?)
this QUrl had been forgot to add back so that the
FoldersTabsSettingsPage knows what is the current url.
This change checks for the main window of dolphin, then gets
the URL of it whenever useCurrentLocation is called.
However, when this is used as KCM, the button is not
created, since there it doesn't make sense.
Carl Schwan [Tue, 27 Aug 2024 22:16:59 +0000 (00:16 +0200)]
Make settings tabbar expanding
Allow to use https://invent.kde.org/plasma/breeze/-/merge_requests/478
but even without the breeze MR, it look better and similar to what we do
with other settings page.
Jérôme Lécuyer [Wed, 21 Aug 2024 23:27:07 +0000 (01:27 +0200)]
Use QLocale to display localized time role group
Use QLocale to format the QDateTime displayed as the role/label of a group.
`QDateTime::toString` format the date and month names in English.
`QLocale::toString` returns them localized.
See the note about day and month names at https://doc.qt.io/qt-6/qdatetime.html#toString
Jin Liu [Mon, 19 Aug 2024 11:15:23 +0000 (11:15 +0000)]
Fix middle-click not following the "Open archives as folder" setting
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.
Felix Ernst [Sun, 18 Aug 2024 21:41:34 +0000 (21:41 +0000)]
Implement "Focus Places Panel"
This commit implements an action to move focus to the Places panel
analogous to "Focus Terminal Panel" functionality-wise.
The implementation of the "Focus Terminal Panel" and "Focus Places
Panel" actions is streamlined while improving their code quality.
The "Focus Terminal Panel" action is moved into the "Show Panels"
sub-menu because it makes more sense to be there considering that its
previous location (the "Tools" menu) is meant for external applications
and not for functionality internal to Dolphin.
This commit also makes it so the keyboard focus is moved to and from
the Places panel whenever it is toggled visible or invisible. This is
now consistent with the focus handling when the Terminal panel is shown
or hidden.
The "Focus Places Panel" is one of the actions which was wished for in
KDE's accessibility chat room because people relying on keyboard
controls might need to press the Tab key a lot to move from the view to
the Places panel.
Felix Ernst [Thu, 15 Aug 2024 20:46:39 +0000 (22:46 +0200)]
Make FoldersTabsSettingsPage fully usable for blind users
This commit fixes keyboard navigation for the "Folders & Tabs" page
in Dolphin's settings dialog. It also makes sure that the Orca
screen reader reads out sufficient information for every widget
that can get keyboard focus. These two groups of fixes together
should allow basic usage of this settings page for users relying
on keyboard controls and screen readers.
One weirdness prior to this commit was that for checkboxes with
a short group label in front and the full description behind
screen readers would only read out the label and skip the
explanation what the checkbox actually does. This commit fixes this
by explicitly setting the accessible text for the label. In
practice only reading out the explanation and skipping the label
seemed sufficient and is implemented here, but more specific text
could be provided using this mechanism if needed.
Felix Ernst [Thu, 15 Aug 2024 18:40:02 +0000 (20:40 +0200)]
ContextMenuSettingsPage: Stop forcing focus onto search field
Prior to this commit when switching between categories in Dolphin's
settings dialog by keyboard, the focus would suddenly switch away
from the category chooser when going over the "Context Menu"
category. This meant that one couldn't move to the Trash category
in a straightforward way but had to fight the focus change forced
by Dolphin.
This commit removes that forced focus change so the category can
now be changed by keyboard as expected.
Felix Ernst [Thu, 15 Aug 2024 17:56:39 +0000 (19:56 +0200)]
DolphinSettingsDialog: Move focus to Okay button last
This commit changes the Tab order in Dolphin's Configure dialog
so that the items which are visually at the end of the dialog are
also last in the keyboard focus order when cycling through the
interface using the Tab key.
Previously, the "Cancel", "Defaults", "Okay", and "Apply" buttons
received focus prior to the actual contents of the pages which
does not make sense from a workflow perspective.
This change should also make navigating this dialog easier when
relying on screen readers because reading those buttons out prior
to users even having a chance to change any setting did not make
any sense.
John Veness [Fri, 16 Aug 2024 07:35:27 +0000 (07:35 +0000)]
Fix display of filename ampersands in actions
If you added the "Actions for..." button to the toolbar, filenames that contain "&" would not appear correctly in that button. This MR fixes that, and also the button that appears when using "Delete" with selection mode.
Yifan Zhu [Fri, 9 Aug 2024 03:21:08 +0000 (20:21 -0700)]
KStandardItemListWidget: select by number of unicode chars
Previously during rename, the number of QChar is used for selection,
which might be different from number of unicode characters.
Test plan:
- create the file zz❤️❤️.txt
- rename the file
- verify that the first 4 characters are correctly selected, which
didn't work before the patch.
Felix Ernst [Mon, 22 Jul 2024 10:51:33 +0000 (10:51 +0000)]
Notify users if authorization is required to proceed
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.