]> git.sur5r.net Git - bacula/bacula/commitdiff
Add intelegence to prerestore. Radio buttons for select or all files. Radio
authorDirk H Bartley <dbartley@schupan.com>
Sun, 6 May 2007 19:51:52 +0000 (19:51 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sun, 6 May 2007 19:51:52 +0000 (19:51 +0000)
button for select or list jobs.  Text input for list of jobs.

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

bacula/src/qt-console/restore/prerestore.cpp
bacula/src/qt-console/restore/prerestore.ui
bacula/src/qt-console/restore/restore.cpp
bacula/src/qt-console/restore/restore.h
bacula/src/qt-console/restore/restore.ui
bacula/src/qt-console/run/runcmd.cpp

index a1a8423ecb051586f0d29921089180fe59561c9d..4828794dcfd9a49ada9ebf9fbaebceaf8066a32d 100644 (file)
@@ -41,6 +41,7 @@
 
 prerestorePage::prerestorePage()
 {
+   m_dtformat = "yyyy-MM-dd HH:MM:ss";
    m_name = "Pre-Restore";
    setupUi(this);
    pgInitialize();
@@ -50,14 +51,24 @@ prerestorePage::prerestorePage()
    jobCombo->addItems(m_console->job_list);
    filesetCombo->addItems(m_console->fileset_list);
    clientCombo->addItems(m_console->client_list);
+   poolCombo->addItem("Any");
    poolCombo->addItems(m_console->pool_list);
    storageCombo->addItems(m_console->storage_list);
+   /* current or before . .  Start out with current checked */
+   recentCheckBox->setCheckState(Qt::Checked);
+   beforeDateTime->setDisplayFormat(m_dtformat);
    beforeDateTime->setDateTime(QDateTime::currentDateTime());
    beforeDateTime->setEnabled(false);
+   selectFilesRadio->setChecked(true);
+   selectJobsRadio->setChecked(true);
+   jobIdEdit->setText("Comma separted list of jobs id's");
+   jobIdEdit->setEnabled(false);
    job_name_change(0);
    connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
    connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
    connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
+   connect(recentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(recentChanged(int)));
+   connect(selectJobsRadio, SIGNAL(toggled(bool)), this, SLOT(jobsRadioClicked(bool)));
 
    dockPage();
    setCurrent();
@@ -69,22 +80,43 @@ void prerestorePage::okButtonPushed()
    QString cmd;
 
    this->hide();
-   
-   cmd = QString(
-         "restore select current fileset=\"%1\" client=\"%2\" pool=\"%3\" "
-             "storage=\"%4\"\n")
-             .arg(filesetCombo->currentText())
-             .arg(clientCombo->currentText())
-             .arg(poolCombo->currentText())
-             .arg(storageCombo->currentText());
+
+   cmd = QString("restore ");
+   if (selectFilesRadio->isChecked()) {
+      cmd += "select ";
+   } else {
+      cmd += "all done ";
+   }
+   cmd += "fileset=\"" + filesetCombo->currentText() + "\" ";
+   if (selectJobsRadio->isChecked()) {
+      cmd += "client=\"" + clientCombo->currentText() + "\" ";
+      if (poolCombo->currentText() != "Any" ){
+         cmd += "pool=\"" + poolCombo->currentText() + "\" ";
+      }
+      cmd += "storage=\"" + storageCombo->currentText() + "\" ";
+      if (recentCheckBox->checkState() == Qt::Checked) {
+         cmd += " current";
+      } else {
+         QDateTime stamp = beforeDateTime->dateTime();
+         QString before = stamp.toString(m_dtformat);
+         cmd += " before=\"" + before + "\"";
+      }
+   } else {
+      cmd += "jobid=\"" + jobIdEdit->text() + "\"";
+   }
 
    /* ***FIXME*** */
-   //printf("preRestore command \"%s\"\n", cmd.toUtf8().data());
-   m_console->write(cmd);
-   m_console->display_text(cmd);
+   //printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
+   consoleCommand(cmd);
    /* Note, do not turn notifier back on here ... */
-   new restorePage();
-   closeStackPage();
+   if (selectFilesRadio->isChecked()) {
+      new restorePage();
+      closeStackPage();
+   } else {
+      m_console->notify(true);
+      closeStackPage();
+      mainWin->resetFocus();
+   }
 }
 
 
@@ -110,3 +142,39 @@ void prerestorePage::job_name_change(int index)
       storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
    }
 }
