FORMS += mount/mount.ui
FORMS += console/console.ui
FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
-FORMS += run/run.ui run/runcmd.ui run/estimate.ui
+FORMS += run/run.ui run/runcmd.ui run/estimate.ui run/prune.ui
FORMS += select/select.ui
FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui
# Run dialog
HEADERS += run/run.h
-SOURCES += run/run.cpp run/runcmd.cpp run/estimate.cpp
+SOURCES += run/run.cpp run/runcmd.cpp run/estimate.cpp run/prune.cpp
# Select dialog
HEADERS += select/select.h
#include <QMenu>
#include "bat.h"
#include "clients/clients.h"
+#include "run/run.h"
Clients::Clients()
{
m_populated = false;
m_checkcurwidget = true;
m_closeable = false;
+ /* add context sensitive menu items specific to this classto the page
+ * selector tree. m_contextActions is QList of QActions */
+ m_contextActions.append(actionRefreshClients);
}
Clients::~Clients()
mp_treeWidget->removeAction(actionListJobsofClient);
mp_treeWidget->removeAction(actionStatusClientInConsole);
mp_treeWidget->removeAction(actionPurgeJobs);
+ mp_treeWidget->removeAction(actionPrune);
}
}
mp_treeWidget->addAction(actionListJobsofClient);
mp_treeWidget->addAction(actionStatusClientInConsole);
mp_treeWidget->addAction(actionPurgeJobs);
+ mp_treeWidget->addAction(actionPrune);
}
}
}
SLOT(consoleStatusClient()));
connect(actionPurgeJobs, SIGNAL(triggered()), this,
SLOT(consolePurgeJobs()));
+ connect(actionPrune, SIGNAL(triggered()), this,
+ SLOT(prune()));
}
/*
{
if(!m_populated) {
populateTree();
- /* add context sensitive menu items specific to this classto the page
- * selector tree. m_contextActions is QList of QActions, so this is
- * only done once with the first population. */
- m_contextActions.append(actionRefreshClients);
/* Create the context menu for the client tree */
createContextMenu();
m_populated=true;
consoleCommand(cmd);
}
+/*
+ * Function responding to actionPrune
+ */
+void Clients::prune()
+{
+ new prunePage("", m_currentlyselected);
+}
+
#include "ui_clients.h"
#include "console.h"
#include "pages.h"
-//#include <qstringlist.h>
class Clients : public Pages, public Ui::ClientForm
{
void showJobs();
void consoleStatusClient();
void consolePurgeJobs();
+ void prune();
private:
void createContextMenu();
</layout>
<action name="actionRefreshClients" >
<property name="icon" >
- <iconset>../../../../../../../:images/run.png</iconset>
+ <iconset>images/run.png</iconset>
</property>
<property name="text" >
<string>Refresh Client List</string>
</action>
<action name="actionListJobsofClient" >
<property name="icon" >
- <iconset>../../../../../../../:images/unmark.png</iconset>
+ <iconset>images/unmark.png</iconset>
</property>
<property name="text" >
<string>List Jobs of Client</string>
</property>
+ <property name="statusTip" >
+ <string>Open a joblist page selecting this client.</string>
+ </property>
</action>
<action name="actionStatusClientInConsole" >
<property name="icon" >
- <iconset>../../../../../../../:images/status.png</iconset>
+ <iconset>images/status.png</iconset>
</property>
<property name="text" >
<string>Status Client In Console</string>
</property>
+ <property name="statusTip" >
+ <string>Execute status client in console.</string>
+ </property>
</action>
<action name="actionPurgeJobs" >
+ <property name="icon" >
+ <iconset>images/unmark.png</iconset>
+ </property>
<property name="text" >
<string>Purge Jobs</string>
</property>
+ <property name="statusTip" >
+ <string>Purge jobs peformed from this client.</string>
+ </property>
+ </action>
+ <action name="actionPrune" >
+ <property name="icon" >
+ <iconset>images/unmark.png</iconset>
+ </property>
+ <property name="text" >
+ <string>Prune Jobs</string>
+ </property>
+ <property name="statusTip" >
+ <string>Open the diaolog to prune for this client.</string>
+ </property>
</action>
</widget>
<resources/>
m_checkcurwidget = true;
m_closeable = false;
readSettings();
+ /* add context sensitive menu items specific to this classto the page
+ * selector tree. m_contextActions is QList of QActions */
+ m_contextActions.append(actionRefreshFileSet);
}
FileSet::~FileSet()
{
if(!m_populated) {
populateTree();
- /* add context sensitive menu items specific to this classto the page
- * selector tree. m_contextActions is QList of QActions, so this is
- * only done once with the first population. */
- m_contextActions.append(actionRefreshFileSet);
/* Create the context menu for the fileset tree */
createContextMenu();
m_populated=true;
#include "mediaedit/mediaedit.h"
#include "joblist/joblist.h"
#include "relabel/relabel.h"
+#include "run/run.h"
MediaList::MediaList()
{
m_populated = false;
m_checkcurwidget = true;
m_closeable = false;
+ /* add context sensitive menu items specific to this classto the page
+ * selector tree. m_contextActions is QList of QActions */
+ m_contextActions.append(actionRefreshMediaList);
}
MediaList::~MediaList()
mp_treeWidget->removeAction(actionEditVolume);
mp_treeWidget->removeAction(actionListJobsOnVolume);
mp_treeWidget->removeAction(actionDeleteVolume);
+ mp_treeWidget->removeAction(actionPruneVolume);
mp_treeWidget->removeAction(actionPurgeVolume);
mp_treeWidget->removeAction(actionRelabelVolume);
}
mp_treeWidget->addAction(actionEditVolume);
mp_treeWidget->addAction(actionListJobsOnVolume);
mp_treeWidget->addAction(actionDeleteVolume);
+ mp_treeWidget->addAction(actionPruneVolume);
mp_treeWidget->addAction(actionPurgeVolume);
mp_treeWidget->addAction(actionRelabelVolume);
}
connect(actionListJobsOnVolume, SIGNAL(triggered()), this, SLOT(showJobs()));
connect(actionDeleteVolume, SIGNAL(triggered()), this, SLOT(deleteVolume()));
connect(actionPurgeVolume, SIGNAL(triggered()), this, SLOT(purgeVolume()));
+ connect(actionPruneVolume, SIGNAL(triggered()), this, SLOT(pruneVolume()));
connect(actionRelabelVolume, SIGNAL(triggered()), this, SLOT(relabelVolume()));
connect(mp_treeWidget, SIGNAL(
currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
{
if(!m_populated) {
populateTree();
- /* add context sensitive menu items specific to this classto the page
- * selector tree. m_contextActions is QList of QActions, so this is
- * only done once with the first population. */
- m_contextActions.append(actionRefreshMediaList);
/* Create the context menu for the medialist tree */
createContextMenu();
m_populated=true;
}
/*
- * Called from the signal of the context sensitive menu!
+ * Called from the signal of the context sensitive menu to delete a volume!
*/
void MediaList::deleteVolume()
{
cmd += m_currentVolumeName;
consoleCommand(cmd);
}
+
/*
- * Called from the signal of the context sensitive menu!
+ * Called from the signal of the context sensitive menu to purge!
*/
void MediaList::purgeVolume()
{
consoleCommand(cmd);
populateTree();
}
+
/*
- * Called from the signal of the context sensitive menu!
+ * Called from the signal of the context sensitive menu to prune!
+ */
+void MediaList::pruneVolume()
+{
+ new prunePage(m_currentVolumeName, "");
+}
+
+/*
+ * Called from the signal of the context sensitive menu to relabel!
*/
void MediaList::relabelVolume()
{
void editVolume();
void deleteVolume();
void purgeVolume();
+ void pruneVolume();
void relabelVolume();
private:
<string>Delete Volume</string>
</property>
</action>
+ <action name="actionPruneVolume" >
+ <property name="icon" >
+ <iconset>:images/unmark.png</iconset>
+ </property>
+ <property name="text" >
+ <string>Prune Volume</string>
+ </property>
+ </action>
<action name="actionPurgeVolume" >
<property name="icon" >
<iconset>:images/unmark.png</iconset>
</action>
<action name="actionRelabelVolume" >
<property name="icon" >
- <iconset>../images/unmark.png</iconset>
+ <iconset>:images/unmark.png</iconset>
</property>
<property name="text" >
<string>Relabel Volume</string>
--- /dev/null
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+
+/*
+ * Run Dialog class
+ *
+ * Kern Sibbald, February MMVII
+ *
+ * $Id: prune.cpp 4856 2007-05-20 15:28:43Z bartleyd2 $
+ */
+
+#include "bat.h"
+#include "run.h"
+
+/*
+ * Setup all the combo boxes and display the dialog
+ */
+prunePage::prunePage(const QString &volume, const QString &client)
+{
+ QDateTime dt;
+
+ m_name = "Prune";
+ pgInitialize();
+ setupUi(this);
+ m_console->notify(false);
+
+ QString query("SELECT VolumeName AS Media FROM Media ORDER BY Media");
+ if (mainWin->m_sqlDebug) {
+ Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
+ }
+ QStringList results, volumeList;
+ if (m_console->sql_cmd(query, results)) {
+ QString field;
+ QStringList fieldlist;
+ /* Iterate through the lines of results. */
+ foreach (QString resultline, results) {
+ fieldlist = resultline.split("\t");
+ volumeList.append(fieldlist[0]);
+ } /* foreach resultline */
+ } /* if results from query */
+
+ volumeCombo->addItem("Any");
+ volumeCombo->addItems(volumeList);
+ clientCombo->addItem("Any");
+ clientCombo->addItems(m_console->client_list);
+ connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
+ connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
+ filesCheckBox->setCheckState(Qt::Checked);
+ jobsCheckBox->setCheckState(Qt::Checked);
+ volumeCheckBox->setCheckState(Qt::Checked);
+ connect(filesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(checkStateChanged()));
+ connect(jobsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(checkStateChanged()));
+ connect(volumeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(checkStateChanged()));
+ if (clientCombo->findText(client, Qt::MatchExactly) != -1)
+ clientCombo->setCurrentIndex(clientCombo->findText(client, Qt::MatchExactly));
+ else
+ clientCombo->setCurrentIndex(0);
+ if (volumeCombo->findText(volume, Qt::MatchExactly) != -1)
+ volumeCombo->setCurrentIndex(volumeCombo->findText(volume, Qt::MatchExactly));
+ else
+ volumeCombo->setCurrentIndex(0);
+ connect(volumeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(volumeChanged()));
+ connect(clientCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(clientChanged()));
+
+ dockPage();
+ setCurrent();
+ this->show();
+}
+
+void prunePage::okButtonPushed()
+{
+ this->hide();
+ QString cmd("prune");
+ if (filesCheckBox->checkState() == Qt::Checked) {
+ cmd += " files";
+ }
+ if (jobsCheckBox->checkState() == Qt::Checked) {
+ cmd += " jobs";
+ }
+ if (filesCheckBox->checkState() == Qt::Checked) {
+ cmd += " volume";
+ }
+ if (volumeCombo->currentText() != "Any") {
+ cmd += " volume=\"" + volumeCombo->currentText() + "\"";
+ }
+ if (clientCombo->currentText() != "Any") {
+ cmd += " client=\"" + clientCombo->currentText() + "\"";
+ }
+ cmd += " yes";
+
+ if (mainWin->m_commandDebug) {
+ Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
+ }
+
+ consoleCommand(cmd);
+ m_console->notify(true);
+ closeStackPage();
+ mainWin->resetFocus();
+}
+
+
+void prunePage::cancelButtonPushed()
+{
+ mainWin->set_status(" Canceled");
+ this->hide();
+ m_console->notify(true);
+ closeStackPage();
+ mainWin->resetFocus();
+}
+
+void prunePage::checkStateChanged()
+{
+ if ((filesCheckBox->checkState() == Qt::Unchecked) &&
+ (jobsCheckBox->checkState() == Qt::Unchecked) &&
+ (volumeCheckBox->checkState() == Qt::Unchecked)) {
+ filesCheckBox->setCheckState(Qt::Checked);
+ }
+}
+
+void prunePage::volumeChanged()
+{
+ if ((volumeCombo->currentText() == "Any") && (clientCombo->currentText() == "Any")) {
+ clientCombo->setCurrentIndex(1);
+ }
+}
+
+void prunePage::clientChanged()
+{
+ if ((volumeCombo->currentText() == "Any") && (clientCombo->currentText() == "Any")) {
+ volumeCombo->setCurrentIndex(1);
+ }
+}
--- /dev/null
+<ui version="4.0" >
+ <class>pruneForm</class>
+ <widget class="QWidget" name="pruneForm" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>501</width>
+ <height>326</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>351</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" >
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="1" >
+ <widget class="QComboBox" name="clientCombo" />
+ </item>
+ <item row="5" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="volumeCheckBox" >
+ <property name="layoutDirection" >
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text" >
+ <string>Prune Volumes</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>71</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="run" >
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string><h3>Prune Files/Jobs/Volumes</h3></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="6" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="jobsCheckBox" >
+ <property name="layoutDirection" >
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text" >
+ <string>Prune Jobs</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QComboBox" name="volumeCombo" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="maximumSize" >
+ <size>
+ <width>65</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Client:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>clientCombo</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="filesCheckBox" >
+ <property name="layoutDirection" >
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text" >
+ <string>Prune Files</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_8" >
+ <property name="text" >
+ <string>Volume:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>volumeCombo</cstring>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>351</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
#include "ui_run.h"
#include "ui_runcmd.h"
#include "ui_estimate.h"
+#include "ui_prune.h"
#include "console.h"
class runPage : public Pages, public Ui::runForm
private:
};
+class prunePage : public Pages, public Ui::pruneForm
+{
+ Q_OBJECT
+
+public:
+ prunePage(const QString &volume, const QString &client);
+
+public slots:
+ void okButtonPushed();
+ void cancelButtonPushed();
+ void checkStateChanged();
+ void volumeChanged();
+ void clientChanged();
+
+private:
+};
+
#endif /* _RUN_H_ */
m_checkcurwidget = true;
m_closeable = false;
m_currentStorage = "";
+ /* add context sensitive menu items specific to this classto the page
+ * selector tree. m_contextActions is QList of QActions */
+ m_contextActions.append(actionRefreshStorage);
}
Storage::~Storage()
{
if(!m_populated) {
populateTree();
- /* add context sensitive menu items specific to this classto the page
- * selector tree. m_contextActions is QList of QActions, so this is
- * only done once with the first population. */
- m_contextActions.append(actionRefreshStorage);
/* Create the context menu for the storage tree */
createContextMenu();
m_populated=true;