]> git.sur5r.net Git - bacula/bacula/commitdiff
This gets the .mod command to run when the ok button has been pushed. Creates
authorDirk H Bartley <dbartley@schupan.com>
Thu, 17 May 2007 02:52:41 +0000 (02:52 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Thu, 17 May 2007 02:52:41 +0000 (02:52 +0000)
a .mod command that puts in all the boxes except catalog and job.

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

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

index 9a8796aba867dfb22c0cf9fa6fa3a1da10ea385b..ec55c726eae1604a767100c44a1f0efe8a7538d5 100644 (file)
@@ -35,6 +35,7 @@ public slots:
 
 private:
    void fill();
+   QString m_dtformat;
 };
 
 
index a7c516b0276185d8e213cd60397ae04ec437d565..fe125fcbc0513bfb1b3237f52a57b3f752e0f978 100644 (file)
@@ -48,6 +48,7 @@
  */
 runCmdPage::runCmdPage()
 {
+   m_dtformat = "yyyy-MM-dd HH:mm:ss";
    m_name = "Restore Run";
    pgInitialize();
    setupUi(this);
@@ -61,6 +62,7 @@ runCmdPage::runCmdPage()
    dockPage();
    setCurrent();
    this->show();
+
 }
 
 void runCmdPage::fill()
@@ -69,6 +71,12 @@ void runCmdPage::fill()
    QStringList items;
    QRegExp rx("^.*:\\s*(\\S.*$)");   /* Regex to get value */
 
+   clientCombo->addItems(m_console->client_list);
+   filesetCombo->addItems(m_console->fileset_list);
+   replaceCombo->addItems(QStringList() << "never" << "always" << "ifnewer" << "ifolder");
+   storageCombo->addItems(m_console->storage_list);
+   dateTimeEdit->setDisplayFormat(m_dtformat);
+
    m_console->read();
    item = m_console->msg();
    items = item.split("\n");
@@ -90,11 +98,11 @@ void runCmdPage::fill()
          continue;
       }
       if (item.startsWith("Backup Client:")) {
-         clientCombo->addItem(val);
+         clientCombo->setCurrentIndex(clientCombo->findText(val, Qt::MatchExactly));
          continue;
       }
       if (item.startsWith("Storage:")) {
-         storageCombo->addItem(val);
+         storageCombo->setCurrentIndex(storageCombo->findText(val, Qt::MatchExactly));
          continue;
       }
       if (item.startsWith("Where:")) {
@@ -102,18 +110,26 @@ void runCmdPage::fill()
          continue;
       }
       if (item.startsWith("When:")) {
+         dateTimeEdit->setDateTime(QDateTime::fromString(val,m_dtformat));
          continue;
       }
       if (item.startsWith("Catalog:")) {
          catalogCombo->addItem(val);
          continue;
       }
-      if (item.startsWith("Fileset:")) {
-         filesetCombo->addItem(val);
+      if (item.startsWith("FileSet:")) {
+         filesetCombo->setCurrentIndex(filesetCombo->findText(val, Qt::MatchExactly));
          continue;
       }
       if (item.startsWith("Priority:")) {
-//       prioritySpin->setValue(atoi(val));
+         bool okay;
+         int pri = val.toInt(&okay, 10);
+         if (okay) 
+            prioritySpin->setValue(pri);
+         continue;
+      }
+      if (item.startsWith("Replace:")) {
+         replaceCombo->setCurrentIndex(replaceCombo->findText(val, Qt::MatchExactly));
          continue;
       }
    }
@@ -121,14 +137,22 @@ void runCmdPage::fill()
 
 void runCmdPage::okButtonPushed()
 {
-
-   this->hide();
+   QString cmd(".mod");
+   cmd += " restoreclient=\"" + clientCombo->currentText() + "\"";
+   cmd += " fileset=\"" + filesetCombo->currentText() + "\"";
+   cmd += " storage=\"" + storageCombo->currentText() + "\"";
+   cmd += " replace=\"" + replaceCombo->currentText() + "\"";
+   cmd += " when=\"" + dateTimeEdit->dateTime().toString(m_dtformat) + "\"";
+   cmd += " bootstrap=\"" + bootstrap->text() + "\"";
+   cmd += " where=\"" + where->text() + "\"";
+   QString pri;
+   QTextStream(&pri) << "priority=\"" << prioritySpin->value() << "\"";
+   cmd += pri;
+   cmd += " yes\n";
    
-   m_console->write_dir("yes");
-   m_console->displayToPrompt();
+   consoleCommand(cmd);
    m_console->notify(true);
    closeStackPage();
-   mainWin->resetFocus();
 }
 
 
