*/
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();
#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);
/* 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);
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);
this->SetSize(size);
EnableConsole(false);
- consoleBuffer = "";
+ consoleBuffer = wxT("");
- configfile = "";
+ configfile = wxT("");
}
/*
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();
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();
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();
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);
}
}
}
- 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 */
parsers.RemoveAt(index);
}
else {
- Print("Failed to unregister a data parser !", CS_DEBUG);
+ Print(wxT("Failed to unregister a data parser !"), CS_DEBUG);
}
}
void wxbMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
- Print("Quitting.\n", CS_DEBUG);
+ Print(wxT("Quitting.\n"), CS_DEBUG);
if (ct != NULL) {
ct->Delete();
ct = NULL;
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;
}
}
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);
lockedbyconsole = true;
DisablePanels();
typeCtrl->HistoryAdd(typeCtrl->GetValue());
- wxString str = typeCtrl->GetValue() + "\n";
+ wxString str = typeCtrl->GetValue() + wxT("\n");
Send(str);
}
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);
}
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++) {
}
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);
}
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;
}
}
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();
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++;
}
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"));
}
}
}
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)));
}
//consoleBuffer << "<P>";
}
- 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);
}
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);
* 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);
}
}
}
void wxbTreeItemData::SetMarked(wxString marked) {
- if (marked == "*") {
+ if (marked == wxT("*")) {
this->marked = 1;
}
- else if (marked == "+") {
+ else if (marked == wxT("+")) {
this->marked = 2;
}
else {
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];
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);
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);
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);
----------------------------------------------------------------------------*/
wxString wxbRestorePanel::GetTitle() {
- return "Restore";
+ return wxT("Restore");
}
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;
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;
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;
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;
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;
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) {
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);
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);
for (i = 0; i < tableparser->GetCount(); i++) {
str = (*tableparser)[i][2];
- str.Replace(",", "");
+ str.Replace(wxT(","), wxT(""));
if (str.ToLong(&l)) {
tot += l;
}
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;
}
}
}
- else if ((*dt)[lastindex] == "+") {
+ else if ((*dt)[lastindex] == wxT("+")) {
gauge->SetValue(gauge->GetValue()+var);
wxTheApp->Yield(true);
}
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) {
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);
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);
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
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
}
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;
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;
}
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);
}
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;
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) {
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;
void wxbRestorePanel::CmdConfigApply() {
if (cfgUpdated == 0) return;
- wxbMainFrame::GetInstance()->SetStatusText("Applying restore configuration changes...");
+ wxbMainFrame::GetInstance()->SetStatusText(wxT("Applying restore configuration changes..."));
EnableConfig(false);
}
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 {
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;
}
}
EnableConfig(true);
if (!failed) {
- wxbMainFrame::GetInstance()->SetStatusText("Restore configuration changes were applied.");
+ wxbMainFrame::GetInstance()->SetStatusText(wxT("Restore configuration changes were applied."));
}
delete dt;
/* 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);
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;
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.
}
}
wxString dir = itemdata[0]->GetPath();
wxString file;
- if (dir != "/") {
+ if (dir != wxT("/")) {
if (dir.GetChar(dir.Length()-1) == '/') {
dir.RemoveLast();
}
int i = dir.Find('/', TRUE);
if (i == -1) {
file = dir;
- dir = "/";
+ dir = wxT("/");
}
else { /* first dir below root */
file = dir.Mid(i+1);
}
}
else {
- dir = "/";
- file = "*";
+ dir = wxT("/");
+ file = wxT("*");
}
if (state == -1) {
}
}
- 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 */
// this->updatelist = updatelist;
wxbDataTokenizer* dt;
- dt = wxbUtils::WaitForEnd(wxString("cd \"") <<
+ dt = wxbUtils::WaitForEnd(wxString(wxT("cd \"")) <<
static_cast<wxbTreeItemData*>(tree->GetItemData(item))
- ->GetPath() << "\"\n", false);
+ ->GetPath() << wxT("\"\n"), false);
/* TODO: check command result */
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;
}
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];
/* 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
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));
}
}
}
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;
}
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();
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);
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);
break;
case choosing:
start->Enable(true);
- start->SetLabel("Restore");
+ start->SetLabel(wxT("Restore"));
centerSizer->Remove(configPanel);
configPanel->Show(false);
centerSizer->Add(treelistPanel, 1, wxEXPAND);
restorePanel->EnableApply(false);
break;
case restoring:
- start->SetLabel("Restoring...");
+ start->SetLabel(wxT("Restoring..."));
gauge->Enable(true);
gauge->SetValue(0);
start->Enable(false);