--- /dev/null
+/*
+ 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();
+}
--- /dev/null
+<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><h3>Run RestoreTree Job</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>