index 3176d9650ecdd81dde9d54ba24e4cbd8a28aaa6f..9778231eb0da94fc56ac20cafdd3d267e1ae9a28 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>678</width>
-    <height>386</height>
+    <width>704</width>
+    <height>466</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -19,8 +19,8 @@
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="1" column="1" colspan="2" >
-    <layout class="QHBoxLayout" >
+   <item row="2" column="2" >
+    <layout class="QVBoxLayout" >
      <property name="margin" >
       <number>0</number>
      </property>
       <number>6</number>
      </property>
      <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType" >
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>131</width>
-         <height>25</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QLabel" name="run" >
-       <property name="maximumSize" >
-        <size>
-         <width>16777215</width>
-         <height>30</height>
-        </size>
-       </property>
-       <property name="text" >
-        <string>&lt;h3>Restore Run&lt;/h3></string>
+      <layout class="QHBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
        </property>
-       <property name="alignment" >
-        <set>Qt::AlignCenter</set>
+       <property name="spacing" >
+        <number>6</number>
        </property>
-      </widget>
+       <item>
+        <widget class="QLabel" name="label_4" >
+         <property name="text" >
+          <string>Priority:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>prioritySpin</cstring>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QSpinBox" name="prioritySpin" >
+         <property name="maximum" >
+          <number>10000</number>
+         </property>
+         <property name="minimum" >
+          <number>1</number>
+         </property>
+         <property name="value" >
+          <number>12</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
      </item>
      <item>
       <spacer>
        <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType" >
-        <enum>QSizePolicy::Fixed</enum>
+        <enum>Qt::Vertical</enum>
        </property>
        <property name="sizeHint" >
         <size>
-         <width>131</width>
-         <height>25</height>
+         <width>20</width>
+         <height>171</height>
         </size>
        </property>
       </spacer>
      </item>
     </layout>
    </item>
-   <item row="3" column="1" colspan="2" >
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
+   <item rowspan="3" row="1" column="3" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
      </property>
-     <property name="spacing" >
-      <number>6</number>
+     <property name="sizeHint" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
      </property>
-     <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="okButton" >
-       <property name="text" >
-        <string>OK</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="cancelButton" >
-       <property name="text" >
-        <string>Cancel</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
+    </spacer>
+   </item>
+   <item row="4" column="1" colspan="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::MinimumExpanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>572</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item rowspan="3" row="1" 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" colspan="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::MinimumExpanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>572</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
    </item>
    <item row="2" column="1" >
     <layout class="QGridLayout" >
      <item row="8" column="1" >
       <widget class="QLineEdit" name="where" >
        <property name="enabled" >
-        <bool>false</bool>
+        <bool>true</bool>
        </property>
        <property name="minimumSize" >
         <size>
      <item row="7" column="1" >
       <widget class="QLineEdit" name="bootstrap" >
        <property name="enabled" >
-        <bool>false</bool>
+        <bool>true</bool>
        </property>
        <property name="minimumSize" >
         <size>
      </item>
     </layout>
    </item>
-   <item row="2" column="2" >
-    <layout class="QVBoxLayout" >
+   <item row="3" column="1" colspan="2" >
+    <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
      </property>
       <number>6</number>
      </property>
      <item>
-      <layout class="QGridLayout" >
-       <property name="margin" >
-        <number>0</number>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
        </property>
-       <property name="spacing" >
-        <number>6</number>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
        </property>
-       <item row="1" column="1" >
-        <widget class="QSpinBox" name="prioritySpin" >
-         <property name="maximum" >
-          <number>10000</number>
-         </property>
-         <property name="minimum" >
-          <number>1</number>
-         </property>
-         <property name="value" >
-          <number>10</number>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="1" >
-        <widget class="QComboBox" name="typeCombo" >
-         <property name="sizePolicy" >
-          <sizepolicy>
-           <hsizetype>5</hsizetype>
-           <vsizetype>0</vsizetype>
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize" >
-          <size>
-           <width>150</width>
-           <height>0</height>
-          </size>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0" >
-        <widget class="QLabel" name="label_4" >
-         <property name="text" >
-          <string>Priority:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>prioritySpin</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0" >
-        <widget class="QLabel" name="label_7" >
-         <property name="text" >
-          <string>Type:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>typeCombo</cstring>
-         </property>
-        </widget>
-       </item>
-      </layout>
+      </spacer>
      </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelButton" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="1" colspan="2" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
      <item>
       <spacer>
        <property name="orientation" >
-        <enum>Qt::Vertical</enum>
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Fixed</enum>
        </property>
        <property name="sizeHint" >
         <size>
-         <width>20</width>
-         <height>171</height>
+         <width>131</width>
+         <height>25</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="run" >
+       <property name="maximumSize" >
+        <size>
+         <width>16777215</width>
+         <height>30</height>
+        </size>
+       </property>
+       <property name="text" >
+        <string>&lt;h3>Run Restore Job&lt;/h3></string>
+       </property>
+       <property name="alignment" >
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Fixed</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>131</width>
+         <height>25</height>
         </size>
        </property>
       </spacer>
      </item>
     </layout>
    </item>
-   <item row="0" column="1" colspan="2" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::MinimumExpanding</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>572</width>
-       <height>16</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item rowspan="3" row="1" 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 rowspan="3" row="1" 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="4" column="1" colspan="2" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::MinimumExpanding</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>572</width>
-       <height>16</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>