]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbrestorepanel.cpp
Some Win32 fixes
[bacula/bacula] / bacula / src / wx-console / wxbrestorepanel.cpp
index 1783446fc8de3a2e6a150a975cd0b625257263b3..51da80753ea5d8d4c4613ce3c1244e640ef37550 100644 (file)
@@ -814,20 +814,27 @@ void wxbRestorePanel::CmdStart() {
          
          wxDateTime jobtime;
          
-         if (jobname == (*tableparser)[tableparser->GetCount()-1][1]) {
-            wxStringTokenizer jtkz((*tableparser)[tableparser->GetCount()-1][2], " ", wxTOKEN_STRTOK);
-            if ((jobtime.ParseDate(jtkz.GetNextToken()) != NULL) && // Date
-                  (jobtime.ParseTime(jtkz.GetNextToken()) != NULL)) { // Time
-               if (jobtime.IsLaterThan(currenttime)) {
-                  jobid = (*tableparser)[tableparser->GetCount()-1][0];
-                  cmd << jobid << "\n";
-                  delete tableparser;
-                  cancel->Enable(true);
-                  break;
+         for (i = 0; i < tableparser->GetCount(); i++) {
+            if (jobname == (*tableparser)[i][1]) {
+               wxStringTokenizer jtkz((*tableparser)[i][2], " ", wxTOKEN_STRTOK);
+               if ((jobtime.ParseDate(jtkz.GetNextToken()) != NULL) && // Date
+                     (jobtime.ParseTime(jtkz.GetNextToken()) != NULL)) { // Time
+                  if (jobtime.IsLaterThan(currenttime)) {
+                     jobid = (*tableparser)[i][0];
+                     cmd << jobid << "\n";
+                     delete tableparser;
+                     tableparser = NULL;
+                     cancel->Enable(true);
+                     break;
+                  }
                }
             }
          }
    
+         if (tableparser == NULL) { //The job was found
+            break;
+         }
+         
          delete tableparser;
          
          wxStopWatch sw2;
@@ -1114,8 +1121,8 @@ void wxbRestorePanel::CmdListJobs() {
       wxbDataTokenizer* dt = wxbUtils::WaitForEnd(configPanel->GetRowString("Client") + "\n", true);
 
       if (!tableparser->hasFinished()) {
-         for (int i = 0; i < dt->Count(); i++) {
-            if ((*dt)[i].Index("No results to list.") == 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);
                configPanel->EnableApply(true); // Enabling the not existing apply button disables the ok button.
@@ -1123,7 +1130,7 @@ void wxbRestorePanel::CmdListJobs() {
                delete dt;
                return;
             }
-            else if (((*dt)[i].Index("ERROR") > -1) || ((*dt)[i].Index("Query failed") > -1)) {
+            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);
                configPanel->EnableApply(true); // Enabling the not existing apply button disables the ok button.