Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor-tab.cc @ 18082:c3e7da9836bd stable
allow saving an editor file as the current one (bug #40759)
* file-editor-tab.cc (handle_save_file_as_answer): just save the file if the
selected file name is the same as the current file name
(handle_save_file_as_answer_close): removed the case that the selected file
name is the same as the current one because the latter is not valid here
(message_duplicate_file_name): removed message since not needed anymore
* file-editor-tab.h: removed message_duplicate_file_name
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 05 Dec 2013 06:49:48 +0100 |
parents | a761ba02a52f |
children | f26d527c1a71 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -1158,31 +1158,12 @@ } void -file_editor_tab::message_duplicate_file_name (const QString& saveFileName) -{ - // Could overwrite the file here (and tell user the file was - // overwritten), but the user could have unintentionally - // selected the same name not intending to overwrite. - - // Create a NonModal message about error. - QMessageBox* msgBox - = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), - tr ("File not saved! The selected file name\n%1\n" - "is the same as the current file name"). - arg (saveFileName), - QMessageBox::Ok, 0); - - show_dialog (msgBox); -} - -void file_editor_tab::handle_save_file_as_answer (const QString& saveFileName) { if (saveFileName == _file_name) { - message_duplicate_file_name (saveFileName); - // Nothing done, allow editing again. - _edit_area->setReadOnly (false); + // same name as actual file, save it as "save" would do + save_file (saveFileName); } else { @@ -1194,17 +1175,11 @@ void file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName) { - if (saveFileName == _file_name) - { - message_duplicate_file_name (saveFileName); - // Nothing done, allow editing again. - _edit_area->setReadOnly (false); - } - else - { - // Have editor check for conflict, delete tab after save. - emit editor_check_conflict_save (saveFileName, true); - } + // saveFileName == _file_name can not happen, because we only can get here + // when we close a tab and _file_name is not a valid file name yet + + // Have editor check for conflict, delete tab after save. + emit editor_check_conflict_save (saveFileName, true); } void