From 5afded630aad7c0b40d795de41bc11be314df77d Mon Sep 17 00:00:00 2001 From: Thorsten Engel Date: Fri, 13 May 2005 14:38:17 +0000 Subject: [PATCH] added win32 unicode support for wx-console (compile with _UNICODE) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2025 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/win32/compat/compat.h | 3 + bacula/src/wx-console/console_thread.cpp | 38 +- bacula/src/wx-console/csprint.h | 3 + bacula/src/wx-console/main.cpp | 14 +- bacula/src/wx-console/wxbconfigfileeditor.cpp | 30 +- bacula/src/wx-console/wxbconfigpanel.cpp | 32 +- bacula/src/wx-console/wxbconfigpanel.h | 14 +- bacula/src/wx-console/wxbhistorytextctrl.cpp | 24 +- bacula/src/wx-console/wxbhistorytextctrl.h | 2 +- bacula/src/wx-console/wxbmainframe.cpp | 167 +++--- bacula/src/wx-console/wxbrestorepanel.cpp | 492 +++++++++--------- bacula/src/wx-console/wxbtableparser.cpp | 2 +- bacula/src/wx-console/wxbutils.cpp | 52 +- 13 files changed, 446 insertions(+), 427 deletions(-) diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 47276f227f..7a2eb7de43 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -168,6 +168,8 @@ int gettimeofday(struct timeval *, struct timezone *); #define ETIMEDOUT 55 #ifndef HAVE_MINGW + +#ifndef _STAT_DEFINED struct stat { _dev_t st_dev; @@ -184,6 +186,7 @@ struct stat uint32_t st_blksize; uint64_t st_blocks; }; +#endif #undef S_IFMT #define S_IFMT 0170000 /* file type mask */ diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index b47bc35b11..98536f1982 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -50,7 +50,7 @@ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons); bool console_thread::inited = false; bool console_thread::configloaded = false; -wxString console_thread::working_dir = "."; +wxString console_thread::working_dir = wxT("."); void console_thread::SetWorkingDirectory(wxString w_dir) { if ((w_dir.Last() == '/') || (w_dir.Last() == '\\')) { @@ -71,7 +71,7 @@ void console_thread::InitLib() { init_stack_dump(); my_name_is(0, NULL, "wx-console"); //textdomain("bacula-console"); - working_directory = console_thread::working_dir; + working_directory = (const char*) console_thread::working_dir.GetData(); inited = true; } @@ -94,7 +94,7 @@ static void scan_err(const char *file, int line, LEX *lc, const char *msg, ...) va_list arg_ptr; char buf[MAXSTRING]; char more[MAXSTRING]; - char err[MAXSTRING]; + wxString err; va_start(arg_ptr, msg); bvsnprintf(buf, sizeof(buf), msg, arg_ptr); @@ -106,9 +106,10 @@ static void scan_err(const char *file, int line, LEX *lc, const char *msg, ...) } else { more[0] = 0; } - bsnprintf(err, sizeof(err), _("Config error: %s\n" -" : line %d, col %d of file %s\n%s\n%s"), + + err.Format(wxT("Config error: %s\n : line %d, col %d of file %s\n%s\n%s"), buf, lc->line_no, lc->col_no, lc->fname, lc->line, more); + errmsg << err; } @@ -116,7 +117,7 @@ wxString console_thread::LoadConfig(wxString configfile) { if (!inited) { InitLib(); if (!inited) - return "Error while initializing library."; + return wxT("Error while initializing library."); } free_config_resources(); @@ -132,22 +133,22 @@ wxString console_thread::LoadConfig(wxString configfile) { } init_msg(NULL, msgs); - init_console_msg(console_thread::working_dir); + init_console_msg(console_thread::working_dir.mb_str(*wxConvCurrent)); - errmsg = ""; - if (!parse_config(configfile.c_str(), &scan_err)) { + errmsg = wxT(""); + if (!parse_config(configfile.mb_str(*wxConvCurrent), &scan_err)) { configloaded = false; term_msg(); return errmsg; } term_msg(); - wxRemoveFile(console_thread::working_dir + "/wx-console.conmsg"); + wxRemoveFile(console_thread::working_dir + wxT("/wx-console.conmsg")); init_msg(NULL, NULL); configloaded = true; - return ""; + return wxT(""); } // class constructor @@ -225,13 +226,13 @@ void* console_thread::Entry() { csprint("Multiple directors found in your config file.\n"); for (int i = 0; i < count; i++) { if (i < 9) { - csprint(wxString(" ") << (i+1) << ": " << res[i]->hdr.name << "\n"); + csprint(wxString(wxT(" ")) << (i+1) << wxT(": ") << wxString(res[i]->hdr.name,*wxConvCurrent) << wxT("\n")); } else { - csprint(wxString(" ") << (i+1) << ": " << res[i]->hdr.name << "\n"); + csprint(wxString(wxT(" ")) << (i+1) << wxT(": ") << wxString(res[i]->hdr.name,*wxConvCurrent) << wxT("\n")); } } - csprint(wxString("Please choose a director (1-") << count << ") : "); + csprint(wxString(wxT("Please choose a director (1-")) << count << wxT(") : "),CS_DATA); csprint(NULL, CS_PROMPT); choosingdirector = true; directorchoosen = -1; @@ -344,10 +345,13 @@ void console_thread::Write(const char* str) { bnet_send(UA_sock); } else if (choosingdirector) { - wxString number = str; - number.RemoveLast(); /* Removes \n */ + +// wxString number = str; +// number.RemoveLast(); /* Removes \n */ long val; - if (number.ToLong(&val)) { + +// if (number.ToLong(&val)) { + if (val = atol(str)) { directorchoosen = (int)val; } else { diff --git a/bacula/src/wx-console/csprint.h b/bacula/src/wx-console/csprint.h index 6ee61cbd28..c5ff664ab1 100644 --- a/bacula/src/wx-console/csprint.h +++ b/bacula/src/wx-console/csprint.h @@ -38,6 +38,9 @@ #define CS_TERMINATED 99 /* used to signal that the thread is terminated */ /* function called by console_thread to send events back to the GUI */ +class wxString; + void csprint(const char* str, int status=CS_DATA); +void csprint(wxString str, int status=CS_DATA); #endif diff --git a/bacula/src/wx-console/main.cpp b/bacula/src/wx-console/main.cpp index 0b38fb7892..443720c58e 100644 --- a/bacula/src/wx-console/main.cpp +++ b/bacula/src/wx-console/main.cpp @@ -72,10 +72,10 @@ bool MyApp::OnInit() long posx, posy, sizex, sizey; int displayx, displayy; InitWinAPIWrapper(); - wxConfig::Get()->Read("/Position/X", &posx, 50); - wxConfig::Get()->Read("/Position/Y", &posy, 50); - wxConfig::Get()->Read("/Size/Width", &sizex, 780); - wxConfig::Get()->Read("/Size/Height", &sizey, 500); + wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50); + wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50); + wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780); + wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500); wxDisplaySize(&displayx, &displayy); @@ -92,14 +92,14 @@ bool MyApp::OnInit() } } - wxbMainFrame *frame = wxbMainFrame::CreateInstance(_T("Bacula wx-console"), + wxbMainFrame *frame = wxbMainFrame::CreateInstance(wxT("Bacula wx-console"), wxPoint(posx, posy), wxSize(sizex, sizey)); frame->Show(TRUE); - frame->Print(wxString("Welcome to bacula wx-console ") << VERSION << " (" << BDATE << ")!\n", CS_DEBUG); + frame->Print(wxString(wxT("Welcome to bacula wx-console ")) << wxT(VERSION) << wxT(" (") << wxT(BDATE) << wxT(")!\n"), CS_DEBUG); - frame->StartConsoleThread(""); + frame->StartConsoleThread(wxT("")); return TRUE; } diff --git a/bacula/src/wx-console/wxbconfigfileeditor.cpp b/bacula/src/wx-console/wxbconfigfileeditor.cpp index f6257083e0..803fde57e1 100644 --- a/bacula/src/wx-console/wxbconfigfileeditor.cpp +++ b/bacula/src/wx-console/wxbconfigfileeditor.cpp @@ -41,11 +41,11 @@ BEGIN_EVENT_TABLE(wxbConfigFileEditor, wxDialog) END_EVENT_TABLE() wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename): - wxDialog(parent, -1, "Config file editor", wxDefaultPosition, wxSize(500, 300), + wxDialog(parent, -1, wxT("Config file editor"), wxDefaultPosition, wxSize(500, 300), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { this->filename = filename; - textCtrl = new wxTextCtrl(this,-1,"",wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_RICH | wxTE_DONTWRAP); + textCtrl = new wxTextCtrl(this,-1,wxT(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_RICH | wxTE_DONTWRAP); wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL); #if defined __WXGTK12__ && !defined __WXGTK20__ // Fix for "chinese" fonts under gtk+ 1.2 font.SetDefaultEncoding(wxFONTENCODING_ISO8859_1); @@ -57,8 +57,8 @@ wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename): mainSizer->AddGrowableRow(0); wxBoxSizer *bottomsizer = new wxBoxSizer(wxHORIZONTAL); - bottomsizer->Add(new wxButton(this, Save, "Save and close"), 0, wxALL, 10); - bottomsizer->Add(new wxButton(this, Quit, "Close without saving"), 0, wxALL, 10); + 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); mainSizer->Add(textCtrl, 1, wxEXPAND); mainSizer->Add(bottomsizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL); @@ -68,16 +68,16 @@ wxbConfigFileEditor::wxbConfigFileEditor(wxWindow* parent, wxString filename): wxFileName filen(filename); if (!filen.FileExists()) { - (*textCtrl) << "#\n"; - (*textCtrl) << "# Bacula wx-console Configuration File\n"; - (*textCtrl) << "#\n"; - (*textCtrl) << "\n"; - (*textCtrl) << "Director {\n"; - (*textCtrl) << " Name = -dir\n"; - (*textCtrl) << " DIRport = 9101\n"; - (*textCtrl) << " address = \n"; - (*textCtrl) << " Password = \"\"\n"; - (*textCtrl) << "}\n"; + (*textCtrl) << wxT("#\n"); + (*textCtrl) << wxT("# Bacula wx-console Configuration File\n"); + (*textCtrl) << wxT("#\n"); + (*textCtrl) << wxT("\n"); + (*textCtrl) << wxT("Director {\n"); + (*textCtrl) << wxT(" Name = -dir\n"); + (*textCtrl) << wxT(" DIRport = 9101\n"); + (*textCtrl) << wxT(" address = \n"); + (*textCtrl) << wxT(" Password = \"\"\n"); + (*textCtrl) << wxT("}\n"); } else { wxFile file(filename); @@ -100,7 +100,7 @@ wxbConfigFileEditor::~wxbConfigFileEditor() { void wxbConfigFileEditor::OnSave(wxCommandEvent& event) { wxFile file(filename, wxFile::write); if (!file.IsOpened()) { - wxMessageBox(wxString("Unable to write to ") << filename << "\n", "Error while saving", + wxMessageBox(wxString(wxT("Unable to write to ")) << filename << wxT("\n"), wxT("Error while saving"), wxOK | wxICON_ERROR, this); EndModal(wxCANCEL); return; diff --git a/bacula/src/wx-console/wxbconfigpanel.cpp b/bacula/src/wx-console/wxbconfigpanel.cpp index 1b5bc8d903..80c039a489 100644 --- a/bacula/src/wx-console/wxbconfigpanel.cpp +++ b/bacula/src/wx-console/wxbconfigpanel.cpp @@ -65,7 +65,7 @@ wxbConfigParam::~wxbConfigParam() { } void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) { - sizer->Add(new wxStaticText(parent, -1, title + ": ", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 0, wxALIGN_CENTER_VERTICAL); + sizer->Add(new wxStaticText(parent, -1, title + wxT(": "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 0, wxALIGN_CENTER_VERTICAL); switch (type) { case text: statictext = new wxStaticText(parent, -1, value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); @@ -94,16 +94,16 @@ wxString wxbConfigParam::GetTitle() { wxString wxbConfigParam::GetValue() { switch (type) { case text: - return (statictext != NULL) ? statictext->GetLabel() : wxString(""); + return (statictext != NULL) ? statictext->GetLabel() : wxString(wxT("")); break; case modifiableText: - return (textctrl != NULL) ? textctrl->GetValue() : wxString(""); + return (textctrl != NULL) ? textctrl->GetValue() : wxString(wxT("")); break; case choice: - return (choicectrl != NULL) ? choicectrl->GetStringSelection() : wxString(""); + return (choicectrl != NULL) ? choicectrl->GetStringSelection() : wxString(wxT("")); break; } - return ""; + return wxT(""); } void wxbConfigParam::SetValue(wxString str) { @@ -180,18 +180,18 @@ wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString tit wxBoxSizer* restoreBottomSizer = new wxBoxSizer(wxHORIZONTAL); - cfgOk = new wxButton(this, ok, "OK", wxDefaultPosition, wxSize(70, 25)); + cfgOk = new wxButton(this, ok, wxT("OK"), wxDefaultPosition, wxSize(70, 25)); restoreBottomSizer->Add(cfgOk, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, 10); if (apply != -1) { - cfgApply = new wxButton(this, apply, "Apply", wxDefaultPosition, wxSize(70, 25)); + cfgApply = new wxButton(this, apply, wxT("Apply"), wxDefaultPosition, wxSize(70, 25)); restoreBottomSizer->Add(cfgApply, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 10); } else { cfgApply = NULL; } - cfgCancel = new wxButton(this, cancel, "Cancel", wxDefaultPosition, wxSize(70, 25)); + cfgCancel = new wxButton(this, cancel, wxT("Cancel"), wxDefaultPosition, wxSize(70, 25)); restoreBottomSizer->Add(cfgCancel, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); mainSizer->Add(restoreBottomSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -206,29 +206,29 @@ wxbConfigPanel::~wxbConfigPanel() { delete config; } -void wxbConfigPanel::SetRowString(const char* title, wxString value) { +void wxbConfigPanel::SetRowString(const wxChar* title, wxString value) { int i; if ((i = FindRow(title)) > -1) { (*config)[i].SetValue(value); } } -wxString wxbConfigPanel::GetRowString(const char* title) { +wxString wxbConfigPanel::GetRowString(const wxChar* title) { int i; if ((i = FindRow(title)) > -1) { return (*config)[i].GetValue(); } - return ""; + return wxT(""); } -void wxbConfigPanel::SetRowSelection(const char* title, int ind) { +void wxbConfigPanel::SetRowSelection(const wxChar* title, int ind) { int i; if ((i = FindRow(title)) > -1) { (*config)[i].SetIndex(ind); } } -int wxbConfigPanel::GetRowSelection(const char* title) { +int wxbConfigPanel::GetRowSelection(const wxChar* title) { int i; if ((i = FindRow(title)) > -1) { return (*config)[i].GetIndex(); @@ -236,21 +236,21 @@ int wxbConfigPanel::GetRowSelection(const char* title) { return -1; } -void wxbConfigPanel::ClearRowChoices(const char* title) { +void wxbConfigPanel::ClearRowChoices(const wxChar* title) { int i; if ((i = FindRow(title)) > -1) { (*config)[i].Clear(); } } -void wxbConfigPanel::AddRowChoice(const char* title, wxString value) { +void wxbConfigPanel::AddRowChoice(const wxChar* title, wxString value) { int i; if ((i = FindRow(title)) > -1) { (*config)[i].Add(value); } } -int wxbConfigPanel::FindRow(const char* title) { +int wxbConfigPanel::FindRow(const wxChar* title) { unsigned int i; for (i = last; i < config->GetCount(); i++) { diff --git a/bacula/src/wx-console/wxbconfigpanel.h b/bacula/src/wx-console/wxbconfigpanel.h index 6ba123b8be..bcbe1d39a7 100644 --- a/bacula/src/wx-console/wxbconfigpanel.h +++ b/bacula/src/wx-console/wxbconfigpanel.h @@ -85,13 +85,13 @@ public: wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString title, wxWindowID ok, wxWindowID cancel, wxWindowID apply = -1); ~wxbConfigPanel(); - void SetRowString(const char* title, wxString value); - wxString GetRowString(const char* title); - int GetRowSelection(const char* title); - void SetRowSelection(const char* title, int ind); + void SetRowString(const wxChar* title, wxString value); + wxString GetRowString(const wxChar* title); + int GetRowSelection(const wxChar* title); + void SetRowSelection(const wxChar* title, int ind); - void ClearRowChoices(const char* title); - void AddRowChoice(const char* title, wxString value); + void ClearRowChoices(const wxChar* title); + void AddRowChoice(const wxChar* title, wxString value); /* If enable is true, enables apply button, and disables ok button */ void EnableApply(bool enable = true); @@ -105,7 +105,7 @@ private: wxButton* cfgCancel; wxButton* cfgApply; - int FindRow(const char* title); + int FindRow(const wxChar* title); }; #endif diff --git a/bacula/src/wx-console/wxbhistorytextctrl.cpp b/bacula/src/wx-console/wxbhistorytextctrl.cpp index 10122cfc64..acb6e9a32e 100644 --- a/bacula/src/wx-console/wxbhistorytextctrl.cpp +++ b/bacula/src/wx-console/wxbhistorytextctrl.cpp @@ -41,7 +41,7 @@ wxbHistoryTextCtrl::wxbHistoryTextCtrl(wxStaticText* help, wxTE_PROCESS_ENTER, validator, name) { this->help = help; index = 0; - history.Add(""); + history.Add(wxT("")); } void wxbHistoryTextCtrl::AddCommand(wxString cmd, wxString description) { @@ -53,15 +53,15 @@ void wxbHistoryTextCtrl::ClearCommandList() { } void wxbHistoryTextCtrl::HistoryAdd(wxString cmd) { - if (cmd == "") return; + if (cmd == wxT("")) return; index = history.Count(); history[index-1] = cmd; - history.Add(""); + history.Add(wxT("")); } void wxbHistoryTextCtrl::SetValue(const wxString& value) { - if (value == "") { - help->SetLabel("Type your command below:"); + if (value == wxT("")) { + help->SetLabel(wxT("Type your command below:")); } wxTextCtrl::SetValue(value); } @@ -93,27 +93,27 @@ void wxbHistoryTextCtrl::OnKeyUp(wxKeyEvent& event) { SetInsertionPointEnd(); } } - else if (GetValue() != "") { + else if (GetValue() != wxT("")) { wxbCommands::iterator it; wxString key; - wxString helptext = "Unknown command."; + wxString helptext = wxT("Unknown command."); int found = 0; for( it = commands.begin(); it != commands.end(); ++it ) { if (it->first.Find(GetValue()) == 0) { found++; if (found > 2) { - helptext += " " + it->first; + helptext += wxT(" ") + it->first; } else if (found > 1) { - helptext = "Possible completions: " + key + " " + it->first; + helptext = wxT("Possible completions: ") + key + wxT(" ") + it->first; } else { // (found == 1) - helptext = it->first + ": " + it->second; + helptext = it->first + wxT(": ") + it->second; key = it->first; } } else if (GetValue().Find(it->first) == 0) { - helptext = it->first + ": " + it->second; + helptext = it->first + wxT(": ") + it->second; found = 0; break; } @@ -132,7 +132,7 @@ void wxbHistoryTextCtrl::OnKeyUp(wxKeyEvent& event) { } } else { - help->SetLabel("Type your command below:"); + help->SetLabel(wxT("Type your command below:")); event.Skip(); } } diff --git a/bacula/src/wx-console/wxbhistorytextctrl.h b/bacula/src/wx-console/wxbhistorytextctrl.h index 6c7478bee1..7a874f9a7b 100644 --- a/bacula/src/wx-console/wxbhistorytextctrl.h +++ b/bacula/src/wx-console/wxbhistorytextctrl.h @@ -41,7 +41,7 @@ WX_DECLARE_STRING_HASH_MAP( wxString, wxbCommands ); class wxbHistoryTextCtrl: public wxTextCtrl { public: wxbHistoryTextCtrl(wxStaticText* help, wxWindow* parent, wxWindowID id, - const wxString& value = "", const wxPoint& pos = wxDefaultPosition, + const wxString& value = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); diff --git a/bacula/src/wx-console/wxbmainframe.cpp b/bacula/src/wx-console/wxbmainframe.cpp index da875b1a96..2d0ce3a188 100644 --- a/bacula/src/wx-console/wxbmainframe.cpp +++ b/bacula/src/wx-console/wxbmainframe.cpp @@ -195,10 +195,10 @@ wxbMainFrame* wxbMainFrame::GetInstance() */ wxbMainFrame::~wxbMainFrame() { - wxConfig::Get()->Write("/Position/X", (long)GetPosition().x); - wxConfig::Get()->Write("/Position/Y", (long)GetPosition().y); - wxConfig::Get()->Write("/Size/Width", (long)GetSize().GetWidth()); - wxConfig::Get()->Write("/Size/Height", (long)GetSize().GetHeight()); + wxConfig::Get()->Write(wxT("/Position/X"), (long)GetPosition().x); + wxConfig::Get()->Write(wxT("/Position/Y"), (long)GetPosition().y); + wxConfig::Get()->Write(wxT("/Size/Width"), (long)GetSize().GetWidth()); + wxConfig::Get()->Write(wxT("/Size/Height"), (long)GetSize().GetHeight()); if (ct != NULL) { // && (!ct->IsRunning()) ct->Delete(); @@ -247,7 +247,8 @@ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSi #endif // wxUSE_MENUS CreateStatusBar(1); - SetStatusText(wxString("Welcome to bacula wx-console ") << VERSION << " (" << BDATE << ")!\n"); + + SetStatusText(wxString(wxT("Welcome to bacula wx-console ")) << wxString(wxT(VERSION)) << wxString (wxT(" (")) << wxString(wxT(BDATE)) << wxString(wxT(")!\n"))); wxPanel* global = new wxPanel(this, -1); @@ -256,9 +257,9 @@ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSi /* Console */ wxPanel* consolePanel = new wxPanel(notebook, -1); - notebook->AddPage(consolePanel, "Console"); + notebook->AddPage(consolePanel, wxT("Console")); - consoleCtrl = new wxTextCtrl(consolePanel,-1,"",wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH); + consoleCtrl = new wxTextCtrl(consolePanel,-1,wxT(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH); wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL); #if defined __WXGTK12__ && !defined __WXGTK20__ // Fix for "chinese" fonts under gtk+ 1.2 font.SetDefaultEncoding(wxFONTENCODING_ISO8859_1); @@ -268,14 +269,14 @@ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSi consoleCtrl->SetDefaultStyle(wxTextAttr(*wxBLACK, wxNullColour, font)); #endif - helpCtrl = new wxStaticText(consolePanel, -1, "Type your command below:"); + helpCtrl = new wxStaticText(consolePanel, -1, wxT("Type your command below:")); wxFlexGridSizer *consoleSizer = new wxFlexGridSizer(4, 1, 0, 0); consoleSizer->AddGrowableCol(0); consoleSizer->AddGrowableRow(0); - typeCtrl = new wxbHistoryTextCtrl(helpCtrl, consolePanel,TypeText,"",wxDefaultPosition,wxSize(200,20)); - sendButton = new wxButton(consolePanel, SendButton, "Send"); + typeCtrl = new wxbHistoryTextCtrl(helpCtrl, consolePanel,TypeText,wxT(""),wxDefaultPosition,wxSize(200,20)); + sendButton = new wxButton(consolePanel, SendButton, wxT("Send")); wxFlexGridSizer *typeSizer = new wxFlexGridSizer(1, 2, 0, 0); typeSizer->AddGrowableCol(0); @@ -324,9 +325,9 @@ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSi this->SetSize(size); EnableConsole(false); - consoleBuffer = ""; + consoleBuffer = wxT(""); - configfile = ""; + configfile = wxT(""); } /* @@ -348,32 +349,32 @@ void wxbMainFrame::StartConsoleThread(const wxString& config) { promptparser = new wxbPromptParser(); } - if (config == "") { - configfile = ""; + if (config == wxT("")) { + configfile = wxT(""); if (((wxTheApp->argc % 2) != 1)) { - Print("Error while parsing command line arguments, using defaults.\n", CS_DEBUG); - Print("Usage: wx-console [-c configfile] [-w tmp]\n", CS_DEBUG); + Print(wxT("Error while parsing command line arguments, using defaults.\n"), CS_DEBUG); + Print(wxT("Usage: wx-console [-c configfile] [-w tmp]\n"), CS_DEBUG); } else { for (int c = 1; c < wxTheApp->argc; c += 2) { - if ((wxTheApp->argc >= c+2) && (wxString(wxTheApp->argv[c]) == "-c")) { + if ((wxTheApp->argc >= c+2) && (wxString(wxTheApp->argv[c]) == wxT("-c"))) { configfile = wxTheApp->argv[c+1]; } - if ((wxTheApp->argc >= c+2) && (wxString(wxTheApp->argv[c]) == "-w")) { + if ((wxTheApp->argc >= c+2) && (wxString(wxTheApp->argv[c]) == wxT("-w"))) { console_thread::SetWorkingDirectory(wxTheApp->argv[c+1]); } if (wxTheApp->argv[c][0] != '-') { - Print("Error while parsing command line arguments, using defaults.\n", CS_DEBUG); - Print("Usage: wx-console [-c configfile] [-w tmp]\n", CS_DEBUG); + Print(wxT("Error while parsing command line arguments, using defaults.\n"), CS_DEBUG); + Print(wxT("Usage: wx-console [-c configfile] [-w tmp]\n"), CS_DEBUG); break; } } } - if (configfile == "") { - wxConfig::Set(new wxConfig("wx-console", "bacula")); - if (!wxConfig::Get()->Read("/ConfigFile", &configfile)) { + if (configfile == wxT("")) { + wxConfig::Set(new wxConfig(wxT("wx-console"), wxT("bacula"))); + if (!wxConfig::Get()->Read(wxT("/ConfigFile"), &configfile)) { #ifdef HAVE_MACOSX wxFileName filename(::wxGetHomeDir()); filename.MakeAbsolute(); @@ -382,20 +383,20 @@ void wxbMainFrame::StartConsoleThread(const wxString& config) { configfile += '/'; configfile += "Library/Preferences/org.bacula.wxconsole.conf"; #else - wxFileName filename(::wxGetCwd(), "wx-console.conf"); + wxFileName filename(::wxGetCwd(), wxT("wx-console.conf")); filename.MakeAbsolute(); configfile = filename.GetLongPath(); #ifdef HAVE_WIN32 - configfile.Replace("\\", "/"); + configfile.Replace(wxT("\\"), wxT("/")); #endif //HAVE_WIN32 #endif //HAVE_MACOSX - wxConfig::Get()->Write("/ConfigFile", configfile); + wxConfig::Get()->Write(wxT("/ConfigFile"), configfile); int answer = wxMessageBox( - wxString("It seems that it is the first time you run wx-console.\n") << - "This file (" << configfile << ") has been choosen as default configuration file.\n" << - "Do you want to edit it? (if you click No you will have to select another file)", - "First run", + wxString(wxT("It seems that it is the first time you run wx-console.\n")) << + wxString(wxT("This file (")) << configfile << wxString(wxT(") has been choosen as default configuration file.\n")) << + wxString(wxT("Do you want to edit it? (if you click No you will have to select another file)")), + wxT("First run"), wxYES_NO | wxICON_QUESTION, this); if (answer == wxYES) { wxbConfigFileEditor(this, configfile).ShowModal(); @@ -409,11 +410,11 @@ void wxbMainFrame::StartConsoleThread(const wxString& config) { wxString err = console_thread::LoadConfig(configfile); - while (err != "") { + while (err != wxT("")) { int answer = wxMessageBox( - wxString("Unable to read ") << configfile << "\n" << - err << "\nDo you want to choose another one? (Press no to edit this file)", - "Unable to read configuration file", + wxString(wxT("Unable to read ")) << configfile << wxString(wxT("\n")) << + err << wxString(wxT("\nDo you want to choose another one? (Press no to edit this file)")), + wxT("Unable to read configuration file"), wxYES_NO | wxCANCEL | wxICON_ERROR, this); if (answer == wxNO) { wxbConfigFileEditor(this, configfile).ShowModal(); @@ -425,7 +426,7 @@ void wxbMainFrame::StartConsoleThread(const wxString& config) { return; } else { // (answer == wxYES) - configfile = wxFileSelector("Please choose a configuration file to use"); + configfile = wxFileSelector(wxT("Please choose a configuration file to use")); if ( !configfile.empty() ) { err = console_thread::LoadConfig(configfile); } @@ -436,24 +437,25 @@ void wxbMainFrame::StartConsoleThread(const wxString& config) { } } - if ((err == "") && (config == "")) { + if ((err == wxT("")) && (config == wxT(""))) { answer = wxMessageBox( - "This configuration file has been successfully read, use it as default?", - "Configuration file read successfully", + wxT("This configuration file has been successfully read, use it as default?"), + wxT("Configuration file read successfully"), wxYES_NO | wxICON_QUESTION, this); if (answer == wxYES) { - wxConfigBase::Get()->Write("/ConfigFile", configfile); + wxConfigBase::Get()->Write(wxT("/ConfigFile"), configfile); } break; } } - csprint(wxString("Using this configuration file: ") << configfile << "\n", CS_DEBUG); + // former was csprint + Print(wxString(wxT("Using this configuration file: ")) << configfile << wxT("\n"), CS_DEBUG); ct = new console_thread(); ct->Create(); ct->Run(); - SetStatusText("Connecting to the director..."); + SetStatusText(wxT("Connecting to the director...")); } /* Register a new wxbDataParser */ @@ -468,7 +470,7 @@ void wxbMainFrame::Unregister(wxbDataParser* dp) { parsers.RemoveAt(index); } else { - Print("Failed to unregister a data parser !", CS_DEBUG); + Print(wxT("Failed to unregister a data parser !"), CS_DEBUG); } } @@ -476,7 +478,7 @@ void wxbMainFrame::Unregister(wxbDataParser* dp) { void wxbMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Print("Quitting.\n", CS_DEBUG); + Print(wxT("Quitting.\n"), CS_DEBUG); if (ct != NULL) { ct->Delete(); ct = NULL; @@ -498,18 +500,18 @@ void wxbMainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void wxbMainFrame::OnChangeConfig(wxCommandEvent& event) { wxString oriconfigfile; - wxConfig::Get()->Read("/ConfigFile", &oriconfigfile); - wxString configfile = wxFileSelector("Please choose your default configuration file"); + wxConfig::Get()->Read(wxT("/ConfigFile"), &oriconfigfile); + wxString configfile = wxFileSelector(wxT("Please choose your default configuration file")); if ( !configfile.empty() ) { if (oriconfigfile != configfile) { int answer = wxMessageBox( - "Use this configuration file as default?", - "Configuration file", + wxT("Use this configuration file as default?"), + wxT("Configuration file"), wxYES_NO | wxICON_QUESTION, this); if (answer == wxYES) { - wxConfigBase::Get()->Write("/ConfigFile", configfile); + wxConfigBase::Get()->Write(wxT("/ConfigFile"), configfile); wxConfigBase::Get()->Flush(); - StartConsoleThread(""); + StartConsoleThread(wxT("")); return; } } @@ -520,7 +522,7 @@ void wxbMainFrame::OnChangeConfig(wxCommandEvent& event) { void wxbMainFrame::OnEditConfig(wxCommandEvent& event) { wxString configfile; - wxConfig::Get()->Read("/ConfigFile", &configfile); + wxConfig::Get()->Read(wxT("/ConfigFile"), &configfile); int stat = wxbConfigFileEditor(this, configfile).ShowModal(); if (stat == wxOK) { StartConsoleThread(configfile); @@ -543,7 +545,7 @@ void wxbMainFrame::OnEnter(wxCommandEvent& WXUNUSED(event)) lockedbyconsole = true; DisablePanels(); typeCtrl->HistoryAdd(typeCtrl->GetValue()); - wxString str = typeCtrl->GetValue() + "\n"; + wxString str = typeCtrl->GetValue() + wxT("\n"); Send(str); } @@ -567,20 +569,20 @@ void wxbMainFrame::Print(wxString str, int status) if (status == CS_TERMINATED) { consoleCtrl->AppendText(consoleBuffer); - consoleBuffer = ""; - SetStatusText("Console thread terminated."); + consoleBuffer = wxT(""); + SetStatusText(wxT("Console thread terminated.")); consoleCtrl->ScrollLines(3); ct = NULL; DisablePanels(); - int answer = wxMessageBox("Connection to the director lost. Quit program?", "Connection lost", + int answer = wxMessageBox(wxT("Connection to the director lost. Quit program?"), wxT("Connection lost"), wxYES_NO | wxICON_EXCLAMATION, this); if (answer == wxYES) { frame = NULL; Close(true); } menuFile->Enable(MenuConnect, true); - menuFile->SetLabel(MenuConnect, "Connect"); - menuFile->SetHelpString(MenuConnect, "Connect to the director"); + menuFile->SetLabel(MenuConnect, wxT("Connect")); + menuFile->SetHelpString(MenuConnect, wxT("Connect to the director")); menuFile->Enable(MenuDisconnect, false); menuFile->Enable(ChangeConfigFile, true); menuFile->Enable(EditConfigFile, true); @@ -588,9 +590,9 @@ void wxbMainFrame::Print(wxString str, int status) } if (status == CS_CONNECTED) { - SetStatusText("Connected to the director."); + SetStatusText(wxT("Connected to the director.")); typeCtrl->ClearCommandList(); - wxbDataTokenizer* dt = wxbUtils::WaitForEnd(".help", true); + wxbDataTokenizer* dt = wxbUtils::WaitForEnd(wxT(".help"), true); int i, j; wxString str; for (i = 0; i < (int)dt->GetCount(); i++) { @@ -602,8 +604,8 @@ void wxbMainFrame::Print(wxString str, int status) } EnablePanels(); menuFile->Enable(MenuConnect, true); - menuFile->SetLabel(MenuConnect, "Reconnect"); - menuFile->SetHelpString(MenuConnect, "Reconnect to the director"); + menuFile->SetLabel(MenuConnect, wxT("Reconnect")); + menuFile->SetHelpString(MenuConnect, wxT("Reconnect to the director")); menuFile->Enable(MenuDisconnect, true); menuFile->Enable(ChangeConfigFile, true); menuFile->Enable(EditConfigFile, true); @@ -611,9 +613,9 @@ void wxbMainFrame::Print(wxString str, int status) } if (status == CS_DISCONNECTED) { consoleCtrl->AppendText(consoleBuffer); - consoleBuffer = ""; + consoleBuffer = wxT(""); consoleCtrl->ScrollLines(3); - SetStatusText("Disconnected of the director."); + SetStatusText(wxT("Disconnected of the director.")); DisablePanels(); return; } @@ -632,12 +634,12 @@ void wxbMainFrame::Print(wxString str, int status) } if ((status == CS_PROMPT) && (promptcaught < 1) && (promptparser->isPrompt())) { - Print("Unexpected question has been received.\n", CS_DEBUG); + Print(wxT("Unexpected question has been received.\n"), CS_DEBUG); // Print(wxString("(") << promptparser->getIntroString() << "/-/" << promptparser->getQuestionString() << ")\n", CS_DEBUG); wxString message; - if (promptparser->getIntroString() != "") { - message << promptparser->getIntroString() << "\n"; + if (promptparser->getIntroString() != wxT("")) { + message << promptparser->getIntroString() << wxT("\n"); } message << promptparser->getQuestionString(); @@ -647,7 +649,7 @@ void wxbMainFrame::Print(wxString str, int status) int n = 0; for (unsigned int i = 0; i < promptparser->getChoices()->GetCount(); i++) { - if ((*promptparser->getChoices())[i] != "") { + if ((*promptparser->getChoices())[i] != wxT("")) { choices[n] = (*promptparser->getChoices())[i]; numbers[n] = i; n++; @@ -655,22 +657,22 @@ void wxbMainFrame::Print(wxString str, int status) } int res = ::wxGetSingleChoiceIndex(message, - "wx-console: unexpected director's question.", n, choices, this); + wxT("wx-console: unexpected director's question."), n, choices, this); if (res == -1) { //Cancel pressed - Send(".\n"); + Send(wxT(".\n")); } else { if (promptparser->isNumericalChoice()) { - Send(wxString() << numbers[res] << "\n"); + Send(wxString() << numbers[res] << wxT("\n")); } else { - Send(wxString() << choices[res] << "\n"); + Send(wxString() << choices[res] << wxT("\n")); } } } else { Send(::wxGetTextFromUser(message, - "wx-console: unexpected director's question.", "", this) + "\n"); + wxT("wx-console: unexpected director's question."), wxT(""), this) + wxT("\n")); } } } @@ -680,12 +682,12 @@ void wxbMainFrame::Print(wxString str, int status) EnablePanels(); lockedbyconsole = false; } - str = "#"; + str = wxT("#"); } if (status == CS_DEBUG) { consoleCtrl->AppendText(consoleBuffer); - consoleBuffer = ""; + consoleBuffer = wxT(""); consoleCtrl->ScrollLines(3); consoleCtrl->SetDefaultStyle(wxTextAttr(wxColour(0, 128, 0))); } @@ -700,9 +702,9 @@ void wxbMainFrame::Print(wxString str, int status) //consoleBuffer << "

