]> git.sur5r.net Git - bacula/bacula/commitdiff
This is an example of where I would like to go with offering the user the ability
authorDirk H Bartley <dbartley@schupan.com>
Fri, 27 Jul 2007 02:43:58 +0000 (02:43 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Fri, 27 Jul 2007 02:43:58 +0000 (02:43 +0000)
change options in the restore command like what is available in the runCmdPage class.

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

bacula/src/qt-console/bat.pro.in
bacula/src/qt-console/restore/restoretree.cpp
bacula/src/qt-console/restore/restoretreerun.cpp [new file with mode: 0644]
bacula/src/qt-console/restore/restoretreerun.h [new file with mode: 0644]
bacula/src/qt-console/restore/restoretreerun.ui [new file with mode: 0644]

index 7f3de5d6200ea3cffd26af6f8bcb38cd3d49e0e5..b56232bc388e50e8ec08f7626c7510ca66f4ae65 100644 (file)
@@ -37,6 +37,7 @@ FORMS += mount/mount.ui
 FORMS += console/console.ui
 FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
 FORMS += restore/restoretree.ui
+FORMS += restore/restoretreerun.ui
 FORMS += run/run.ui run/runcmd.ui run/estimate.ui run/prune.ui
 FORMS += select/select.ui
 FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
@@ -115,6 +116,8 @@ SOURCES += jobs/jobs.cpp
 ## RestoreTree
 HEADERS += restore/restoretree.h
 SOURCES += restore/restoretree.cpp
+HEADERS += restore/restoretreerun.h
+SOURCES += restore/restoretreerun.cpp
 
 ## Job Step Graphs
 HEADERS += jobgraphs/jobplot.h
index 4cbaa016947fe33b4abe2f3637a7b32c146e780b..a3f12108524252b8864ac173652d85f1d75667c3 100644 (file)
@@ -38,6 +38,7 @@
 #include "bat.h"
 #include "restoretree.h"
 #include "pages.h"
+#include "restoretreerun.h"
 
 restoreTree::restoreTree()
 {
@@ -1422,22 +1423,8 @@ void restoreTree::testButtonPushed()
       } /*  if (doneKeys.value(fversion, 0) == 0) */
    } /* while (vFMiter.hasNext()) */
    if (tempTable != "") {
-      QString jobOption = " jobid=\"";
-      bool first = true;
-      foreach (int job, jobList) {
-         if (first) first = false;
-         else jobOption += ",";
-         jobOption += QString("%1").arg(job);
-      }
-      jobOption += "\"";
-      QString cmd = QString("restore");
-      cmd += " client=\"" + m_prevClientCombo + "\""
-             + jobOption +
-             " file=\"?" + tempTable + "\" yes";
-      if (mainWin->m_commandDebug)
-         Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
-      consoleCommand(cmd);
-      mainWin->resetFocus();
+      QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
+      new restoreTreeRunPage(tempTable, m_prevClientCombo, jobList, pageSelectorTreeWidgetItem);
    }
 }
 
