]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/storage/content.cpp
Change copyright as per agreement with FSFE
[bacula/bacula] / bacula / src / qt-console / storage / content.cpp
index 3a3863bde412acafcbb6565545bdb1967878885c..f8e937dcfcfe22578432a24ff26c04af6c37188f 100644 (file)
@@ -1,29 +1,20 @@
 /*
-   Bacula® - The Network Backup Solution
-
-   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 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.
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2016 Kern Sibbald
+
+   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"
@@ -42,7 +33,7 @@
 //       use user selection to add slot= argument
 // 
 
-Content::Content(QString storage, QTreeWidgetItem *parentWidget)
+Content::Content(QString storage, QTreeWidgetItem *parentWidget) : Pages()
 {
    setupUi(this);
    pgInitialize(storage, parentWidget);
@@ -103,6 +94,10 @@ void table_get_selection(QTableWidget *table, QString &sel)
     * We take only one instance
     */
    int s = table->rowCount();
+   if (s == 0) {
+      /* No selection?? */
+      return;
+   }
    bool *tab = (bool *)malloc(s * sizeof(bool));
    memset(tab, 0, s); 
 
@@ -179,7 +174,7 @@ void Content::statusStorageWindow()
 void Content::populateContent()
 {
    char buf[200];
-   time_t t;
+   time_t tim;
    struct tm tm;
 
    QStringList results_all;
@@ -244,16 +239,16 @@ void Content::populateContent()
          /* Pool */
          slotitem.setTextFld(index++, fld.next());
          
-         t = fld.next().toInt();
-         if (t > 0) {
+         tim = fld.next().toInt();
+         if (tim > 0) {
             /* LastW */
-            localtime_r(&t, &tm);
+            localtime_r(&tim, &tm);
             strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
             slotitem.setTextFld(index++, QString(buf));
             
             /* Expire */
-            t = fld.next().toInt();
-            localtime_r(&t, &tm);
+            tim = fld.next().toInt();
+            localtime_r(&tim, &tm);
             strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
             slotitem.setTextFld(index++, QString(buf));
          }
@@ -275,13 +270,16 @@ void Content::populateContent()
    tableTray->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
    tableDrive->verticalHeader()->hide();
+   /* Get count of rows needed (Drives) */
    QStringList drives = results_all.filter(QRegExp("^D\\|[0-9]+\\|"));
+   /* Ensure we have sufficient rows for Drive display */
+   tableDrive->setRowCount(drives.size()); 
    row = 0;
    foreach (resultline, drives) {
       fieldlist = resultline.split("|");
-      if (fieldlist.size() < 4)
+      if (fieldlist.size() < 4) { 
          continue; /* some fields missing, ignore row */
-
+      } 
       int index=0;
       QStringListIterator fld(fieldlist);
       TableItemFormatter slotitem(*tableDrive, row);