]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbconfigfileeditor.cpp
Fix my errors in specifying the configuration defaults:
[bacula/bacula] / bacula / src / wx-console / wxbconfigfileeditor.cpp
index 803fde57e13cf8817d4a635df981ba4ceddca331..8d8481c18b21c85f1de8cbee6534e956af4b37ed 100644 (file)
@@ -7,21 +7,18 @@
  *    Version $Id$
  */
 /*
-   Copyright (C) 2004 Kern Sibbald and John Walker
+   Copyright (C) 2004-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2
-   of the License, or (at your option) any later version.
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
 #include "wxbconfigfileeditor.h"
@@ -41,7 +38,7 @@ BEGIN_EVENT_TABLE(wxbConfigFileEditor, wxDialog)
 END_EVENT_TABLE()
 
 wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename):
-      wxDialog(parent, -1, wxT("Config file editor"), wxDefaultPosition, wxSize(500, 300),
+      wxDialog(parent, -1, _("Config file editor"), wxDefaultPosition, wxSize(500, 300),
                    wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
    this->filename = filename;
    
@@ -57,8 +54,8 @@ wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename):
    mainSizer->AddGrowableRow(0);
    
    wxBoxSizer *bottomsizer = new wxBoxSizer(wxHORIZONTAL);
-   bottomsizer->Add(new wxButton(this, Save, wxT("Save and close")), 0, wxALL, 10);
-   bottomsizer->Add(new wxButton(this, Quit, wxT("Close without saving")), 0, wxALL, 10);
+   bottomsizer->Add(new wxButton(this, Save, _("Save and close")), 0, wxALL, 10);
+   bottomsizer->Add(new wxButton(this, Quit, _("Close without saving")), 0, wxALL, 10);
    
    mainSizer->Add(textCtrl, 1, wxEXPAND);
    mainSizer->Add(bottomsizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL);
@@ -69,7 +66,7 @@ wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename):
    
    if (!filen.FileExists()) {
       (*textCtrl) << wxT("#\n");
-      (*textCtrl) << wxT("# Bacula wx-console Configuration File\n");
+      (*textCtrl) << _("# Bacula wx-console Configuration File\n");
       (*textCtrl) << wxT("#\n");
       (*textCtrl) << wxT("\n");
       (*textCtrl) << wxT("Director {\n");
@@ -81,11 +78,11 @@ wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename):
    }
    else {
       wxFile file(filename);
-      wxChar buffer[2049];
+      char buffer[2049];
       off_t len;
       while ((len = file.Read(buffer, 2048)) > -1) {
-         buffer[len] = (wxChar)0;
-         (*textCtrl) << buffer;
+         buffer[len] = 0;
+         (*textCtrl) << wxString(buffer,wxConvLocal);
          if (file.Eof())
             break;
       }
@@ -100,13 +97,14 @@ wxbConfigFileEditor::~wxbConfigFileEditor() {
 void wxbConfigFileEditor::OnSave(wxCommandEvent& event) {
    wxFile file(filename, wxFile::write);
    if (!file.IsOpened()) {
-      wxMessageBox(wxString(wxT("Unable to write to ")) << filename << wxT("\n"), wxT("Error while saving"),
+      wxMessageBox(wxString::Format(_("Unable to write to %s\n"), filename.c_str()),
+                        _("Error while saving"),
                         wxOK | wxICON_ERROR, this);
       EndModal(wxCANCEL);
       return;
    }
    
-   file.Write(textCtrl->GetValue());
+   file.Write(textCtrl->GetValue(),wxConvLocal);
    
    file.Flush();
    file.Close();