Enhancement of all file save dialogs. Committed on behalf of Sankey, issue 1314
This commit is contained in:
@@ -295,13 +295,14 @@ void CurveEditorGroup::setUnChanged (bool uc, CurveEditor* ce) {
|
||||
}
|
||||
|
||||
CurveEditorSubGroup::CurveEditorSubGroup(Glib::ustring& curveDir) :
|
||||
curveDir(curveDir) {
|
||||
curveDir(curveDir), lastFilename("") {
|
||||
}
|
||||
|
||||
Glib::ustring CurveEditorSubGroup::outputFile () {
|
||||
|
||||
Gtk::FileChooserDialog dialog(M("CURVEEDITOR_SAVEDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_SAVE);
|
||||
FileChooserLastFolderPersister persister(&dialog, curveDir);
|
||||
dialog.set_current_name (lastFilename);
|
||||
|
||||
dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL);
|
||||
dialog.add_button(Gtk::StockID("gtk-save"), Gtk::RESPONSE_APPLY);
|
||||
@@ -316,33 +317,22 @@ Glib::ustring CurveEditorSubGroup::outputFile () {
|
||||
filter_any.add_pattern("*");
|
||||
dialog.add_filter(filter_any);
|
||||
|
||||
dialog.set_do_overwrite_confirmation (true);
|
||||
//dialog.set_do_overwrite_confirmation (true);
|
||||
|
||||
Glib::ustring fname;
|
||||
Glib::ustring fname;
|
||||
do {
|
||||
int result = dialog.run();
|
||||
|
||||
fname = dialog.get_filename();
|
||||
|
||||
if (result==Gtk::RESPONSE_APPLY) {
|
||||
|
||||
if (getExtension (fname)!="rtc")
|
||||
fname = fname + ".rtc";
|
||||
|
||||
if (safe_file_test (fname, Glib::FILE_TEST_EXISTS)) {
|
||||
Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": " + M("MAIN_MSG_ALREADYEXISTS") + "\n" + M("MAIN_MSG_QOVERWRITE") + "</b>";
|
||||
Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
|
||||
int response = msgd.run ();
|
||||
if (response==Gtk::RESPONSE_YES)
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else {
|
||||
fname = "";
|
||||
break;
|
||||
}
|
||||
if (dialog.run() == Gtk::RESPONSE_APPLY) {
|
||||
fname = dialog.get_filename();
|
||||
if (getExtension (fname) != "rtc")
|
||||
fname += ".rtc";
|
||||
if (confirmOverwrite (dialog, fname)) {
|
||||
lastFilename = Glib::path_get_basename (fname);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fname = "";
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return fname;
|
||||
|
Reference in New Issue
Block a user