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()) {
116 m_console->notify(true);
118 mainWin->resetFocus();
123 void prerestorePage::cancelButtonPushed()
125 mainWin->set_status("Canceled");
127 m_console->notify(true);
132 void prerestorePage::job_name_change(int index)
134 job_defaults job_defs;
137 job_defs.job_name = jobCombo->currentText();
138 if (m_console->get_job_defaults(job_defs)) {
139 filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
140 clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
141 poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
142 storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
146 void prerestorePage::recentChanged(int state)
148 if ((state == Qt::Unchecked) && (selectJobsRadio->isChecked())) {
149 beforeDateTime->setEnabled(true);
151 beforeDateTime->setEnabled(false);
155 void prerestorePage::jobsRadioClicked(bool checked)
158 jobCombo->setEnabled(true);
159 // filesetCombo->setEnabled(true);
160 clientCombo->setEnabled(true);
161 poolCombo->setEnabled(true);
162 storageCombo->setEnabled(true);
163 recentCheckBox->setEnabled(true);
164 if (!recentCheckBox->isChecked()) {
165 beforeDateTime->setEnabled(true);
167 jobIdEdit->setEnabled(false);
169 jobCombo->setEnabled(false);
170 // filesetCombo->setEnabled(false);
171 clientCombo->setEnabled(false);
172 poolCombo->setEnabled(false);
173 storageCombo->setEnabled(false);
174 recentCheckBox->setEnabled(false);
175 beforeDateTime->setEnabled(false);
176 jobIdEdit->setEnabled(true);