"; } - if ((status == CS_END) || (status == CS_PROMPT) || (str.Find("\n") > -1)) { + if ((status == CS_END) || (status == CS_PROMPT) || (str.Find(wxT("\n")) > -1)) { consoleCtrl->AppendText(consoleBuffer); - consoleBuffer = ""; + consoleBuffer = wxT(""); consoleCtrl->ScrollLines(3); } @@ -729,8 +731,8 @@ void wxbMainFrame::Print(wxString str, int status) void wxbMainFrame::Send(wxString str) { if (ct != NULL) { - ct->Write((const char*)str); - typeCtrl->SetValue(""); + ct->Write(str.mb_str(wxConvUTF8)); + typeCtrl->SetValue(wxT("")); consoleCtrl->SetDefaultStyle(wxTextAttr(*wxRED)); consoleCtrl->AppendText(wxbUtils::ConvertToPrintable(str)); consoleCtrl->ScrollLines(3); @@ -801,12 +803,19 @@ void firePrintEvent(wxString str, int status) * Called by console thread, this function forwards data line by line and end * signals to the GUI. */ + +void csprint(wxString str, int status) +{ + firePrintEvent(str, status); +} + + void csprint(const char* str, int status) { if (str != 0) { - firePrintEvent(wxString(str), status); + firePrintEvent(wxString(str,wxConvUTF8), status); } else { - firePrintEvent("", status); + firePrintEvent(wxT(""), status); } } diff --git a/bacula/src/wx-console/wxbrestorepanel.cpp b/bacula/src/wx-console/wxbrestorepanel.cpp index 8b63dba566..c23efa5ce7 100644 --- a/bacula/src/wx-console/wxbrestorepanel.cpp +++ b/bacula/src/wx-console/wxbrestorepanel.cpp @@ -123,10 +123,10 @@ int wxbTreeItemData::GetMarked() { } void wxbTreeItemData::SetMarked(wxString marked) { - if (marked == "*") { + if (marked == wxT("*")) { this->marked = 1; } - else if (marked == "+") { + else if (marked == wxT("+")) { this->marked = 2; } else { @@ -257,10 +257,10 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) { firstSizer->AddGrowableCol(0); firstSizer->AddGrowableRow(0); - start = new wxButton(this, RestoreStart, "Enter restore mode", wxDefaultPosition, wxSize(150, 30)); + start = new wxButton(this, RestoreStart, wxT("Enter restore mode"), wxDefaultPosition, wxSize(150, 30)); firstSizer->Add(start, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 10); - cancel = new wxButton(this, RestoreCancel, "Cancel restore", wxDefaultPosition, wxSize(150, 30)); + cancel = new wxButton(this, RestoreCancel, wxT("Cancel restore"), wxDefaultPosition, wxSize(150, 30)); firstSizer->Add(cancel, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_RIGHT, 10); wxString elist[1]; @@ -286,11 +286,11 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) { treeSizer->Add(tree, 1, wxEXPAND, 0); wxBoxSizer *treeCtrlSizer = new wxBoxSizer(wxHORIZONTAL); - treeadd = new wxButton(treePanel, TreeAdd, "Add", wxDefaultPosition, wxSize(60, 25)); + treeadd = new wxButton(treePanel, TreeAdd, wxT("Add"), wxDefaultPosition, wxSize(60, 25)); treeCtrlSizer->Add(treeadd, 0, wxLEFT | wxRIGHT, 3); - treeremove = new wxButton(treePanel, TreeRemove, "Remove", wxDefaultPosition, wxSize(60, 25)); + treeremove = new wxButton(treePanel, TreeRemove, wxT("Remove"), wxDefaultPosition, wxSize(60, 25)); treeCtrlSizer->Add(treeremove, 0, wxLEFT | wxRIGHT, 3); - treerefresh = new wxButton(treePanel, TreeRefresh, "Refresh", wxDefaultPosition, wxSize(60, 25)); + treerefresh = new wxButton(treePanel, TreeRefresh, wxT("Refresh"), wxDefaultPosition, wxSize(60, 25)); treeCtrlSizer->Add(treerefresh, 0, wxLEFT | wxRIGHT, 3); treeSizer->Add(treeCtrlSizer, 1, wxALIGN_CENTER_HORIZONTAL, 0); @@ -309,42 +309,42 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) { wxListItem info; info.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT); - info.SetText("M"); + info.SetText(wxT("M")); info.SetAlign(wxLIST_FORMAT_CENTER); list->InsertColumn(0, info); - info.SetText("Filename"); + info.SetText(wxT("Filename")); info.SetAlign(wxLIST_FORMAT_LEFT); list->InsertColumn(1, info); - info.SetText("Size"); + info.SetText(wxT("Size")); info.SetAlign(wxLIST_FORMAT_RIGHT); list->InsertColumn(2, info); - info.SetText("Date"); + info.SetText(wxT("Date")); info.SetAlign(wxLIST_FORMAT_LEFT); list->InsertColumn(3, info); - info.SetText("Perm."); + info.SetText(wxT("Perm.")); info.SetAlign(wxLIST_FORMAT_LEFT); list->InsertColumn(4, info); - info.SetText("User"); + info.SetText(wxT("User")); info.SetAlign(wxLIST_FORMAT_RIGHT); list->InsertColumn(5, info); - info.SetText("Group"); + info.SetText(wxT("Group")); info.SetAlign(wxLIST_FORMAT_RIGHT); list->InsertColumn(6, info); listSizer->Add(list, 1, wxEXPAND, 0); wxBoxSizer *listCtrlSizer = new wxBoxSizer(wxHORIZONTAL); - listadd = new wxButton(listPanel, ListAdd, "Add", wxDefaultPosition, wxSize(60, 25)); + listadd = new wxButton(listPanel, ListAdd, wxT("Add"), wxDefaultPosition, wxSize(60, 25)); listCtrlSizer->Add(listadd, 0, wxLEFT | wxRIGHT, 5); - listremove = new wxButton(listPanel, ListRemove, "Remove", wxDefaultPosition, wxSize(60, 25)); + listremove = new wxButton(listPanel, ListRemove, wxT("Remove"), wxDefaultPosition, wxSize(60, 25)); listCtrlSizer->Add(listremove, 0, wxLEFT | wxRIGHT, 5); - listrefresh = new wxButton(listPanel, ListRefresh, "Refresh", wxDefaultPosition, wxSize(60, 25)); + listrefresh = new wxButton(listPanel, ListRefresh, wxT("Refresh"), wxDefaultPosition, wxSize(60, 25)); listCtrlSizer->Add(listrefresh, 0, wxLEFT | wxRIGHT, 5); listSizer->Add(listCtrlSizer, 1, wxALIGN_CENTER_HORIZONTAL, 0); @@ -358,31 +358,31 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) { treelistPanel->Show(false); wxbConfig* config = new wxbConfig(); - config->Add(new wxbConfigParam("Job Name", ConfigJobName, choice, 0, elist)); - config->Add(new wxbConfigParam("Client", ConfigClient, choice, 0, elist)); - config->Add(new wxbConfigParam("Fileset", ConfigFileset, choice, 0, elist)); - config->Add(new wxbConfigParam("Pool", ConfigPool, choice, 0, elist)); - config->Add(new wxbConfigParam("Storage", ConfigStorage, choice, 0, elist)); - config->Add(new wxbConfigParam("Before", ConfigWhen, choice, 0, elist)); + config->Add(new wxbConfigParam(wxT("Job Name"), ConfigJobName, choice, 0, elist)); + config->Add(new wxbConfigParam(wxT("Client"), ConfigClient, choice, 0, elist)); + config->Add(new wxbConfigParam(wxT("Fileset"), ConfigFileset, choice, 0, elist)); + config->Add(new wxbConfigParam(wxT("Pool"), ConfigPool, choice, 0, elist)); + config->Add(new wxbConfigParam(wxT("Storage"), ConfigStorage, choice, 0, elist)); + config->Add(new wxbConfigParam(wxT("Before"), ConfigWhen, choice, 0, elist)); - configPanel = new wxbConfigPanel(this, config, "Please configure parameters concerning files to restore :", RestoreStart, RestoreCancel, -1); + configPanel = new wxbConfigPanel(this, config, wxT("Please configure parameters concerning files to restore :"), RestoreStart, RestoreCancel, -1); configPanel->Show(true); configPanel->Enable(false); config = new wxbConfig(); - config->Add(new wxbConfigParam("Job Name", -1, text, "")); - config->Add(new wxbConfigParam("Bootstrap", -1, text, "")); - config->Add(new wxbConfigParam("Where", ConfigWhere, modifiableText, "")); - wxString erlist[] = {"always", "if newer", "if older", "never"}; - config->Add(new wxbConfigParam("Replace", ConfigReplace, choice, 4, erlist)); - config->Add(new wxbConfigParam("Fileset", ConfigFileset, choice, 0, erlist)); - config->Add(new wxbConfigParam("Client", ConfigClient, choice, 0, erlist)); - config->Add(new wxbConfigParam("Storage", ConfigStorage, choice, 0, erlist)); - config->Add(new wxbConfigParam("When", ConfigWhen, modifiableText, "")); - config->Add(new wxbConfigParam("Priority", ConfigPriority, modifiableText, "")); - - restorePanel = new wxbConfigPanel(this, config, "Please configure parameters concerning files restoration :", ConfigOk, ConfigCancel, ConfigApply); + config->Add(new wxbConfigParam(wxT("Job Name"), -1, text, wxT(""))); + config->Add(new wxbConfigParam(wxT("Bootstrap"), -1, text, wxT(""))); + config->Add(new wxbConfigParam(wxT("Where"), ConfigWhere, modifiableText, wxT(""))); + wxString erlist[] = {wxT("always"), wxT("if newer"), wxT("if older"), wxT("never")}; + config->Add(new wxbConfigParam(wxT("Replace"), ConfigReplace, choice, 4, erlist)); + config->Add(new wxbConfigParam(wxT("Fileset"), ConfigFileset, choice, 0, erlist)); + config->Add(new wxbConfigParam(wxT("Client"), ConfigClient, choice, 0, erlist)); + config->Add(new wxbConfigParam(wxT("Storage"), ConfigStorage, choice, 0, erlist)); + config->Add(new wxbConfigParam(wxT("When"), ConfigWhen, modifiableText, wxT(""))); + config->Add(new wxbConfigParam(wxT("Priority"), ConfigPriority, modifiableText, wxT(""))); + + restorePanel = new wxbConfigPanel(this, config, wxT("Please configure parameters concerning files restoration :"), ConfigOk, ConfigCancel, ConfigApply); restorePanel->Show(false); @@ -425,7 +425,7 @@ wxbRestorePanel::~wxbRestorePanel() { ----------------------------------------------------------------------------*/ wxString wxbRestorePanel::GetTitle() { - return "Restore"; + return wxT("Restore"); } void wxbRestorePanel::EnablePanel(bool enable) { @@ -447,23 +447,23 @@ void wxbRestorePanel::EnablePanel(bool enable) { void wxbRestorePanel::CmdStart() { unsigned int i; if (status == activable) { - wxbMainFrame::GetInstance()->SetStatusText("Getting parameters list."); - wxbDataTokenizer* dt = wxbUtils::WaitForEnd(".clients\n", true, false); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Getting parameters list.")); + wxbDataTokenizer* dt = wxbUtils::WaitForEnd(wxT(".clients\n"), true, false); wxString str; - configPanel->ClearRowChoices("Client"); - restorePanel->ClearRowChoices("Client"); + configPanel->ClearRowChoices(wxT("Client")); + restorePanel->ClearRowChoices(wxT("Client")); if (dt->GetCount() == 0) { - wxbMainFrame::GetInstance()->SetStatusText("Error : no clients returned by the director."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Error : no clients returned by the director.")); return; } for (i = 0; i < dt->GetCount(); i++) { str = (*dt)[i]; str.RemoveLast(); - configPanel->AddRowChoice("Client", str); - restorePanel->AddRowChoice("Client", str); + configPanel->AddRowChoice(wxT("Client"), str); + restorePanel->AddRowChoice(wxT("Client"), str); } delete dt; @@ -473,21 +473,21 @@ void wxbRestorePanel::CmdStart() { return; } - dt = wxbUtils::WaitForEnd(".filesets\n", true, false); + dt = wxbUtils::WaitForEnd(wxT(".filesets\n"), true, false); - configPanel->ClearRowChoices("Fileset"); - restorePanel->ClearRowChoices("Fileset"); + configPanel->ClearRowChoices(wxT("Fileset")); + restorePanel->ClearRowChoices(wxT("Fileset")); if (dt->GetCount() == 0) { - wxbMainFrame::GetInstance()->SetStatusText("Error : no filesets returned by the director."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Error : no filesets returned by the director.")); return; } for (i = 0; i < dt->GetCount(); i++) { str = (*dt)[i]; str.RemoveLast(); - configPanel->AddRowChoice("Fileset", str); - restorePanel->AddRowChoice("Fileset", str); + configPanel->AddRowChoice(wxT("Fileset"), str); + restorePanel->AddRowChoice(wxT("Fileset"), str); } delete dt; @@ -497,21 +497,21 @@ void wxbRestorePanel::CmdStart() { return; } - dt = wxbUtils::WaitForEnd(".storage\n", true, false); + dt = wxbUtils::WaitForEnd(wxT(".storage\n"), true, false); - configPanel->ClearRowChoices("Storage"); - restorePanel->ClearRowChoices("Storage"); + configPanel->ClearRowChoices(wxT("Storage")); + restorePanel->ClearRowChoices(wxT("Storage")); if (dt->GetCount() == 0) { - wxbMainFrame::GetInstance()->SetStatusText("Error : no storage returned by the director."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Error : no storage returned by the director.")); return; } for (i = 0; i < dt->GetCount(); i++) { str = (*dt)[i]; str.RemoveLast(); - configPanel->AddRowChoice("Storage", str); - restorePanel->AddRowChoice("Storage", str); + configPanel->AddRowChoice(wxT("Storage"), str); + restorePanel->AddRowChoice(wxT("Storage"), str); } delete dt; @@ -521,22 +521,22 @@ void wxbRestorePanel::CmdStart() { return; } - dt = wxbUtils::WaitForEnd(".jobs\n", true, false); + dt = wxbUtils::WaitForEnd(wxT(".jobs\n"), true, false); - configPanel->ClearRowChoices("Job Name"); + configPanel->ClearRowChoices(wxT("Job Name")); if (dt->GetCount() == 0) { - wxbMainFrame::GetInstance()->SetStatusText("Error : no jobs returned by the director."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Error : no jobs returned by the director.")); return; } for (i = 0; i < dt->GetCount(); i++) { str = (*dt)[i]; str.RemoveLast(); - configPanel->AddRowChoice("Job Name", str); + configPanel->AddRowChoice(wxT("Job Name"), str); } - configPanel->SetRowString("Job Name", "RestoreFiles"); + configPanel->SetRowString(wxT("Job Name"), wxT("RestoreFiles")); delete dt; @@ -545,19 +545,19 @@ void wxbRestorePanel::CmdStart() { return; } - dt = wxbUtils::WaitForEnd(".pools\n", true, false); + dt = wxbUtils::WaitForEnd(wxT(".pools\n"), true, false); - configPanel->ClearRowChoices("Pool"); + configPanel->ClearRowChoices(wxT("Pool")); if (dt->GetCount() == 0) { - wxbMainFrame::GetInstance()->SetStatusText("Error : no jobs returned by the director."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Error : no jobs returned by the director.")); return; } for (i = 0; i < dt->GetCount(); i++) { str = (*dt)[i]; str.RemoveLast(); - configPanel->AddRowChoice("Pool", str); + configPanel->AddRowChoice(wxT("Pool"), str); } delete dt; @@ -571,7 +571,7 @@ void wxbRestorePanel::CmdStart() { UpdateFirstConfig(); - wxbMainFrame::GetInstance()->SetStatusText("Please configure your restore parameters."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Please configure your restore parameters.")); } else if (status == entered) { /* if (clientChoice->GetStringSelection().Length() < 1) { @@ -582,31 +582,31 @@ void wxbRestorePanel::CmdStart() { wxbMainFrame::GetInstance()->SetStatusText("Please select a restore date."); return; }*/ - wxbMainFrame::GetInstance()->SetStatusText("Building restore tree..."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Building restore tree...")); SetStatus(choosing); wxbTableParser* tableparser = new wxbTableParser(); wxbDataTokenizer* dt = new wxbDataTokenizer(false); - wxbMainFrame::GetInstance()->Send(wxString("restore") << - " client=\"" << configPanel->GetRowString("Client") << - "\" fileset=\"" << configPanel->GetRowString("Fileset") << - "\" pool=\"" << configPanel->GetRowString("Pool") << - "\" storage=\"" << configPanel->GetRowString("Storage") << - "\" before=\"" << configPanel->GetRowString("Before") << - "\" select\n"); + wxbMainFrame::GetInstance()->Send(wxString(wxT("restore")) << + wxT(" client=\"") << configPanel->GetRowString(wxT("Client")) << + wxT("\" fileset=\"") << configPanel->GetRowString(wxT("Fileset")) << + wxT("\" pool=\"") << configPanel->GetRowString(wxT("Pool")) << + wxT("\" storage=\"") << configPanel->GetRowString(wxT("Storage")) << + wxT("\" before=\"") << configPanel->GetRowString(wxT("Before")) << + wxT("\" select\n")); //wxbUtils::WaitForPrompt("6\n"); //WaitForEnd(); - /*wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxString() << configPanel->GetRowString("Before") << "\n", true); - int client = pp->getChoices()->Index(configPanel->GetRowString("Client")); + /*wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxString() << configPanel->GetRowString(wxT("Before")) << "\n", true); + int client = pp->getChoices()->Index(configPanel->GetRowString(wxT("Client"))); if (client == wxNOT_FOUND) { wxbMainFrame::GetInstance()->SetStatusText("Failed to find the selected client."); return; } delete pp;*/ - //wxbMainFrame::GetInstance()->Send(wxString() << configPanel->GetRowString("Before") << "\n"); + //wxbMainFrame::GetInstance()->Send(wxString() << configPanel->GetRowString(wxT("Before")) << "\n"); while (!tableparser->hasFinished() && !dt->hasFinished()) { wxTheApp->Yield(true); @@ -616,12 +616,12 @@ void wxbRestorePanel::CmdStart() { wxString str; if (dt->hasFinished() && !tableparser->hasFinished()) { - str = ""; + str = wxT(""); if (dt->GetCount() > 1) { str = (*dt)[dt->GetCount()-2]; str.RemoveLast(); } - wxbMainFrame::GetInstance()->SetStatusText(wxString("Error while starting restore: ") << str); + wxbMainFrame::GetInstance()->SetStatusText(wxString(wxT("Error while starting restore: ")) << str); delete dt; delete tableparser; SetStatus(finished); @@ -633,7 +633,7 @@ void wxbRestorePanel::CmdStart() { for (i = 0; i < tableparser->GetCount(); i++) { str = (*tableparser)[i][2]; - str.Replace(",", ""); + str.Replace(wxT(","), wxT("")); if (str.ToLong(&l)) { tot += l; } @@ -660,13 +660,13 @@ void wxbRestorePanel::CmdStart() { if (newdate.Subtract(base).GetMilliseconds() > 10 ) { base = newdate; for (; lastindex < dt->GetCount(); lastindex++) { - if (((i1 = (*dt)[lastindex].Find("Building directory tree for JobId ")) >= 0) && - ((i2 = (*dt)[lastindex].Find(" ...")) > 0)) { + if (((i1 = (*dt)[lastindex].Find(wxT("Building directory tree for JobId "))) >= 0) && + ((i2 = (*dt)[lastindex].Find(wxT(" ..."))) > 0)) { str = (*dt)[lastindex].Mid(i1+34, i2-(i1+34)); for (i = 0; i < tableparser->GetCount(); i++) { if (str == (*tableparser)[i][0]) { str = (*tableparser)[i][2]; - str.Replace(",", ""); + str.Replace(wxT(","), wxT("")); if (str.ToLong(&l)) { done += willdo; willdo += l; @@ -678,7 +678,7 @@ void wxbRestorePanel::CmdStart() { } } } - else if ((*dt)[lastindex] == "+") { + else if ((*dt)[lastindex] == wxT("+")) { gauge->SetValue(gauge->GetValue()+var); wxTheApp->Yield(true); } @@ -705,13 +705,13 @@ void wxbRestorePanel::CmdStart() { return; } - wxbUtils::WaitForEnd("unmark *\n"); - wxTreeItemId root = tree->AddRoot(configPanel->GetRowString("Client"), -1, -1, new wxbTreeItemData("/", configPanel->GetRowString("Client"), 0)); + wxbUtils::WaitForEnd(wxT("unmark *\n")); + wxTreeItemId root = tree->AddRoot(configPanel->GetRowString(wxT("Client")), -1, -1, new wxbTreeItemData(wxT("/"), configPanel->GetRowString(wxT("Client")), 0)); currentTreeItem = root; tree->Refresh(); tree->SelectItem(root); CmdList(root); - wxbMainFrame::GetInstance()->SetStatusText("Right click on a file or on a directory, or double-click on its mark to add it to the restore list."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Right click on a file or on a directory, or double-click on its mark to add it to the restore list.")); tree->Expand(root); } else if (status == choosing) { @@ -723,25 +723,25 @@ void wxbRestorePanel::CmdStart() { int j; dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt("done\n"); + wxbUtils::WaitForPrompt(wxT("done\n")); SetStatus(configuring); for (i = 0; i < dt->GetCount(); i++) { - if ((j = (*dt)[i].Find(" files selected to be restored.")) > -1) { + if ((j = (*dt)[i].Find(wxT(" files selected to be restored."))) > -1) { (*dt)[i].Mid(0, j).ToLong(&totfilemessages); break; } - if ((j = (*dt)[i].Find(" file selected to be restored.")) > -1) { + if ((j = (*dt)[i].Find(wxT(" file selected to be restored."))) > -1) { (*dt)[i].Mid(0, j).ToLong(&totfilemessages); break; } } wxbMainFrame::GetInstance()->SetStatusText( - wxString("Please configure your restore (") - << totfilemessages << " files selected to be restored)..."); + wxString(wxT("Please configure your restore (") ) + << totfilemessages << wxT(" files selected to be restored)...")); UpdateSecondConfig(dt); @@ -751,23 +751,23 @@ void wxbRestorePanel::CmdStart() { restorePanel->EnableApply(false); if (totfilemessages == 0) { - wxbMainFrame::GetInstance()->Print("Restore failed : no file selected.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("Restore failed : no file selected."); + wxbMainFrame::GetInstance()->Print(wxT("Restore failed : no file selected.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore failed : no file selected.")); SetStatus(finished); return; } } else if (status == configuring) { cancel->Enable(false); - jobid = ""; + jobid = wxT(""); EnableConfig(false); - wxbMainFrame::GetInstance()->SetStatusText("Restoring, please wait..."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restoring, please wait...")); wxbDataTokenizer* dt; SetStatus(restoring); - dt = wxbUtils::WaitForEnd("yes\n", true); + dt = wxbUtils::WaitForEnd(wxT("yes\n"), true); gauge->SetValue(0); gauge->SetRange(totfilemessages); @@ -775,29 +775,29 @@ void wxbRestorePanel::CmdStart() { int j; for (i = 0; i < dt->GetCount(); i++) { - if ((j = (*dt)[i].Find("Job started. JobId=")) > -1) { + if ((j = (*dt)[i].Find(wxT("Job started. JobId="))) > -1) { jobid = (*dt)[i].Mid(j+19); - wxbMainFrame::GetInstance()->SetStatusText("Restore started, jobid=" + jobid); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore started, jobid=") + jobid); break; } - if ((j = (*dt)[i].Find("Job failed.")) > -1) { - wxbMainFrame::GetInstance()->Print("Restore failed, please look at messages.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("Restore failed, please look at messages in console."); + if ((j = (*dt)[i].Find(wxT("Job failed."))) > -1) { + wxbMainFrame::GetInstance()->Print(wxT("Restore failed, please look at messages.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore failed, please look at messages in console.")); return; } } - if (jobid == "") { - wxbMainFrame::GetInstance()->Print("Failed to retrieve jobid.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("Failed to retrieve jobid.\n"); + if (jobid == wxT("")) { + wxbMainFrame::GetInstance()->Print(wxT("Failed to retrieve jobid.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Failed to retrieve jobid.\n")); return; } wxDateTime currenttime; - dt = wxbUtils::WaitForEnd("time\n", true); - wxStringTokenizer ttkz((*dt)[0], " ", wxTOKEN_STRTOK); + dt = wxbUtils::WaitForEnd(wxT("time\n"), true); + wxStringTokenizer ttkz((*dt)[0], wxT(" "), wxTOKEN_STRTOK); if ((currenttime.ParseDate(ttkz.GetNextToken()) == NULL) || // Date (currenttime.ParseTime(ttkz.GetNextToken()) == NULL)) { // Time currenttime.SetYear(1990); // If parsing fails, set currenttime to a dummy date @@ -808,7 +808,7 @@ void wxbRestorePanel::CmdStart() { delete dt; wxDateTime scheduledtime; - wxStringTokenizer stkz(restorePanel->GetRowString("When"), " ", wxTOKEN_STRTOK); + wxStringTokenizer stkz(restorePanel->GetRowString(wxT("When")), wxT(" "), wxTOKEN_STRTOK); if ((scheduledtime.ParseDate(stkz.GetNextToken()) == NULL) || // Date (scheduledtime.ParseTime(stkz.GetNextToken()) == NULL)) { // Time @@ -816,13 +816,13 @@ void wxbRestorePanel::CmdStart() { } if (scheduledtime.Subtract(currenttime).IsLongerThan(wxTimeSpan::Seconds(150))) { - wxbMainFrame::GetInstance()->Print("Restore is scheduled in more than two minutes, wx-console will not wait for its completion.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("Restore is scheduled in more than two minutes, wx-console will not wait for its completion."); + wxbMainFrame::GetInstance()->Print(wxT("Restore is scheduled in more than two minutes, wx-console will not wait for its completion.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore is scheduled in more than two minutes, wx-console will not wait for its completion.")); SetStatus(finished); return; } - wxString cmd = wxString("list jobid=") + jobid; + wxString cmd = wxString(wxT("list jobid=")) + jobid; wxbTableParser* tableparser; @@ -841,81 +841,81 @@ void wxbRestorePanel::CmdStart() { status = (*tableparser)[0][7].GetChar(0); switch (status) { case JS_Created: - wxbMainFrame::GetInstance()->SetStatusText("Restore job created, but not yet running."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job created, but not yet running.")); waitforever = false; break; case JS_Running: wxbMainFrame::GetInstance()->SetStatusText( - wxString("Restore job running, please wait (") << filemessages << - " of " << totfilemessages << " files restored)..."); + wxString(wxT("Restore job running, please wait (")) << filemessages << + wxT(" of ") << totfilemessages << wxT(" files restored)...")); waitforever = true; break; case JS_Terminated: - wxbMainFrame::GetInstance()->SetStatusText("Restore job terminated successfully."); - wxbMainFrame::GetInstance()->Print("Restore job terminated successfully.\n", CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job terminated successfully.")); + wxbMainFrame::GetInstance()->Print(wxT("Restore job terminated successfully.\n"), CS_DEBUG); waitforever = false; ended = true; break; case JS_ErrorTerminated: - wxbMainFrame::GetInstance()->SetStatusText("Restore job terminated in error, see messages in console."); - wxbMainFrame::GetInstance()->Print("Restore job terminated in error, see messages.\n", CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job terminated in error, see messages in console.")); + wxbMainFrame::GetInstance()->Print(wxT("Restore job terminated in error, see messages.\n"), CS_DEBUG); waitforever = false; ended = true; break; case JS_Error: - wxbMainFrame::GetInstance()->SetStatusText("Restore job reported a non-fatal error."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job reported a non-fatal error.")); waitforever = false; break; case JS_FatalError: - wxbMainFrame::GetInstance()->SetStatusText("Restore job reported a fatal error."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job reported a fatal error.")); waitforever = false; ended = true; break; case JS_Canceled: - wxbMainFrame::GetInstance()->SetStatusText("Restore job cancelled by user."); - wxbMainFrame::GetInstance()->Print("Restore job cancelled by user.\n", CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job cancelled by user.")); + wxbMainFrame::GetInstance()->Print(wxT("Restore job cancelled by user.\n"), CS_DEBUG); waitforever = false; ended = true; break; case JS_WaitFD: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting on File daemon."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting on File daemon.")); waitforever = false; break; case JS_WaitMedia: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for new media."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for new media.")); waitforever = false; break; case JS_WaitStoreRes: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for storage resource."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for storage resource.")); waitforever = false; break; case JS_WaitJobRes: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for job resource."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for job resource.")); waitforever = false; break; case JS_WaitClientRes: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for Client resource."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for Client resource.")); waitforever = false; break; case JS_WaitMaxJobs: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for maximum jobs."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for maximum jobs.")); waitforever = false; break; case JS_WaitStartTime: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for start time."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for start time.")); waitforever = false; break; case JS_WaitPriority: - wxbMainFrame::GetInstance()->SetStatusText("Restore job is waiting for higher priority jobs to finish."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore job is waiting for higher priority jobs to finish.")); waitforever = false; break; } delete tableparser; - dt = wxbUtils::WaitForEnd(".messages\n", true); + dt = wxbUtils::WaitForEnd(wxT(".messages\n"), true); for (unsigned int i = 0; i < dt->GetCount(); i++) { - wxStringTokenizer tkz((*dt)[i], " ", wxTOKEN_STRTOK); + wxStringTokenizer tkz((*dt)[i], wxT(" "), wxTOKEN_STRTOK); wxDateTime datetime; @@ -955,19 +955,19 @@ void wxbRestorePanel::CmdStart() { } if ((!waitforever) && (sw.Time() > 60000)) { - wxbMainFrame::GetInstance()->Print("The restore job has not been started within one minute, wx-console will not wait for its completion anymore.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("The restore job has not been started within one minute, wx-console will not wait for its completion anymore."); + wxbMainFrame::GetInstance()->Print(wxT("The restore job has not been started within one minute, wx-console will not wait for its completion anymore.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("The restore job has not been started within one minute, wx-console will not wait for its completion anymore.")); break; } } - wxbUtils::WaitForEnd(".messages\n"); + wxbUtils::WaitForEnd(wxT(".messages\n")); gauge->SetValue(totfilemessages); if (status == JS_Terminated) { - wxbMainFrame::GetInstance()->Print("Restore done successfully.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("Restore done successfully."); + wxbMainFrame::GetInstance()->Print(wxT("Restore done successfully.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore done successfully.")); } SetStatus(finished); } @@ -978,8 +978,8 @@ void wxbRestorePanel::CmdCancel() { cancelled = 1; if (status == restoring) { - if (jobid != "") { - wxbMainFrame::GetInstance()->Send(wxString("cancel job=") << jobid << "\n"); + if (jobid != wxT("")) { + wxbMainFrame::GetInstance()->Send(wxString(wxT("cancel job=")) << jobid << wxT("\n")); } cancel->Enable(true); return; @@ -991,10 +991,10 @@ void wxbRestorePanel::CmdCancel() { wxbUtils::MilliSleep(100); if (sw.Time() > 30000) { /* 30 seconds timeout */ if (status == choosing) { - wxbMainFrame::GetInstance()->Send("quit\n"); + wxbMainFrame::GetInstance()->Send(wxT("quit\n")); } else if (status == configuring) { - wxbMainFrame::GetInstance()->Send("no\n"); + wxbMainFrame::GetInstance()->Send(wxT("no\n")); } else if (status == restoring) { @@ -1007,10 +1007,10 @@ void wxbRestorePanel::CmdCancel() { switch (status) { case choosing: - wxbMainFrame::GetInstance()->Send("quit\n"); + wxbMainFrame::GetInstance()->Send(wxT("quit\n")); break; case configuring: - wxbMainFrame::GetInstance()->Send("no\n"); + wxbMainFrame::GetInstance()->Send(wxT("no\n")); break; default: break; @@ -1038,7 +1038,7 @@ void wxbRestorePanel::CmdCancel() { void wxbRestorePanel::CmdConfigApply() { if (cfgUpdated == 0) return; - wxbMainFrame::GetInstance()->SetStatusText("Applying restore configuration changes..."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Applying restore configuration changes...")); EnableConfig(false); @@ -1053,80 +1053,80 @@ void wxbRestorePanel::CmdConfigApply() { } wxString def; //String to send if can't use our data if ((cfgUpdated >> ConfigWhere) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbUtils::WaitForPrompt("9\n"); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbUtils::WaitForPrompt(wxT("9\n")); dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(restorePanel->GetRowString("Where") + "\n"); - def = "/tmp"; + wxbUtils::WaitForPrompt(restorePanel->GetRowString(wxT("Where")) + wxT("\n")); + def = wxT("/tmp"); cfgUpdated = cfgUpdated & (~(1 << ConfigWhere)); } else if ((cfgUpdated >> ConfigReplace) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbUtils::WaitForPrompt("10\n"); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbUtils::WaitForPrompt(wxT("10\n")); dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << (restorePanel->GetRowSelection("Replace")+1) << "\n"); - def = "1"; + wxbUtils::WaitForPrompt(wxString() << (restorePanel->GetRowSelection(wxT("Replace"))+1) << wxT("\n")); + def = wxT("1"); cfgUpdated = cfgUpdated & (~(1 << ConfigReplace)); } else if ((cfgUpdated >> ConfigWhen) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbUtils::WaitForPrompt("6\n"); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbUtils::WaitForPrompt(wxT("6\n")); dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(restorePanel->GetRowString("When") + "\n"); - def = ""; + wxbUtils::WaitForPrompt(restorePanel->GetRowString(wxT("When")) + wxT("\n")); + def = wxT(""); cfgUpdated = cfgUpdated & (~(1 << ConfigWhen)); } else if ((cfgUpdated >> ConfigPriority) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbUtils::WaitForPrompt("7\n"); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbUtils::WaitForPrompt(wxT("7\n")); dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(restorePanel->GetRowString("Priority") + "\n"); - def = "10"; + wxbUtils::WaitForPrompt(restorePanel->GetRowString(wxT("Priority")) + wxT("\n")); + def = wxT("10"); cfgUpdated = cfgUpdated & (~(1 << ConfigPriority)); } else if ((cfgUpdated >> ConfigClient) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbPromptParser *pp = wxbUtils::WaitForPrompt("5\n", true); - int client = pp->getChoices()->Index(restorePanel->GetRowString("Client")); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("5\n"), true); + int client = pp->getChoices()->Index(restorePanel->GetRowString(wxT("Client"))); if (client == wxNOT_FOUND) { - wxbMainFrame::GetInstance()->SetStatusText("Failed to find the selected client."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Failed to find the selected client.")); failed = true; client = 1; } delete pp; dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << client << "\n"); - def = "1"; + wxbUtils::WaitForPrompt(wxString() << client << wxT("\n")); + def = wxT("1"); cfgUpdated = cfgUpdated & (~(1 << ConfigClient)); } else if ((cfgUpdated >> ConfigFileset) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbPromptParser *pp = wxbUtils::WaitForPrompt("4\n", true); - int fileset = pp->getChoices()->Index(restorePanel->GetRowString("Fileset")); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("4\n"), true); + int fileset = pp->getChoices()->Index(restorePanel->GetRowString(wxT("Fileset"))); if (fileset == wxNOT_FOUND) { - wxbMainFrame::GetInstance()->SetStatusText("Failed to find the selected fileset."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Failed to find the selected fileset.")); failed = true; fileset = 1; } delete pp; dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << fileset << "\n"); - def = "1"; + wxbUtils::WaitForPrompt(wxString() << fileset << wxT("\n")); + def = wxT("1"); cfgUpdated = cfgUpdated & (~(1 << ConfigFileset)); } else if ((cfgUpdated >> ConfigStorage) & 1) { - wxbUtils::WaitForPrompt("mod\n"); /* TODO: check results */ - wxbPromptParser *pp = wxbUtils::WaitForPrompt("2\n", true); - int fileset = pp->getChoices()->Index(restorePanel->GetRowString("Storage")); + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("2\n"), true); + int fileset = pp->getChoices()->Index(restorePanel->GetRowString(wxT("Storage"))); if (fileset == wxNOT_FOUND) { - wxbMainFrame::GetInstance()->SetStatusText("Failed to find the selected storage."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Failed to find the selected storage.")); failed = true; fileset = 1; } delete pp; dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << fileset << "\n"); - def = "1"; + wxbUtils::WaitForPrompt(wxString() << fileset << wxT("\n")); + def = wxT("1"); cfgUpdated = cfgUpdated & (~(1 << ConfigFileset)); } else { @@ -1136,14 +1136,14 @@ void wxbRestorePanel::CmdConfigApply() { unsigned int i; for (i = 0; i < dt->GetCount(); i++) { - if ((*dt)[i].Find("Run Restore job") == 0) { + if ((*dt)[i].Find(wxT("Run Restore job")) == 0) { break; } } if (i == dt->GetCount()) { delete dt; - dt = wxbUtils::WaitForEnd(def + "\n", true); + dt = wxbUtils::WaitForEnd(def + wxT("\n"), true); failed = true; } } @@ -1152,7 +1152,7 @@ void wxbRestorePanel::CmdConfigApply() { EnableConfig(true); if (!failed) { - wxbMainFrame::GetInstance()->SetStatusText("Restore configuration changes were applied."); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore configuration changes were applied.")); } delete dt; @@ -1160,21 +1160,21 @@ void wxbRestorePanel::CmdConfigApply() { /* Cancel restore */ void wxbRestorePanel::CmdConfigCancel() { - wxbUtils::WaitForEnd("no\n"); - wxbMainFrame::GetInstance()->Print("Restore cancelled.\n", CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText("Restore cancelled."); + wxbUtils::WaitForEnd(wxT("no\n")); + wxbMainFrame::GetInstance()->Print(wxT("Restore cancelled.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore cancelled.")); SetStatus(finished); } /* List jobs for a specified client */ void wxbRestorePanel::CmdListJobs() { if (status == entered) { - configPanel->ClearRowChoices("Before"); + configPanel->ClearRowChoices(wxT("Before")); /*wxbUtils::WaitForPrompt("query\n"); wxbUtils::WaitForPrompt("6\n");*/ wxbTableParser* tableparser = new wxbTableParser(false); wxbDataTokenizer* dt = wxbUtils::WaitForEnd( - wxString(".backups client=") + configPanel->GetRowString("Client") + "\n", true); + wxString(wxT(".backups client=")) + configPanel->GetRowString(wxT("Client")) + wxT("\n"), true); while (!tableparser->hasFinished()) { wxTheApp->Yield(true); @@ -1183,17 +1183,17 @@ void wxbRestorePanel::CmdListJobs() { if (!tableparser->GetCount() == 0) { for (unsigned int i = 0; i < dt->Count(); i++) { - if ((*dt)[i].Find("No results to list.") == 0) { - configPanel->AddRowChoice("Before", "No backup found for this client."); - configPanel->SetRowSelection("Before", 0); + if ((*dt)[i].Find(wxT("No results to list.")) == 0) { + configPanel->AddRowChoice(wxT("Before"), wxT("No backup found for this client.")); + configPanel->SetRowSelection(wxT("Before"), 0); configPanel->EnableApply(true); // Enabling the not existing apply button disables the ok button. delete tableparser; delete dt; return; } - else if (((*dt)[i].Find("ERROR") > -1) || ((*dt)[i].Find("Query failed") > -1)) { - configPanel->AddRowChoice("Before", "Cannot get previous backups list, see console."); - configPanel->SetRowSelection("Before", 0); + else if (((*dt)[i].Find(wxT("ERROR")) > -1) || ((*dt)[i].Find(wxT("Query failed")) > -1)) { + configPanel->AddRowChoice(wxT("Before"), wxT("Cannot get previous backups list, see console.")); + configPanel->SetRowSelection(wxT("Before"), 0); configPanel->EnableApply(true); // Enabling the not existing apply button disables the ok button. delete tableparser; delete dt; @@ -1207,16 +1207,16 @@ void wxbRestorePanel::CmdListJobs() { for (int i = tableparser->GetCount()-1; i > -1; i--) { wxString str = (*tableparser)[i][3]; wxDateTime datetime; - const char* chr; + const wxChar* chr; if ( ( (chr = datetime.ParseDate(str.GetData()) ) != NULL ) && ( datetime.ParseTime(++chr) != NULL ) ) { datetime += wxTimeSpan::Seconds(1); - configPanel->AddRowChoice("Before", datetime.Format("%Y-%m-%d %H:%M:%S")); + configPanel->AddRowChoice(wxT("Before"), datetime.Format(wxT("%Y-%m-%d %H:%M:%S"))); } } delete tableparser; - configPanel->SetRowSelection("Before", 0); + configPanel->SetRowSelection(wxT("Before"), 0); configPanel->EnableApply(false); // Disabling the not existing apply button enables the ok button. } } @@ -1283,7 +1283,7 @@ void wxbRestorePanel::CmdMark(wxTreeItemId treeitem, long* listitems, int listsi wxString dir = itemdata[0]->GetPath(); wxString file; - if (dir != "/") { + if (dir != wxT("/")) { if (dir.GetChar(dir.Length()-1) == '/') { dir.RemoveLast(); } @@ -1291,7 +1291,7 @@ void wxbRestorePanel::CmdMark(wxTreeItemId treeitem, long* listitems, int listsi int i = dir.Find('/', TRUE); if (i == -1) { file = dir; - dir = "/"; + dir = wxT("/"); } else { /* first dir below root */ file = dir.Mid(i+1); @@ -1299,8 +1299,8 @@ void wxbRestorePanel::CmdMark(wxTreeItemId treeitem, long* listitems, int listsi } } else { - dir = "/"; - file = "*"; + dir = wxT("/"); + file = wxT("*"); } if (state == -1) { @@ -1338,8 +1338,8 @@ void wxbRestorePanel::CmdMark(wxTreeItemId treeitem, long* listitems, int listsi } } - wxbUtils::WaitForEnd(wxString("cd \"") << dir << "\"\n"); - wxbUtils::WaitForEnd(wxString((state==1) ? "mark" : "unmark") << " \"" << file << "\"\n"); + wxbUtils::WaitForEnd(wxString(wxT("cd \"")) << dir << wxT("\"\n")); + wxbUtils::WaitForEnd(wxString((state==1) ? wxT("mark") : wxT("unmark")) << wxT(" \"") << file << wxT("\"\n")); /* TODO: Check commands results */ @@ -1379,9 +1379,9 @@ void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist, bool re // this->updatelist = updatelist; wxbDataTokenizer* dt; - dt = wxbUtils::WaitForEnd(wxString("cd \"") << + dt = wxbUtils::WaitForEnd(wxString(wxT("cd \"")) << static_cast(tree->GetItemData(item)) - ->GetPath() << "\"\n", false); + ->GetPath() << wxT("\"\n"), false); /* TODO: check command result */ @@ -1391,14 +1391,14 @@ void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist, bool re if (updatelist) list->DeleteAllItems(); - dt = wxbUtils::WaitForEnd("dir\n", true); + dt = wxbUtils::WaitForEnd(wxT("dir\n"), true); wxString str; for (unsigned int i = 0; i < dt->GetCount(); i++) { str = (*dt)[i]; - if (str.Find("cwd is:") == 0) { // Sometimes cd command result "infiltrate" into listings. + if (str.Find(wxT("cwd is:")) == 0) { // Sometimes cd command result "infiltrate" into listings. break; } @@ -1498,7 +1498,7 @@ wxString* wxbRestorePanel::ParseList(wxString line) { ret[6] = line.Mid(62+i, 1); ret[7] = line.Mid(63+i).Trim(); - if (ret[6] == " ") ret[6] = ""; + if (ret[6] == wxT(" ")) ret[6] = wxT(""); if (ret[7].GetChar(ret[7].Length()-1) == '/') { ret[8] = ret[7]; @@ -1720,7 +1720,7 @@ void wxbRestorePanel::RefreshList() { /* Update first config, adapting settings to the job name selected */ void wxbRestorePanel::UpdateFirstConfig() { configPanel->Enable(false); - wxbDataTokenizer* dt = wxbUtils::WaitForEnd(wxString(".defaults job=") + configPanel->GetRowString("Job Name") + "\n", true, false); + wxbDataTokenizer* dt = wxbUtils::WaitForEnd(wxString(wxT(".defaults job=")) + configPanel->GetRowString(wxT("Job Name")) + wxT("\n"), true, false); /* job=RestoreFiles * pool=Default * messages=Standard @@ -1741,21 +1741,21 @@ void wxbRestorePanel::UpdateFirstConfig() { str = (*dt)[i]; if ((j = str.Find('=')) > -1) { name = str.Mid(0, j); - if (name == "pool") { - configPanel->SetRowString("Pool", str.Mid(j+1)); + if (name == wxT("pool")) { + configPanel->SetRowString(wxT("Pool"), str.Mid(j+1)); } - else if (name == "client") { + else if (name == wxT("client")) { str = str.Mid(j+1); - if ((str != configPanel->GetRowString("Client")) || (configPanel->GetRowString("Before") == "")) { - configPanel->SetRowString("Client", str); + if ((str != configPanel->GetRowString(wxT("Client"))) || (configPanel->GetRowString(wxT("Before")) == wxT(""))) { + configPanel->SetRowString(wxT("Client"), str); dolistjobs = true; } } - else if (name == "storage") { - configPanel->SetRowString("Storage", str.Mid(j+1)); + else if (name == wxT("storage")) { + configPanel->SetRowString(wxT("Storage"), str.Mid(j+1)); } - else if (name == "fileset") { - configPanel->SetRowString("Fileset", str.Mid(j+1)); + else if (name == wxT("fileset")) { + configPanel->SetRowString(wxT("Fileset"), str.Mid(j+1)); } } } @@ -1788,7 +1788,7 @@ void wxbRestorePanel::UpdateFirstConfig() { bool wxbRestorePanel::UpdateSecondConfig(wxbDataTokenizer* dt) { unsigned int i; for (i = 0; i < dt->GetCount(); i++) { - if ((*dt)[i].Find("Run Restore job") == 0) + if ((*dt)[i].Find(wxT("Run Restore job")) == 0) break; } @@ -1798,31 +1798,31 @@ bool wxbRestorePanel::UpdateSecondConfig(wxbDataTokenizer* dt) { int k; - if ((k = (*dt)[++i].Find("JobName:")) != 0) return false; - restorePanel->SetRowString("Job Name", (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("Bootstrap:")) != 0) return false; - restorePanel->SetRowString("Bootstrap", (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("Where:")) != 0) return false; - restorePanel->SetRowString("Where", (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("JobName:"))) != 0) return false; + restorePanel->SetRowString(wxT("Job Name"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("Bootstrap:"))) != 0) return false; + restorePanel->SetRowString(wxT("Bootstrap"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("Where:"))) != 0) return false; + restorePanel->SetRowString(wxT("Where"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("Replace:")) != 0) return false; + if ((k = (*dt)[++i].Find(wxT("Replace:"))) != 0) return false; wxString str = (*dt)[i].Mid(10).Trim(false).RemoveLast(); - if (str == "always") restorePanel->SetRowSelection("Replace", 0); - else if (str == "ifnewer") restorePanel->SetRowSelection("Replace", 1); - else if (str == "ifolder") restorePanel->SetRowSelection("Replace", 2); - else if (str == "never") restorePanel->SetRowSelection("Replace", 3); - else restorePanel->SetRowSelection("Replace", 0); - - if ((k = (*dt)[++i].Find("FileSet:")) != 0) return false; - restorePanel->SetRowString("Fileset", (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("Client:")) != 0) return false; - restorePanel->SetRowString("Client", (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("Storage:")) != 0) return false; - restorePanel->SetRowString("Storage", (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("When:")) != 0) return false; - restorePanel->SetRowString("When", (*dt)[i].Mid(10).Trim(false).RemoveLast()); - if ((k = (*dt)[++i].Find("Priority:")) != 0) return false; - restorePanel->SetRowString("Priority", (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if (str == wxT("always")) restorePanel->SetRowSelection(wxT("Replace"), 0); + else if (str == wxT("ifnewer")) restorePanel->SetRowSelection(wxT("Replace"), 1); + else if (str == wxT("ifolder")) restorePanel->SetRowSelection(wxT("Replace"), 2); + else if (str == wxT("never")) restorePanel->SetRowSelection(wxT("Replace"), 3); + else restorePanel->SetRowSelection(wxT("Replace"), 0); + + if ((k = (*dt)[++i].Find(wxT("FileSet:"))) != 0) return false; + restorePanel->SetRowString(wxT("Fileset"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("Client:"))) != 0) return false; + restorePanel->SetRowString(wxT("Client"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("Storage:"))) != 0) return false; + restorePanel->SetRowString(wxT("Storage"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("When:"))) != 0) return false; + restorePanel->SetRowString(wxT("When"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); + if ((k = (*dt)[++i].Find(wxT("Priority:"))) != 0) return false; + restorePanel->SetRowString(wxT("Priority"), (*dt)[i].Mid(10).Trim(false).RemoveLast()); cfgUpdated = 0; restorePanel->Layout(); @@ -1848,7 +1848,7 @@ void wxbRestorePanel::SetStatus(status_enum newstatus) { configPanel->Layout(); centerSizer->Layout(); this->Layout(); - start->SetLabel("Enter restore mode"); + start->SetLabel(wxT("Enter restore mode")); start->Enable(false); configPanel->Enable(false); tree->Enable(false); @@ -1871,13 +1871,13 @@ void wxbRestorePanel::SetStatus(status_enum newstatus) { this->Layout(); tree->DeleteAllItems(); list->DeleteAllItems(); - configPanel->ClearRowChoices("Client"); - configPanel->ClearRowChoices("Before"); + configPanel->ClearRowChoices(wxT("Client")); + configPanel->ClearRowChoices(wxT("Before")); wxbMainFrame::GetInstance()->EnablePanels(); newstatus = activable; case activable: cancelled = 0; - start->SetLabel("Enter restore mode"); + start->SetLabel(wxT("Enter restore mode")); start->Enable(true); configPanel->Enable(false); tree->Enable(false); @@ -1902,7 +1902,7 @@ void wxbRestorePanel::SetStatus(status_enum newstatus) { break; case choosing: start->Enable(true); - start->SetLabel("Restore"); + start->SetLabel(wxT("Restore")); centerSizer->Remove(configPanel); configPanel->Show(false); centerSizer->Add(treelistPanel, 1, wxEXPAND); @@ -1929,7 +1929,7 @@ void wxbRestorePanel::SetStatus(status_enum newstatus) { restorePanel->EnableApply(false); break; case restoring: - start->SetLabel("Restoring..."); + start->SetLabel(wxT("Restoring...")); gauge->Enable(true); gauge->SetValue(0); start->Enable(false); diff --git a/bacula/src/wx-console/wxbtableparser.cpp b/bacula/src/wx-console/wxbtableparser.cpp index 5ce98e2764..06f47afc9f 100644 --- a/bacula/src/wx-console/wxbtableparser.cpp +++ b/bacula/src/wx-console/wxbtableparser.cpp @@ -91,7 +91,7 @@ bool wxbTableParser::Analyse(wxString str, int status) { if ((str.GetChar(0) == '|') && (str.GetChar(str.Length()-2) == '|') && (str.GetChar(str.Length()-1) == '\n')) { str.RemoveLast(); - wxStringTokenizer tkz(str, "|", wxTOKEN_STRTOK); + wxStringTokenizer tkz(str, wxT("|"), wxTOKEN_STRTOK); if (separatorNum == 1) { while ( tkz.HasMoreTokens() ) { diff --git a/bacula/src/wx-console/wxbutils.cpp b/bacula/src/wx-console/wxbutils.cpp index b15cf58c1f..11139b5ae8 100644 --- a/bacula/src/wx-console/wxbutils.cpp +++ b/bacula/src/wx-console/wxbutils.cpp @@ -168,14 +168,14 @@ bool wxbDataParser::Print(wxString str, int status) { } if (allnewline) { - ret = Analyse(buffer << "\n", CS_DATA); - buffer = ""; + ret = Analyse(buffer << wxT("\n"), CS_DATA); + buffer = wxT(""); for (unsigned int i = 1; i < str.Length(); i++) { - ret = Analyse("\n", status); + ret = Analyse(wxT("\n"), status); } } else { - wxStringTokenizer tkz(str, "\n", + wxStringTokenizer tkz(str, wxT("\n"), (wxStringTokenizerMode)(wxTOKEN_RET_DELIMS | wxTOKEN_RET_EMPTY | wxTOKEN_RET_EMPTY_ALL)); while ( tkz.HasMoreTokens() ) { @@ -184,23 +184,23 @@ bool wxbDataParser::Print(wxString str, int status) { if ((buffer.GetChar(buffer.Length()-1) == '\n') || (buffer.GetChar(buffer.Length()-1) == '\r')) { ret = Analyse(buffer, status); - buffer = ""; + buffer = wxT(""); } } } } - if (buffer == "$ ") { // Restore console + if (buffer == wxT("$ ")) { // Restore console ret = Analyse(buffer, status); - buffer = ""; + buffer = wxT(""); } if (status != CS_DATA) { if (buffer.Length() != 0) { ret = Analyse(buffer, CS_DATA); } - buffer = ""; - ret = Analyse("", status); + buffer = wxT(""); + ret = Analyse(wxT(""), status); } } else { @@ -225,7 +225,7 @@ wxbDataTokenizer::~wxbDataTokenizer() { bool wxbDataTokenizer::Analyse(wxString str, int status) { finished = ((status == CS_END) || (status == CS_PROMPT) || (status == CS_DISCONNECTED)); - if (str != "") { + if (str != wxT("")) { Add(str); } return false; @@ -241,10 +241,10 @@ bool wxbDataTokenizer::hasFinished() { wxbPromptParser::wxbPromptParser(): wxbDataParser(false) { finished = false; prompt = false; - introStr = ""; + introStr = wxT(""); choices = NULL; numerical = false; - questionStr = ""; + questionStr = wxT(""); } /* Destroy a wxbDataTokenizer */ @@ -267,23 +267,23 @@ bool wxbPromptParser::Analyse(wxString str, int status) { choices = NULL; numerical = false; } - questionStr = ""; - introStr = ""; + questionStr = wxT(""); + introStr = wxT(""); } int i; long num; - if (((i = str.Find(": ")) > 0) && (str.Mid(0, i).Trim(false).ToLong(&num))) { /* List element */ + if (((i = str.Find(wxT(": "))) > 0) && (str.Mid(0, i).Trim(false).ToLong(&num))) { /* List element */ if (!choices) { choices = new wxArrayString(); - choices->Add(""); /* index 0 is never used by multiple choice questions */ + choices->Add(wxT("")); /* index 0 is never used by multiple choice questions */ numerical = true; } if ((long)choices->GetCount() != num) { /* new choice has begun */ delete choices; choices = new wxArrayString(); - choices->Add("", num); /* fill until this number */ + choices->Add(wxT(""), num); /* fill until this number */ numerical = true; } @@ -300,20 +300,20 @@ bool wxbPromptParser::Analyse(wxString str, int status) { } else { finished = ((status == CS_PROMPT) || (status == CS_END) || (status == CS_DISCONNECTED)); - if (prompt = ((status == CS_PROMPT) && (questionStr != "$ "))) { // && (str.Find(": ") == str.Length()) + if (prompt = ((status == CS_PROMPT) && (questionStr != wxT("$ ")))) { // && (str.Find(": ") == str.Length()) if (introStr.Last() == '\n') { introStr.RemoveLast(); } - if ((introStr != "") && (questionStr == "")) { + if ((introStr != wxT("")) && (questionStr == wxT(""))) { questionStr = introStr; - introStr = ""; + introStr = wxT(""); } - if ((!choices) && (questionStr.Find("(yes/mod/no)") > -1)) { + if ((!choices) && (questionStr.Find(wxT("(yes/mod/no)")) > -1)) { choices = new wxArrayString(); - choices->Add("yes"); - choices->Add("mod"); - choices->Add("no"); + choices->Add(wxT("yes")); + choices->Add(wxT("mod")); + choices->Add(wxT("no")); numerical = false; } @@ -325,8 +325,8 @@ bool wxbPromptParser::Analyse(wxString str, int status) { choices = NULL; numerical = false; } - questionStr = ""; - introStr = ""; + questionStr = wxT(""); + introStr = wxT(""); } } return false; -- 2.39.5