]> git.sur5r.net Git - bacula/bacula/commitdiff
Moved behavior of MainWin::setContextMenuDockText and setTreeWidgetItemDockColor
authorDirk H Bartley <dbartley@schupan.com>
Sat, 12 May 2007 14:17:40 +0000 (14:17 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sat, 12 May 2007 14:17:40 +0000 (14:17 +0000)
to the pages class.
Add column for purged flag to joblist.  Add four filters: job, level, status
and purged.
Add Feature to right click on job and get restore from time option, this
populates the timestamp in the before box of the prerestore page.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4762 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/TODO
bacula/src/qt-console/joblist/joblist.cpp
bacula/src/qt-console/joblist/joblist.h
bacula/src/qt-console/joblist/joblist.ui
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/pages.cpp
bacula/src/qt-console/pages.h
bacula/src/qt-console/restore/prerestore.cpp
bacula/src/qt-console/restore/restore.h

index 68a1a2e92f57660969c6a16c53e27d5e6bdb1cfb..21b36caba150ed46742208b5c7744a4042eb05b1 100644 (file)
@@ -5,11 +5,6 @@ a specific job.  Want the ability to create an instance of that class from
 joblist.  I also want a table to convert termination code into human readable
 text.
 
-move behavior of:
-  MainWin::setContextMenuDockText
-  MainWin::setTreeWidgetItemDockColor
-to the pages class
-
 Test left pane of restore with 2 windows drives in one backup job.
 
 User preferences.  With log to stdout options.
@@ -88,6 +83,11 @@ global one defined in the mainWin class (if I remember right).
 ============================================================
 DONE:
 ============================================================
+move behavior of:
+  MainWin::setContextMenuDockText
+  MainWin::setTreeWidgetItemDockColor
+to the pages class
+
 preempt all connections to console with 
 if (!is_connectedGui())
 or some other mechanism.  May find more as users start finding them.
index 963c63ed17792b9981873efa43f57c633980ad5c..48b864d96eb85ae15eb7451fdff671b316043609 100644 (file)
@@ -99,6 +99,14 @@ void JobList::populateTable()
       if (volumeIndex != -1) {
          volumeComboBox->setCurrentIndex(volumeIndex);
       }
+      jobComboBox->addItem("Any");
+      jobComboBox->addItems(m_console->job_list);
+      levelComboBox->addItem("Any");
+      levelComboBox->addItems( QStringList() << "F" << "D" << "I");
+      statusComboBox->addItem("Any");
+      statusComboBox->addItems( QStringList() << "T");
+      purgedComboBox->addItem("Any");
+      purgedComboBox->addItems( QStringList() << "0" << "1");
    }
 
    /* Set up query QString and header QStringList */
@@ -106,7 +114,8 @@ void JobList::populateTable()
    query += "SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client,"
             " Job.Starttime AS JobStart, Job.Type AS JobType,"
             " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
-            " Job.JobBytes AS Bytes, Job.JobStatus AS Status"
+            " Job.JobBytes AS Bytes, Job.JobStatus AS Status,"
+            " Job.PurgedFiles AS Purged"
             " FROM Job, JobMedia, Media, Client"
             " WHERE JobMedia.JobId=Job.JobId and JobMedia.MediaId=Media.MediaId"
             " and Client.ClientId=Job.ClientId";
@@ -124,6 +133,22 @@ void JobList::populateTable()
       query += " AND Client.Name='" + m_clientName + "'";
       m_closeable=true;
    }
+   int jobIndex = jobComboBox->currentIndex();
+   if ((jobIndex != -1) && (jobComboBox->itemText(jobIndex) != "Any")) {
+      query += " AND Job.Name='" + jobComboBox->itemText(jobIndex) + "'";
+   }
+   int levelIndex = levelComboBox->currentIndex();
+   if ((levelIndex != -1) && (levelComboBox->itemText(levelIndex) != "Any")) {
+      query += " AND Job.Level='" + levelComboBox->itemText(levelIndex) + "'";
+   }
+   int statusIndex = statusComboBox->currentIndex();
+   if ((statusIndex != -1) && (statusComboBox->itemText(statusIndex) != "Any")) {
+      query += " AND Job.JobStatus='" + statusComboBox->itemText(statusIndex) + "'";
+   }
+   int purgedIndex = purgedComboBox->currentIndex();
+   if ((purgedIndex != -1) && (purgedComboBox->itemText(purgedIndex) != "Any")) {
+      query += " AND Job.PurgedFiles='" + purgedComboBox->itemText(purgedIndex) + "'";
+   }
    /* If Limit check box For limit by days is checked  */
    if (daysCheckBox->checkState() == Qt::Checked) {
       QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value());
