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.
32 * Kern Sibbald, February MMVII
34 * $Id: prune.cpp 4856 2007-05-20 15:28:43Z bartleyd2 $
41 * Setup all the combo boxes and display the dialog
43 prunePage::prunePage(const QString &volume, const QString &client)
50 m_console->notify(false);
52 QString query("SELECT VolumeName AS Media FROM Media ORDER BY Media");
53 if (mainWin->m_sqlDebug) {
54 Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
56 QStringList results, volumeList;
57 if (m_console->sql_cmd(query, results)) {
59 QStringList fieldlist;
60 /* Iterate through the lines of results. */
61 foreach (QString resultline, results) {
62 fieldlist = resultline.split("\t");
63 volumeList.append(fieldlist[0]);
64 } /* foreach resultline */
65 } /* if results from query */
67 volumeCombo->addItem("Any");
68 volumeCombo->addItems(volumeList);
69 clientCombo->addItem("Any");
70 clientCombo->addItems(m_console->client_list);
71 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
72 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
73 filesCheckBox->setCheckState(Qt::Checked);
74 jobsCheckBox->setCheckState(Qt::Checked);
75 volumeCheckBox->setCheckState(Qt::Checked);
76 connect(filesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(checkStateChanged()));
77 connect(jobsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(checkStateChanged()));
78 connect(volumeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(checkStateChanged()));
79 if (clientCombo->findText(client, Qt::MatchExactly) != -1)
80 clientCombo->setCurrentIndex(clientCombo->findText(client, Qt::MatchExactly));
82 clientCombo->setCurrentIndex(0);
83 if (volumeCombo->findText(volume, Qt::MatchExactly) != -1)
84 volumeCombo->setCurrentIndex(volumeCombo->findText(volume, Qt::MatchExactly));
86 volumeCombo->setCurrentIndex(0);
87 connect(volumeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(volumeChanged()));
88 connect(clientCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(clientChanged()));
95 void prunePage::okButtonPushed()
99 if (filesCheckBox->checkState() == Qt::Checked) {
102 if (jobsCheckBox->checkState() == Qt::Checked) {
105 if (filesCheckBox->checkState() == Qt::Checked) {
108 if (volumeCombo->currentText() != "Any") {
109 cmd += " volume=\"" + volumeCombo->currentText() + "\"";
111 if (clientCombo->currentText() != "Any") {
112 cmd += " client=\"" + clientCombo->currentText() + "\"";
116 if (mainWin->m_commandDebug) {
117 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
121 m_console->notify(true);
123 mainWin->resetFocus();
127 void prunePage::cancelButtonPushed()
129 mainWin->set_status(" Canceled");
131 m_console->notify(true);
133 mainWin->resetFocus();
136 void prunePage::checkStateChanged()
138 if ((filesCheckBox->checkState() == Qt::Unchecked) &&
139 (jobsCheckBox->checkState() == Qt::Unchecked) &&
140 (volumeCheckBox->checkState() == Qt::Unchecked)) {
141 filesCheckBox->setCheckState(Qt::Checked);
145 void prunePage::volumeChanged()
147 if ((volumeCombo->currentText() == "Any") && (clientCombo->currentText() == "Any")) {
148 clientCombo->setCurrentIndex(1);
152 void prunePage::clientChanged()
154 if ((volumeCombo->currentText() == "Any") && (clientCombo->currentText() == "Any")) {
155 volumeCombo->setCurrentIndex(1);