changeset 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 200dab2eecd4
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h
diffstat 3 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sun Jan 27 15:50:49 2013 +0100
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sun Jan 27 22:22:19 2013 +0100
@@ -659,7 +659,7 @@
 {
   QString title ("");
   if (_file_name.isEmpty () || _file_name.at (_file_name.count () - 1) == '/')
-    title = UNNAMED_FILE;
+    title = tr("<unnamed>");
   else
     {
       if ( _long_title )
@@ -866,7 +866,7 @@
           fileDialog->setDirectory (_file_name);
         }
     }
-  fileDialog->setNameFilter (SAVE_FILE_FILTER);
+  fileDialog->setNameFilter (tr("Octave Files (*.m);;All Files (*.*)"));
   fileDialog->setDefaultSuffix ("m");
   fileDialog->setAcceptMode (QFileDialog::AcceptSave);
   fileDialog->setViewMode (QFileDialog::Detail);
@@ -897,7 +897,8 @@
   // Create a NonModal message about error.
   QMessageBox* msgBox = new QMessageBox (
           QMessageBox::Critical, tr ("Octave Editor"),
-          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.)").
+          tr ("File not saved! The selected file name\n%1\n"
+              "is the same as the current file name").
           arg (saveFileName),
           QMessageBox::Ok, 0);
   msgBox->setWindowModality (Qt::NonModal);
--- a/libgui/src/m-editor/file-editor.cc	Sun Jan 27 15:50:49 2013 +0100
+++ b/libgui/src/m-editor/file-editor.cc	Sun Jan 27 22:22:19 2013 +0100
@@ -110,8 +110,8 @@
   file_editor_tab *fileEditorTab = new file_editor_tab (ced);
   if (fileEditorTab)
     {
-      add_file_editor_tab (fileEditorTab, UNNAMED_FILE);
-      fileEditorTab->new_file ();
+      add_file_editor_tab (fileEditorTab, "");  // new tab with empty title
+      fileEditorTab->new_file ();               // title is updated here
     }
 }
 
@@ -124,7 +124,7 @@
 
   // Create a NonModal message.
   QFileDialog* fileDialog = new QFileDialog (this);
-  fileDialog->setNameFilter (SAVE_FILE_FILTER);
+  fileDialog->setNameFilter (tr("Octave Files (*.m);;All Files (*.*)"));
   fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
   fileDialog->setViewMode (QFileDialog::Detail);
   fileDialog->setDirectory (ced);
--- a/libgui/src/m-editor/file-editor.h	Sun Jan 27 15:50:49 2013 +0100
+++ b/libgui/src/m-editor/file-editor.h	Sun Jan 27 22:22:19 2013 +0100
@@ -33,8 +33,6 @@
 #include "file-editor-interface.h"
 #include "file-editor-tab.h"
 
-const char UNNAMED_FILE[]     = "<unnamed>";
-const char SAVE_FILE_FILTER[] = "Octave Files (*.m);;All Files (*.*)";
 enum editor_markers
   {
     bookmark,