Bug 408813 - Provide option to not prefix file:// when copying
Summary: Provide option to not prefix file:// when copying
Status: REOPENED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.44.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-17 07:19 UTC by Shriramana Sharma
Modified: 2020-01-15 11:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shriramana Sharma 2019-06-17 07:19:40 UTC
I have seen bug #241225 which already requested this and was rejected. However that was against KDE 4 so re-filing against KDE 5.

I have been using KDE ever since my very first Linux days (it was KDE 3 then) and I have sort of gotten used to the irritation of having to manually delete the initial file:// prefix whenever I copy-paste a file path from a KDE application to terminals, GTK file dialogs or text boxes.

However this needn't be so. As seen in the other bug, it has the potential to lose KDE users. I am sticking with KDE because of its more numerous advantages, but I hope all these needless irritations can be polished away to be more friendly and useful.

If I am living near Salem, Tamil Nadu, India and there is a Salem, Oregon, USA (which most people here don't know), the Salem I refer to will almost always be the town here and not the one in the USA. Similarly the path I refer to by a plain path without protocol prefix will be my local file system only. There is no need for always prefixing file:// and having the user delete it when it creates a problem.

Even in web browsers, typing gmail.com and pressing enter automatically prefixes http:// since that is the most common protocol. Why should the local behaviour be any different?

The technology should serve the convenience of the user, and the user shouldn't have to adjust to the technology.

If it can be fixed for one particular case: bug #170608 why can't it be fixed in  general?

Thanks!
Comment 1 Kurt Hindenburg 2019-11-25 00:11:13 UTC
Git commit 9bc892eff0dd3a19346182650b8b6d5ef0436aee by Kurt Hindenburg, on behalf of Ahmad Samir.
Committed on 25/11/2019 at 00:10.
Pushed by scmsync into branch 'master'.

Paste urls of local files as a list of quoted strings

When pasting urls of local files, remove the the scheme part, "file://",
and paste the urls as a space-separated list of local file paths, which
are quoted as needed.

Commands such as cp, mv, ls... etc, don't understand/parse the file://
bit of local urls, therefore it's more useful to strip the scheme for local
files.

M  +21   -1    src/TerminalDisplay.cpp
M  +5    -2    src/TerminalDisplay.h

https://commits.kde.org/konsole/9bc892eff0dd3a19346182650b8b6d5ef0436aee
Comment 2 Shriramana Sharma 2019-11-25 05:52:02 UTC
Hello and thanks for this work. But it seems you have devised a solution for only pasting in Konsole.

If you will see my post, I also refer to GTK file dialogs etc, which aren't under your control. So the correct approach would be to avoid the prefix at the time of copying, and not pasting in one particular application. That's why I filed the bug against the frameworks and not even just Dolphin.

Please see the bug #170608 fixed ten years back which directly omits the file:// prefix at the time of copying.
Comment 3 Ahmad Samir 2019-11-25 09:34:13 UTC
Please note that according to bug 241225 comment6 dolphin and the clipboard system tray plugin actually use the file:// scheme. The fix in bug 170608 was straight forward because what's being copied isn't files but the files paths, i.e. the intention is clear "I am copying text strings". 

IIUC, it has to be fixed in the application receiving the pasted text, if it's not interested in them it can discard them, like Konsole does now.

For the GTK file dialog, I tested with gedit, and the open file dialog seems to understand file:// schemes and opens them without any problems.

Firefox and Chromium seem to understand them too, so pasting a file:// url in the urlbar and pressing Enter opens the file as intended.

Even XFCE didn't drop the file:// scheme entirely[1], but conditionally based on the application where the text is being pasted (that is IIUC, as I don't know C).

[1]
https://bugzilla.xfce.org/show_bug.cgi?id=8271
https://git.xfce.org/xfce/thunar/commit/?id=c69f40c34b794567ff890570d7064e555c39b991
Comment 4 Ahmad Samir 2019-11-25 14:17:40 UTC
Closing as a duplicate of bug 241225 (as dolphin really uses KIO to copy/paste files). Feel free to open separate bug reports for other KDE application where you think copying files then pasting them should paste the file paths as text without the file:// scheme part.

*** This bug has been marked as a duplicate of bug 241225 ***
Comment 5 Shriramana Sharma 2020-01-15 11:00:10 UTC
Hello. Over time, I am finding n-number of other non-KDE applications which are having problem with the file:// prefix. Yes, GTK apps like GEdit are supporting and LibreOffice also, but QGIS doesn't support for data sources and Inkscape field for outputting PNG export is not supporting. If I am running Jupyter and want to open a file there whose path I copy from Dolphin, again I face the same problem.

Why is it necessary for me to hunt down all those other projects and ask them to support file:// prefix? KDE has always been about flexibility and options. “Powerful with sensible defaults” has been KDE's maxim IIUC. What I am asking is for an *option* to copy without the prefix. Just because Klipper has special actions based on the prefix isn't reason enough to hinder usability of all those applications when using KDE environment.

So rather than solving it in KonsolePart, it should have been solved in Klipper, providing an option to retain or omit file:// when pasting. Please provide this option. I am only asking you to provide an option. I am not even asking you to change the default behaviour. Why can't you please accomodate?