@@ -140,7 +165,7 @@ void JobList::populateTable()
    }
    QStringList headerlist = (QStringList()
       << "Job Id" << "Job Name" << "Client" << "Job Starttime" << "Job Type" 
-      << "Job Level" << "Job Files" << "Job Bytes" << "Job Status"  );
+      << "Job Level" << "Job Files" << "Job Bytes" << "Job Status"  << "Purged" );
 
    /* Initialize the QTableWidget */
    m_checkCurrentWidget = false;
@@ -277,6 +302,7 @@ void JobList::createConnections()
    mp_tableWidget->addAction(actionDeleteJob);
    mp_tableWidget->addAction(actionPurgeFiles);
    mp_tableWidget->addAction(actionRestoreFromJob);
+   mp_tableWidget->addAction(actionRestoreFromTime);
 
    /* Make Connections */
    connect(actionLongListJob, SIGNAL(triggered()), this,
@@ -295,6 +321,8 @@ void JobList::createConnections()
                 SLOT(consolePurgeFiles()));
    connect(actionRestoreFromJob, SIGNAL(triggered()), this,
                 SLOT(preRestoreFromJob()));
+   connect(actionRestoreFromTime, SIGNAL(triggered()), this,
+                SLOT(preRestoreFromTime()));
 }
 
 /*
@@ -373,5 +401,13 @@ void JobList::consolePurgeFiles()
  */
 void JobList::preRestoreFromJob()
 {
-   new prerestorePage(m_currentJob);
+   new prerestorePage(m_currentJob, R_JOBIDLIST);
+}
+
+/*
+ * Subroutine to call preRestore to restore from a select job
+ */
+void JobList::preRestoreFromTime()
+{
+   new prerestorePage(m_currentJob, R_JOBDATETIME);
 }
index 5d35d7e4ea8edaa2408aac30c3a98c12dfcd5223..cacc930d4f51cf6f2eca022cdaea6777a7114691 100644 (file)
@@ -62,6 +62,7 @@ private slots:
    void consoleDeleteJob();
    void consolePurgeFiles();
    void preRestoreFromJob();
+   void preRestoreFromTime();
 
 private:
    void createConnections();
index faa15cbacd5d227dbea60aa597f93219da0ed197..eb50b2387e3f6b4545ef1486fdcd686de3c8bf2b 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>621</width>
-    <height>500</height>
+    <width>547</width>
+    <height>361</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <property name="spacing" >
     <number>6</number>
    </property>
+   <item row="0" column="0" >
+    <widget class="QTableWidget" name="mp_tableWidget" />
+   </item>
    <item row="1" column="0" >
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
      </property>
      <property name="spacing" >
-      <number>6</number>
+      <number>0</number>
      </property>
      <item>
       <layout class="QVBoxLayout" >
         <number>6</number>
        </property>
        <item>
-        <widget class="QCheckBox" name="limitCheckBox" >
-         <property name="text" >
-          <string>Record Limit</string>
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
          </property>
-        </widget>
+         <item>
+          <widget class="QCheckBox" name="limitCheckBox" >
+           <property name="text" >
+            <string>Record Limit</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="limitSpinBox" >
+           <property name="maximum" >
+            <number>10000</number>
+           </property>
+           <property name="minimum" >
+            <number>1</number>
+           </property>
+           <property name="singleStep" >
+            <number>25</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
        <item>
-        <widget class="QSpinBox" name="limitSpinBox" >
-         <property name="maximum" >
-          <number>10000</number>
-         </property>
-         <property name="minimum" >
-          <number>1</number>
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
          </property>
-         <property name="singleStep" >
-          <number>25</number>
+         <property name="spacing" >
+          <number>6</number>
          </property>
