]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/util/comboutil.cpp
Backport from BEE
[bacula/bacula] / bacula / src / qt-console / util / comboutil.cpp
index 8d893fd5039a72715e7d36fd1634606cd0d0bf1f..1abc5c281c56118edea4fabaa9e84ac763cc2b26 100644 (file)
@@ -1,31 +1,19 @@
 /*
    Bacula® - The Network Backup Solution
 
-   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 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 John Walker.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf@fsfeurope.org.
+   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.
+
+   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.
 */
+
 /*
  *   Version $Id$
  *
  *
  *   Riccardo Ghetta, May 2008
  *
- */ 
+ */
 
+#include "bat.h"
 #include <QComboBox>
 #include <QString>
 #include <QStringList>
-#include "bat.h"
+#include "fmtwidgetitem.h"
 #include "comboutil.h"
 
 static const QString QS_ANY(QObject::tr("Any"));
@@ -94,7 +83,7 @@ void levelComboFill(QComboBox *combo)
    combo->addItem(job_level_to_str(L_VERIFY_VOLUME_TO_CATALOG), L_VERIFY_VOLUME_TO_CATALOG);
    combo->addItem(job_level_to_str(L_VERIFY_DISK_TO_CATALOG), L_VERIFY_DISK_TO_CATALOG);
    combo->addItem(job_level_to_str(L_VERIFY_DATA), L_VERIFY_DATA);
-   /* combo->addItem(job_level_to_str(L_BASE), L_BASE);  base jobs ignored */ 
+   /* combo->addItem(job_level_to_str(L_BASE), L_BASE);  base jobs ignored */
 }
 
 void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname)
@@ -106,3 +95,48 @@ void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fl
    }
 }
 
+/* job status combo */
+void jobStatusComboFill(QComboBox *combo)
+{
+   static const char js[] = {
+                     JS_Terminated,
+                      JS_Created,
+                     JS_Running,
+                     JS_Blocked,
+                     JS_ErrorTerminated,
+                     JS_Error,
+                     JS_FatalError,
+                     JS_Differences,
+                     JS_Canceled,
+                     JS_WaitFD,
+                     JS_WaitSD,
+                     JS_WaitMedia,
+                     JS_WaitMount,
+                     JS_WaitStoreRes,
+                     JS_WaitJobRes,
+                     JS_WaitClientRes,
+                     JS_WaitMaxJobs,
+                     JS_WaitStartTime,
+                     JS_WaitPriority,
+                     JS_AttrDespooling,
+                     JS_AttrInserting,
+                     JS_DataDespooling,
+                     JS_DataCommitting,
+                     '\0'};
+
+   int pos;
+
+   combo->addItem(QS_ANY);
+   for (pos = 0 ; js[pos] != '\0' ; ++pos) {
+     combo->addItem(convertJobStatus( QString(js[pos]) ), js[pos]);
+   }
+}
+
+void jobStatusComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname)
+{
+   int index = combo->currentIndex();
+   if (index != -1 && combo->itemText(index) != QS_ANY ) {
+      QString cnd = combo->itemData(index).toChar();
+      cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
+   }
+}