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 plus additions
11 that are listed in the file LICENSE.
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 * Version $Id: restore.cpp 4307 2007-03-04 10:24:39Z kerns $
32 * preRestore -> dialog put up to determine the restore type
34 * Kern Sibbald, February MMVII
42 prerestorePage::prerestorePage()
44 m_dtformat = "yyyy-MM-dd HH:MM:ss";
48 m_console->notify(false);
51 jobCombo->addItems(m_console->job_list);
52 filesetCombo->addItems(m_console->fileset_list);
53 clientCombo->addItems(m_console->client_list);
54 poolCombo->addItem("Any");
55 poolCombo->addItems(m_console->pool_list);
56 storageCombo->addItems(m_console->storage_list);
57 /* current or before . . Start out with current checked */
58 recentCheckBox->setCheckState(Qt::Checked);
59 beforeDateTime->setDisplayFormat(m_dtformat);
60 beforeDateTime->setDateTime(QDateTime::currentDateTime());
61 beforeDateTime->setEnabled(false);
62 selectFilesRadio->setChecked(true);
63 selectJobsRadio->setChecked(true);
64 jobIdEdit->setText("Comma separted list of jobs id's");
65 jobIdEdit->setEnabled(false);
67 connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
68 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
69 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
70 connect(recentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(recentChanged(int)));
71 connect(selectJobsRadio, SIGNAL(toggled(bool)), this, SLOT(jobsRadioClicked(bool)));
78 void prerestorePage::okButtonPushed()
84 cmd = QString("restore ");
85 if (selectFilesRadio->isChecked()) {
90 cmd += "fileset=\"" + filesetCombo->currentText() + "\" ";
91 if (selectJobsRadio->isChecked()) {
92 cmd += "client=\"" + clientCombo->currentText() + "\" ";
93 if (poolCombo->currentText() != "Any" ){
94 cmd += "pool=\"" + poolCombo->currentText() + "\" ";
96 cmd += "storage=\"" + storageCombo->currentText() + "\" ";
97 if (recentCheckBox->checkState() == Qt::Checked) {
100 QDateTime stamp = beforeDateTime->dateTime();
101 QString before = stamp.toString(m_dtformat);
102 cmd += " before=\"" + before + "\"";
105 cmd += "jobid=\"" + jobIdEdit->text() + "\"";
109 //printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
111 /* Note, do not turn notifier back on here ... */
112 if (selectFilesRadio->isChecked()) {
117 m_console->notify(true);
119 mainWin->resetFocus();
124 void prerestorePage::cancelButtonPushed()
126 mainWin->set_status("Canceled");
128 m_console->notify(true);
133 void prerestorePage::job_name_change(int index)
135 job_defaults job_defs;
138 job_defs.job_name = jobCombo->currentText();
139 if (m_console->get_job_defaults(job_defs)) {
140 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
141 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
142 poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
143 storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
147 void prerestorePage::recentChanged(int state)
149 if ((state == Qt::Unchecked) && (selectJobsRadio->isChecked())) {
150 beforeDateTime->setEnabled(true);
152 beforeDateTime->setEnabled(false);
156 void prerestorePage::jobsRadioClicked(bool checked)
159 jobCombo->setEnabled(true);
160 // filesetCombo->setEnabled(true);
161 clientCombo->setEnabled(true);
162 poolCombo->setEnabled(true);
163 storageCombo->setEnabled(true);
164 recentCheckBox->setEnabled(true);
165 if (!recentCheckBox->isChecked()) {
166 beforeDateTime->setEnabled(true);
168 jobIdEdit->setEnabled(false);
170 jobCombo->setEnabled(false);
171 // filesetCombo->setEnabled(false);
172 clientCombo->setEnabled(false);
173 poolCombo->setEnabled(false);
174 storageCombo->setEnabled(false);
175 recentCheckBox->setEnabled(false);
176 beforeDateTime->setEnabled(false);
177 jobIdEdit->setEnabled(true);