]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/status/dirstat.cpp
Backport from BEE
[bacula/bacula] / bacula / src / qt-console / status / dirstat.cpp
index de63951978c1a18afebbaaa9acc20ee789a4cfd9..4190de60fee2d0f0a6992bc8e394ef2e310ededa 100644 (file)
@@ -1,49 +1,37 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+   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 two of the GNU General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
+   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 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.
+   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.
 
    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: dirstat.cpp 5880 2007-11-09 01:20:40Z bartleyd2 $
  *
  *   Dirk Bartley, March 2007
  */
+
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
 #include "dirstat.h"
 
+static bool working = false;         /* prevent timer recursion */
+
 /*
  * Constructor for the class
  */
-DirStat::DirStat()
+DirStat::DirStat() : Pages()
 {
    setupUi(this);
    m_name = tr("Director Status");
-   m_closeable = true;
    pgInitialize();
    QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
    thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/status.png")));
@@ -55,8 +43,6 @@ DirStat::DirStat()
 
    createConnections();
    setCurrent();
-
-   dockPage();
 }
 
 void DirStat::getFont()
@@ -100,12 +86,14 @@ void DirStat::timerTriggered()
 {
    double value = timerDisplay->value();
    value -= 1;
-   if (value == 0) {
+   if (value <= 0 && !working) {
+      working = true;
       value = spinBox->value();
       bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this);
-      if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) {
+      if (((isDocked() && iscurrent) || ((!isDocked()) && isOnceDocked())) && (checkBox->checkState() == Qt::Checked)) {
          populateAll();
       }
+      working = false;
    }
    timerDisplay->display(value);
 }
@@ -143,10 +131,10 @@ void DirStat::populateTerminated()
    terminatedTable->clear();
    QStringList headerlist = (QStringList()
       << tr("Job Id") << tr("Job Level") << tr("Job Files")
-      << tr("Job Bytes") << tr("Job Status") << tr("Job Time") 
+      << tr("Job Bytes") << tr("Job Status") << tr("Job Time")
       << tr("Job Name"));
    QStringList flaglist = (QStringList()
-      << "R" << "L" << "R" << "R" << "LC" 
+      << "R" << "L" << "R" << "R" << "LC"
       << "L" << "L");
 
    terminatedTable->setColumnCount(headerlist.size());
@@ -174,7 +162,7 @@ void DirStat::populateTerminated()
                   p_tableitem->setBackground(Qt::green);
                else
                   p_tableitem->setBackground(Qt::red);
-           }
+            }
             terminatedTable->setItem(results.size() - row - 1, column, p_tableitem);
             column += 1;
          }
@@ -199,7 +187,7 @@ void DirStat::populateScheduled()
 
    scheduledTable->clear();
    QStringList headerlist = (QStringList()
-      << tr("Job Level") << tr("Job Type") << tr("Priority") << tr("Job Time") 
+      << tr("Job Level") << tr("Job Type") << tr("Priority") << tr("Job Time")
       << tr("Job Name") << tr("Volume"));
    QStringList flaglist = (QStringList()
       << "L" << "L" << "R" << "L" << "L" << "L");
@@ -288,6 +276,9 @@ void DirStat::PgSeltreeWidgetClicked()
       populateAll();
       m_populated=true;
    }
+   if (!isOnceDocked()) {
+      dockPage();
+   }
 }
 
 /*