-        </widget>
+         <item>
+          <widget class="QCheckBox" name="daysCheckBox" >
+           <property name="text" >
+            <string>Days Limit</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="daysSpinBox" >
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
       </layout>
      </item>
         <number>6</number>
        </property>
        <item>
-        <widget class="QCheckBox" name="daysCheckBox" >
-         <property name="text" >
-          <string>Days Limit</string>
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
          </property>
-        </widget>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <item>
+          <widget class="QLabel" name="clientsLabel" >
+           <property name="text" >
+            <string>Clients</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="clientsComboBox" />
+         </item>
+        </layout>
        </item>
        <item>
-        <widget class="QSpinBox" name="daysSpinBox" >
-         <property name="singleStep" >
-          <number>10</number>
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
          </property>
-        </widget>
+         <item>
+          <widget class="QLabel" name="volumeLabel" >
+           <property name="text" >
+            <string>Volume</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="volumeComboBox" />
+         </item>
+        </layout>
        </item>
       </layout>
      </item>
         <number>6</number>
        </property>
        <item>
-        <widget class="QLabel" name="clientsLabel" >
-         <property name="text" >
-          <string>Clients</string>
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
          </property>
-        </widget>
+         <item>
+          <widget class="QLabel" name="jobLabel" >
+           <property name="text" >
+            <string>Job</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="jobComboBox" />
+         </item>
+        </layout>
        </item>
        <item>
-        <widget class="QComboBox" name="clientsComboBox" />
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <item>
+          <widget class="QLabel" name="levelLabel" >
+           <property name="text" >
+            <string>Level</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="levelComboBox" />
+         </item>
+        </layout>
        </item>
       </layout>
      </item>
         <number>6</number>
        </property>
        <item>
-        <widget class="QLabel" name="volumeLabel" >
-         <property name="text" >
-          <string>Volume</string>
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
          </property>
-        </widget>
+         <item>
+          <widget class="QLabel" name="statusLabel" >
+           <property name="text" >
+            <string>Status</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="statusComboBox" />
+         </item>
+        </layout>
        </item>
        <item>
-        <widget class="QComboBox" name="volumeComboBox" />
+        <layout class="QVBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <item>
+          <widget class="QLabel" name="purgedLabel" >
+           <property name="text" >
+            <string>Purged</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="purgedComboBox" />
+         </item>
+        </layout>
        </item>
       </layout>
      </item>
      </item>
     </layout>
    </item>
-   <item row="0" column="0" >
-    <widget class="QTableWidget" name="mp_tableWidget" />
-   </item>
   </layout>
   <action name="actionRefreshJobList" >
    <property name="icon" >
     <string>Restore From Job</string>
    </property>
   </action>
+  <action name="actionRestoreFromTime" >
+   <property name="icon" >
+    <iconset>../images/unmark.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Restore From Time</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections/>
index 68e2d81ce24777947e3106b4608d51862465dd2e..8fa0aec17ac591fa059f3eb6e991b6c317948803 100644 (file)
@@ -417,7 +417,7 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre
          nextPage->raise();
       }
       /* for the page selectors menu action to dock or undock, set the text */
-      setContextMenuDockText(nextPage, currentitem);
+      nextPage->setContextMenuDockText();
 
       treeWidget->addAction(actionToggleDock);
       /* if this page is closeable, then add that action */
