Fix for Fl_Native_File_Chooser::filter_value() - cont'd (#899)

This commit is contained in:
ManoloFLTK 2024-04-22 18:35:34 +02:00
parent 576f7bb9cc
commit 5ec7176e81
3 changed files with 28 additions and 30 deletions

View File

@ -269,7 +269,7 @@ public:
/// Meaningful for the Wayland/X11 platform only. When switched on, the library uses a Zenity-based file dialog. /// Meaningful for the Wayland/X11 platform only. When switched on, the library uses a Zenity-based file dialog.
/// When switched off (default), no zenity-based file dialog is used. /// When switched off (default), no zenity-based file dialog is used.
OPTION_FNFC_USES_ZENITY, OPTION_FNFC_USES_ZENITY,
/// Meaningful for the Wayland/X11 platform only and for the KDE-Plasma desktop only. /// Meaningful for the Wayland/X11 platform only.
/// When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is available on the running system. /// When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is available on the running system.
/// When switched off (default), no kdialog-based file dialog is used. /// When switched off (default), no kdialog-based file dialog is used.
OPTION_FNFC_USES_KDIALOG, OPTION_FNFC_USES_KDIALOG,

View File

@ -144,7 +144,7 @@ Fo_Option_Descr g_option_list[] = {
{ FO_OPTION_BOOL, "Native File Chooser uses Kdialog:", { FO_OPTION_BOOL, "Native File Chooser uses Kdialog:",
Fl::OPTION_FNFC_USES_KDIALOG, "OPTION_FNFC_USES_KDIALOG", "UseKdialog", false, Fl::OPTION_FNFC_USES_KDIALOG, "OPTION_FNFC_USES_KDIALOG", "UseKdialog", false,
"Fl_Native_File_Chooser uses the 'kdialog' command if possible.", "Fl_Native_File_Chooser uses the 'kdialog' command if possible.",
"Meaningful for the Wayland/X11 platform and the KDE-Plasma desktop only. " "Meaningful for the Wayland/X11 platform. "
"When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is " "When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is "
"available. When switched off (default), command 'kdialog' is not used." }, "available. When switched off (default), command 'kdialog' is not used." },
{ FO_HEADLINE, "Print dialog Options" }, { FO_HEADLINE, "Print dialog Options" },

View File

@ -944,9 +944,7 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
// if we found zenity, we will use the Fl_Zenity_Native_File_Chooser_Driver // if we found zenity, we will use the Fl_Zenity_Native_File_Chooser_Driver
if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val); if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val);
} }
const char *desktop = getenv("XDG_CURRENT_DESKTOP"); if (!platform_fnfc && Fl::option(Fl::OPTION_FNFC_USES_KDIALOG) && val != BROWSE_MULTI_DIRECTORY) {
if (!platform_fnfc && Fl::option(Fl::OPTION_FNFC_USES_KDIALOG) && desktop &&
strcmp(desktop, "KDE") == 0 && val != BROWSE_MULTI_DIRECTORY) {
if (!Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog) { if (!Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog) {
// First Time here, try to find kdialog // First Time here, try to find kdialog
FILE *pipe = popen("kdialog -v 2> /dev/null", "r"); FILE *pipe = popen("kdialog -v 2> /dev/null", "r");