/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2009 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.
+ License as published by the Free Software Foundation and included
+ 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
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Bacula® is a registered trademark of John Walker.
+ Bacula® is a registered trademark of Kern Sibbald.
The licensor of Bacula is the Free Software Foundation Europe
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
/*
- * Version $Id: batstack.h 4230 2007-02-21 20:07:37Z kerns $
+ * Version $Id$
*
* Dirk Bartley, March 2007
*/
+#include "bat.h"
#include <QAbstractEventDispatcher>
#include <QTableWidgetItem>
#include <QMessageBox>
-#include "bat.h"
#include "mediaedit.h"
-#include <inttypes.h>
/*
* A constructor
MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId)
{
setupUi(this);
- m_name = "Media Edit";
- pgInitialize(parentWidget);
+ pgInitialize(tr("Media Edit"), parentWidget);
QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
- thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge-edit.svg")));
+ thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge-edit.png")));
m_closeable = true;
dockPage();
setCurrent();
m_status = "";
m_slot = 0;
- if (!m_console->preventInUseConnect())
- return;
-
/* The media's pool */
poolCombo->addItems(m_console->pool_list);
/* The media's Status */
- QStringList statusList = (QStringList() << "Full" << "Used" << "Append" << "Error" << "Purged" << "Recycled");
+ QStringList statusList = (QStringList() << "Full" << "Used" << "Append"
+ << "Error" << "Purged" << "Recycle" << "Read-Only" << "Cleaning");
statusCombo->addItems(statusList);
/* Set up the query for the default values */
i += 1;
}
query += " FROM Media"
- " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)"
- " LEFT OUTER JOIN Pool AS pol ON (Media.recyclepoolid=Pol.PoolId)"
- " WHERE Media.MediaId='" + mediaId + "'"
- " ORDER BY Pool.Name";
+ " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
+ " LEFT OUTER JOIN Pool AS Pol ON (Media.recyclepoolid=Pol.PoolId)"
+ " WHERE Media.MediaId='" + mediaId + "'";
if (mainWin->m_sqlDebug) {
Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data());
else enabledCheck->setCheckState(Qt::Unchecked);
/* default for recycle pool */
recyclePoolCombo->addItems(m_console->pool_list);
+ recyclePoolCombo->insertItem(0, "*None*");
index = recyclePoolCombo->findText(m_recyclePool, Qt::MatchExactly);
if (index == -1) {
- recyclePoolCombo->insertItem(0, "");
- index = recyclePoolCombo->findText(m_recyclePool, Qt::MatchExactly);
- }
- if (index != -1) {
- recyclePoolCombo->setCurrentIndex(index);
+ index = 0;
}
+ recyclePoolCombo->setCurrentIndex(index);
} else {
- QMessageBox::warning(this, "No Volume name", "No Volume name given",
+ QMessageBox::warning(this, tr("No Volume name"), tr("No Volume name given"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
docmd = true;
}
if (m_recyclePool != recyclePoolCombo->currentText()) {
- scmd += " recyclepool=\"" + recyclePoolCombo->currentText() + "\"";
+ scmd += " recyclepool=\"";
+ if (recyclePoolCombo->currentText() != "*None*") {
+ scmd += recyclePoolCombo->currentText();
+ }
+ scmd += "\"";
docmd = true;
}
if (docmd) {
*/
void MediaEdit::setSpins(int value)
{
- int years, days, hours, minutes, seconds, left;
-
+ int years, months, days, hours, minutes, seconds, left;
+
years = abs(value / 31536000);
left = value - years * 31536000;
+ months = abs(left / 2592000);
+ left = left - months * 2592000;
days = abs(left / 86400);
left = left - days * 86400;
hours = abs(left / 3600);
seconds = left - minutes * 60;
disconnectSpins();
yearsSpin->setValue(years);
+ monthsSpin->setValue(months);
daysSpin->setValue(days);
hoursSpin->setValue(hours);
minutesSpin->setValue(minutes);
daysSpin->setValue(daysSpin->value()-1);
}
if (daysSpin->value() == -1) {
- daysSpin->setValue(364);
+ daysSpin->setValue(29);
+ monthsSpin->setValue(monthsSpin->value()-1);
+ }
+ if (monthsSpin->value() == -1) {
+ monthsSpin->setValue(11);
yearsSpin->setValue(yearsSpin->value()-1);
}
if (yearsSpin->value() == -1) {
hoursSpin->setValue(0);
daysSpin->setValue(daysSpin->value()+1);
}
- if (daysSpin->value() == 365) {
+ if (daysSpin->value() == 30) {
daysSpin->setValue(0);
+ monthsSpin->setValue(monthsSpin->value()+1);
+ }
+ if (monthsSpin->value() == 12) {
+ monthsSpin->setValue(0);
yearsSpin->setValue(yearsSpin->value()+1);
}
connectSpins();
int retention;
retention = secondsSpin->value() + minutesSpin->value() * 60 +
hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
+ monthsSpin->value() * 2592000 +
yearsSpin->value() * 31536000;
disconnect(retentionSpin, SIGNAL(valueChanged(int)), this, SLOT(retentionChanged()));
retentionSpin->setValue(retention);
int useDuration;
useDuration = secondsSpin->value() + minutesSpin->value() * 60 +
hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
+ monthsSpin->value() * 2592000 +
yearsSpin->value() * 31536000;
disconnect(useDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(useDurationChanged()));
useDurationSpin->setValue(useDuration);
connect(minutesSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
connect(hoursSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
connect(daysSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
+ connect(monthsSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
connect(yearsSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
}
disconnect(minutesSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
disconnect(hoursSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
disconnect(daysSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
+ disconnect(monthsSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
disconnect(yearsSpin, SIGNAL(valueChanged(int)), this, SLOT(durationChanged()));
}