Bug 456481

Summary: Open with default program -button opens multiple editor windows
Product: [Applications] digikam Reporter: _ <myaccount132>
Component: Usability-OpenWithAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: metzpinguin
Priority: NOR    
Version First Reported In: 7.7.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 7.8.0
Sentry Crash Report:

Description _ 2022-07-08 09:21:16 UTC
SUMMARY
Separate Gimp processes opened for each image when multiple images opened with default editor button at toolbar IF prior Gimp instance is NOT already opened. 

Works correctly when right clicked and used "Open with" -> "Gimp".

STEPS TO REPRODUCE
1. Gimp selected as default program for pictures. (Possibly occurs with other programs too.)
2. Select sevaral images.
3. Press "Open with default editor (Ctrl+F4)" (translated from fi translation "Avaa oletussovellukseen"

OBSERVED RESULT
Separate Gimp windows and processes are opened for every image.

EXPECTED RESULT
Only one instance of Gimp should be opened with multiple images open.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 22.04 LTS
KDE Plasma Version: 
KDE Frameworks Version: 5.95.0
Qt Version: Version 5.15.3 (built against 5.15.3)

(For some reason digikam runs in finnish even when I'm using english Ubuntu, so English texts in features are guessed.)
Comment 1 _ 2022-07-08 09:24:09 UTC
STEPS TO REPRODUCE
0. Close all Gimp windows if they're opened.

***

This worked ok with 6.x I think.
Comment 2 Maik Qualmann 2022-07-08 11:31:25 UTC
The behavior was no different in digiKam-6.x.x. To open with the default application we use QDesktopService::openUrl(). This function can only handle a single URL, so we pass all the URLs one by one. We have the "Open With" menu under Linux and recently also under MacOS and can list applications that handle the mime type. Here we use our own program starter that starts URLs depending on the option parameters (%f, %F, %u, %U) according to program instances or transfers the URLs as a list. But I think we can't get the set default application.

Maik
Comment 3 _ 2022-07-09 13:17:50 UTC
Could there be separate start for default program first, then pass urls to it OR wait some time after passing first url to allow program first to initialize to *possibly* avoid opening several instances?
Comment 4 Maik Qualmann 2022-07-09 18:21:01 UTC
Git commit bfd5a7b8aab39eca2b12a251ce7abff6dfe5c00b by Maik Qualmann.
Committed on 09/07/2022 at 18:19.
Pushed by mqualmann into branch 'qt5-maintenance'.

on Linux, use KService to get default application to open it
This will work fine under a KF5 Plasma Desktop.
FIXED-IN: 7.8.0

M  +1    -1    NEWS
M  +15   -0    core/app/items/utils/itemviewutilities.cpp

https://invent.kde.org/graphics/digikam/commit/bfd5a7b8aab39eca2b12a251ce7abff6dfe5c00b