← All bug reports

FS#2424File/Folder selection dialogs are broken under KDE

Type
Bug
Status
Closed
Resolution
Fixed
Category
QCAD (main)
Severity
Low
Priority
Low
Reported version
3.27.8
Operating system
Linux (All / Other)
Reported
2022-11-15 by cognifloyd
Closed
2022-11-23 by andrew

I run KDE Plasma (KWin window manager) on Gentoo Linux.

I have tested with several different builds of QCAD 3.27.8:

If I use Open, Save As, and anything else that selects a file or a folder, the dialog does not show any contents, and the terminal prints an error:

Warning:  couldn't create slave: "Unknown protocol 'file'."

Some of the dialogs behave better by deselecting:
Application Prefs > File: Open/Save > File Dialog > Use system file dialog

So, looking through the code, I noticed that there is already KDE-specific handling to avoid using the system dialog, but it has probably been broken since switching to QT5, because Q_WS_X11 (and all other Q_WS_* global macros) no longer exist with QT5+.

I've attached a patch that fixes the usage of that macro. With that patch, in my portage-built Community Edition build, I no longer have to deselect "Use system file dialog".

But, there are at least two places that do not respect the DontUseNativeDialogs setting:

  • Application Prefs > File > Templates > Template Folders > Add
  • Application Prefs > Widgets > Library Browser > Library Sources > Add...

I found the scripts source for the Library Browser PreferencesPage.ui, but I couldn't find the same for the Templates selection, probably because that is a Pro-only feature (right?).

For the LibraryBrowser, here is the appropriate sections of code:

So, somehow this line needs to change to use the DontUseNativeDialogs setting, but I'm not sure how to do that (I don't have much experience with QT development).

var dir = QFileDialog.getExistingDirectory(this, fileDlgTitle);

Assuming that Template Folders preference also uses the DirectoryList widget, fixing this should fix that pref pane as well.

Comments (1)

cognifloyd 2022-11-16

OK. I have a fix that gets rid of most of these console messages:

Warning:  couldn't create slave: "Unknown protocol 'file'."

When DontUseNativeDialog, I only get one of those messages each time I open one of the QFileDialogs instead of 3x with the native version.

I also figured out how to adjust DirectoryList so it no longer uses the native dialog. That fixed both Template Folders or Library Sources preference panes.

It would be nice to fix things so the Native dialogs also work, but this is functional now, whereas it was broken (by default for File Open/Save, and just broken for the prefs) before.

Please review this PR to make sure my fix is sane:
https://github.com/qcad/qcad/pull/43