2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of John Walker.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
30 * Run Command Dialog class
32 * This is called when a Run Command signal is received from the
33 * Director. We parse the Director's output and throw up a
34 * dialog box. This happens, for example, after the user finishes
35 * selecting files to be restored. The Director will then submit a
36 * run command, that causes this page to be popped up.
38 * Kern Sibbald, March MMVII
44 #include "restoretreerun.h"
47 * Setup all the combo boxes and display the dialog
49 restoreTreeRunPage::restoreTreeRunPage(QString &table, QString &client, QList<int> &jobs, QTreeWidgetItem* parentItem)
54 m_name = "Restore Tree Run";
55 pgInitialize(parentItem);
57 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
58 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png")));
59 m_console->notify(false);
62 m_console->discardToPrompt();
64 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
65 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
71 void restoreTreeRunPage::fill()
74 clientCombo->addItems(m_console->client_list);
75 clientCombo->setCurrentIndex(clientCombo->findText(m_client, Qt::MatchExactly));
76 replaceCombo->addItems(QStringList() << "never" << "always" << "ifnewer" << "ifolder");
77 replaceCombo->setCurrentIndex(replaceCombo->findText("never", Qt::MatchExactly));
78 dateTimeEdit->setDisplayFormat(mainWin->m_dtformat);
79 dateTimeEdit->setDateTime(dt.currentDateTime());
82 void restoreTreeRunPage::okButtonPushed()
84 QString jobOption = " jobid=\"";
86 foreach (int job, m_jobList) {
87 if (first) first = false;
88 else jobOption += ",";
89 jobOption += QString("%1").arg(job);
92 QString cmd = QString("restore");
94 " file=\"?" + m_tempTable + "\" yes"
95 " replace=\"" + replaceCombo->currentText() + "\""
96 " when=\"" + dateTimeEdit->dateTime().toString(mainWin->m_dtformat) + "\""
97 " restoreclient=\"" + clientCombo->currentText() + "\"";
98 if (mainWin->m_commandDebug)
99 Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
101 mainWin->resetFocus();
104 /* QString cmd(".mod");
105 cmd += " bootstrap=\"" + bootstrap->text() + "\"";
106 cmd += " where=\"" + where->text() + "\"";
108 QTextStream(&pri) << " priority=\"" << prioritySpin->value() << "\"";
114 void restoreTreeRunPage::cancelButtonPushed()
116 m_console->displayToPrompt();
117 m_console->write_dir(".");
118 m_console->displayToPrompt();
119 mainWin->set_status(" Canceled");
121 m_console->notify(true);
123 mainWin->resetFocus();