/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
+ Copyright (C) 2000-2015 Kern Sibbald
Copyright (C) 2007-2010 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 three of the GNU Affero General Public
- 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
- 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 Affero 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 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.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
+
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
+
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
*/
#include "bat.h"
#include "run/run.h"
#include "util/fmtwidgetitem.h"
-MediaView::MediaView()
+MediaView::MediaView() : Pages()
{
setupUi(this);
m_name = tr("Media");
bool MediaView::getSelection(QStringList &list)
{
- QList<QTableWidgetItem*> items = m_tableMedia->selectedItems();
QTableWidgetItem *it;
+ QList<QTableWidgetItem*> items = m_tableMedia->selectedItems();
int row;
- int *tab;
+ int nrows; /* number of rows */
+ bool *tab;
int nb = items.count();
if (!nb) {
return false;
}
- tab = (int *) malloc (nb * sizeof(int));
- memset(tab, 0, sizeof(int)*nb);
+ nrows = m_tableMedia->rowCount();
+ tab = (bool *) malloc (nrows * sizeof(bool));
+ memset(tab, 0, sizeof(bool)*nrows);
for (int i = 0; i < nb; ++i) {
row = items[i]->row();
if (!tab[row]) {
- tab[row]=1;
+ tab[row] = true;
it = m_tableMedia->item(row, 0);
list.append(it->text());
}
if (m_console->sql_cmd(query, results)) {
foreach (resultline, results) {
fieldlist = resultline.split("\t");
+ if (fieldlist.size() != 3) {
+ Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
+ continue;
+ }
if (fieldlist.at(1).toInt() >= 1) {
// MediaType
hash_size[fieldlist.at(2)]
int row=0;
filterExipired(results);
m_tableMedia->setRowCount(results.size());
-
foreach (resultline, results) { // should have only one result
int index = 0;
QString Slot, VolBytes, MediaType, LastWritten, VolStatus;
fieldlist = resultline.split("\t");
- if (fieldlist.size() != 10) {
+ if (fieldlist.size() != 9) {
+ Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
continue;
}
QStringListIterator fld(fieldlist);
mediaitem.setInChanger(index++, fld.next());
Slot = fld.next(); // Slot
- mediaitem.setTextFld(index++, Slot);
+ mediaitem.setNumericFld(index++, Slot);
MediaType = fld.next();
VolStatus = fld.next();