@@ -503,8 +503,6 @@ void MainWin::undockWindowButton()
 {
    Pages* page = (Pages*)stackedWidget->currentWidget();
    page->togglePageDocking();
-   /* The window has been undocked, lets change the context menu */
-   setContextMenuDockText();
 }
 
 /*
@@ -520,78 +518,6 @@ void MainWin::toggleDockContextWindow()
    if (getFromHash(currentitem)) {
       Pages* page = getFromHash(currentitem);
       page->togglePageDocking();
-      if (page->isDocked()) {
-         stackedWidget->setCurrentWidget(page);
-      }
-      /* Toggle the menu item.  The window's dock status has been toggled */
-      setContextMenuDockText(page, currentitem);
-   }
-}
-
-/*
- * Function to set the text of the toggle dock context menu when page and
- * widget item are NOT known.  This is an overoaded funciton.
- * It is called from MainWin::undockWindowButton, it is not intended to change
- * for the top pages tree widget, it is for the currently active tree widget
- * item.  Which is why the page is not passed.
- */
-void MainWin::setContextMenuDockText()
-{
-   QTreeWidgetItem *currentitem = treeWidget->currentItem();
-   
-   /* Is this a page that has been inserted into the hash  */
-   if (getFromHash(currentitem)) {
-      Pages* page = getFromHash(currentitem);
-      setContextMenuDockText(page, currentitem);
-   }
-}
-
-/*
- * Function to set the text of the toggle dock context menu when page and
- * widget item are known.  This is the more commonly used.
- */
-void MainWin::setContextMenuDockText(Pages* page, QTreeWidgetItem* item)
-{
-   QString docktext("");
-   if (page->isDocked()) {
-      docktext += "UnDock ";
-   } else {
-      docktext += "ReDock ";
-   }
-   docktext += item->text(0) += " Window";
-   
-   actionToggleDock->setText(docktext);
-   setTreeWidgetItemDockColor(page, item);
-}
-
-/*
- * Function to set the color of the tree widget item based on whether it is
- * docked or not.
- */
-void MainWin::setTreeWidgetItemDockColor(Pages* page, QTreeWidgetItem* item)
-{
-   if (item->text(0) != "Console") {
-      if (page->isDocked()) {
-      /* Set the brush to blue if undocked */
-         QBrush blackBrush(Qt::black);
-         item->setForeground(0, blackBrush);
-      } else {
-      /* Set the brush back to black if docked */
-         QBrush blueBrush(Qt::blue);
-         item->setForeground(0, blueBrush);
-      }
-   }
-}
-
-/*
- *  Overload of previous function, use treeindex to get item from page
- *  This is called when an undocked window is closed.
- */
-void MainWin::setTreeWidgetItemDockColor(Pages* page)
-{
-   QTreeWidgetItem* item = getFromHash(page);
-   if (item) {
-     setTreeWidgetItemDockColor(page, item);
    }
 }
 
index 19da0df74f76449e12cda68bb2482966bd406b70..60ad2630b364f0a799445d9408fa55457ff9b292 100644 (file)
@@ -55,10 +55,6 @@ public:
    void writeSettings();
    void readSettings();
    void resetFocus() { lineEdit->setFocus(); };
-   void setContextMenuDockText();
-   void setContextMenuDockText(Pages *, QTreeWidgetItem *);
-   void setTreeWidgetItemDockColor(Pages *, QTreeWidgetItem *);
-   void setTreeWidgetItemDockColor(Pages *);
    void hashInsert(QTreeWidgetItem *, Pages *);
    void hashRemove(Pages *);
    void hashRemove(QTreeWidgetItem *, Pages *);
index 2e94f0a7866428064a5b4dc491483c1daa61adfd..1e57794d39bee8a644711055ad9385c4a41549a3 100644 (file)
@@ -46,13 +46,15 @@ void Pages::dockPage()
     * that it has the proper window flag and parent.
     */
    setWindowFlags(Qt::Widget);
-//   setParent(m_parent);
 
    /* This was being done already */
    m_parent->addWidget(this);
 
    /* Set docked flag */
    m_docked = true;
+   mainWin->stackedWidget->setCurrentWidget(this);
+   /* lets set the page selectors action for docking or undocking */
+   setContextMenuDockText();
 }
 
 /*
@@ -69,6 +71,8 @@ void Pages::undockPage()
    show();
    /* Clear docked flag */
    m_docked = false;
+   /* The window has been undocked, lets change the context menu */
+   setContextMenuDockText();
 }
 
 /*
@@ -117,24 +121,12 @@ void Pages::closeEvent(QCloseEvent* event)
    /* A Widget was closed, lets toggle it back into the window, and set it in front. */
    dockPage();
 
-   /* is the tree widget item for "this" the current widget item */
-   if (mainWin->treeWidget->currentItem() == mainWin->getFromHash(this))
-      /* in case the current widget is the one which represents this, lets set the context
-       * menu to undock */
-      mainWin->setContextMenuDockText();
-   else
-      /* in case the current widget is not the one which represents this, lets set the
-      * color back to black */
-      mainWin->setTreeWidgetItemDockColor(this);
-
    /* this fixes my woes of getting the widget to show up on top when closed */
    event->ignore();
 
