diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-04-30 16:14:29 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-04-30 16:14:29 +0200 |
| commit | a0d657b2e8679a84d704e03ef3f2b225b3449094 (patch) | |
| tree | 66507cacd17a499ec1a36c1523b4b6e0f5453a30 | |
| parent | 9472ff546cc0b4150d4dec89b48b3e4814b421f6 (diff) | |
Fix preset_file() and directory() in native file chooser for kdialog
| -rw-r--r-- | src/Fl_Native_File_Chooser_Kdialog.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Fl_Native_File_Chooser_Kdialog.cxx b/src/Fl_Native_File_Chooser_Kdialog.cxx index 402c47acc..2d252815e 100644 --- a/src/Fl_Native_File_Chooser_Kdialog.cxx +++ b/src/Fl_Native_File_Chooser_Kdialog.cxx @@ -1,7 +1,7 @@ // // FLTK native file chooser widget : KDE version // -// Copyright 2021-2023 by Bill Spitzak and others. +// Copyright 2021-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -24,6 +24,7 @@ #include <FL/Fl_Native_File_Chooser.H> #include "Fl_Native_File_Chooser_Kdialog.H" #include "Fl_Window_Driver.H" +#include "Fl_System_Driver.H" #include "drivers/Unix/Fl_Unix_Screen_Driver.H" #include <stdio.h> #include <stdlib.h> @@ -93,9 +94,13 @@ void Fl_Kdialog_Native_File_Chooser_Driver::build_command(Fl_String& command) { } // Build preset - const char *preset = "."; - if (_preset_file) preset = _preset_file; - else if (_directory) preset = _directory; + char preset[FL_PATH_MAX] = ""; + if (_preset_file) { + if (_directory) strcpy(preset, _directory); + else Fl::system_driver()->getcwd(preset, FL_PATH_MAX); + strcat(preset, "/"); + strcat(preset, _preset_file); + } // Build command command = "kdialog"; @@ -114,7 +119,7 @@ void Fl_Kdialog_Native_File_Chooser_Driver::build_command(Fl_String& command) { command += quoted_filt; } command += " 2> /dev/null"; // get rid of stderr - //printf("command = %s\n", command.c_str()); + printf("command = %s\n", command.c_str()); } |
