summaryrefslogtreecommitdiff
path: root/src/Fl_Native_File_Chooser_Kdialog.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-12-07 12:57:39 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-12-07 12:57:49 +0100
commit630517049f21d83dd6a4d63a0f6bbff55a05ac70 (patch)
tree4cd7db99ebc173072911c18f999c04ea04bd180d /src/Fl_Native_File_Chooser_Kdialog.cxx
parent663b93a8070db905e1e7741f9e6b1cea915f61c7 (diff)
Fix for issue #278 - continued
Because kdialog can't select multiple directories, run the GTK chooser when BROWSE_MULTI_DIRECTORY is used.
Diffstat (limited to 'src/Fl_Native_File_Chooser_Kdialog.cxx')
-rw-r--r--src/Fl_Native_File_Chooser_Kdialog.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/Fl_Native_File_Chooser_Kdialog.cxx b/src/Fl_Native_File_Chooser_Kdialog.cxx
index 37980ba0a..6f2298bb1 100644
--- a/src/Fl_Native_File_Chooser_Kdialog.cxx
+++ b/src/Fl_Native_File_Chooser_Kdialog.cxx
@@ -51,8 +51,29 @@ int Fl_Kdialog_Native_File_Chooser_Driver::show() {
Fl::flush(); // to close menus if necessary
const char *option;
switch (_btype) {
+ case Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY: {
+ // BROWSE_MULTI_DIRECTORY is not supported by kdialog, run GTK chooser instead
+ Fl_Native_File_Chooser fnfc(Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY);
+ fnfc.title( title() );
+ fnfc.directory(directory());
+ fnfc.preset_file(preset_file());
+ fnfc.filter(filter());
+ fnfc.options(options());
+ int retval = fnfc.show();
+ for (int i = 0; i < _tpathnames; i++) delete[] _pathnames[i];
+ delete[] _pathnames; _pathnames = NULL;
+ _tpathnames = fnfc.count();
+ if (_tpathnames && retval == 0) {
+ _pathnames = new char*[_tpathnames];
+ for (int i = 0; i < _tpathnames; i++) {
+ _pathnames[i] = new char[strlen(fnfc.filename(i))+1];
+ strcpy(_pathnames[i], fnfc.filename(i));
+ }
+ }
+ return retval;
+ }
+ break;
case Fl_Native_File_Chooser::BROWSE_DIRECTORY:
- case Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY: // not supported
option = "--getexistingdirectory";
break;