https://bugs.kde.org/show_bug.cgi?id=524837

            Bug ID: 524837
           Summary: Copy Location copies only the first path when several
                    items are selected
    Classification: Applications
           Product: dolphin
      Version First 26.08.0
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Select several files, use Copy Location — from the context menu or Ctrl+Alt+C —
and paste. You get one path. The rest of the selection is dropped, with nothing
to indicate it happened: the action is enabled, it does not warn, and a single
path pastes cleanly, so it reads as having worked.

STEPS TO REPRODUCE
1. Open a folder with at least three files.
2. Select all of them.
3. Copy Location (context menu, or Ctrl+Alt+C).
4. Paste into a text editor or terminal.

OBSERVED RESULT
One path — the first item of the selection.

EXPECTED RESULT
All selected paths, one per line.

WHERE IT COMES FROM
`DolphinView::copyPathToClipboard()`, src/views/dolphinview.cpp:2750 on master
(0bedd75), takes the first entry and ignores the remainder:

```cpp
    const KFileItemList list = selectedItems();
    if (list.isEmpty()) {
        return;
    }
    const KFileItem &item = list.at(0);
    QString path = item.localPath();
    if (path.isEmpty()) {
        path = item.url().toDisplayString();
    }
    ...
    clipboard->setText(QDir::toNativeSeparators(path));
```

There is no technical obstacle here — `selectedItems()` has the whole list, and
only the first element is used.

To be fair, this is documented, after a fashion: the action's What's This says
"This will copy the path of the first selected item into the clipboard"
(src/views/dolphinviewactionhandler.cpp:174). But that string is only reachable
by explicitly asking for What's This. From the context menu and from the
keyboard
shortcut there is nothing that hints part of the selection is being discarded.

I read this in the source rather than instrumenting a running Dolphin; the code
path is short and unconditional, and it matches the behaviour seen in normal
use.

HOW MUCH IT MATTERS
Not very, taken on its own — nothing is lost or corrupted, it is a paste that
quietly comes out short. It bites when the paths are the point: handing a set
of
files to a terminal command, a script, or a message to someone else. That is
also
where it is least likely to be noticed, because one path pastes without any
error
and the shortfall only shows up later.

SUGGESTED DIRECTION
Copy every selected path, one per line, with the present behaviour falling out
as
the single-item case of the same rule. That is what Files, Explorer and Finder
do,
so it is also the least surprising option.

If the first-item behaviour is worth preserving for someone, the alternative is
a
second action — but two near-identical entries in the context menu seems a
worse
trade than changing this one.

Happy to write the patch if the direction is agreed.

SOFTWARE/OS VERSIONS
Dolphin 26.08.0 (Fedora 44 RPM), KF6 6.29.0, Qt 6.11.1
Plasma 6.7.4, Wayland session
Code quoted from master at 0bedd75

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to