From b3545aede4d670a4fee1d4655724a667e268d869 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 27 Feb 2005 16:50:04 +0000 Subject: [PATCH] Allow multiple files to be selected when adding files and attachments. --- src/mmg/tab_attachments.cpp | 9 +++++++-- src/mmg/tab_input.cpp | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/mmg/tab_attachments.cpp b/src/mmg/tab_attachments.cpp index 4e2706efb..2208fc4cb 100644 --- a/src/mmg/tab_attachments.cpp +++ b/src/mmg/tab_attachments.cpp @@ -140,11 +140,16 @@ tab_attachments::enable(bool e) { void tab_attachments::on_add_attachment(wxCommandEvent &evt) { wxFileDialog dlg(NULL, wxT("Choose an attachment file"), last_open_dir, - wxT(""), wxT(ALLFILES), wxOPEN); + wxT(""), wxT(ALLFILES), wxOPEN | wxMULTIPLE); if(dlg.ShowModal() == wxID_OK) { + wxArrayString files; + int i; + last_open_dir = dlg.GetDirectory(); - add_attachment(dlg.GetPath()); + dlg.GetPaths(files); + for (i = 0; i < files.Count(); i++) + add_attachment(files[i]); } } diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index b45b2c8d0..08655c174 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -712,11 +712,16 @@ tab_input::select_file(bool append) { wxFileDialog dlg(NULL, append ? wxT("Choose an input file to add") : wxT("Chose an input file to append"), - last_open_dir, wxT(""), media_files, wxOPEN); + last_open_dir, wxT(""), media_files, wxOPEN | wxMULTIPLE); if(dlg.ShowModal() == wxID_OK) { + wxArrayString files; + int i; + last_open_dir = dlg.GetDirectory(); - add_file(dlg.GetPath(), append); + dlg.GetPaths(files); + for (i = 0; i < files.Count(); i++) + add_file(files[i], append); } } @@ -771,8 +776,8 @@ tab_input::add_file(const wxString &file_name, result = wxExecute(command, output, errors); wxRemoveFile(opt_file_name); if ((result < 0) || (result > 1)) { - name.Printf(wxT("File identification failed. Return code: %d\n\n"), - result); + name.Printf(wxT("File identification failed for '%s'. Return code: " + "%d\n\n"), file_name.c_str(), result); for (i = 0; i < output.Count(); i++) name += break_line(output[i]) + wxT("\n"); name += wxT("\n");