]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/mediainfo/mediainfo.cpp
Change copyright as per agreement with FSFE
[bacula/bacula] / bacula / src / qt-console / mediainfo / mediainfo.cpp
index 2de3f2128d45eab621da612697118335b8d1c123..e6cb853573402d37f0fe5e6d09225e9072bfa8f0 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 two of the GNU 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 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"
@@ -40,7 +31,8 @@
 /*
  * A constructor 
  */
-MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName)
+MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName) 
+  : Pages()
 {
    setupUi(this);
    pgInitialize(tr("Media Info"), parentWidget);
@@ -53,7 +45,6 @@ MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName)
    connect(pbEdit, SIGNAL(clicked()), this, SLOT(editVol()));
    connect(tableJob, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(showInfoForJob(QTableWidgetItem *)));
    
-   m_closeable = true;
    dockPage();
    setCurrent();
    populateForm();
@@ -138,13 +129,16 @@ void MediaInfo::populateForm()
       "LastWritten, VolMounts, VolBytes, Media.Enabled,"
       "Location.Location, VolStatus, RecyclePool.Name, Media.Recycle, "
       "VolReadTime/1000000, VolWriteTime/1000000, Media.VolUseDuration, "
-      "Media.MaxVolJobs, "
-      "Media.MaxVolFiles, Media.MaxVolBytes, Media.VolRetention,InChanger,Slot "
+      "Media.MaxVolJobs, Media.MaxVolFiles, Media.MaxVolBytes, "
+      "Media.VolRetention,InChanger,Slot "
       "FROM Media JOIN Pool USING (PoolId) LEFT JOIN Pool AS RecyclePool "
-      "ON (Media.RecyclePoolId = RecyclePool.PoolId) "
-      "LEFT JOIN Location USING (LocationId) "
-      "WHERE Media.VolumeName = '" + m_mediaName + "'";
+      "ON (Media.RecyclePoolId=RecyclePool.PoolId) "
+      "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) "
+      "WHERE Media.VolumeName='" + m_mediaName + "'";
 
+   if (mainWin->m_sqlDebug) {
+      Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data());
+   }
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
       QString resultline;
@@ -186,12 +180,14 @@ void MediaInfo::populateForm()
          edit_utime(stat.toULongLong(), buf, sizeof(buf));
          label_VolRetention->setText(QString(buf));
 
-         t = str_to_utime(LastWritten.toAscii().data());
-         t = t + stat.toULongLong();
-         ttime = t;
-         localtime_r(&ttime, &tm);         
-         strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
-         label_Expire->setText(QString(buf));
+         if (LastWritten != "") {
+            t = str_to_utime(LastWritten.toAscii().data());
+            t = t + stat.toULongLong();
+            ttime = t;
+            localtime_r(&ttime, &tm);         
+            strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
+            label_Expire->setText(QString(buf));
+         }
          label_Online->setPixmap(QPixmap(":/images/inflag"+fld.next()+".png"));
 //         label_VolFiles->setText(fld.next());
 //         label_VolErrors->setText(fld.next());
@@ -210,6 +206,9 @@ void MediaInfo::populateForm()
       "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
       "WHERE Media.VolumeName = '" + m_mediaName + "'";
 
+   if (mainWin->m_sqlDebug) {
+      Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data());
+   }
    results.clear();
    if (m_console->sql_cmd(query, results)) {
       QString resultline;