diff options
| author | Greg Ercolano <erco@seriss.com> | 2020-07-10 21:49:00 -0700 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-14 12:52:56 +0200 |
| commit | 0693c70f577624e66fd660a888f2d2bcd3fc180b (patch) | |
| tree | e3b4161c0516ebacaf84e9b58852f48d4e4b6357 /src/Fl_File_Chooser2.cxx | |
| parent | 9925b0f12852dc37fb7fb773a525486c258d2c62 (diff) | |
First pass at fixing issue 99
A lot of code touched because low level functions needed to pass up
error messages reliably, and this had to propagate up the entire
driver hierarchy.
Tested OK *in English* on:
> Linux
> OSX 10.10.x
> Windows VS2017
> Windows mingw64
I have no way to test on Android, but it might work.
TODO: Needs testing in other languages to verify proper UTF8 error messages,
esp. with Windows VS, due to complexities with FormatMessage() -- see get_ms_errmsg()
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index de2b7c160..ec04bd77c 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -1020,17 +1020,15 @@ void Fl_File_Chooser::preview(int e) Fl_Group *p = previewBox->parent(); if (e) { int w = p->w() * 2 / 3; - fileList->resize(fileList->x(), fileList->y(), - w, fileList->h()); - previewBox->resize(fileList->x()+w, previewBox->y(), - p->w()-w, previewBox->h()); + fileList->resize(fileList->x(), fileList->y(), w, fileList->h()); + errorBox->resize(errorBox->x(), errorBox->y(), w, errorBox->h()); + previewBox->resize(fileList->x()+w, previewBox->y(), p->w()-w, previewBox->h()); previewBox->show(); update_preview(); } else { - fileList->resize(fileList->x(), fileList->y(), - p->w(), fileList->h()); - previewBox->resize(p->x()+p->w(), previewBox->y(), - 0, previewBox->h()); + fileList->resize(fileList->x(), fileList->y(), p->w(), fileList->h()); + errorBox->resize(errorBox->x(), errorBox->y(), p->w(), errorBox->h()); + previewBox->resize(p->x()+p->w(), previewBox->y(), 0, previewBox->h()); previewBox->hide(); } p->init_sizes(); @@ -1070,7 +1068,14 @@ Fl_File_Chooser::rescan() okButton->deactivate(); // Build the file list... - fileList->load(directory_, sort); + if ( fileList->load(directory_, sort) <= 0 ) { + if ( fileList->errmsg() ) errorBox->label(fileList->errmsg()); // show OS errormsg when possible + else errorBox->label("No files found..."); + show_error_box(1); + } else { + show_error_box(0); + } + if (Fl::system_driver()->dot_file_hidden() && !showHiddenButton->value()) remove_hidden_files(); // Update the preview box... update_preview(); @@ -1094,7 +1099,13 @@ void Fl_File_Chooser::rescan_keep_filename() strlcpy(pathname, fn, sizeof(pathname)); // Build the file list... - fileList->load(directory_, sort); + if (fileList->load(directory_, sort) <= 0) { + if ( fileList->errmsg() ) errorBox->label(fileList->errmsg()); // show OS errormsg when possible + else errorBox->label("No files found..."); + show_error_box(1); + } else { + show_error_box(0); + } if (Fl::system_driver()->dot_file_hidden() && !showHiddenButton->value()) remove_hidden_files(); // Update the preview box... update_preview(); |
