Bug 297079 - "open with"->"other" context menu parameter behaviour (%U)
Summary: "open with"->"other" context menu parameter behaviour (%U)
Status: RESOLVED FIXED
Alias: None
Product: krusader
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Alex Bikadorov
URL:
Keywords: reproducible
Depends on:
Blocks:
 
Reported: 2012-03-29 22:23 UTC by Till Schäfer
Modified: 2016-12-21 13:06 UTC (History)
4 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 Till Schäfer 2012-03-29 22:23:39 UTC
If i open a file with an application and i choose "open with -> other" it is impossible two open more than one file at once.  if i select the application directly it does work. 

Using KDE 4.8.2 from Gentoo.  (The version was not selectible in the bug tracker)

an Example: 
1) selecting two pdf files
2a) right click -> "open with" -> other -> "okular %U" 
  => only the first file opens
2b) right click -> okular (wich uses the same command internally)
  => the two files are opened

I only tested %U (uppercase) and no other options. 

I hope "kde" was the right category because it does not only apply to dolphin. wherever the kde contextmenu is used this error occurs (e.g. Krusader, Folder View).
Comment 1 Jekyll Wu 2012-03-31 11:51:07 UTC
Is version 4.8.2 a typo? It has not been released yet.

Anyway, I can't reprouduce the problem using KDE SC 4.8.1 on ArchLinux and KDE SC built from git on Gentoo
Comment 2 Till Schäfer 2012-03-31 13:24:29 UTC
yes it is Verison 4.8.1
Comment 3 Jekyll Wu 2012-07-07 14:55:53 UTC
Still can't reproduce it .

Feel free to reopen this report if the problem still happens in recent versions (KDE SC 4.8.4 or higher).
Comment 4 Till Schäfer 2012-07-08 18:26:34 UTC
its still reproducable, but it seems it is krusader specific. thought this might be a general component reused by dolphin and krusader.
Comment 5 Till Schäfer 2016-09-17 19:12:02 UTC
still valid for KF5 git version from today
Comment 6 Alex Bikadorov 2016-09-17 21:08:41 UTC
Please test current master again, should be fixed now.
Comment 7 Till Schäfer 2016-09-17 21:24:40 UTC
it does not open any file anymore. 

Before: selection of multiple files caused only a single file to open. 
Now: Application is opened with no file.
Comment 8 Till Schäfer 2016-09-17 21:37:47 UTC
I just created a simple script to write out the parameters and here is what the application receives regarding the parameter list with the current git version. I thought that the parameters might not be grouped correctly, but it seems that nothing at all is received by the application:

Single File:
0: /home/till/temp/bla.sh
1: /home/till/temp/IMG_20160908_191124.jpg

Multiple Files
0: /home/till/temp/bla.sh
Comment 9 Davide Gianforte 2016-09-17 22:45:26 UTC
This is heavily related to the chosen program. Not every applications handle list of files.

If you run krusader in debug, you'll see this type of error: "x URLs supplied to single-URL service..."

meaning that the program can't receive from KIO a list of files as parameter, so it will open without files. The "classic" open command runs an instance for each file.
Comment 10 Alex Bikadorov 2016-09-17 23:37:14 UTC
Heck! Everything I tested (Okular, Gwenview, Clementine, ...) works just fine.

@Till 
What is the program you have problems with?

@Davide
what do we do (as fallback)?:
1. classic approach, one instance for each argument: <app> <file1> ; <app> <file2>
2. do not care if the application can't handle multiple files: <app> <file1> <file2>

A shell script is an example where we can't know if its supports multiple files or not, but we should expect it, so I prefer (2)
Comment 11 Till Schäfer 2016-09-17 23:46:19 UTC
(In reply to Alex Bikadorov from comment #10)
> Heck! Everything I tested (Okular, Gwenview, Clementine, ...) works just
> fine.
> 
> @Till 
> What is the program you have problems with?
if have tried it with okular, kate and above described custom shell script 
-> so at least here it is independent of the type of application.

> 
> @Davide
> what do we do (as fallback)?:
> 1. classic approach, one instance for each argument: <app> <file1> ; <app>
> <file2>
> 2. do not care if the application can't handle multiple files: <app> <file1>
> <file2>
> 
> A shell script is an example where we can't know if its supports multiple
> files or not, but we should expect it, so I prefer (2)

i also prefer (2) in most cases. However, may (2) cause trouble for some applications in addition to just not opening the file correctly? I.e. if a second parameter is an output file? Though, I cannot find an example of such a case. Do you know what Dolphin is doing?
Comment 12 Alex Bikadorov 2016-09-18 00:05:45 UTC
I tested Okular (again) with PDFs. Works fine, an instance for each file is opened
Output:
/usr/bin/okular file1.pdf file2.pdf file3.pdf --icon okular -caption Okular

Kate is indeed a problem. I don't know why KIO detects this wrong.

>  I.e. if a second parameter is an output file?
True, this is maybe too dangerous. Dolphin does solution (1).
Comment 13 Till Schäfer 2016-09-18 00:16:39 UTC
my fault with the okular example. If i select "open with -> other" and just type in "okular" it does not work, but if I select the desktop entry from the applications list it works.
Comment 14 Alex Bikadorov 2016-09-18 12:09:50 UTC
I mean "open with -> other", this works for me. But this could be caused by different versions, Okular 16.08.1, KF5 5.25.0 here.

Anyway, once fixed for Kate it will also be solved for Okular.
Comment 15 Alex Bikadorov 2016-09-26 16:14:38 UTC
Ok, i did some testing again and I'm pretty sure what your problem here is: it simply makes it a different if you add "%U" to the command or not.
E.g. select some *.txt files, right-click->open with->Others... and
  (a) type "kate": an empty Kate instance opened, no files
  (b) type "kate %U": all files are opened in one Kate instance

Same with every other runnable including custom shell scripts.

And if you select a desktop entry it depends on its command what is executed. For further information see: https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

My conclusion is that at this point it has nothing to do anymore with Krusader or KIO. If you agree plz close this report.
Comment 16 Till Schäfer 2016-12-21 13:06:44 UTC
seems to work with krusader-2.5.0 regardless whether the %U is added or not.

-> closing this as fixed