2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
5 Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
7 The original author of Bacula is Kern Sibbald, with contributions
8 from many others, a complete list can be found in the file AUTHORS.
10 You may use this file and others of this release according to the
11 license defined in the LICENSE file, which includes the Affero General
12 Public License, v3.0 ("AGPLv3") and some additional permissions and
13 terms pursuant to its AGPLv3 Section 7.
15 This notice must be preserved when any source code is
16 conveyed and/or propagated.
18 Bacula(R) is a registered trademark of Kern Sibbald.
24 * Kern Sibbald, February MMVII
33 * Setup all the combo boxes and display the dialog
35 prunePage::prunePage(const QString &volume, const QString &client) : Pages()
42 m_conn = m_console->notifyOff();
44 QString query("SELECT VolumeName AS Media FROM Media ORDER BY Media");
45 if (mainWin->m_sqlDebug) {
46 Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
48 QStringList results, volumeList;
49 if (m_console->sql_cmd(query, results)) {
51 QStringList fieldlist;
52 /* Iterate through the lines of results. */
53 foreach (QString resultline, results) {
54 fieldlist = resultline.split("\t");
55 volumeList.append(fieldlist[0]);
56 } /* foreach resultline */
57 } /* if results from query */
59 volumeCombo->addItem(tr("Any"));
60 volumeCombo->addItems(volumeList);
61 clientCombo->addItem(tr("Any"));
62 clientCombo->addItems(m_console->client_list);
63 connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
64 connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
65 filesRadioButton->setChecked(true);
66 if (clientCombo->findText(client, Qt::MatchExactly) != -1)
67 clientCombo->setCurrentIndex(clientCombo->findText(client, Qt::MatchExactly));
69 clientCombo->setCurrentIndex(0);
70 if (volumeCombo->findText(volume, Qt::MatchExactly) != -1)
71 volumeCombo->setCurrentIndex(volumeCombo->findText(volume, Qt::MatchExactly));
73 volumeCombo->setCurrentIndex(0);
74 connect(volumeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(volumeChanged()));
75 connect(clientCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(clientChanged()));
82 void prunePage::okButtonPushed()
86 if (filesRadioButton->isChecked()) {
89 if (jobsRadioButton->isChecked()) {
92 if (filesRadioButton->isChecked()) {
95 if (volumeCombo->currentText() != tr("Any")) {
96 cmd += " volume=\"" + volumeCombo->currentText() + "\"";
98 if (clientCombo->currentText() != tr("Any")) {
99 cmd += " client=\"" + clientCombo->currentText() + "\"";
103 if (mainWin->m_commandDebug) {
104 Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
108 m_console->notify(m_conn, true);
110 mainWin->resetFocus();
114 void prunePage::cancelButtonPushed()
116 mainWin->set_status(tr(" Canceled"));
118 m_console->notify(m_conn, true);
120 mainWin->resetFocus();
123 void prunePage::volumeChanged()
125 if ((volumeCombo->currentText() == tr("Any")) && (clientCombo->currentText() == tr("Any"))) {
126 clientCombo->setCurrentIndex(1);
130 void prunePage::clientChanged()
132 if ((volumeCombo->currentText() == tr("Any")) && (clientCombo->currentText() == tr("Any"))) {
133 volumeCombo->setCurrentIndex(1);