diff --git a/bacula/src/qt-console/restore/restoretreerun.cpp b/bacula/src/qt-console/restore/restoretreerun.cpp
new file mode 100644 (file)
index 0000000..04acf86
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ *  Run Command Dialog class
+ *
+ *  This is called when a Run Command signal is received from the
+ *    Director. We parse the Director's output and throw up a 
+ *    dialog box.  This happens, for example, after the user finishes
+ *    selecting files to be restored. The Director will then submit a
+ *    run command, that causes this page to be popped up.
+ *
+ *   Kern Sibbald, March MMVII
+ *
+ *  $Id: $
+ */ 
+
+#include "bat.h"
+#include "restoretreerun.h"
+
+/*
+ * Setup all the combo boxes and display the dialog
+ */
+restoreTreeRunPage::restoreTreeRunPage(QString &table, QString &client, QList<int> &jobs, QTreeWidgetItem* parentItem)
+{
+   m_tempTable = table;
+   m_jobList = jobs;
+   m_client = client;
+   m_name = "Restore Tree Run";
+   pgInitialize(parentItem);
+   setupUi(this);
+   QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
+   thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png")));
+   m_console->notify(false);
+
+   fill();
+   m_console->discardToPrompt();
+
+   connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
+   connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
+   dockPage();
+   setCurrent();
+   this->show();
+}
+
+void restoreTreeRunPage::fill()
+{
+   QDateTime dt;
+   clientCombo->addItems(m_console->client_list);
+   replaceCombo->addItems(QStringList() << "never" << "always" << "ifnewer" << "ifolder");
+   replaceCombo->setCurrentIndex(replaceCombo->findText("never", Qt::MatchExactly));
+   dateTimeEdit->setDisplayFormat(mainWin->m_dtformat);
+   dateTimeEdit->setDateTime(dt.currentDateTime());
+}
+
+void restoreTreeRunPage::okButtonPushed()
+{
+   QString jobOption = " jobid=\"";
+   bool first = true;
+   foreach (int job, m_jobList) {
+      if (first) first = false;
+      else jobOption += ",";
+      jobOption += QString("%1").arg(job);
+   }
+   jobOption += "\"";
+   QString cmd = QString("restore");
+   cmd += " client=\"" + m_client + "\""
+          + jobOption + 
+          " file=\"?" + m_tempTable + "\" yes";
+   if (mainWin->m_commandDebug)
+      Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
+   consoleCommand(cmd);
+   mainWin->resetFocus();
+   closeStackPage();
+
+/*   QString cmd(".mod");
+   cmd += " restoreclient=\"" + clientCombo->currentText() + "\"";
+   cmd += " replace=\"" + replaceCombo->currentText() + "\"";
+   cmd += " when=\"" + dateTimeEdit->dateTime().toString(mainWin->m_dtformat) + "\"";
+   cmd += " bootstrap=\"" + bootstrap->text() + "\"";
+   cmd += " where=\"" + where->text() + "\"";
+   QString pri;
+   QTextStream(&pri) << " priority=\"" << prioritySpin->value() << "\"";
+   cmd += pri;
+   cmd += " yes\n"; */
+}
+
+
+void restoreTreeRunPage::cancelButtonPushed()
+{
+   m_console->displayToPrompt();
+   m_console->write_dir(".");
+   m_console->displayToPrompt();
+   mainWin->set_status(" Canceled");
+   this->hide();
+   m_console->notify(true);
+   closeStackPage();
+   mainWin->resetFocus();
+}
diff --git a/bacula/src/qt-console/restore/restoretreerun.h b/bacula/src/qt-console/restore/restoretreerun.h
new file mode 100644 (file)
index 0000000..07f2672
--- /dev/null
@@ -0,0 +1,27 @@
+
+#ifndef _RESTORETREERUN_H_
+#define _RESTORETREERUN_H_
+
+#include <QtGui>
+#include "ui_restoretreerun.h"
+#include "console.h"
+
+class restoreTreeRunPage : public Pages, public Ui::restoreTreeRunForm
+{
+   Q_OBJECT 
+
+public:
+   restoreTreeRunPage(QString &, QString &, QList<int> &, QTreeWidgetItem*);
+
+public slots:
+   void okButtonPushed();
+   void cancelButtonPushed();
+
+private:
+   void fill();
+   QString m_tempTable;
+   QString m_client;
+   QList<int> m_jobList;
+};
+
+#endif /* _RESTORETREERUN_H_ */
diff --git a/bacula/src/qt-console/restore/restoretreerun.ui b/bacula/src/qt-console/restore/restoretreerun.ui
new file mode 100644 (file)
index 0000000..9fd9651
--- /dev/null
@@ -0,0 +1,357 @@
+<ui version="4.0" >
+ <class>restoreTreeRunForm</class>
+ <widget class="QWidget" name="restoreTreeRunForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>484</width>
+    <height>268</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="2" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="1" >
+    <layout class="QGridLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item row="1" column="0" >
+      <layout class="QGridLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item row="1" column="1" >
+        <widget class="QComboBox" name="replaceCombo" />
+       </item>
+       <item row="1" column="0" >
+        <widget class="QLabel" name="label_13" >
+         <property name="text" >
+          <string>Replace:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1" >
+        <widget class="QComboBox" name="clientCombo" />
+       </item>
+       <item row="2" column="1" >
+        <widget class="QDateTimeEdit" name="dateTimeEdit" >
+         <property name="dateTime" >
+          <datetime>
+           <hour>0</hour>
+           <minute>2</minute>
+           <second>0</second>
+           <year>2000</year>
+           <month>1</month>
+           <day>1</day>
+          </datetime>
+         </property>
+         <property name="displayFormat" >
+          <string>yyyy-mm-dd hh:mm:ss</string>
+         </property>
+         <property name="calendarPopup" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="0" >
+        <widget class="QLabel" name="label_5" >
+         <property name="text" >
+          <string>Where:</string>
+         </property>
+         <property name="openExternalLinks" >
+          <bool>true</bool>
+         </property>
+         <property name="buddy" >
+          <cstring>where</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="1" >
+        <widget class="QLineEdit" name="where" >
+         <property name="enabled" >
+          <bool>true</bool>
+         </property>
+         <property name="minimumSize" >
+          <size>
+           <width>200</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="readOnly" >
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1" >
+        <widget class="QLineEdit" name="bootstrap" >
+         <property name="enabled" >
+          <bool>true</bool>
+         </property>
+         <property name="minimumSize" >
+          <size>
+           <width>200</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="readOnly" >
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0" >
+        <widget class="QLabel" name="label" >
+         <property name="text" >
+          <string>When:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>dateTimeEdit</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0" >
+        <widget class="QLabel" name="label_8" >
+         <property name="text" >
+          <string>To client:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>clientCombo</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" >
+        <widget class="QLabel" name="label_12" >
+         <property name="text" >
+          <string>Bootstrap:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>bootstrap</cstring>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item row="1" column="1" >
+      <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <layout class="QHBoxLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <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::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>171</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+     <item row="2" column="0" 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::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>
+     </item>
+     <item row="0" column="0" 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::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>Run RestoreTree 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>
+    </layout>
+   </item>
+   <item 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="1" column="2" >
+    <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>
+ <resources/>
+ <connections/>
+</ui>