+2013-04-24 Carl Hetherington <cth@carlh.net>
+
+ * Allow use of existing empty directories for new films (without
+ confirmation) and existing non-empty directories (with confirmation)
+ (#124).
+
2013-04-26 Carl Hetherington <cth@carlh.net>
* Version 0.87 released.
if (r == wxID_OK) {
- if (boost::filesystem::exists (d->get_path())) {
- error_dialog (this, std_to_wx (String::compose (wx_to_std (_("The directory %1 already exists.")), d->get_path().c_str())));
- return;
+ if (boost::filesystem::exists (d->get_path()) && !boost::filesystem::is_empty(d->get_path())) {
+ if (!confirm_dialog (
+ this,
+ std_to_wx (
+ String::compose (wx_to_std (_("The directory %1 already exists and is not empty. "
+ "Are you sure you want to use it?")),
+ d->get_path().c_str())
+ )
+ )) {
+ return;
+ }
}
maybe_save_then_delete_film ();
d->Destroy ();
}
+bool
+confirm_dialog (wxWindow* parent, wxString m)
+{
+ wxMessageDialog* d = new wxMessageDialog (parent, m, _("DVD-o-matic"), wxYES_NO | wxICON_QUESTION);
+ int const r = d->ShowModal ();
+ d->Destroy ();
+ return r == wxID_YES;
+}
+
+
/** @param s wxWidgets string.
* @return Corresponding STL string.
*/
*/
extern void error_dialog (wxWindow *, wxString);
+extern bool confirm_dialog (wxWindow *, wxString);
extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, int prop = 0);
extern wxStaticText* add_label_to_grid_bag_sizer (wxGridBagSizer *, wxWindow *, wxString, wxGBPosition, wxGBSpan span = wxDefaultSpan);
extern std::string wx_to_std (wxString);