When one instance of Dolphin activates another it passes a startupId (X11) / activation token (wayland) along.
On X11 this is passed using the DESKTOP_STARTUP_ID environment variable. The code tries to read that through KStartupInfo::startupId().
That doesn't work though, since Qt at startup reads the environment variable afterwards. However, it is nice enough to allow us to access
it through QX11Info::nextStartupId(). Use that to read the token in the first instance and pass it to the second instance like we do on Wayland
The user-facing impact of this is minimal since KStartupInfo::setNewStartupId internally falls back to KWindowSystem::forceActiveWindow when no
startupId is passed.
While building dolphin, a warning comes up about KStandardGuiItem::yes()
being deprecated, and that another action verb should be using instead.
This commit fixes the warning by replacing KStandardGuiItem::yes() with
a KGuiItem constructor in the file src/views/dolphinview.cpp.
The icon for the "Rename and Hide" button has also been changed from a
check mark (dialog-ok) to an eye with a cross (view-hidden) to make the
button look more unique and grab the attention of the user.
When the current view mode is different from the view mode for
which settings were changed in Dolphin's settings dialog, those
changes were sometimes not present when then changing the view
mode of a view to the view mode for which settings were changed.
This commit fixes this by always loading the settings for all view
modes in the DolphinItemListView even if the view is currently
using only one of those view modes.
This commit changes how the setting to switch between full row
highlight and the old way of only having the icons and names be
activatable in details mode is presented on the settings page.
Before this commit a singular checkbox is used that talks about
the highlight effect.
But the highlight effect isn't actually what users should be
interested in. They mostly care how much of the area can be used to
activate an item. To make this clear this commit uses radio buttons
instead that give a distinctive choice between activation areas.
When not using the full row highlight, the text of non-name columns
in details view mode was wrongly colored in a way that pretended
that the full row selection highlight was active.
When it isn't active we use the normal color that we generally use
when the additional information is not within the selection
highlight.
In d383961719 the details view mode
was changed in a way that made the full row of an item the click
target instead of only having the item's icon and text be the
representative clickable area of an item.
This commit makes this new behaviour optional through a setting
which can be changed in Dolphin's settings dialog.
The explanation for introducing yet another setting in this case is
as follows:
While the introduced change is an improvement for many typical
workflows, there are some workflows for which this new behaviour
is problematic. Quite prominently a usage of Dolphin that tries
to maximise information density is made worse by the change because
now side padding is necessary to click the view's background. While
the side padding is and was optional, disabling it made switching
the active view in split view mode more difficult among other
things. For a more complete discussion about the issues, please
check out the bug report(s) and the discussion in Dolphin's gitlab
issue with number 34.
Co-authored-by: Ivan Čukić <ivan.cukic@kde.org>
BUG: 453700
FIXED-IN: 22.12
This one liner changes the signal that is emitted when the
"Dismiss" button is pressed on the Paste bottom bar in selection
mode. Before this commit, the `leaveSelectionModeRequested()`
signal was used but it had no effect because technically the
selection mode isn't active anymore when the paste bar is shown.
Everything works as expected if instead
`barVisibilityChangeRequested()` is emitted.
The application launching Dolphin passes a token via the XDG_ACTIVATION_TOKEN environment variable
We need to pass that to the running instance so that it can use it to raise itself
This commit introduces the private getter
DolphinTabWidget::viewContainerAt(ViewIndex)
and another private method
DolphinTabWidget::activateViewContainerAt(ViewIndex).
Both methods return nullptr if there is no valid
DolphinViewContainer at the specified ViewIndex.
Before this commit, even items that are distant children of
currently open views were considered selectable. This lead to the
bug that items meant to be highlighted through DBus would not be
highlighted if any ancestor of the item was open in any view.
This was fixed by only considering items in view if they can be
seen by scrolling. Main difficulty here was to make this also work
for the details view mode which allows expanding.
To implement this cleanly, some refactoring seemed necessary
because the logic to determine if an item is already in view
was previously intertwined with the logic to identify already open
directories.
This commit also contains the following refactorings aiming to
make the code more readable:
- A magic value (-1) is replaced using std::optional.
- A boolean trap is removed.
- A QPair is replaced by a struct with named variables.
- More and improved documentation
on long touch (and not on mouse press) don't pop up the context menu
anymore but enter selection mode, similar behavior to mobile applications.
the full context menu is still available from the actions toolbar
appearing in selection mode
Sending SIGINT can be destructive, for example if we interrupt the
loading of the shell init files (e.g. .bashrc) and clobber history
preservation settings. Follow the example of Kate and send a Ctrl-E
Ctrl-U to clear the prompt instead.
BUG: 279614
Signed-off-by: John Brooks <john@fastquake.com>
Improve the test by also testing the various selection mode bars.
No combination of bars should lead to a resize of the paces panel.
This commit also helps with increasing code coverage by making all
possible selection mode bars appear.
@broulik noticed an issue in the code. This commit fixes it.
-------------------
Before this commit there was a `QObject::disconnect` call that did
nothing (because it had `nullptr` as the first parameter) and there was a `QObject::connect` call that created
the same connections multiple times because of this.
This had no effect on end users. However such code can lead to
issues in the future e.g. if we ever had a situation in which the selection mode could be toggled for an inactive view container.
This commit solves this by replacing the `QObject::disconnect` call
with one that works. The `QObject::connect` call is moved so
there won't be multiple connections of the same type.
Deleting DolphinView deletes KItemListContainer, which deletes
KItemListController, which emits modelChanged, which causes a
signal delivery to the already destroyed DolphinView
This is never good, and in Qt6 causes an assert
(https://codereview.qt-project.org/c/qt/qtbase/+/381860).
Co-authored-by: Nicolas Fella <nicolas.fella@gmx.de>
click-and-holding with a pointing device like a mouse.
This functionality was originally implemented because it seemed
useful to save users the effort of entering selection mode
explicitly by using its corresponding action.
However, click-and-holding to trigger anything is not really an
expected behaviour. (This contrasts with touch devices where
press-and-holding is common to trigger something.)
Aside from the above reasoning, the click-and-hold behaviour was
also buggy so that selection mode was entered in a couple of
situations that weren't strictly about click-and-holding.
So this commit removes the functionality and the bugs.
BUG: 457973
BUG: 458129
CCBUG: 457975
There were two changes in framework that triggered this commit:
KHamburgerMenu and KToolTipHelper.
When the Dolphin-specific hamburger menu was replaced by
KHamburgerMenu, I didn't clean everything up correctly. Not
anymore!
Help texts also weren't updated accordingly. This commit replaces
any mention of the old hamburger menu which was called "Control"
with text that reflects the current application state.
The other framework change "KToolTipHelper" takes responsibility
for opening links in help texts. So we won't need code to do this
in Dolphin anymore. This means we can also get rid of some
duplicate help texts which only existed because links didn't work
correctly in some places.
If this role isn't in the model yet, it would be `QVariant::Invalid`
which is obviously a distinct type from an empty string list.
This means `KFileItemModel::setData` treats them non-equal and
potentially does expensive operations on the model, which is
called every time a role is resolved in `KFileItemModelRolesUpdater`.
With this change, the number of pointless layout calculations is
significantly reduced.
In selection mode, a bottom bar with contextual actions appears
when at least one item is selected. This commit makes it so this
bottom bar also contains the "Invert Selection" and "Select All"
actions so users have more complete control over changing what is
and isn't selected while in selection mode.
- Make Esc leave selection mode and have it only clear selection
when already outside selection mode.
- Let translators know that the "More" overflow button should only
have a short text on it.
- Fix a crash that happened when any code tried to exit selection
mode even though selection mode had never been enabled to begin
with.
- Various code improvements
- Smoother animations
- The bottom bar in General Mode only becomes visible if items are
currently selected
- Removed the selection mode action from the default toolbar since
it can already be toggled in various ways
- More documentation
- Some cleaning
The selection mode action is a checkable toggle action named
"Select Files and Folders" which has "Space" as the default
shortcut.
In selection mode a bottom bar with contextual actions is shown.
These should mostly mirror the actions which are available through
the right-click context menu aka DolphinContextMenu.
Resizing of the window might make a overflow button appear in the
bottom selection mode bar.
This commit makes press and hold in the view activate selection
mode. This behaviour is not triggered if the press and hold is
used to either start a rubberband selection or a drag operation
within a short time. The length of the short timeframe is defined
by a QStyleHint. This is currently not implemented in touch
because I can't test it.
Mix the selection mode bars' background colors using a nice
combination of colors from the current color scheme
BUG: 427202
Makes this setting more accessible and makes it consistent with other
KDE applications. Since Dolphin has a separate status bar on each view
container and doesn't use kxmlgui's statusbar, we don't get this menu
entry automatically.
This merge request fixes up a little oversight by me. I will merge this as soon as the pipeline passes.
------------------
Some lines verified that nothing is selected when navigating to a
folder that was not acted on yet. These verifications didn't test
anything meaningful because the folder in question was empty.
This commit adds a file and a folder to the test folder so that
testing if nothing is selected means something.
- The first test makes sure that the width of the places panel
doesn't change no matter what other panels are shown or hidden.
There used to be bugs about this.
- The second test is kind of an integration test. It makes sure
that the go actions work correctly. On two occasions we had
the regression here that after going "Up" in the file system
hierarchy the folder one emerged from didn't have keyboard
focus which makes peeking into multiple folders tiresome.
The test also makes sure that going back and forward works
as expected and there are some sanity checks about which
go actions are enabled, which items are selected and that
using tabs doesn't interfere with any of that.
We know that we'll be a `QHelpEvent` from `QEvent::ToolTip`, so do a
static_cast from the event handler (where it's obvious from context),
and then pass it along to `tryShowNameToolTip`.
Since d383961719 in details view mode
clicking anywhere within the row is considered a click on the item.
That commit also changed it so that dropping files anywhere inside
a row would make it so the files are received by the folder of that
row.
This commit reverts the drop behaviour to be identical to the old
one.
I am having trouble explaining why this is better because one can
look at it in different ways. Bottom line is that one doesn't
really feel like one is dropping files inside a folder unless the
mouse cursor is actually directly above a folder's icon or name.
Another argument is that it is normal behaviour to just throw files
onto an application and the files then being opened by it.
Having potentially large parts of the view area covered by the rows
of folders means that there has to be more of a conscious effort to
not drop the files inside one of the folders by accident while with
this commit one has to aim precisely onto a folder to do it
intentionally.
CCBUG: 453700
If tooltips are enabled and you hover over item
while immediately closing Dolphin sometimes it would crash
because native parent might have been destroyed before
DolphinView
KItemListView::setAlternateBackgrounds(bool) (kitemlistview.cpp:489)
In C++, a data member of an object is not automatically initialized to "zero".
In this case a bool had random values such as the integer 255.
If one was fast to open the right-click context menu on the row of
an item in details view mode, the hover highlight would persist
while the context menu for the view was open.
This one-liner makes it so the highlight on the row is always
removed before the right-click context menu for the view is opened
so it is as clear as possible that the newly opened context menu
has no relation to the fileItem.
Before this change, right-clicking the row of an unselected item
in details view mode would be in a weird state:
- It didn't really count as a click on the item because the item
didn't get selected by this click before opening the context
menu.
- It didn't really count as a click on the view background either
because the actions that showed up depended on the item in
that row.
This commit fixes this by considering a right-click in the same row
as an unselected item as a click on the view background.
The behaviour of right-clicking the icon or name of a file directly
is unchanged.
This fixes the following bugs:
- The Paste action that shows up when right-clicking in the
unselected row of a folder now works (instead of doing
nothing). It now pastes the clipboard contents onto the view
background.
- When right-clicking the unselected row of a file (not a folder)
a Paste action once again shows up.
This commit changes it so the sizes of selection rectangles and hover
highlights in compact and details view mode is identical for all items.
Before this commit, selection rectangles in lists would have varying
indentation of the left edge of the selection rectangle depending on
the preview image's width-to-height ratio. This would cause a sort of
"ragged edge" in both compact and details list view when multiple items
were selected.
This commit doesn't change anything about icon view mode.
BUG: 453046
Since it actually adds padding on both left and right sides,
"Side Padding" might be more accurate.
This change is also propagated to variable and method names.
BUG: 453172
service-menu-installer ignores <package-name>.tar.gz-dir/uninstall.sh
if this is actualy just a symbolic link to install.sh in the same directory
(hardlinks and copies work)
canonicalPath() is used to get the name of the file on disk and returns install.sh
in the case of a symbolic link. install.sh without any arguments is called instead
of uninstall.sh consequently and no de-installation takes place.
replace canonicalPath() with absolutePath() as used in the rest of source file
resolves:
BUG: 452289
In KF6 KMoreTools should become it's own library and thus the KNS3 prefix should get removed.
Considering that the classes are not in any namespace, having a namespaced include is not needed and only causes noise.
This is equivalent to the "Open Terminal Here" feature that existed until Version 20.12.
If the user has selected folders, replace "Open Terminal" in the context menu with "Open Terminal Here".
When more than 5 folders are selected, a modal window will ask the user if they are sure they want to
open all 6 or more terminal windows.
In Detail View, users can also select a file,
which will open a terminal at the location of that file.
BUG: 452637
FIXED-IN: 22.08
The terminal panel is supposed to show the same location as the
currently active Dolphin view at all times.
However there was an issue when the terminal is supposed to
quickly switch to a new location and then back again to the old
one. The terminal ignored the switch to the old location unless it
had already fully switched to the new location. Because it isn't
particularly fast at fully switching to the new location, it would
never do the expected thing of switching back to the old location.
This commit makes it so the switch to the old location is only
ignored if there are no in-progress switches to a different
location.
BUG: 391380
BUG: 416690
FIXED-IN: 22.04.2
Not totally sure if this fixes everything but it seems like an improvement.
Currently, Dolphin doesn't have the ability to sort by file extension (sorting by type means that files will be sorted by mimetype but not by extension). This MR fixes this shortcoming.
BUG: 429579
(Part of my work towards !273)
Currently, when items are selected and a user right-clicks a selected item
while having the Ctrl key pressed down, the item is first
deselected and then a context menu is opened that doesn't involve
the item that was just deselected.
This is slightly confusing because normally one right-clicks an
item to see its context menu. Right-click being able to deselect
an item seems like unintended functionality in the first place but
in this scenario it also means that the intended opening of a
context menu for the pressed item doesn't even happen.
There is a good chance that nobody is even aware of this behaviour
because the normal way to deselect an item would be to
Ctrl+Left-Click if anything. Why would someone choose to open a
context menu and deselect items in a single step? Why would they
have selected an item they don't want to open a context menu for in
the first place?
Because of a discussion in this merge request deselecting on Ctrl+Middle-Click was also
removed for consistency with Ctrl+Right-Click and
Ctrl+Shift+Middle-Click.
This commit also makes a later implementation of a selection mode
more straightforward.
Accepts Ark's special dnd mime types so that archive contents can
be dragged onto a place to extract and/or (mount and) switch to the
hovered location.
There have been some reports that users were unable to figure out
that the padding on the left of the left-most "name" column can be
used for deselecting or for dropping file items. All of these
reports were by people using a Dolphin version in which that
padding was way too narrow because of a regression (that has since
been fixed). Nonetheless this highlights the potential problem that
some users might be unable to notice/figure out the usefulness of
the left padding.
This commit adds a similar area on the right side of the view when
the column widths are set automatically by Dolphin. The width of
the right padding column mirrors the width of the left padding
column when sized automatically. Both can manually be hidden or
resized similarly to resizing other columns.
There are various usability advantages to having this padding by
default on both sides of the view and not only on the left:
- The right margin is more discoverable since the item highlight
ends right before the padding column
- Less mouse travel time to reach either of the areas
- More than double the likelihood of users figuring out the
advantages of these padding areas for deselecting or dropping
- More visual symmetry
I had suggested also having this kind of right padding even before
the initial implementation of the left padding. The contributor
implementing it was in favour of it. It only wasn't implemented
because the contributor said it was impossible without a lot of
work. Turns out adding two characters at the right position seems
to suffice in most ways.
This commit does not contain the string change of renaming "Leading
Column Padding" to "Column Padding" (since it changes two paddings
now) to not infringe on the string freeze.
BUG: 452273
Since d383961719 dragging the
highlighted row of already selected items in the details view mode
will begin a drag operation of all selected items.
As a unintended side-effect of this change, dragging the row of a
previously unselected item while holding the control key would also
begin a drag operation.
After this commit, dragging the row of a previously unselected item
while holding the control key in details view mode will instead
create a rubberband. Ctrl-dragging the item's icon or text directly will drag the item as expected.
With this change, using multiple rubberbands to select scattered
items among a list of items should be as convenient as it was
previously.
BUG: 452181
This reverts commit 3ce9d1d19e.
This reverts commit ddba4f5fd8.
Aside from the two bugs mentioned below, this also fixes another
regression: The spacing on the left of the view does now once again
follow the size of its column header.
BUG: 451704
BUG: 451341
This mostly red MR should have no visible effect. It is part of my work towards !273.
There are two calls necessary to open the DolphinContextMenu:
One to construct it and one to execute/show it.
Before this commit, the actual populating of the ContextMenu was
done on execute. This meant that the actions of the ContextMenu
couldn't be looked at or changed without first showing the Menu
to the user. It also meant that the construction itself didn't
actually do much constructing/populating at all which might seem
a bit unintuitive.
This commit changes this behaviour so the DolphinContextMenu is
actually populated fully on construction. The executing/showing of
the ContextMenu now does just that and nothing more.
Previously, some actions in the context menu were actually not
wired up to anything and instead the DolphinContextMenu or the
DolphinMainWindow executed some code after the user had clicked
such a dummy action from the ContextMenu. Now all the actions are
properly constructed beforehand and no special handling is
necessary when the ContextMenu hides itself.
This commit removes the pos parameter from the DolphinContextMenu
constructor. This parameter contained the position where the Menu
would be shown later. This information isn't necessary to have on
construction and was already part of the exec(pos) call in the
first place. The variable m_pos that stored the value is removed.
This commit also removes a "customActions" functionality that can
supposedly be used to add further custom actions to the
DolphinContextMenu but this functionality isn't ever used
anywhere so its usefulness is questionable. It also wouldn't be
difficult to re-add this functionality if it was ever required for
something.
This commit also addresses an old TODO in dolphinpart.cpp that
asked for the calls for opening the DolphinContextMenu to actually
contain the information for which items the DolphinContextMenu is
supposed to be constructed. Before this, only the item that was
directly clicked was transmitted and then DolphinContextMenu
retrieved the currently selected set of items by itself.
It makes more sense that DolphinContextMenu would be informed on
construction which items it is supposed to show context actions
for.
Most of this is necessary so we are able to show the contextual
actions anywhere else than in the ContextMenu in the future.
I am targeting 22.08 with this MR because it makes no sense to merge a refactor for the upcoming release already.
Since KIO 5.85, this new file location is preferred over the
KServiceTypeTrader results.
With this change, single desktop files from the KDE store are installed
in the correct location. If however a custom install script is used,
developers need to adjust their scripts.
Because the "kio/servicemenus" locations is different than the one
KAuthorized allows by default, we have to mark the file as executable.
Task: https://phabricator.kde.org/T14543
This reverts b7fbd19a76 but creates the
widget only once and then reuses it.
However, ownership of a parent-less widget is transferred to the
`KToolTipWidget` but since we first request metadata, then show the
tooltip (or won't if the mouse moved on since), we cannot rely on
the `KToolTipWidget` exclusively.
Instead, when we still delete the widget ourself until we have
shown the `KToolTipWidget` once at which point it will handle the
life time for us.
This fixes parenting the widget to `DolphinView` which would make
it appear as a broken line in the top left of the window.
This adds the following additional special view modes (some of them were
already there but broken because they weren't applied, or were
changed to have better defaults now that they are actually used):
* Recent Files and Recent Documents, timeline:
Details view with grouped sorting enabled and Name, Path, Modified
* Search For Images:
Icon view with Name, Dimensions, Date Time of the Picture
* Search For Audio:
Details view with Name, Artist, Album, Duration
* Search For Videos:
Icon view with just Name
* Search For everything else, including Documents:
Details view with Name, Path, Modified
* Trash:
Details view with Name, (Original) Path, Deletion Time
BUG: 400969
BUG: 340393
BUG: 186376
FIXED-IN: 22.04.0
Currently any time we hover the mouse over a file we create a new DolphinFileMetaDataWidget (even when we don't actually show a tooltip).
That is quite wasteful
Instead we can reuse the existing instance and only change the URL
This commit allows us to very explicitly refer to any set of items
in text. This way buttons don't need to be labeled generically
like "Permanently Delete" but can be enriched to be labeled
"Permanently Delete "FileName"" or "Copy 7 Selected Folders" or
"Copy 6 Files" or "Rename "file1", "file2", "file3", "file4" and
"folder5"".
This commit tries to save translators a lot of work by using a
translation puzzle. This might be problematic for some languages.
The alternative on the other hand would mean that any label which
wants to be explicit would need to have over 10 translations just
for one label which seems quite bad as well.
A fallback is to be implemented for languages that can't really
accommodate for any specific word puzzle. This is explained in the
documentation.
Adds a compact label based on the closes place similar to the
address bar (e.g. instead of /home/user/Pictures/Holidays it will
show Pictures/Holidays), unless "show full path in address bar"
is enabled.
Also, add the folder icon
Indicate that you cannot drop here.
Avoids a "Cannot drop file" or "not supported" error when
dropping files ontop of a search or timeline URL.
It is done in Dolphin rather than the library as there we cannot
assume what a consumer might be doing with the drop.
If we have directory "a" and "a/b" and expand both, then collapse "a" we
tell KDirWatcher to stop watching both these directories.
However, KDirWatcher keeps them in the listersCurrentlyHolding list as
well as the listersCurrentlyListing list and will still notify of
changes. If a new file appears in "a/b/" we will still get change
notifications.
When dolphin processes these changes we cannot find the relevant parent
node. It then gets confused and inserts the item into the root directory
from the POV of the model notifications. When we then open the relevant
folder the model knows a node with that URL exists and fails to add it
correctly.
This can also be reproduced by continually downloading files into a
subdirectory tree and rapidly expanding and collapsing folders a few
levels deep.
There is an unintended side-effect in
d383961719 which this MR fixes.
Normally in Dolphin, when clicking on an item to open/activate it,
it is both selected by the click and opened/activated.
Prior to this MR, the item wasn't selected when all of these
conditions were met:
- Use ActivateItemOnSingleClick also knwon as single-click mode
- Have more than one item selected already
- Click on an item that was previously not selected
Prior to this MR, the click would deselect all items and
activate the clicked item but not select it.
With this MR, the click will deselect all items, activate
the clicked item and also select it and move the anchor there.
When testing this with folders, make sure to navigate back after activating the folder. The folder should then still be selected.
This is then consistent with the behaviour when the specific
conditions mentioned above are not met.
When displaying the KCMs in another application's configuration dialog
(for example, in Konqueror), the Apply, Ok and Reset buttons aren't
shown. This issue is caused by a missing Apply flag in the call to
setButtons in the KCModule constructor.
the fact that in the call to setButtons
from the KCModule constructor, the Apply flag is missing.
BUG: 448352
Avoids a text rect taller than the area that actually contains text,
as can be seen by hovering files in a folder with "additional roles"
that a given file does not contain.
Current implementation of the zooming animation is a bit buggy.
This MR fixes the following issues:
* in the Icon view mode, the icons sometimes "jump"
* in the Compact view mode, the labels sometimes are cut off
BUG: 449179
When passing an URL like ftp://foo/bar.txt OpenUrlJob opens it in the default handler for ftp urls, not the one for txt files, which would be more appropriate here
By passing along the mimetype we can change that behavior to what we want
BUG: 443253
When opening tags:/ we show 'No tags' when there are no tags found.
When opening a tag that exists but doesn't have any files associated we show the same message, which isnt't appropriate.
Instead show "No files tagged with 'foo'", which makes more sense