2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2009 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 Kern Sibbald.
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
41 * Setup all the combo boxes and display the dialog
43 prunePage::prunePage(const QString &volume, const QString &client)
50 m_conn = m_console->notifyOff();
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(tr("Any"));
68 volumeCombo->addItems(volumeList);
69 clientCombo->addItem(tr("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 filesRadioButton->setChecked(true);
74 if (clientCombo->findText(client, Qt::MatchExactly) != -1)
75 clientCombo->setCurrentIndex(clientCombo->findText(client, Qt::MatchExactly));
77 clientCombo->setCurrentIndex(0);
78 if (volumeCombo->findText(volume, Qt::MatchExactly) != -1)
79 volumeCombo->setCurrentIndex(volumeCombo->findText(volume, Qt::MatchExactly));
81 volumeCombo->setCurrentIndex(0);
82 connect(volumeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(volumeChanged()));
83 connect(clientCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(clientChanged()));
90 void prunePage::okButtonPushed()
94 if (filesRadioButton->isChecked()) {
97 if (jobsRadioButton->isChecked()) {
100 if (filesRadioButton->isChecked()) {
103 if (volumeCombo->currentText() != tr("Any")) {
104 cmd += " volume=\"" + volumeCombo->currentText() + "\"";
106 if (clientCombo->currentText() != tr("Any")) {
107 cmd += " client=\"" + clientCombo->currentText() + "\"";
111 if (mainWin->m_commandDebug) {
112 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
116 m_console->notify(m_conn, true);
118 mainWin->resetFocus();
122 void prunePage::cancelButtonPushed()
124 mainWin->set_status(tr(" Canceled"));
126 m_console->notify(m_conn, true);
128 mainWin->resetFocus();
131 void prunePage::volumeChanged()
133 if ((volumeCombo->currentText() == tr("Any")) && (clientCombo->currentText() == tr("Any"))) {
134 clientCombo->setCurrentIndex(1);
138 void prunePage::clientChanged()
140 if ((volumeCombo->currentText() == tr("Any")) && (clientCombo->currentText() == tr("Any"))) {
141 volumeCombo->setCurrentIndex(1);