Felix Ernst [Mon, 14 Oct 2024 12:44:47 +0000 (14:44 +0200)]
Fix double-click view background feature
c934e803647674b4692668f047b6ffa18121982a was meant to change the
double-click view background feature to only allow double-clicks
with the left mouse button. However, it mistakenly did the exact
opposite and allowed every double-click except ones with the left
mouse button to trigger the feature. This one-liner fixes this.
Jin Liu [Fri, 11 Oct 2024 08:21:14 +0000 (16:21 +0800)]
dolphinview: when rename dialog finishes, immediately update the model and 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.
Jin Liu [Fri, 11 Oct 2024 08:17:04 +0000 (16:17 +0800)]
dolphinview: after inline renaming, immediately update the selection
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.
Jin Liu [Fri, 11 Oct 2024 08:08:31 +0000 (16:08 +0800)]
KFileItemModel: fix `setData` in the renaming usage
The `setData` function is used by inline renaming to
update the `text` role (i.e. file name) in the model
before actually do the renaming.
However, the current implementation only updates `text`
and url in KFileItem in this case, leaving the `url` role
and the `m_items` cache untouched. This makes the cache
incoherent, so `index()` won't find the renamed item. It
also makes the `url` role incoherent with the `text` role.
This also fixes the problem mentioned in bug #481561
where when inline renaming fails, it still shows the new
name. (Because `m_model->index` fails to find the new name
and rename it back on job failure.)
Felix Ernst [Thu, 3 Oct 2024 09:18:59 +0000 (11:18 +0200)]
Accessibility: Fix message boxes not being announced
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.
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.
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.