Problem with KParts::BrowserOpenOrSaveQuestion

Stefano Crocco stefano.crocco at alice.it
Sun Apr 2 09:30:22 BST 2023


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.

Thanks in advance

Stefano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 1596 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20230402/eba6a1ab/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeLists.txt
Type: text/x-cmake
Size: 617 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20230402/eba6a1ab/attachment.bin>


More information about the kde-devel mailing list