X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=bacula%2Fsrc%2Fqt-console%2Fmediaedit%2Fmediaedit.cpp;h=137b77e0a07d8052ebc823184a9f52f4ab09bb9f;hb=f650cbb0c57b32426e30c27004ef2a6f43dc3796;hp=c817585ba05be24af5c83dd05086fa577efd6d23;hpb=d780f6666fa0d554aa9c21d5e8382108721a2874;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp index c817585ba0..137b77e0a0 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.cpp +++ b/bacula/src/qt-console/mediaedit/mediaedit.cpp @@ -1,14 +1,14 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2008 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 @@ -26,7 +26,7 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Version $Id: batstack.h 4230 2007-02-21 20:07:37Z kerns $ + * Version $Id$ * * Dirk Bartley, March 2007 */ @@ -44,10 +44,10 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) { setupUi(this); - m_name = "Media Edit"; + m_name = tr("Media Edit"); pgInitialize(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(); @@ -72,7 +72,8 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) 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 */ @@ -96,10 +97,9 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) i += 1; } query += " FROM Media" - " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)" + " 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"; + " WHERE Media.MediaId='" + mediaId + "'"; if (mainWin->m_sqlDebug) { Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data()); @@ -187,13 +187,11 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) 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; } @@ -257,7 +255,7 @@ void MediaEdit::okButtonPushed() scmd += " enabled=yes"; docmd = true; } - if (m_recyclePool != recyclePoolCombo->currentText()) { + if (m_recyclePool != recyclePoolCombo->currentText() && recyclePoolCombo->currentText() != "") { scmd += " recyclepool=\"" + recyclePoolCombo->currentText() + "\""; docmd = true; } @@ -299,10 +297,12 @@ void MediaEdit::useDurationChanged() */ 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); @@ -311,6 +311,7 @@ void MediaEdit::setSpins(int value) seconds = left - minutes * 60; disconnectSpins(); yearsSpin->setValue(years); + monthsSpin->setValue(months); daysSpin->setValue(days); hoursSpin->setValue(hours); minutesSpin->setValue(minutes); @@ -337,7 +338,11 @@ void MediaEdit::durationChanged() 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) { @@ -356,8 +361,12 @@ void MediaEdit::durationChanged() 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(); @@ -365,6 +374,7 @@ void MediaEdit::durationChanged() 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); @@ -374,6 +384,7 @@ void MediaEdit::durationChanged() 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); @@ -388,6 +399,7 @@ void MediaEdit::connectSpins() 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())); } @@ -398,6 +410,7 @@ void MediaEdit::disconnectSpins() 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())); }