-   /* put this widget on the top of the stack widget */
-   m_parent->setCurrentWidget(this);
-
    /* Set the current tree widget item in the Page Selector window to the item 
-    * which represents "this" */
+    * which represents "this" 
+    * Which will also bring "this" to the top of the stacked widget */
    setCurrent();
 }
 
@@ -220,7 +212,11 @@ void Pages::consoleCommand(QString &command)
 #ifdef xxdebugcode
    m_console->display_text("Context sensitive command :\n\n");
    m_console->display_text("****    ");
-   m_console->display_text(command + "    ****\n");
+#endif
+   m_console->display_text(command);
+   m_console->display_text("\n");
+#ifdef xxdebugcode
+   m_console->display_text("    ****\n");
    m_console->display_text("Director Response :\n\n");
 #endif
    m_console->write_dir(command.toUtf8().data());
@@ -269,3 +265,44 @@ void Pages::setCurrent()
 {
    mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(this));
 }
+
+/*
+ * Function to set the text of the toggle dock context menu when page and
+ * widget item are NOT known.  
+ */
+void Pages::setContextMenuDockText()
+{
+   QTreeWidgetItem *item = mainWin->getFromHash(this);
+   QString docktext("");
+   if (isDocked()) {
+       docktext += "UnDock ";
+   } else {
+       docktext += "ReDock ";
+   }
+   docktext += item->text(0) += " Window";
+      
+   mainWin->actionToggleDock->setText(docktext);
+   setTreeWidgetItemDockColor();
+}
+
+/*
+ * Function to set the color of the tree widget item based on whether it is
+ * docked or not.
+ */
+void Pages::setTreeWidgetItemDockColor()
+{
+   QTreeWidgetItem* item = mainWin->getFromHash(this);
+   if (item) {
+      if (item->text(0) != "Console") {
+         if (isDocked()) {
+         /* Set the brush to blue if undocked */
+            QBrush blackBrush(Qt::black);
+            item->setForeground(0, blackBrush);
+         } else {
+         /* Set the brush back to black if docked */
+            QBrush blueBrush(Qt::blue);
+            item->setForeground(0, blueBrush);
+         }
+      }
+   }
+}
index 857ed706353b7f287c02a77802129ae2e07ea797..c7e7d1a1f19d917b3b9770cd83ef69287bb7c21f 100644 (file)
@@ -67,6 +67,8 @@ public:
    void closeStackPage();
    Console *console() { return m_console; };
    void setCurrent();
+   void setContextMenuDockText();
+   void setTreeWidgetItemDockColor();
 
 public slots:
    /* closeEvent is a virtual function inherited from QWidget */
index 458201237a34f177d59b46c963063bb7413dd5c9..56995db43f5b47585e5a1aa1b28966add2953eb1 100644 (file)
 #include "restore.h"
 
 /* Constructor to have job id list default in */
-prerestorePage::prerestorePage(QString &jobIdString)
+prerestorePage::prerestorePage(QString &data, unsigned int datatype)
 {
-   m_jobIdListIn = jobIdString;
+   m_dataIn = data;
+   m_dataInType = datatype;
    buildPage();
 }
 
 /* Basic Constructor */
 prerestorePage::prerestorePage()
 {
-   m_jobIdListIn = "";
+   m_dataIn = "";
+   m_dataInType = R_NONE;
    buildPage();
 }
 
