Trigger loading a list of files from Dolphin using "open with"

J Blackquill uhhadd at gmail.com
Fri Jul 15 22:50:40 BST 2022


Hi, this is controlled by the KIO::ApplicationLauncherJob.
It asks KService whether it can launch one instance or if it needs to
do n instances, and this is the code that KService uses for that:

bool KService::allowMultipleFiles() const
{
   Q_D(const KService);
   // Can we pass multiple files on the command line or do we have to
start the application for every single file ?
   return (d->m_strExec.contains(QLatin1String("%F")) //
           || d->m_strExec.contains(QLatin1String("%U")) //
           || d->m_strExec.contains(QLatin1String("%N")) //
           || d->m_strExec.contains(QLatin1String("%D")));
}

In short, you should be using the standard XDG thing that says you can
take multiple URLs on launch in your .desktop file (%U in the Exec
key).

Cheers, Janet

Am Fr., 15. Juli 2022 um 17:35 Uhr schrieb Tobias Leupold <tl at stonemx.de>:
>
> Hi list!
>
> I'm working on Bug #455074, and I noticed some behavior of Dolphin I wonder if
> it can be changed or worked around.
>
> What happens when I select multiple files in Dolphin and do "open with" is
> that not a list of the selected files is passed to the called program, but one
> instance of the program is opened for each file.
>
> This does not only happen for what I try to implement in KGeoTag, but also
> e.g. for the Gimp (instead of opening a tab for each file, one Gimp instance
> is opened for each file).
>
> So: Can this behavior be changed? Is it possible to send a list of files to a
> program called via "open with"? And can I tell Dolphin to do so via the
> .desktop file or such?
>
> In case of KGeoTag, what I implemented to open files and/or directories using
> command line parameters works fine if it's called via the command line (also
> with wildcards), but not via Dolphin ...
>
> Thanks for all help!
>
> Cheers, Tobias
>
>


More information about the kde-devel mailing list