+
+void prerestorePage::recentChanged(int state)
+{
+   if ((state == Qt::Unchecked) && (selectJobsRadio->isChecked())) {
+      beforeDateTime->setEnabled(true);
+   } else {
+      beforeDateTime->setEnabled(false);
+   }
+}
+
+void prerestorePage::jobsRadioClicked(bool checked)
+{
+   if (checked) {
+      printf("In prerestorePage::jobsRadioClicked checked\n");
+      jobCombo->setEnabled(true);
+//      filesetCombo->setEnabled(true);
+      clientCombo->setEnabled(true);
+      poolCombo->setEnabled(true);
+      storageCombo->setEnabled(true);
+      recentCheckBox->setEnabled(true);
+      if (!recentCheckBox->isChecked()) {
+         beforeDateTime->setEnabled(true);
+      }
+      jobIdEdit->setEnabled(false);
+   } else {
+      printf("In prerestorePage::jobsRadioClicked UNchecked\n");
+      jobCombo->setEnabled(false);
+//      filesetCombo->setEnabled(false);
+      clientCombo->setEnabled(false);
+      poolCombo->setEnabled(false);
+      storageCombo->setEnabled(false);
+      recentCheckBox->setEnabled(false);
+      beforeDateTime->setEnabled(false);
+      jobIdEdit->setEnabled(true);
+   }
+}
index b230563350e35270bd187267e45fca4e207055fe..96876736f5b433e447c211af8fda5ddd185f426a 100644 (file)
@@ -5,13 +5,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>578</width>
-    <height>406</height>
+    <width>589</width>
+    <height>458</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Form</string>
   </property>
+  <property name="autoFillBackground" >
+   <bool>true</bool>
+  </property>
   <layout class="QGridLayout" >
    <property name="margin" >
     <number>9</number>
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="1" column="0" >
+   <item row="0" column="1" >
     <spacer>
      <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeHint" >
       <size>
-       <width>40</width>
-       <height>20</height>
+       <width>20</width>
+       <height>40</height>
       </size>
      </property>
     </spacer>
      </property>
     </spacer>
    </item>
+   <item row="1" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>93</width>
+       <height>301</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item row="1" column="1" >
     <layout class="QGridLayout" >
      <property name="margin" >
      <property name="spacing" >
       <number>6</number>
      </property>