@@ -57,7 +59,7 @@ prerestorePage::prerestorePage()
  */
 void prerestorePage::buildPage()
 {
-   m_dtformat = "yyyy-MM-dd HH:MM:ss";
+   m_dtformat = "yyyy-MM-dd HH:mm:ss";
    m_name = "Restore";
    setupUi(this);
    pgInitialize();
@@ -76,19 +78,31 @@ void prerestorePage::buildPage()
    beforeDateTime->setDateTime(QDateTime::currentDateTime());
    beforeDateTime->setEnabled(false);
    selectFilesRadio->setChecked(true);
-   if (m_jobIdListIn == "") {
+   if (m_dataInType == R_NONE) {
       selectJobsRadio->setChecked(true);
       jobIdEdit->setText("Comma separted list of jobs id's");
       jobIdEdit->setEnabled(false);
-   } else {
+   } else if (m_dataInType == R_JOBIDLIST) {
       listJobsRadio->setChecked(true);
-      jobIdEdit->setText(m_jobIdListIn);
+      jobIdEdit->setText(m_dataIn);
       jobsRadioClicked(false);
       QStringList fieldlist;
-      jobdefsFromJob(fieldlist,m_jobIdListIn);
+      jobdefsFromJob(fieldlist,m_dataIn);
+      filesetCombo->setCurrentIndex(filesetCombo->findText(fieldlist[2], Qt::MatchExactly));
+      clientCombo->setCurrentIndex(clientCombo->findText(fieldlist[1], Qt::MatchExactly));
+      jobCombo->setCurrentIndex(jobCombo->findText(fieldlist[0], Qt::MatchExactly));
+   } else if (m_dataInType == R_JOBDATETIME) {
+      selectJobsRadio->setChecked(true);
+      jobIdEdit->setText("Comma separted list of jobs id's");
+      jobIdEdit->setEnabled(false);
+      recentCheckBox->setCheckState(Qt::Unchecked);
+      jobsRadioClicked(true);
+      QStringList fieldlist;
+      jobdefsFromJob(fieldlist,m_dataIn);
       filesetCombo->setCurrentIndex(filesetCombo->findText(fieldlist[2], Qt::MatchExactly));
       clientCombo->setCurrentIndex(clientCombo->findText(fieldlist[1], Qt::MatchExactly));
       jobCombo->setCurrentIndex(jobCombo->findText(fieldlist[0], Qt::MatchExactly));
+      beforeDateTime->setDateTime(QDateTime::fromString(fieldlist[3], m_dtformat));
    }
    job_name_change(0);
    connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
@@ -143,7 +157,7 @@ void prerestorePage::okButtonPushed()
    }
 
    /* ***FIXME*** */
-   //printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
+   printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
    consoleCommand(cmd);
    /* Note, do not turn notifier back on here ... */
    if (selectFilesRadio->isChecked()) {
@@ -237,7 +251,8 @@ void prerestorePage::jobdefsFromJob(QStringList &fieldlist, QString jobId)
 {
    QString job, client, fileset;
    QString query("");
-   query = "SELECT DISTINCT Job.Name AS JobName, Client.Name AS Client, FileSet.FileSet AS FileSet "
+   query = "SELECT DISTINCT Job.Name AS JobName, Client.Name AS Client,"
+   " FileSet.FileSet AS FileSet, Job.Starttime AS JobStart"
    " From Job, Client, FileSet"
    " WHERE Job.FileSetId=FileSet.FileSetId AND Job.ClientId=Client.ClientId"
    " AND JobId=\'" + jobId + "\'";
@@ -271,7 +286,6 @@ bool prerestorePage::checkJobIdList()
          "Press OK to continue?"), QMessageBox::Ok );
       return false;
    }
-   //printf("In prerestorePage::jobIdEditFinished %s\n",line.toUtf8().data());
    QStringList joblist = line.split(",", QString::SkipEmptyParts);
    bool allintokay = true, alljobok = true, allisjob = true;
    QString jobName(""), clientName("");
index f027e233e56db842869ab49bb754a2828bab8b17..39150a3cc8348fdd12e38bae322bfc00e2e821a6 100644 (file)
 #include "ui_restore.h"
 #include "ui_prerestore.h"
 
+enum {
+   R_NONE,
+   R_JOBIDLIST,
+   R_JOBDATETIME
+};
+
 /*
  * The pre-restore dialog selects the Job/Client to be restored
  * It really could use considerable enhancement.
@@ -50,7 +56,7 @@ class prerestorePage : public Pages, public Ui::prerestoreForm
 
 public:
    prerestorePage();
-   prerestorePage(QString &jobIdString);
+   prerestorePage(QString &data, unsigned int);
 
 private slots:
    void okButtonPushed();
@@ -65,7 +71,8 @@ private:
    void buildPage();
    bool checkJobIdList();
    QString m_dtformat;
-   QString m_jobIdListIn;
+   QString m_dataIn;
+   unsigned int m_dataInType;
 };
 
 /*