status dir on page select director item
All items with jobid= that I thought could work from joblist are done.
+relabel storage=DDS3 oldvolume=ddsvol003 volume=dds3vol003 slot=3 pool=dds3_hope
+in label slot spinner, limit the upper to the value of slots for that storage.
+
Create list of what does not work.
Ask Kern about bRestore and what to do with it in terms of priorities. Should
that be working before an initial release.
-Fix bug in myth box not working with .sql query="" command.
-
Create documentation for any other developers interested in creating
new classes to add more pages. Explain how to use the pages class
and about not populating until the tree widget is clicked etc...
============================================================
DONE:
============================================================
+Fix bug in myth box not working with .sql query="" command.
+This was a fix in mysql
+
Figure out how to get tables like Joblist to do the equivalent of double clicking
on the separating lines between each of the headings.
Tried the hard way first. Oops.
# Main window
FORMS += main.ui
-FORMS += label/label.ui
+FORMS += label/label.ui mount/mount.ui
FORMS += console/console.ui
FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
FORMS += run/run.ui run/runcmd.ui
HEADERS += label/label.h
SOURCES += label/label.cpp
+# Mount dialog
+HEADERS += mount/mount.h
+SOURCES += mount/mount.cpp
+
# Run dialog
HEADERS += run/run.h
SOURCES += run/run.cpp run/runcmd.cpp
/* Set up query QString and header QStringList */
QString query("");
- query += "SELECT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client,"
+ query += "SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client,"
" Job.Starttime AS JobStart, Job.Type AS JobType,"
" Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
" Job.JobBytes AS Bytes, Job.JobStatus AS Status"
.arg(poolCombo->currentText())
.arg(storageCombo->currentText())
.arg(slotSpin->value());
+ /* FIXME Make this a user configurable logging action and dont use printf */
+ //printf("sending command : %s\n",scmd.toUtf8().data());
m_console->write_dir(scmd.toUtf8().data());
m_console->displayToPrompt();
m_console->notify(true);
poolCombo->addItems(console->pool_list);
/* The media's Status */
- QStringList statusList = (QStringList() << "Full" << "Append" << "Error");
+ QStringList statusList = (QStringList() << "Full" << "Append" << "Error" << "Purged" << "Recycled");
statusCombo->addItems(statusList);
/* Set up the query for the default values */
QTreeWidgetItem *mediatreeitem, *pooltreeitem, *topItem;
QStringList headerlist = (QStringList()
- << "Volume Name" << "Media Id" << "Volume Status" << "Enabled"
- << "Volume Bytes" << "Volume Files" << "Volume Jobs" << "Volume Retention"
+ << "Volume Name" << "Id" << "Status" << "Enabled"
+ << "Bytes" << "Files" << "Jobs" << "Retention"
<< "Media Type" << "Slot" << "Last Written");
m_checkcurwidget = false;
/*
* Called from the signal of the context sensitive menu!
*/
-void MediaList::editMedia()
+void MediaList::editVolume()
{
- MediaEdit* edit = new MediaEdit(m_console, m_currentlyselected);
+ MediaEdit* edit = new MediaEdit(m_console, m_currentVolumeId);
connect(edit, SIGNAL(destroyed()), this, SLOT(populateTree()));
}
{
QString emptyclient("");
QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
- mainWin->createPageJobList(m_currentlyselected, emptyclient, parentItem);
+ mainWin->createPageJobList(m_currentVolumeName, emptyclient, parentItem);
}
/*
if (treedepth == 2){
mp_treeWidget->removeAction(actionEditVolume);
mp_treeWidget->removeAction(actionListJobsOnVolume);
+ mp_treeWidget->removeAction(actionDeleteVolume);
+ mp_treeWidget->removeAction(actionPurgeVolume);
}
}
int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
if (treedepth == 2){
- m_currentlyselected=currentwidgetitem->text(1);
+ m_currentVolumeName=currentwidgetitem->text(0);
+ m_currentVolumeId=currentwidgetitem->text(1);
mp_treeWidget->addAction(actionEditVolume);
mp_treeWidget->addAction(actionListJobsOnVolume);
+ mp_treeWidget->addAction(actionDeleteVolume);
+ mp_treeWidget->addAction(actionPurgeVolume);
}
}
}
{
mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
mp_treeWidget->addAction(actionRefreshMediaList);
- connect(actionEditVolume, SIGNAL(triggered()), this, SLOT(editMedia()));
+ connect(actionEditVolume, SIGNAL(triggered()), this, SLOT(editVolume()));
connect(actionListJobsOnVolume, SIGNAL(triggered()), this, SLOT(showJobs()));
+ connect(actionDeleteVolume, SIGNAL(triggered()), this, SLOT(deleteVolume()));
+ connect(actionPurgeVolume, SIGNAL(triggered()), this, SLOT(purgeVolume()));
connect(mp_treeWidget, SIGNAL(
currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
m_populated=true;
}
}
+
+/*
+ * Called from the signal of the context sensitive menu!
+ */
+void MediaList::deleteVolume()
+{
+ QString cmd("delete volume=");
+ cmd += m_currentVolumeName;
+ consoleCommand(cmd);
+}
+/*
+ * Called from the signal of the context sensitive menu!
+ */
+void MediaList::purgeVolume()
+{
+ QString cmd("purge volume=");
+ cmd += m_currentVolumeName;
+ consoleCommand(cmd);
+}
private slots:
void populateTree();
void showJobs();
- void editMedia();
+ void editVolume();
+ void deleteVolume();
+ void purgeVolume();
private:
void createContextMenu();
- QString m_currentlyselected;
+ QString m_currentVolumeName;
+ QString m_currentVolumeId;
bool m_populated;
bool m_checkcurwidget;
};
<string>List Jobs On Volume</string>
</property>
</action>
+ <action name="actionDeleteVolume" >
+ <property name="icon" >
+ <iconset>../images/unmark.png</iconset>
+ </property>
+ <property name="text" >
+ <string>Delete Volume</string>
+ </property>
+ </action>
+ <action name="actionPurgeVolume" >
+ <property name="icon" >
+ <iconset>../images/unmark.png</iconset>
+ </property>
+ <property name="text" >
+ <string>Purge Volume</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
--- /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.
+*/
+
+/*
+ * Label Dialog class
+ *
+ * Kern Sibbald, February MMVII
+ *
+ */
+
+#include "bat.h"
+#include "mount/mount.h"
+#include <QMessageBox>
+
+/*
+ * A constructor
+ */
+mountDialog::mountDialog(Console *console, QString &storageName)
+{
+ m_console = console;
+ m_storageName = storageName;
+ m_console->notify(false);
+ setupUi(this);
+ this->show();
+
+ QString labelText("Storage : ");
+ labelText += storageName;
+ storageLabel->setText(labelText);
+}
+
+void mountDialog::accept()
+{
+ QString scmd;
+ if (m_storageName == "") {
+ QMessageBox::warning(this, "No Storage name", "No Storage name given",
+ QMessageBox::Ok, QMessageBox::Ok);
+ return;
+ }
+ this->hide();
+ scmd = QString("mount storage=\"%1\" slot=%2")
+ .arg(m_storageName)
+ .arg(slotSpin->value());
+ /* FIXME Make this a user configurable logging action and dont use printf */
+ //printf("sending command : %s\n",scmd.toUtf8().data());
+
+ m_console->display_text("Context sensitive command :\n\n");
+ m_console->display_text("**** ");
+ m_console->display_text(scmd + " ****\n");
+ m_console->display_text("Director Response :\n\n");
+
+ m_console->write_dir(scmd.toUtf8().data());
+ m_console->displayToPrompt();
+ m_console->notify(true);
+ delete this;
+ mainWin->resetFocus();
+}
+
+void mountDialog::reject()
+{
+ this->hide();
+ m_console->notify(true);
+ delete this;
+ mainWin->resetFocus();
+}
--- /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.
+*/
+/*
+ * Kern Sibbald, February MMVII
+ */
+
+#ifndef _MOUNT_H_
+#define _MOUNT_H_
+
+#include <QtGui>
+#include "ui_mount.h"
+#include "console.h"
+
+class mountDialog : public QDialog, public Ui::mountForm
+{
+ Q_OBJECT
+
+public:
+ mountDialog(Console *console, QString &storage);
+
+private slots:
+ void accept();
+ void reject();
+
+private:
+ Console *m_console;
+ QString m_storageName;
+};
+
+#endif /* _MOUNT_H_ */
--- /dev/null
+<ui version="4.0" >
+ <class>mountForm</class>
+ <widget class="QDialog" name="mountForm" >
+ <property name="windowModality" >
+ <enum>Qt::WindowModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Label</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="storageLabel" >
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Slot:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>slotSpin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="slotSpin" >
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Maximum</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>21</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0" >
+ <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="label" >
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Mount a Slot</span></p></body></html></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="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Maximum</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>382</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>mountForm</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>mountForm</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
if (!m_console->is_connectedGui())
return;
/* Bring this directors console to the front of the stack */
- mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(m_console));
+ placeConsoleOnTop();
m_console->display_text("Context sensitive command :\n\n");
m_console->display_text("**** ");
m_console->display_text(command + " ****\n");
title += director;
setWindowTitle(title);
}
+
+/*
+ * Bring the current directors console window to the top of the stack.
+ */
+void Pages::placeConsoleOnTop()
+{
+ mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(m_console));
+}
void consoleCommand(QString &);
virtual void treeWidgetName(QString &);
virtual void changeEvent(QEvent *event);
+ void placeConsoleOnTop();
void setTitle();
bool m_closeable;
bool m_docked;
#include <QMenu>
#include "bat.h"
#include "storage/storage.h"
+#include "mount/mount.h"
Storage::Storage()
{
storageItem->setExpanded(true);
/* Set up query QString and header QStringList */
- QString query("");
- query += "SELECT Name AS StorageName, StorageId AS ID, AutoChanger"
- " FROM Storage"
- " WHERE ";
- query += " Name='" + storageName + "'";
- query += " ORDER BY Name";
+ QString query("SELECT StorageId AS ID, AutoChanger AS Changer"
+ " FROM Storage WHERE");
+ query += " Name='" + storageName + "'"
+ " ORDER BY Name";
QStringList results;
/* This could be a log item */
if (treedepth == 1){
/* set a hold variable to the storage name in case the context sensitive
* menu is used */
- m_currentStorage=currentwidgetitem->text(0);
+ m_currentStorage = currentwidgetitem->text(0);
+ m_currentAutoChanger = currentwidgetitem->text(2).toInt();
mp_treeWidget->addAction(actionStatusStorageInConsole);
mp_treeWidget->addAction(actionLabelStorage);
mp_treeWidget->addAction(actionMountStorage);
}
void Storage::consoleMountStorage()
{
- QString cmd("mount storage=");
- cmd += m_currentStorage;
- consoleCommand(cmd);
+ if (m_currentAutoChanger == 0){
+ /* no autochanger, just execute the command in the console */
+ QString cmd("mount storage=");
+ cmd += m_currentStorage;
+ consoleCommand(cmd);
+ } else {
+ placeConsoleOnTop();
+ /* if this storage is an autochanger, lets ask for the slot */
+ new mountDialog(m_console, m_currentStorage);
+ }
}
void Storage::consoleUnMountStorage()
{
private:
void createContextMenu();
QString m_currentStorage;
+ int m_currentAutoChanger;
bool m_populated;
bool m_checkcurwidget;
};