comparison libgui/src/m-editor/file-editor-tab.cc @ 15982:131d40cd805b

gui: cleanup some string constants for translations * file-editor.h: deleted constants for file filters and name for new files * file-editor.cc (request_open_file): translate file filter in open dialog * file-editor.cc (request_new_file): create new edit tab with empty title because the title is updated later * file-editor-tab.cc (update_window_title): translate unnamed title * file-editor-tab.cc (save_file_as): translate file filter, shorter warning message when new file name is the same as the current one
author Torsten <ttl@justmail.de>
date Sun, 27 Jan 2013 22:22:19 +0100
parents e3873531dd7c
children 1eb3c67139f6
comparison
equal deleted inserted replaced
15981:e3873531dd7c 15982:131d40cd805b
657 void 657 void
658 file_editor_tab::update_window_title (bool modified) 658 file_editor_tab::update_window_title (bool modified)
659 { 659 {
660 QString title (""); 660 QString title ("");
661 if (_file_name.isEmpty () || _file_name.at (_file_name.count () - 1) == '/') 661 if (_file_name.isEmpty () || _file_name.at (_file_name.count () - 1) == '/')
662 title = UNNAMED_FILE; 662 title = tr("<unnamed>");
663 else 663 else
664 { 664 {
665 if ( _long_title ) 665 if ( _long_title )
666 title = _file_name; 666 title = _file_name;
667 else 667 else
864 // The file name is actually the directory name from the 864 // The file name is actually the directory name from the
865 // constructor argument. 865 // constructor argument.
866 fileDialog->setDirectory (_file_name); 866 fileDialog->setDirectory (_file_name);
867 } 867 }
868 } 868 }
869 fileDialog->setNameFilter (SAVE_FILE_FILTER); 869 fileDialog->setNameFilter (tr("Octave Files (*.m);;All Files (*.*)"));
870 fileDialog->setDefaultSuffix ("m"); 870 fileDialog->setDefaultSuffix ("m");
871 fileDialog->setAcceptMode (QFileDialog::AcceptSave); 871 fileDialog->setAcceptMode (QFileDialog::AcceptSave);
872 fileDialog->setViewMode (QFileDialog::Detail); 872 fileDialog->setViewMode (QFileDialog::Detail);
873 if (remove_on_success) 873 if (remove_on_success)
874 { 874 {
895 // selected the same name not intending to overwrite. 895 // selected the same name not intending to overwrite.
896 896
897 // Create a NonModal message about error. 897 // Create a NonModal message about error.
898 QMessageBox* msgBox = new QMessageBox ( 898 QMessageBox* msgBox = new QMessageBox (
899 QMessageBox::Critical, tr ("Octave Editor"), 899 QMessageBox::Critical, tr ("Octave Editor"),
900 tr ("File not saved! You've selected a file name\n\n %1\n\nwhich is the same as the current file name. Use ""Save"" to overwrite. (Could allow overwriting, with message, if that is what folks want.)"). 900 tr ("File not saved! The selected file name\n%1\n"
901 "is the same as the current file name").
901 arg (saveFileName), 902 arg (saveFileName),
902 QMessageBox::Ok, 0); 903 QMessageBox::Ok, 0);
903 msgBox->setWindowModality (Qt::NonModal); 904 msgBox->setWindowModality (Qt::NonModal);
904 msgBox->setAttribute (Qt::WA_DeleteOnClose); 905 msgBox->setAttribute (Qt::WA_DeleteOnClose);
905 msgBox->show (); 906 msgBox->show ();