From: Dirk H Bartley Date: Sun, 29 Apr 2007 18:34:23 +0000 (+0000) Subject: Add a relabel dialog box. It is in context from medialist defaulting in the X-Git-Tag: Release-7.0.0~6468 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9e4fe7a90ae9d0eb30b49ae3a0b96dc6616fd1fb;p=bacula%2Fbacula Add a relabel dialog box. It is in context from medialist defaulting in the media name. The user must correctly select storage, slot and pool. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4661 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index 422082cf78..8b67ec8993 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -6,9 +6,6 @@ Add context sensitive options for most commands 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 @@ -52,6 +49,9 @@ global one defined in the mainWin class (if I remember right). ============================================================ 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. + Fix bug in myth box not working with .sql query="" command. This was a fix in mysql diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index 64a1e93795..93a4a0d5bd 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -30,6 +30,7 @@ UI_DIR = ui # Main window FORMS += main.ui FORMS += label/label.ui +FORMS += relabel/relabel.ui FORMS += mount/mount.ui FORMS += console/console.ui FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui @@ -53,6 +54,10 @@ SOURCES += restore/prerestore.cpp restore/restore.cpp restore/brestore.cpp HEADERS += label/label.h SOURCES += label/label.cpp +# Relabel dialog +HEADERS += relabel/relabel.h +SOURCES += relabel/relabel.cpp + # Mount dialog HEADERS += mount/mount.h SOURCES += mount/mount.cpp diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 53025ac449..06b9d625e7 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -41,6 +41,7 @@ #include "medialist.h" #include "mediaedit/mediaedit.h" #include "joblist/joblist.h" +#include "relabel/relabel.h" MediaList::MediaList() { @@ -182,6 +183,7 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI mp_treeWidget->removeAction(actionListJobsOnVolume); mp_treeWidget->removeAction(actionDeleteVolume); mp_treeWidget->removeAction(actionPurgeVolume); + mp_treeWidget->removeAction(actionRelabelVolume); } } @@ -193,6 +195,7 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI mp_treeWidget->addAction(actionListJobsOnVolume); mp_treeWidget->addAction(actionDeleteVolume); mp_treeWidget->addAction(actionPurgeVolume); + mp_treeWidget->addAction(actionRelabelVolume); } } } @@ -210,6 +213,7 @@ void MediaList::createContextMenu() connect(actionListJobsOnVolume, SIGNAL(triggered()), this, SLOT(showJobs())); connect(actionDeleteVolume, SIGNAL(triggered()), this, SLOT(deleteVolume())); connect(actionPurgeVolume, SIGNAL(triggered()), this, SLOT(purgeVolume())); + connect(actionRelabelVolume, SIGNAL(triggered()), this, SLOT(relabelVolume())); connect(mp_treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); @@ -252,4 +256,13 @@ void MediaList::purgeVolume() QString cmd("purge volume="); cmd += m_currentVolumeName; consoleCommand(cmd); + populateTree(); +} +/* + * Called from the signal of the context sensitive menu! + */ +void MediaList::relabelVolume() +{ + placeConsoleOnTop(); + new relabelDialog(m_console, m_currentVolumeName); } diff --git a/bacula/src/qt-console/medialist/medialist.h b/bacula/src/qt-console/medialist/medialist.h index e484d6752a..35f575821d 100644 --- a/bacula/src/qt-console/medialist/medialist.h +++ b/bacula/src/qt-console/medialist/medialist.h @@ -57,6 +57,7 @@ private slots: void editVolume(); void deleteVolume(); void purgeVolume(); + void relabelVolume(); private: void createContextMenu(); diff --git a/bacula/src/qt-console/medialist/medialist.ui b/bacula/src/qt-console/medialist/medialist.ui index 77ff35c27a..69e45d0e48 100644 --- a/bacula/src/qt-console/medialist/medialist.ui +++ b/bacula/src/qt-console/medialist/medialist.ui @@ -66,6 +66,14 @@ Purge Volume + + + ../images/unmark.png + + + Relabel Volume + + diff --git a/bacula/src/qt-console/relabel/relabel.cpp b/bacula/src/qt-console/relabel/relabel.cpp new file mode 100644 index 0000000000..27d1e3b7e2 --- /dev/null +++ b/bacula/src/qt-console/relabel/relabel.cpp @@ -0,0 +1,96 @@ +/* + 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 "relabel.h" +#include + +/* + * An overload of the constructor to have a default storage show in the + * combobox on start. Used from context sensitive in storage class. + */ +relabelDialog::relabelDialog(Console *console, QString &fromVolume) +{ + m_console = console; + m_fromVolume = fromVolume; + m_console->notify(false); + setupUi(this); + storageCombo->addItems(console->storage_list); + poolCombo->addItems(console->pool_list); + volumeName->setText(fromVolume); + QString fromText("From Volume : "); + fromText += fromVolume; + fromLabel->setText(fromText); + this->show(); +} + + +void relabelDialog::accept() +{ + QString scmd; + if (volumeName->text().toUtf8().data()[0] == 0) { + QMessageBox::warning(this, "No Volume name", "No Volume name given", + QMessageBox::Ok, QMessageBox::Ok); + return; + } + if (m_fromVolume == volumeName->text().toUtf8()) { + QMessageBox::warning(this, "New name must be different", "New name must be different", + QMessageBox::Ok, QMessageBox::Ok); + return; + } + + this->hide(); + scmd = QString("relabel storage=\"%1\" oldvolume=\"%2\" volume=\"%3\" pool=\"%4\" slot=%5") + .arg(storageCombo->currentText()) + .arg(m_fromVolume) + .arg(volumeName->text()) + .arg(poolCombo->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); + delete this; + mainWin->resetFocus(); +} + +void relabelDialog::reject() +{ + this->hide(); + m_console->notify(true); + delete this; + mainWin->resetFocus(); +} diff --git a/bacula/src/qt-console/relabel/relabel.h b/bacula/src/qt-console/relabel/relabel.h new file mode 100644 index 0000000000..f870b73ae4 --- /dev/null +++ b/bacula/src/qt-console/relabel/relabel.h @@ -0,0 +1,55 @@ +/* + 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 _RELABEL_H_ +#define _RELABEL_H_ + +#include +#include "ui_relabel.h" +#include "console.h" + +class relabelDialog : public QDialog, public Ui::relabelForm +{ + Q_OBJECT + +public: + relabelDialog(Console *console, QString &fromVolume); + +private slots: + void accept(); + void reject(); + +private: + Console *m_console; + QString m_fromVolume; +}; + +#endif /* _RELABEL_H_ */ diff --git a/bacula/src/qt-console/relabel/relabel.ui b/bacula/src/qt-console/relabel/relabel.ui new file mode 100644 index 0000000000..4a8b20e802 --- /dev/null +++ b/bacula/src/qt-console/relabel/relabel.ui @@ -0,0 +1,245 @@ + + relabelForm + + + Qt::WindowModal + + + + 0 + 0 + 400 + 212 + + + + Label + + + + 9 + + + 6 + + + + + + 16777215 + 20 + + + + From Volume : + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Maximum + + + + 382 + 16 + + + + + + + + Qt::Vertical + + + QSizePolicy::Maximum + + + + 21 + 16 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + 0 + + + 6 + + + + + 10000 + + + + + + + Pool: + + + poolCombo + + + + + + + Storage: + + + storageCombo + + + + + + + + 200 + 0 + + + + + + + + + + + New Volume Name: + + + volumeName + + + + + + + + + + Slot: + + + slotSpin + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 71 + 21 + + + + + + + + + 16777215 + 30 + + + + <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;">Relabel a Volume</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 81 + 20 + + + + + + + + + + + + buttonBox + accepted() + relabelForm + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + relabelForm + reject() + + + 316 + 260 + + + 286 + 274 + + + + +