-     <item row="2" column="1" >
-      <widget class="QComboBox" name="clientCombo" />
+     <item row="10" column="0" >
+      <widget class="QLabel" name="label_6" >
+       <property name="text" >
+        <string>Before:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>beforeDateTime</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="8" column="1" colspan="2" >
+      <widget class="QComboBox" name="storageCombo" />
+     </item>
+     <item row="7" column="0" >
+      <widget class="QLabel" name="label_4" >
+       <property name="text" >
+        <string>Pool:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>poolCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="10" column="1" colspan="2" >
+      <widget class="QDateTimeEdit" name="beforeDateTime" >
+       <property name="minimumDate" >
+        <date>
+         <year>2000</year>
+         <month>1</month>
+         <day>1</day>
+        </date>
+       </property>
+       <property name="displayFormat" >
+        <string>yyyy-mm-dd h:mm:ss</string>
+       </property>
+       <property name="calendarPopup" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0" colspan="3" >
+      <widget class="QFrame" name="frame_2" >
+       <property name="frameShape" >
+        <enum>QFrame::NoFrame</enum>
+       </property>
+       <property name="frameShadow" >
+        <enum>QFrame::Plain</enum>
+       </property>
+       <property name="lineWidth" >
+        <number>0</number>
+       </property>
+       <layout class="QGridLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item row="0" column="0" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="0" column="1" >
+         <widget class="QRadioButton" name="selectJobsRadio" >
+          <property name="text" >
+           <string>Select Jobs</string>
+          </property>
+          <property name="checked" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2" >
+         <widget class="QRadioButton" name="listJobsRadio" >
+          <property name="text" >
+           <string>List Jobs</string>
+          </property>
+          <property name="checked" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="3" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item row="3" column="1" colspan="2" >
+      <widget class="QLineEdit" name="jobIdEdit" />
+     </item>
+     <item row="6" column="1" colspan="2" >
+      <widget class="QComboBox" name="filesetCombo" />
+     </item>
+     <item row="4" column="0" >
+      <widget class="QLabel" name="label" >
+       <property name="text" >
+        <string>Job:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>jobCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="7" column="1" colspan="2" >
+      <widget class="QComboBox" name="poolCombo" />
+     </item>
+     <item row="9" column="0" colspan="2" >
+      <widget class="QCheckBox" name="recentCheckBox" >
+       <property name="layoutDirection" >
+        <enum>Qt::RightToLeft</enum>
+       </property>
+       <property name="text" >
+        <string>Use Most Recent</string>
+       </property>
+      </widget>
+     </item>
+     <item row="9" column="2" >
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>221</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item row="8" column="0" >
+      <widget class="QLabel" name="label_5" >
+       <property name="text" >
+        <string>Storage:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>storageCombo</cstring>
+       </property>
+      </widget>
      </item>
      <item row="3" column="0" >
+      <widget class="QLabel" name="label_7" >
+       <property name="text" >
+        <string>JobIds:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>jobCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="6" column="0" >
       <widget class="QLabel" name="label_3" >
        <property name="text" >
         <string>File Set:</string>
        </property>
       </widget>
      </item>
-     <item row="7" column="0" colspan="2" >
+     <item row="4" column="1" colspan="2" >
+      <widget class="QComboBox" name="jobCombo" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>7</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="maximumSize" >
+        <size>
+         <width>600</width>
+         <height>600</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item row="11" column="0" colspan="3" >
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </item>
       </layout>
      </item>
-     <item row="4" column="1" >
-      <widget class="QComboBox" name="poolCombo" />
-     </item>
-     <item row="2" column="0" >
-      <widget class="QLabel" name="label_2" >
-       <property name="text" >
-        <string>Client:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>clientCombo</cstring>
-       </property>
-      </widget>
+     <item row="5" column="1" colspan="2" >
+      <widget class="QComboBox" name="clientCombo" />
      </item>
-     <item row="0" column="0" colspan="2" >
+     <item row="0" column="0" colspan="3" >
       <layout class="QHBoxLayout" >
        <property name="margin" >
         <number>0</number>
           </size>
          </property>
          <property name="text" >
-          <string>&lt;h3>Pre - Restore&lt;/h3></string>
+          <string>&lt;h3>Select Jobs&lt;/h3></string>
          </property>
         </widget>
        </item>
        </item>
       </layout>
      </item>
-     <item row="4" column="0" >
-      <widget class="QLabel" name="label_4" >
-       <property name="text" >
-        <string>Pool:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>poolCombo</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="5" column="1" >
-      <widget class="QComboBox" name="storageCombo" />
-     </item>
-     <item row="3" column="1" >
-      <widget class="QComboBox" name="filesetCombo" />
-     </item>
-     <item row="6" column="0" >
-      <widget class="QLabel" name="label_6" >
-       <property name="text" >
-        <string>Before:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>beforeDateTime</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0" >
-      <widget class="QLabel" name="label" >
-       <property name="text" >
-        <string>Job:</string>
+     <item row="1" column="0" colspan="3" >
+      <widget class="QFrame" name="frame" >
+       <property name="frameShape" >
+        <enum>QFrame::NoFrame</enum>
        </property>
