Problem with KParts::BrowserOpenOrSaveQuestion

Albert Astals Cid aacid at
Wed Apr 5 23:19:35 BST 2023

El diumenge, 2 d’abril de 2023, a les 10:30:22 (CEST), Stefano Crocco va 
> Hello to everyone,
> I just found what I believe to be a problem with the service selection of
> KParts::BrowserOpenOrSaveQuestion in KF-5.104 (installed from Gentoo
> packages). Before creating a bug report, I'd like to be sure that this isn't
> a problem related to my system and that I'm not misunderstanding how this
> class works, so I'd like to know whether someone is experiencing the same
> problem or can spot what I'm doing wrong. I've attached the code of a
> minimal program which shows this issue.
> The problem is the following:  KParts::BrowserOpenOrSaveQuestion has a
> feature which allows the user to choose the service to use to open the
> given URL, which is enabled  calling
> setFeatures(KParts::BrowserOpenOrSaveQuestion::ServiceSelection) on the
> dialog. This adds a button to the dialog; when this button is pressed, the
> user is shown a menu with a list of available services for opening the URL;
> the last entry is "Open with..." and it should display a "Choose
> application" dialog so that the user can choose a service which isn't
> listed. However, on my system, pressing this menu entry immediately closes
> the dialog.
> The minimal example I created contains a button which, when clicked, creates
> the KParts::BrowserOpenOrSaveQuestion dialog and shows it. When the dialog
> is closed, a message box with the dialog result and the service chosen by
> the user is shown. Clicking the "Open" button or the "Open with..." button
> and choosing one of the suggested services works correctly, but choosing
> the "Open with..." menu entry produces the behavior I described above: the
> dialog closes with no possibility to choose another application.
> KParts::BrowserOpenOrSaveQuestion::selectedService returns nullptr. Note
> that this doesn't depend on the URL or the mimetypes passed to the dialog.
> To build the minimal example, put the CMakeList.txt main.cpp in the same
> directory and run cmake as usual.
> I'd be grateful to anyone which can help me investigate this issue.

I think there's no issue to investigate, as far as I can see that's what the 
"Open With..." button does, it returns Open and doesn't set any 
selectedService, it's the caller responsability to act on that.

For example

Maybe it's a documentation problem that should make it clearer that is what 
the OpenWith button does?


> Thanks in advance
> Stefano

More information about the kde-devel mailing list