-       <property name="buddy" >
-        <cstring>jobCombo</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="6" column="1" >
-      <widget class="QDateTimeEdit" name="beforeDateTime" >
-       <property name="minimumDate" >
-        <date>
-         <year>2000</year>
-         <month>1</month>
-         <day>1</day>
-        </date>
-       </property>
-       <property name="displayFormat" >
-        <string>yyyy-mm-dd h:mm:ss</string>
-       </property>
-       <property name="calendarPopup" >
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1" >
-      <widget class="QComboBox" name="jobCombo" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>7</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="maximumSize" >
-        <size>
-         <width>600</width>
-         <height>600</height>
-        </size>
+       <property name="frameShadow" >
+        <enum>QFrame::Plain</enum>
        </property>
+       <layout class="QGridLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item row="0" column="2" >
+         <widget class="QRadioButton" name="allFilesRadio" >
+          <property name="text" >
+           <string>All Files</string>
+          </property>
+          <property name="checked" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1" >
+         <widget class="QRadioButton" name="selectFilesRadio" >
+          <property name="text" >
+           <string>Select Files</string>
+          </property>
+          <property name="checked" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="3" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="0" column="0" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
       </widget>
      </item>
      <item row="5" column="0" >
-      <widget class="QLabel" name="label_5" >
+      <widget class="QLabel" name="label_2" >
        <property name="text" >
-        <string>Storage:</string>
+        <string>Client:</string>
        </property>
        <property name="buddy" >
-        <cstring>storageCombo</cstring>
+        <cstring>clientCombo</cstring>
        </property>
       </widget>
      </item>
     </layout>
    </item>
-   <item row="0" column="1" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="2" column="1" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>
index b6e8f8d36d64891d6bf1f045189f397bbf5c8357..f8107f1c68b8378cde9a694dbd896b0843ee97c9 100644 (file)
@@ -237,6 +237,7 @@ void restorePage::cancelButtonPushed()
 {
    this->hide();
    m_console->write("quit");
+   m_console->displayToPrompt();
    mainWin->set_status("Canceled");
    closeStackPage();
    m_console->notify(true);
index c4eabc69aade1c0cea87c77bc3c39649f10a21e4..f952b530dfe5d2963fbeb6863aa89f12848a6d25 100644 (file)
@@ -55,8 +55,11 @@ private slots:
    void okButtonPushed();
    void cancelButtonPushed();
    void job_name_change(int index);
+   void recentChanged(int);
+   void jobsRadioClicked(bool);
 
 private:
+   QString m_dtformat;
 };
 
 /*  
index 043ff8775fa4237c8fc22cdd3d9d4902db07472a..e890eb8f3ffd99d55422e2242ff5cf053ae4b7d5 100644 (file)
         <string>Up</string>
        </property>
        <property name="icon" >
-        <iconset>../../../../../../../:images/up.png</iconset>
+        <iconset>:images/up.png</iconset>
        </property>
       </widget>
      </item>
         <string>Mark</string>
        </property>
        <property name="icon" >
-        <iconset>../../../../../../../:images/mark.png</iconset>
+        <iconset>:images/mark.png</iconset>
        </property>
       </widget>
      </item>
         <string>Unmark</string>
        </property>
        <property name="icon" >
-        <iconset>../../../../../../../:images/unmark.png</iconset>
+        <iconset>:images/unmark.png</iconset>
        </property>
       </widget>
      </item>
index 847d00c3b4f45ce9e4a05d42806c060fa7421d2a..e1f70c93a8a983cfc7146bba66011bd73c66f129 100644 (file)
@@ -125,16 +125,17 @@ void runCmdPage::okButtonPushed()
    m_console->write_dir("yes");
    m_console->displayToPrompt();
    m_console->notify(true);
-   delete this;
+   closeStackPage();
    mainWin->resetFocus();
 }
 
 
 void runCmdPage::cancelButtonPushed()
 {
+   m_console->displayToPrompt();
    mainWin->set_status(" Canceled");
    this->hide();
    m_console->notify(true);
-   delete this;
+   closeStackPage();
    mainWin->resetFocus();
 }