View Issue Details

IDProjectCategoryView StatusLast Update
0000264bareos-corebatpublic2015-03-31 14:39
Reportertuxmaster Assigned Topstorz  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSFedoraOS Version19
Product Version13.2.2 
Summary0000264: Build support for Qt5
DescriptionAdd support to build bat with Qt5.
Additional InformationI have build the needed patched. See attachment.
TagsNo tags attached.

Activities

tuxmaster

tuxmaster

2013-12-30 09:21

reporter  

0001-make-the-code-more-Qt-compliant.patch (249,125 bytes)   
From 86b9c93d7b3ae360660f13e40594c470550d61af Mon Sep 17 00:00:00 2001
From: tuxmaster <frank@bart.netz-von-frank>
Date: Sun, 29 Dec 2013 14:48:56 +0100
Subject: [PATCH 1/3] - make the code more Qt compliant - prepare for support
 of Qt 5

---
 src/qt-console/bat.h                   |   4 +-
 src/qt-console/bcomm/dircomm.h         |   5 +-
 src/qt-console/clients/clients.cpp     | 202 ++++----
 src/qt-console/clients/clients.h       |   1 +
 src/qt-console/console/console.h       |   1 +
 src/qt-console/fileset/fileset.cpp     | 174 +++----
 src/qt-console/fileset/fileset.h       |   1 +
 src/qt-console/job/job.h               |   1 +
 src/qt-console/joblist/joblist.cpp     | 420 +++++++--------
 src/qt-console/joblist/joblist.h       |   3 +-
 src/qt-console/joblog/joblog.h         |   1 +
 src/qt-console/jobs/jobs.h             |   1 +
 src/qt-console/label/label.cpp         |  33 +-
 src/qt-console/label/label.h           |   1 +
 src/qt-console/main.cpp                | 159 +++---
 src/qt-console/mainwin.h               |   4 +-
 src/qt-console/mediaedit/mediaedit.cpp | 349 +++++++------
 src/qt-console/mediaedit/mediaedit.h   |   1 +
 src/qt-console/mediainfo/mediainfo.cpp | 211 ++++----
 src/qt-console/mediainfo/mediainfo.h   |   1 +
 src/qt-console/medialist/medialist.cpp | 434 ++++++++--------
 src/qt-console/medialist/medialist.h   |   2 +-
 src/qt-console/medialist/mediaview.cpp | 356 ++++++-------
 src/qt-console/medialist/mediaview.h   |   2 +-
 src/qt-console/mount/mount.cpp         |  15 +-
 src/qt-console/mount/mount.h           |   1 +
 src/qt-console/pages.h                 |   1 -
 src/qt-console/qstd.h                  | 116 +++--
 src/qt-console/relabel/relabel.cpp     |  43 +-
 src/qt-console/relabel/relabel.h       |   1 +
 src/qt-console/restore/restore.h       |   9 +-
 src/qt-console/restore/restoretree.h   |   9 +-
 src/qt-console/run/run.h               |  11 +-
 src/qt-console/select/select.h         |   1 +
 src/qt-console/select/textinput.h      |   1 +
 src/qt-console/status/clientstat.cpp   | 114 ++---
 src/qt-console/status/clientstat.h     |   1 +
 src/qt-console/status/dirstat.cpp      | 212 ++++----
 src/qt-console/status/dirstat.h        |   1 +
 src/qt-console/status/storstat.cpp     | 214 ++++----
 src/qt-console/status/storstat.h       |   1 +
 src/qt-console/storage/content.cpp     | 900 ++++++++++++++++-----------------
 src/qt-console/storage/content.h       |   1 +
 src/qt-console/storage/storage.cpp     | 434 ++++++++--------
 src/qt-console/storage/storage.h       |   1 +
 src/qt-console/util/comboutil.cpp      |  71 ++-
 src/qt-console/util/fmtwidgetitem.cpp  | 194 ++++---
 47 files changed, 2368 insertions(+), 2351 deletions(-)

diff --git a/src/qt-console/bat.h b/src/qt-console/bat.h
index cbda857..e265814 100644
--- a/src/qt-console/bat.h
+++ b/src/qt-console/bat.h
@@ -24,6 +24,8 @@
 #ifndef _BAT_H_
 #define _BAT_H_
 
+#include <QtGui>
+
 #if defined(HAVE_WIN32)
 #if !defined(_STAT_H)
 #define _STAT_H       /* don't pull in MinGW stat.h */
@@ -33,8 +35,6 @@
 
 #include "hostconfig.h"
 
-#include <QtGui>
-#include <QtCore>
 #include "bareos.h"
 #include "mainwin.h"
 #include "bat_conf.h"
diff --git a/src/qt-console/bcomm/dircomm.h b/src/qt-console/bcomm/dircomm.h
index 892cb66..c7c2487 100644
--- a/src/qt-console/bcomm/dircomm.h
+++ b/src/qt-console/bcomm/dircomm.h
@@ -25,9 +25,10 @@
 #define _DIRCOMM_H_
 
 #include <QtGui>
+
 #include "pages.h"
 #include "ui_console.h"
-#include <QObject>
+
 
 #ifndef MAX_NAME_LENGTH
 #define MAX_NAME_LENGTH 128
@@ -49,7 +50,7 @@ public:
    Console *m_console;
    int  sock_read();
    bool authenticate_with_director(JCR *jcr, DIRRES *director, CONRES *cons,
-                                   char *buf, int buflen);
+								   char *buf, int buflen);
    bool is_connected() { return m_sock != NULL; };
    bool is_ready() { return is_connected() && m_at_prompt && m_at_main_prompt; };
    char *msg();
diff --git a/src/qt-console/clients/clients.cpp b/src/qt-console/clients/clients.cpp
index 7170259..4a00fc9 100644
--- a/src/qt-console/clients/clients.cpp
+++ b/src/qt-console/clients/clients.cpp
@@ -25,9 +25,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QMenu>
 #include "clients/clients.h"
 #include "run/run.h"
 #include "status/clientstat.h"
@@ -47,7 +47,7 @@ Clients::Clients() : Pages()
    m_closeable = false;
    m_firstpopulation = true;
    /* add context sensitive menu items specific to this classto the page
-    * selector tree. m_contextActions is QList of QActions */
+	* selector tree. m_contextActions is QList of QActions */
    m_contextActions.append(actionRefreshClients);
    createContextMenu();
 }
@@ -67,13 +67,13 @@ void Clients::populateTable()
    Freeze frz(*tableWidget); /* disable updating*/
 
    QStringList headerlist = (QStringList() << tr("Client Name") << tr("File Retention")
-       << tr("Job Retention") << tr("AutoPrune") << tr("ClientId") << tr("Uname") );
+	   << tr("Job Retention") << tr("AutoPrune") << tr("ClientId") << tr("Uname") );
 
    int sortcol = headerlist.indexOf(tr("Client Name"));
    Qt::SortOrder sortord = Qt::AscendingOrder;
    if (tableWidget->rowCount()) {
-      sortcol = tableWidget->horizontalHeader()->sortIndicatorSection();
-      sortord = tableWidget->horizontalHeader()->sortIndicatorOrder();
+	  sortcol = tableWidget->horizontalHeader()->sortIndicatorSection();
+	  sortord = tableWidget->horizontalHeader()->sortIndicatorOrder();
    }
 
    m_checkcurwidget = false;
@@ -91,63 +91,63 @@ void Clients::populateTable()
    bool first = true;
    QString client_comsep("");
    foreach (QString clientName, m_console->client_list){
-      if (first) {
-         client_comsep += "'" + clientName + "'";
-         first = false;
-      }
-      else
-         client_comsep += ",'" + clientName + "'";
+	  if (first) {
+		 client_comsep += "'" + clientName + "'";
+		 first = false;
+	  }
+	  else
+		 client_comsep += ",'" + clientName + "'";
    }
 
    if (client_comsep != "") {
-      QString query("");
-      query += "SELECT Name, FileRetention, JobRetention, AutoPrune, ClientId, Uname"
-           " FROM Client"
-           " WHERE ClientId IN (SELECT MAX(ClientId) FROM Client WHERE";
-      query += " Name IN (" + client_comsep + ")";
-      query += " GROUP BY Name) ORDER BY Name";
+	  QString query("");
+	  query += "SELECT Name, FileRetention, JobRetention, AutoPrune, ClientId, Uname"
+		   " FROM Client"
+		   " WHERE ClientId IN (SELECT MAX(ClientId) FROM Client WHERE";
+	  query += " Name IN (" + client_comsep + ")";
+	  query += " GROUP BY Name) ORDER BY Name";
 
-      QStringList results;
-      if (mainWin->m_sqlDebug)
-         Pmsg1(000, "Clients query cmd : %s\n",query.toUtf8().data());
-      if (m_console->sql_cmd(query, results)) {
-         int row = 0;
+	  QStringList results;
+	  if (mainWin->m_sqlDebug)
+		 Pmsg1(000, "Clients query cmd : %s\n",query.toUtf8().data());
+	  if (m_console->sql_cmd(query, results)) {
+		 int row = 0;
 
-         /* Iterate through the record returned from the query */
-         foreach (QString resultline, results) {
-            QStringList fieldlist = resultline.split("\t");
+		 /* Iterate through the record returned from the query */
+		 foreach (QString resultline, results) {
+			QStringList fieldlist = resultline.split("\t");
 
-            if (m_firstpopulation) {
-               settingsOpenStatus(fieldlist[0]);
-            }
+			if (m_firstpopulation) {
+			   settingsOpenStatus(fieldlist[0]);
+			}
 
-            TableItemFormatter item(*tableWidget, row);
+			TableItemFormatter item(*tableWidget, row);
 
-            /* Iterate through fields in the record */
-            QStringListIterator fld(fieldlist);
-            int col = 0;
+			/* Iterate through fields in the record */
+			QStringListIterator fld(fieldlist);
+			int col = 0;
 
-            /* name */
-            item.setTextFld(col++, fld.next());
+			/* name */
+			item.setTextFld(col++, fld.next());
 
-            /* file retention */
-            item.setDurationFld(col++, fld.next());
+			/* file retention */
+			item.setDurationFld(col++, fld.next());
 
-            /* job retention */
-            item.setDurationFld(col++, fld.next());
+			/* job retention */
+			item.setDurationFld(col++, fld.next());
 
-            /* autoprune */
-            item.setBoolFld(col++, fld.next());
+			/* autoprune */
+			item.setBoolFld(col++, fld.next());
 
-            /* client id */
-            item.setNumericFld(col++, fld.next());
+			/* client id */
+			item.setNumericFld(col++, fld.next());
 
-            /* uname */
-            item.setTextFld(col++, fld.next());
+			/* uname */
+			item.setTextFld(col++, fld.next());
 
-            row++;
-         }
-      }
+			row++;
+		 }
+	  }
    }
    /* set default sorting */
    tableWidget->sortByColumn(sortcol, sortord);
@@ -161,12 +161,12 @@ void Clients::populateTable()
    int rcnt = tableWidget->rowCount();
    int ccnt = tableWidget->columnCount();
    for(int r=0; r < rcnt; r++) {
-      for(int c=0; c < ccnt; c++) {
-         QTableWidgetItem* item = tableWidget->item(r, c);
-         if (item) {
-            item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
-         }
-      }
+	  for(int c=0; c < ccnt; c++) {
+		 QTableWidgetItem* item = tableWidget->item(r, c);
+		 if (item) {
+			item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
+		 }
+	  }
    }
    m_firstpopulation = false;
 }
@@ -178,10 +178,10 @@ void Clients::populateTable()
 void Clients::PgSeltreeWidgetClicked()
 {
    if(!m_populated) {
-      populateTable();
+	  populateTable();
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -193,26 +193,26 @@ void Clients::tableItemChanged(QTableWidgetItem *currentwidgetitem, QTableWidget
 {
    /* m_checkcurwidget checks to see if this is during a refresh, which will segfault */
    if (m_checkcurwidget) {
-      int currentRow = currentwidgetitem->row();
-      QTableWidgetItem *currentrowzeroitem = tableWidget->item(currentRow, 0);
-      m_currentlyselected = currentrowzeroitem->text();
-
-      /* The Previous item */
-      if (previouswidgetitem) { /* avoid a segfault if first time */
-         tableWidget->removeAction(actionListJobsofClient);
-         tableWidget->removeAction(actionStatusClientWindow);
-         tableWidget->removeAction(actionPurgeJobs);
-         tableWidget->removeAction(actionPrune);
-      }
-
-      if (m_currentlyselected.length() != 0) {
-         /* set a hold variable to the client name in case the context sensitive
-          * menu is used */
-         tableWidget->addAction(actionListJobsofClient);
-         tableWidget->addAction(actionStatusClientWindow);
-         tableWidget->addAction(actionPurgeJobs);
-         tableWidget->addAction(actionPrune);
-      }
+	  int currentRow = currentwidgetitem->row();
+	  QTableWidgetItem *currentrowzeroitem = tableWidget->item(currentRow, 0);
+	  m_currentlyselected = currentrowzeroitem->text();
+
+	  /* The Previous item */
+	  if (previouswidgetitem) { /* avoid a segfault if first time */
+		 tableWidget->removeAction(actionListJobsofClient);
+		 tableWidget->removeAction(actionStatusClientWindow);
+		 tableWidget->removeAction(actionPurgeJobs);
+		 tableWidget->removeAction(actionPrune);
+	  }
+
+	  if (m_currentlyselected.length() != 0) {
+		 /* set a hold variable to the client name in case the context sensitive
+		  * menu is used */
+		 tableWidget->addAction(actionListJobsofClient);
+		 tableWidget->addAction(actionStatusClientWindow);
+		 tableWidget->addAction(actionPurgeJobs);
+		 tableWidget->addAction(actionPrune);
+	  }
    }
 }
 
@@ -227,20 +227,20 @@ void Clients::createContextMenu()
    tableWidget->addAction(actionRefreshClients);
    /* for the tableItemChanged to maintain m_currentJob */
    connect(tableWidget, SIGNAL(
-           currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
-           this, SLOT(tableItemChanged(QTableWidgetItem *, QTableWidgetItem *)));
+		   currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
+		   this, SLOT(tableItemChanged(QTableWidgetItem *, QTableWidgetItem *)));
 
    /* connect to the action specific to this pages class */
    connect(actionRefreshClients, SIGNAL(triggered()), this,
-                SLOT(populateTable()));
+				SLOT(populateTable()));
    connect(actionListJobsofClient, SIGNAL(triggered()), this,
-                SLOT(showJobs()));
+				SLOT(showJobs()));
    connect(actionStatusClientWindow, SIGNAL(triggered()), this,
-                SLOT(statusClientWindow()));
+				SLOT(statusClientWindow()));
    connect(actionPurgeJobs, SIGNAL(triggered()), this,
-                SLOT(consolePurgeJobs()));
+				SLOT(consolePurgeJobs()));
    connect(actionPrune, SIGNAL(triggered()), this,
-                SLOT(prune()));
+				SLOT(prune()));
 }
 
 /*
@@ -270,8 +270,8 @@ void Clients::consoleStatusClient()
 void Clients::currentStackItem()
 {
    if(!m_populated) {
-      populateTable();
-      /* Create the context menu for the client table */
+	  populateTable();
+	  /* Create the context menu for the client table */
    }
 }
 
@@ -281,7 +281,7 @@ void Clients::currentStackItem()
 void Clients::consolePurgeJobs()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to purge all jobs of client \"%1\" ?\n"
+	  tr("Are you sure you want to purge all jobs of client \"%1\" ?\n"
 "The Purge command will delete associated Catalog database records from Jobs and"
 " Volumes without considering the retention period. Purge  works only on the"
 " Catalog database and does not affect data written to Volumes. This command can"
@@ -290,10 +290,10 @@ void Clients::consolePurgeJobs()
 " you are doing.\n\n"
 " Is there any way I can get you to click Cancel here?  You really don't want to do"
 " this\n\n"
-         "Press OK to proceed with the purge operation?").arg(m_currentlyselected),
-         QMessageBox::Ok | QMessageBox::Cancel,
-         QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+		 "Press OK to proceed with the purge operation?").arg(m_currentlyselected),
+		 QMessageBox::Ok | QMessageBox::Cancel,
+		 QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QString cmd("purge jobs client=");
    cmd += m_currentlyselected;
@@ -316,16 +316,16 @@ void Clients::statusClientWindow()
    /* if one exists, then just set it current */
    bool found = false;
    foreach(Pages *page, mainWin->m_pagehash) {
-      if (mainWin->currentConsole() == page->console()) {
-         if (page->name() == tr("Client Status %1").arg(m_currentlyselected)) {
-            found = true;
-            page->setCurrent();
-         }
-      }
+	  if (mainWin->currentConsole() == page->console()) {
+		 if (page->name() == tr("Client Status %1").arg(m_currentlyselected)) {
+			found = true;
+			page->setCurrent();
+		 }
+	  }
    }
    if (!found) {
-      QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-      new ClientStat(m_currentlyselected, parentItem);
+	  QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
+	  new ClientStat(m_currentlyselected, parentItem);
    }
 }
 
@@ -340,9 +340,9 @@ void Clients::settingsOpenStatus(QString &client)
    settings.beginGroup("OpenOnExit");
    QString toRead = "ClientStatus_" + client;
    if (settings.value(toRead) == 1) {
-      new ClientStat(client, mainWin->getFromHash(this));
-      setCurrent();
-      mainWin->getFromHash(this)->setExpanded(true);
+	  new ClientStat(client, mainWin->getFromHash(this));
+	  setCurrent();
+	  mainWin->getFromHash(this)->setExpanded(true);
    }
    settings.endGroup();
 }
diff --git a/src/qt-console/clients/clients.h b/src/qt-console/clients/clients.h
index 9a6437a..74986eb 100644
--- a/src/qt-console/clients/clients.h
+++ b/src/qt-console/clients/clients.h
@@ -25,6 +25,7 @@
 #define _CLIENTS_H_
 
 #include <QtGui>
+
 #include "ui_clients.h"
 #include <pages.h>
 
diff --git a/src/qt-console/console/console.h b/src/qt-console/console/console.h
index 66fdd5d..c0ab2ec 100644
--- a/src/qt-console/console/console.h
+++ b/src/qt-console/console/console.h
@@ -27,6 +27,7 @@
 #define _CONSOLE_H_
 
 #include <QtGui>
+
 #include "pages.h"
 #include "ui_console.h"
 #include "bcomm/dircomm.h"
diff --git a/src/qt-console/fileset/fileset.cpp b/src/qt-console/fileset/fileset.cpp
index fa6250a..b31160f 100644
--- a/src/qt-console/fileset/fileset.cpp
+++ b/src/qt-console/fileset/fileset.cpp
@@ -25,9 +25,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QMenu>
 #include "fileset/fileset.h"
 #include "util/fmtwidgetitem.h"
 
@@ -45,7 +45,7 @@ FileSet::FileSet() : Pages()
    m_closeable = false;
    readSettings();
    /* add context sensitive menu items specific to this classto the page
-    * selector tree. m_contextActions is QList of QActions */
+	* selector tree. m_contextActions is QList of QActions */
    m_contextActions.append(actionRefreshFileSet);
 }
 
@@ -68,7 +68,7 @@ void FileSet::populateTable()
    m_checkcurwidget = true;
 
    QStringList headerlist = (QStringList() << tr("FileSet Name") << tr("FileSet Id")
-       << tr("Create Time"));
+	   << tr("Create Time"));
 
    tableWidget->setColumnCount(headerlist.count());
    tableWidget->setHorizontalHeaderLabels(headerlist);
@@ -82,63 +82,63 @@ void FileSet::populateTable()
    bool first = true;
    QStringList notFoundList = m_console->fileset_list;
    foreach(QString filesetName, m_console->fileset_list) {
-      if (first) {
-         fileset_comsep += "'" + filesetName + "'";
-         first = false;
-      }
-      else
-         fileset_comsep += ",'" + filesetName + "'";
+	  if (first) {
+		 fileset_comsep += "'" + filesetName + "'";
+		 first = false;
+	  }
+	  else
+		 fileset_comsep += ",'" + filesetName + "'";
    }
 
    int row = 0;
    tableWidget->setRowCount(m_console->fileset_list.count());
    if (fileset_comsep != "") {
-      /* Set up query QString and header QStringList */
-      QString query("");
-      query += "SELECT FileSet AS Name, FileSetId AS Id, CreateTime"
-           " FROM FileSet"
-           " WHERE FileSetId IN (SELECT MAX(FileSetId) FROM FileSet WHERE";
-      query += " FileSet IN (" + fileset_comsep + ")";
-      query += " GROUP BY FileSet) ORDER BY FileSet";
-
-      QStringList results;
-      if (mainWin->m_sqlDebug) {
-         Pmsg1(000, "FileSet query cmd : %s\n",query.toUtf8().data());
-      }
-      if (m_console->sql_cmd(query, results)) {
-         QStringList fieldlist;
-
-         /* Iterate through the record returned from the query */
-         foreach (QString resultline, results) {
-            fieldlist = resultline.split("\t");
-
-            /* remove this fileSet from notFoundList */
-            int indexOf = notFoundList.indexOf(fieldlist[0]);
-            if (indexOf != -1) { notFoundList.removeAt(indexOf); }
-
-            TableItemFormatter item(*tableWidget, row);
-
-            /* Iterate through fields in the record */
-            QStringListIterator fld(fieldlist);
-            int col = 0;
-
-            /* name */
-            item.setTextFld(col++, fld.next());
-
-            /* id */
-            item.setNumericFld(col++, fld.next());
-
-            /* creation time */
-            item.setTextFld(col++, fld.next());
-
-            row++;
-         }
-      }
+	  /* Set up query QString and header QStringList */
+	  QString query("");
+	  query += "SELECT FileSet AS Name, FileSetId AS Id, CreateTime"
+		   " FROM FileSet"
+		   " WHERE FileSetId IN (SELECT MAX(FileSetId) FROM FileSet WHERE";
+	  query += " FileSet IN (" + fileset_comsep + ")";
+	  query += " GROUP BY FileSet) ORDER BY FileSet";
+
+	  QStringList results;
+	  if (mainWin->m_sqlDebug) {
+		 Pmsg1(000, "FileSet query cmd : %s\n",query.toUtf8().data());
+	  }
+	  if (m_console->sql_cmd(query, results)) {
+		 QStringList fieldlist;
+
+		 /* Iterate through the record returned from the query */
+		 foreach (QString resultline, results) {
+			fieldlist = resultline.split("\t");
+
+			/* remove this fileSet from notFoundList */
+			int indexOf = notFoundList.indexOf(fieldlist[0]);
+			if (indexOf != -1) { notFoundList.removeAt(indexOf); }
+
+			TableItemFormatter item(*tableWidget, row);
+
+			/* Iterate through fields in the record */
+			QStringListIterator fld(fieldlist);
+			int col = 0;
+
+			/* name */
+			item.setTextFld(col++, fld.next());
+
+			/* id */
+			item.setNumericFld(col++, fld.next());
+
+			/* creation time */
+			item.setTextFld(col++, fld.next());
+
+			row++;
+		 }
+	  }
    }
    foreach(QString filesetName, notFoundList) {
-      TableItemFormatter item(*tableWidget, row);
-      item.setTextFld(0, filesetName);
-      row++;
+	  TableItemFormatter item(*tableWidget, row);
+	  item.setTextFld(0, filesetName);
+	  row++;
    }
 
    /* set default sorting */
@@ -153,12 +153,12 @@ void FileSet::populateTable()
    int rcnt = tableWidget->rowCount();
    int ccnt = tableWidget->columnCount();
    for(int r=0; r < rcnt; r++) {
-      for(int c=0; c < ccnt; c++) {
-         QTableWidgetItem* item = tableWidget->item(r, c);
-         if (item) {
-            item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
-         }
-      }
+	  for(int c=0; c < ccnt; c++) {
+		 QTableWidgetItem* item = tableWidget->item(r, c);
+		 if (item) {
+			item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
+		 }
+	  }
    }
    m_populated = true;
 }
@@ -170,11 +170,11 @@ void FileSet::populateTable()
 void FileSet::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateTable();
-      createContextMenu();
+	  populateTable();
+	  createContextMenu();
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -186,22 +186,22 @@ void FileSet::tableItemChanged(QTableWidgetItem *currentwidgetitem, QTableWidget
 {
    /* m_checkcurwidget checks to see if this is during a refresh, which will segfault */
    if (m_checkcurwidget && currentwidgetitem) {
-      int currentRow = currentwidgetitem->row();
-      QTableWidgetItem *currentrowzeroitem = tableWidget->item(currentRow, 0);
-      m_currentlyselected = currentrowzeroitem->text();
-
-      /* The Previous item */
-      if (previouswidgetitem) { /* avoid a segfault if first time */
-         tableWidget->removeAction(actionStatusFileSetInConsole);
-         tableWidget->removeAction(actionShowJobs);
-      }
-
-      if (m_currentlyselected.length() != 0) {
-         /* set a hold variable to the fileset name in case the context sensitive
-          * menu is used */
-         tableWidget->addAction(actionStatusFileSetInConsole);
-         tableWidget->addAction(actionShowJobs);
-      }
+	  int currentRow = currentwidgetitem->row();
+	  QTableWidgetItem *currentrowzeroitem = tableWidget->item(currentRow, 0);
+	  m_currentlyselected = currentrowzeroitem->text();
+
+	  /* The Previous item */
+	  if (previouswidgetitem) { /* avoid a segfault if first time */
+		 tableWidget->removeAction(actionStatusFileSetInConsole);
+		 tableWidget->removeAction(actionShowJobs);
+	  }
+
+	  if (m_currentlyselected.length() != 0) {
+		 /* set a hold variable to the fileset name in case the context sensitive
+		  * menu is used */
+		 tableWidget->addAction(actionStatusFileSetInConsole);
+		 tableWidget->addAction(actionShowJobs);
+	  }
    }
 }
 
@@ -215,15 +215,15 @@ void FileSet::createContextMenu()
    tableWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
    tableWidget->addAction(actionRefreshFileSet);
    connect(tableWidget, SIGNAL(
-           currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
-           this, SLOT(tableItemChanged(QTableWidgetItem *, QTableWidgetItem *)));
+		   currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
+		   this, SLOT(tableItemChanged(QTableWidgetItem *, QTableWidgetItem *)));
    /* connect to the action specific to this pages class */
    connect(actionRefreshFileSet, SIGNAL(triggered()), this,
-                SLOT(populateTable()));
+				SLOT(populateTable()));
    connect(actionStatusFileSetInConsole, SIGNAL(triggered()), this,
-                SLOT(consoleShowFileSet()));
+				SLOT(consoleShowFileSet()));
    connect(actionShowJobs, SIGNAL(triggered()), this,
-                SLOT(showJobs()));
+				SLOT(showJobs()));
 }
 
 /*
@@ -243,9 +243,9 @@ void FileSet::consoleShowFileSet()
 void FileSet::currentStackItem()
 {
    if (!m_populated) {
-      populateTable();
-      /* Create the context menu for the fileset table */
-      createContextMenu();
+	  populateTable();
+	  /* Create the context menu for the fileset table */
+	  createContextMenu();
    }
 }
 
diff --git a/src/qt-console/fileset/fileset.h b/src/qt-console/fileset/fileset.h
index c63b116..3a47f73 100644
--- a/src/qt-console/fileset/fileset.h
+++ b/src/qt-console/fileset/fileset.h
@@ -25,6 +25,7 @@
 #define _FILESET_H_
 
 #include <QtGui>
+
 #include "ui_fileset.h"
 #include "pages.h"
 
diff --git a/src/qt-console/job/job.h b/src/qt-console/job/job.h
index d57ef4c..6ec2eb0 100644
--- a/src/qt-console/job/job.h
+++ b/src/qt-console/job/job.h
@@ -22,6 +22,7 @@
 #define _JOB_H_
 
 #include <QtGui>
+
 #include "ui_job.h"
 #include <pages.h>
 
diff --git a/src/qt-console/joblist/joblist.cpp b/src/qt-console/joblist/joblist.cpp
index ec1beaf..33e578b 100644
--- a/src/qt-console/joblist/joblist.cpp
+++ b/src/qt-console/joblist/joblist.cpp
@@ -22,9 +22,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QTableWidgetItem>
 #include "joblist.h"
 #include "restore/restore.h"
 #include "job/job.h"
@@ -36,7 +36,7 @@
  * Constructor for the class
  */
 JobList::JobList(const QString &mediaName, const QString &clientName,
-          const QString &jobName, const QString &filesetName, QTreeWidgetItem *parentTreeWidgetItem)
+		  const QString &jobName, const QString &filesetName, QTreeWidgetItem *parentTreeWidgetItem)
    : Pages()
 {
    setupUi(this);
@@ -53,7 +53,7 @@ JobList::JobList(const QString &mediaName, const QString &clientName,
    m_populated = false;
    m_closeable = false;
    if ((m_mediaName != "") || (m_clientName != "") || (m_jobName != "") || (m_filesetName != "")) {
-      m_closeable=true;
+	  m_closeable=true;
    }
    m_checkCurrentWidget = true;
 
@@ -110,10 +110,10 @@ void JobList::populateTable()
 
    /* Set up the Header for the table */
    QStringList headerlist = (QStringList()
-      << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime")
-      << tr("Job Type") << tr("Job Level") << tr("Job Files")
-      << tr("Job Bytes") << tr("Job Status")  << tr("Purged") << tr("File Set")
-      << tr("Pool Name") << tr("First Volume") << tr("VolCount"));
+	  << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime")
+	  << tr("Job Type") << tr("Job Level") << tr("Job Files")
+	  << tr("Job Bytes") << tr("Job Status")  << tr("Purged") << tr("File Set")
+	  << tr("Pool Name") << tr("First Volume") << tr("VolCount"));
 
    m_jobIdIndex = headerlist.indexOf(tr("Job Id"));
    m_purgedIndex = headerlist.indexOf(tr("Purged"));
@@ -138,73 +138,73 @@ void JobList::populateTable()
    mp_tableWidget->setSortingEnabled(false); /* rows move on insert if sorting enabled */
 
    if (mainWin->m_sqlDebug) {
-      Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
+	  Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
    }
 
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
-      m_resultCount = results.count();
+	  m_resultCount = results.count();
 
-      QStringList fieldlist;
-      mp_tableWidget->setRowCount(results.size());
+	  QStringList fieldlist;
+	  mp_tableWidget->setRowCount(results.size());
 
-      int row = 0;
-      /* Iterate through the record returned from the query */
-      QString resultline;
-      foreach (resultline, results) {
-         fieldlist = resultline.split("\t");
-         if (fieldlist.size() < 13)
-            continue; /* some fields missing, ignore row */
+	  int row = 0;
+	  /* Iterate through the record returned from the query */
+	  QString resultline;
+	  foreach (resultline, results) {
+		 fieldlist = resultline.split("\t");
+		 if (fieldlist.size() < 13)
+			continue; /* some fields missing, ignore row */
 
-         TableItemFormatter jobitem(*mp_tableWidget, row);
+		 TableItemFormatter jobitem(*mp_tableWidget, row);
 
-         /* Iterate through fields in the record */
-         QStringListIterator fld(fieldlist);
-         int col = 0;
+		 /* Iterate through fields in the record */
+		 QStringListIterator fld(fieldlist);
+		 int col = 0;
 
-         /* job id */
-         jobitem.setNumericFld(col++, fld.next());
+		 /* job id */
+		 jobitem.setNumericFld(col++, fld.next());
 
-         /* job name */
-         jobitem.setTextFld(col++, fld.next());
+		 /* job name */
+		 jobitem.setTextFld(col++, fld.next());
 
-         /* client */
-         jobitem.setTextFld(col++, fld.next());
+		 /* client */
+		 jobitem.setTextFld(col++, fld.next());
 
-         /* job starttime */
-         jobitem.setTextFld(col++, fld.next(), true);
+		 /* job starttime */
+		 jobitem.setTextFld(col++, fld.next(), true);
 
-         /* job type */
-         jobitem.setJobTypeFld(col++, fld.next());
+		 /* job type */
+		 jobitem.setJobTypeFld(col++, fld.next());
 
-         /* job level */
-         jobitem.setJobLevelFld(col++, fld.next());
+		 /* job level */
+		 jobitem.setJobLevelFld(col++, fld.next());
 
-         /* job files */
-         jobitem.setNumericFld(col++, fld.next());
+		 /* job files */
+		 jobitem.setNumericFld(col++, fld.next());
 
-         /* job bytes */
-         jobitem.setBytesFld(col++, fld.next());
+		 /* job bytes */
+		 jobitem.setBytesFld(col++, fld.next());
 
-         /* job status */
-         jobitem.setJobStatusFld(col++, fld.next());
+		 /* job status */
+		 jobitem.setJobStatusFld(col++, fld.next());
 
-         /* purged */
-         jobitem.setBoolFld(col++, fld.next());
+		 /* purged */
+		 jobitem.setBoolFld(col++, fld.next());
 
-         /* fileset */
-         jobitem.setTextFld(col++, fld.next());
+		 /* fileset */
+		 jobitem.setTextFld(col++, fld.next());
 
-         /* pool name */
-         jobitem.setTextFld(col++, fld.next());
+		 /* pool name */
+		 jobitem.setTextFld(col++, fld.next());
 
-         /* First Media */
-         jobitem.setTextFld(col++, fld.next());
+		 /* First Media */
+		 jobitem.setTextFld(col++, fld.next());
 
-         /* Medias count */
-         jobitem.setNumericFld(col++, fld.next());
-         row++;
-      }
+		 /* Medias count */
+		 jobitem.setNumericFld(col++, fld.next());
+		 row++;
+	  }
    }
    /* set default sorting */
    mp_tableWidget->sortByColumn(m_jobIdIndex, Qt::DescendingOrder);
@@ -215,11 +215,11 @@ void JobList::populateTable()
    mp_tableWidget->resizeRowsToContents();
    mp_tableWidget->verticalHeader()->hide();
    if ((m_mediaName != tr("Any")) && (m_resultCount == 0)){
-      /* for context sensitive searches, let the user know if there were no
-       * results */
-      QMessageBox::warning(this, "Bat",
-          tr("The Jobs query returned no results.\n"
-         "Press OK to continue?"), QMessageBox::Ok );
+	  /* for context sensitive searches, let the user know if there were no
+	   * results */
+	  QMessageBox::warning(this, "Bat",
+		  tr("The Jobs query returned no results.\n"
+		 "Press OK to continue?"), QMessageBox::Ok );
    }
 
    /* make read only */
@@ -229,32 +229,32 @@ void JobList::populateTable()
 void JobList::prepareFilterWidgets()
 {
    if (!m_populated) {
-      clientComboBox->addItem(tr("Any"));
-      clientComboBox->addItems(m_console->client_list);
-      comboSel(clientComboBox, m_clientName);
+	  clientComboBox->addItem(tr("Any"));
+	  clientComboBox->addItems(m_console->client_list);
+	  comboSel(clientComboBox, m_clientName);
 
-      QStringList volumeList;
-      getVolumeList(volumeList);
-      volumeComboBox->addItem(tr("Any"));
-      volumeComboBox->addItems(volumeList);
-      comboSel(volumeComboBox, m_mediaName);
+	  QStringList volumeList;
+	  getVolumeList(volumeList);
+	  volumeComboBox->addItem(tr("Any"));
+	  volumeComboBox->addItems(volumeList);
+	  comboSel(volumeComboBox, m_mediaName);
 
-      jobComboBox->addItem(tr("Any"));
-      jobComboBox->addItems(m_console->job_list);
-      comboSel(jobComboBox, m_jobName);
+	  jobComboBox->addItem(tr("Any"));
+	  jobComboBox->addItems(m_console->job_list);
+	  comboSel(jobComboBox, m_jobName);
 
-      levelComboFill(levelComboBox);
+	  levelComboFill(levelComboBox);
 
-      boolComboFill(purgedComboBox);
+	  boolComboFill(purgedComboBox);
 
-      fileSetComboBox->addItem(tr("Any"));
-      fileSetComboBox->addItems(m_console->fileset_list);
-      comboSel(fileSetComboBox, m_filesetName);
+	  fileSetComboBox->addItem(tr("Any"));
+	  fileSetComboBox->addItems(m_console->fileset_list);
+	  comboSel(fileSetComboBox, m_filesetName);
 
-      poolComboBox->addItem(tr("Any"));
-      poolComboBox->addItems(m_console->pool_list);
+	  poolComboBox->addItem(tr("Any"));
+	  poolComboBox->addItems(m_console->pool_list);
 
-      jobStatusComboFill(statusComboBox);
+	  jobStatusComboFill(statusComboBox);
    }
 }
 
@@ -263,27 +263,27 @@ void JobList::fillQueryString(QString &query)
    query = "";
    int volumeIndex = volumeComboBox->currentIndex();
    if (volumeIndex != -1)
-      m_mediaName = volumeComboBox->itemText(volumeIndex);
+	  m_mediaName = volumeComboBox->itemText(volumeIndex);
    QString distinct = "";
    if (m_mediaName != tr("Any")) { distinct = "DISTINCT "; }
    query += "SELECT " + distinct + "Job.JobId AS JobId, Job.Name AS JobName, "
-            " Client.Name AS Client,"
-            " Job.Starttime AS JobStart, Job.Type AS JobType,"
-            " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
-            " Job.JobBytes AS Bytes, Job.JobStatus AS Status,"
-            " Job.PurgedFiles AS Purged, FileSet.FileSet,"
-            " Pool.Name AS Pool,"
-            " (SELECT Media.VolumeName FROM JobMedia JOIN Media ON JobMedia.MediaId=Media.MediaId WHERE JobMedia.JobId=Job.JobId ORDER BY JobMediaId LIMIT 1) AS FirstVolume,"
-            " (SELECT count(DISTINCT MediaId) FROM JobMedia WHERE JobMedia.JobId=Job.JobId) AS Volumes"
-            " FROM Job"
-            " JOIN Client ON (Client.ClientId=Job.ClientId)"
-            " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId) "
-            " LEFT OUTER JOIN Pool ON Job.PoolId = Pool.PoolId ";
+			" Client.Name AS Client,"
+			" Job.Starttime AS JobStart, Job.Type AS JobType,"
+			" Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
+			" Job.JobBytes AS Bytes, Job.JobStatus AS Status,"
+			" Job.PurgedFiles AS Purged, FileSet.FileSet,"
+			" Pool.Name AS Pool,"
+			" (SELECT Media.VolumeName FROM JobMedia JOIN Media ON JobMedia.MediaId=Media.MediaId WHERE JobMedia.JobId=Job.JobId ORDER BY JobMediaId LIMIT 1) AS FirstVolume,"
+			" (SELECT count(DISTINCT MediaId) FROM JobMedia WHERE JobMedia.JobId=Job.JobId) AS Volumes"
+			" FROM Job"
+			" JOIN Client ON (Client.ClientId=Job.ClientId)"
+			" LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId) "
+			" LEFT OUTER JOIN Pool ON Job.PoolId = Pool.PoolId ";
    QStringList conditions;
    if (m_mediaName != tr("Any")) {
-      query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId) "
-               " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId) ";
-      conditions.append("Media.VolumeName='" + m_mediaName + "'");
+	  query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId) "
+			   " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId) ";
+	  conditions.append("Media.VolumeName='" + m_mediaName + "'");
    }
 
    comboCond(conditions, clientComboBox, "Client.Name");
@@ -296,32 +296,32 @@ void JobList::fillQueryString(QString &query)
 
    /* If Limit check box For limit by days is checked  */
    if (daysCheckBox->checkState() == Qt::Checked) {
-      QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value());
-      QString since = stamp.toString(Qt::ISODate);
-      conditions.append("Job.Starttime > '" + since + "'");
+	  QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value());
+	  QString since = stamp.toString(Qt::ISODate);
+	  conditions.append("Job.Starttime > '" + since + "'");
    }
    if (filterCopyCheckBox->checkState() == Qt::Checked) {
-      conditions.append("Job.Type != 'c'" );
+	  conditions.append("Job.Type != 'c'" );
    }
    if (filterMigrationCheckBox->checkState() == Qt::Checked) {
-      conditions.append("Job.Type != 'g'" );
+	  conditions.append("Job.Type != 'g'" );
    }
    bool first = true;
    foreach (QString condition, conditions) {
-      if (first) {
-         query += " WHERE " + condition;
-         first = false;
-      } else {
-         query += " AND " + condition;
-      }
+	  if (first) {
+		 query += " WHERE " + condition;
+		 first = false;
+	  } else {
+		 query += " AND " + condition;
+	  }
    }
    /* Descending */
    query += " ORDER BY Job.JobId DESC";
    /* If Limit check box for limit records returned is checked  */
    if (limitCheckBox->checkState() == Qt::Checked) {
-      QString limit;
-      limit.setNum(limitSpinBox->value());
-      query += " LIMIT " + limit;
+	  QString limit;
+	  limit.setNum(limitSpinBox->value());
+	  query += " LIMIT " + limit;
    }
 }
 
@@ -332,21 +332,21 @@ void JobList::fillQueryString(QString &query)
 void JobList::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateTable();
-      /* Lets make sure the splitter is not all the way to size index 0 == 0 */
-      QList<int> sizes = m_splitter->sizes();
-      if (sizes[0] == 0) {
-         int frameMax = frame->maximumHeight();
-         int sizeSum = 0;
-         foreach(int size, sizes) { sizeSum += size; }
-         int tabHeight = mainWin->tabWidget->geometry().height();
-         sizes[0] = frameMax;
-         sizes[1] = tabHeight - frameMax;
-         m_splitter->setSizes(sizes);
-      }
+	  populateTable();
+	  /* Lets make sure the splitter is not all the way to size index 0 == 0 */
+	  QList<int> sizes = m_splitter->sizes();
+	  if (sizes[0] == 0) {
+		 int frameMax = frame->maximumHeight();
+		 int sizeSum = 0;
+		 foreach(int size, sizes) { sizeSum += size; }
+		 int tabHeight = mainWin->tabWidget->geometry().height();
+		 sizes[0] = frameMax;
+		 sizes[1] = tabHeight - frameMax;
+		 m_splitter->setSizes(sizes);
+	  }
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -357,7 +357,7 @@ void JobList::PgSeltreeWidgetClicked()
 void JobList::currentStackItem()
 {
 /*   if (!m_populated) populate every time user comes back to this object */
-      populateTable();
+	  populateTable();
 }
 
 /*
@@ -366,15 +366,15 @@ void JobList::currentStackItem()
 void JobList::treeWidgetName(QString &desc)
 {
    if (m_mediaName != "" ) {
-     desc = tr("Jobs Run on Volume %1").arg(m_mediaName);
+	 desc = tr("Jobs Run on Volume %1").arg(m_mediaName);
    } else if (m_clientName != "" ) {
-     desc = tr("Jobs Run from Client %1").arg(m_clientName);
+	 desc = tr("Jobs Run from Client %1").arg(m_clientName);
    } else if (m_jobName != "" ) {
-     desc = tr("Jobs Run of Job %1").arg(m_jobName);
+	 desc = tr("Jobs Run of Job %1").arg(m_jobName);
    } else if (m_filesetName != "" ) {
-     desc = tr("Jobs Run with fileset %1").arg(m_filesetName);
+	 desc = tr("Jobs Run with fileset %1").arg(m_filesetName);
    } else {
-     desc = tr("Jobs Run");
+	 desc = tr("Jobs Run");
    }
 }
 
@@ -385,7 +385,7 @@ void JobList::treeWidgetName(QString &desc)
 void JobList::createConnections()
 {
    /* connect to the action specific to this pages class that shows up in the
-    * page selector tree */
+	* page selector tree */
    connect(actionRefreshJobList, SIGNAL(triggered()), this, SLOT(populateTable()));
    connect(refreshButton, SIGNAL(pressed()), this, SLOT(populateTable()));
    /* for the selectionChanged to maintain m_currentJob and a delete selection */
@@ -444,16 +444,16 @@ void JobList::consoleListJobTotals()
 void JobList::consoleDeleteJob()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to delete??  !!!.\n"
+	  tr("Are you sure you want to delete??  !!!.\n"
 "This delete command is used to delete a Job record and all associated catalog"
 " records that were created. This command operates only on the Catalog"
 " database and has no effect on the actual data written to a Volume. This"
 " command can be dangerous and we strongly recommend that you do not use"
 " it unless you know what you are doing.  The Job and all its associated"
 " records (File and JobMedia) will be deleted from the catalog."
-      "Press OK to proceed with delete operation.?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with delete operation.?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QString cmd("delete job jobid=");
    cmd += m_selectedJobs;
@@ -467,7 +467,7 @@ void JobList::consoleRestartJob()
 
    cmd = tr("run job=\"%1\" client=\"%2\" level=%3").arg(m_jobName).arg(m_clientName).arg(m_levelName);
    if (m_filesetName != "" && m_filesetName != "*None*") {
-      cmd += tr(" fileset=\"%1\"").arg(m_filesetName);
+	  cmd += tr(" fileset=\"%1\"").arg(m_filesetName);
    }
 
    if (mainWin->m_commandDebug) Pmsg1(000, "Run cmd : %s\n",cmd.toUtf8().data());
@@ -480,22 +480,22 @@ void JobList::consoleRestartJob()
 void JobList::consolePurgeFiles()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to purge ??  !!!.\n"
+	  tr("Are you sure you want to purge ??  !!!.\n"
 "The Purge command will delete associated Catalog database records from Jobs and"
 " Volumes without considering the retention period. Purge  works only on the"
 " Catalog database and does not affect data written to Volumes. This command can"
 " be dangerous because you can delete catalog records associated with current"
 " backups of files, and we recommend that you do not use it unless you know what"
 " you are doing.\n"
-      "Press OK to proceed with the purge operation?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with the purge operation?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    m_console->m_warningPrevent = true;
    foreach(QString job, m_selectedJobsList) {
-      QString cmd("purge files jobid=");
-      cmd += job;
-      consoleCommand(cmd, false);
+	  QString cmd("purge files jobid=");
+	  cmd += job;
+	  consoleCommand(cmd, false);
    }
    m_console->m_warningPrevent = false;
    populateTable();
@@ -568,7 +568,7 @@ void JobList::readSettings()
    QSettings settings(m_console->m_dir->name(), "bat");
    settings.beginGroup(m_groupText);
    if (settings.contains(m_splitText)) {
-      m_splitter->restoreState(settings.value(m_splitText).toByteArray());
+	  m_splitter->restoreState(settings.value(m_splitText).toByteArray());
    }
    filterCopyCheckBox->setCheckState((Qt::CheckState)settings.value("FilterCopyCheckState").toInt());
    filterMigrationCheckBox->setCheckState((Qt::CheckState)settings.value("FilterMigrationCheckState").toInt());
@@ -583,99 +583,99 @@ void JobList::selectionChanged()
    QList<int> rowList;
    QList<QTableWidgetItem *> sitems = mp_tableWidget->selectedItems();
    foreach (QTableWidgetItem *sitem, sitems) {
-      int row = sitem->row();
-      if (!rowList.contains(row)) {
-         rowList.append(row);
-      }
+	  int row = sitem->row();
+	  if (!rowList.contains(row)) {
+		 rowList.append(row);
+	  }
    }
 
    m_selectedJobs = "";
    m_selectedJobsList.clear();
    bool first = true;
    foreach(int row, rowList) {
-      QTableWidgetItem * sitem = mp_tableWidget->item(row, m_jobIdIndex);
-      if (!first) m_selectedJobs.append(",");
-      else first = false;
-      m_selectedJobs.append(sitem->text());
-      m_selectedJobsList.append(sitem->text());
+	  QTableWidgetItem * sitem = mp_tableWidget->item(row, m_jobIdIndex);
+	  if (!first) m_selectedJobs.append(",");
+	  else first = false;
+	  m_selectedJobs.append(sitem->text());
+	  m_selectedJobsList.append(sitem->text());
    }
    m_selectedJobsCount = rowList.count();
    if (m_selectedJobsCount > 1) {
-      QString text = QString( tr("Delete list of %1 Jobs")).arg(m_selectedJobsCount);
-      actionDeleteJob->setText(text);
-      text = QString( tr("Purge Files from list of %1 Jobs")).arg(m_selectedJobsCount);
-      actionPurgeFiles->setText(text);
+	  QString text = QString( tr("Delete list of %1 Jobs")).arg(m_selectedJobsCount);
+	  actionDeleteJob->setText(text);
+	  text = QString( tr("Purge Files from list of %1 Jobs")).arg(m_selectedJobsCount);
+	  actionPurgeFiles->setText(text);
    } else {
-      actionDeleteJob->setText(tr("Delete Single Job"));
-      actionPurgeFiles->setText(tr("Purge Files from single job"));
+	  actionDeleteJob->setText(tr("Delete Single Job"));
+	  actionPurgeFiles->setText(tr("Purge Files from single job"));
    }
 
    /* remove all actions */
    foreach(QAction* mediaAction, mp_tableWidget->actions()) {
-      mp_tableWidget->removeAction(mediaAction);
+	  mp_tableWidget->removeAction(mediaAction);
    }
 
    /* Add Actions */
    mp_tableWidget->addAction(actionRefreshJobList);
    if (m_selectedJobsCount == 1) {
-      mp_tableWidget->addAction(actionListFilesOnJob);
-      mp_tableWidget->addAction(actionListJobMedia);
-      mp_tableWidget->addAction(actionRestartJob);
-      mp_tableWidget->addAction(actionRestoreFromJob);
-      mp_tableWidget->addAction(actionRestoreFromTime);
-      mp_tableWidget->addAction(actionShowLogForJob);
-      mp_tableWidget->addAction(actionShowInfoForJob);
+	  mp_tableWidget->addAction(actionListFilesOnJob);
+	  mp_tableWidget->addAction(actionListJobMedia);
+	  mp_tableWidget->addAction(actionRestartJob);
+	  mp_tableWidget->addAction(actionRestoreFromJob);
+	  mp_tableWidget->addAction(actionRestoreFromTime);
+	  mp_tableWidget->addAction(actionShowLogForJob);
+	  mp_tableWidget->addAction(actionShowInfoForJob);
    }
    if (m_selectedJobsCount >= 1) {
-      mp_tableWidget->addAction(actionDeleteJob);
-      mp_tableWidget->addAction(actionPurgeFiles);
+	  mp_tableWidget->addAction(actionDeleteJob);
+	  mp_tableWidget->addAction(actionPurgeFiles);
    }
 
    /* Make Connections */
    if (m_checkCurrentWidget) {
-      int row = mp_tableWidget->currentRow();
-      QTableWidgetItem* jobitem = mp_tableWidget->item(row, 0);
-      m_currentJob = jobitem->text();    /* get JobId */
-      jobitem = mp_tableWidget->item(row, m_clientIndex);
-      m_clientName = jobitem->text();    /* get Client Name */
-      jobitem = mp_tableWidget->item(row, m_nameIndex);
-      m_jobName = jobitem->text();    /* get Job Name */
-      jobitem = mp_tableWidget->item(row, m_levelIndex);
-      m_levelName = jobitem->text();    /* get level */
-      jobitem = mp_tableWidget->item(row, m_filesetIndex);
-      if (jobitem) {
-         m_filesetName = jobitem->text();    /* get FileSet Name */
-      } else {
-         m_filesetName = "";
-      }
-
-      /* include purged action or not */
-      jobitem = mp_tableWidget->item(row, m_purgedIndex);
-      QString purged = jobitem->text();
+	  int row = mp_tableWidget->currentRow();
+	  QTableWidgetItem* jobitem = mp_tableWidget->item(row, 0);
+	  m_currentJob = jobitem->text();    /* get JobId */
+	  jobitem = mp_tableWidget->item(row, m_clientIndex);
+	  m_clientName = jobitem->text();    /* get Client Name */
+	  jobitem = mp_tableWidget->item(row, m_nameIndex);
+	  m_jobName = jobitem->text();    /* get Job Name */
+	  jobitem = mp_tableWidget->item(row, m_levelIndex);
+	  m_levelName = jobitem->text();    /* get level */
+	  jobitem = mp_tableWidget->item(row, m_filesetIndex);
+	  if (jobitem) {
+		 m_filesetName = jobitem->text();    /* get FileSet Name */
+	  } else {
+		 m_filesetName = "";
+	  }
+
+	  /* include purged action or not */
+	  jobitem = mp_tableWidget->item(row, m_purgedIndex);
+	  QString purged = jobitem->text();
 /*      mp_tableWidget->removeAction(actionPurgeFiles);
-      if (purged == tr("No") ) {
-         mp_tableWidget->addAction(actionPurgeFiles);
-      }*/
-
-      /* include restore from time and job action or not */
-      jobitem = mp_tableWidget->item(row, m_typeIndex);
-      QString type = jobitem->text();
-      if (m_selectedJobsCount == 1) {
-         mp_tableWidget->removeAction(actionRestoreFromJob);
-         mp_tableWidget->removeAction(actionRestoreFromTime);
-         if (type == tr("Backup")) {
-            mp_tableWidget->addAction(actionRestoreFromJob);
-            mp_tableWidget->addAction(actionRestoreFromTime);
-         }
-      }
-
-      /* include cancel action or not */
-      jobitem = mp_tableWidget->item(row, m_statusIndex);
-      QString status = jobitem->text();
-      mp_tableWidget->removeAction(actionCancelJob);
-      if (status == tr("Running") || status == tr("Created, not yet running")) {
-         mp_tableWidget->addAction(actionCancelJob);
-      }
+	  if (purged == tr("No") ) {
+		 mp_tableWidget->addAction(actionPurgeFiles);
+	  }*/
+
+	  /* include restore from time and job action or not */
+	  jobitem = mp_tableWidget->item(row, m_typeIndex);
+	  QString type = jobitem->text();
+	  if (m_selectedJobsCount == 1) {
+		 mp_tableWidget->removeAction(actionRestoreFromJob);
+		 mp_tableWidget->removeAction(actionRestoreFromTime);
+		 if (type == tr("Backup")) {
+			mp_tableWidget->addAction(actionRestoreFromJob);
+			mp_tableWidget->addAction(actionRestoreFromTime);
+		 }
+	  }
+
+	  /* include cancel action or not */
+	  jobitem = mp_tableWidget->item(row, m_statusIndex);
+	  QString status = jobitem->text();
+	  mp_tableWidget->removeAction(actionCancelJob);
+	  if (status == tr("Running") || status == tr("Created, not yet running")) {
+		 mp_tableWidget->addAction(actionCancelJob);
+	  }
    }
 }
 
@@ -690,8 +690,8 @@ void JobList::splitterMoved(int /*pos*/, int /*index*/)
    int sizeSum = 0;
    foreach(int size, sizes) { sizeSum += size; }
    if (sizes[0] > frameMax) {
-      sizes[0] = frameMax;
-      sizes[1] = sizeSum - frameMax;
-      m_splitter->setSizes(sizes);
+	  sizes[0] = frameMax;
+	  sizes[1] = sizeSum - frameMax;
+	  m_splitter->setSizes(sizes);
    }
 }
diff --git a/src/qt-console/joblist/joblist.h b/src/qt-console/joblist/joblist.h
index 821f1d4..cc53dd5 100644
--- a/src/qt-console/joblist/joblist.h
+++ b/src/qt-console/joblist/joblist.h
@@ -25,6 +25,7 @@
 #define _JOBLIST_H_
 
 #include <QtGui>
+
 #include "ui_joblist.h"
 #include "console/console.h"
 #include "pages.h"
@@ -35,7 +36,7 @@ class JobList : public Pages, public Ui::JobListForm
 
 public:
    JobList(const QString &medianame, const QString &clientname,
-           const QString &jobname, const QString &filesetname, QTreeWidgetItem *);
+		   const QString &jobname, const QString &filesetname, QTreeWidgetItem *);
    ~JobList();
    virtual void PgSeltreeWidgetClicked();
    virtual void currentStackItem();
diff --git a/src/qt-console/joblog/joblog.h b/src/qt-console/joblog/joblog.h
index 7542e6e..9cf43fb 100644
--- a/src/qt-console/joblog/joblog.h
+++ b/src/qt-console/joblog/joblog.h
@@ -25,6 +25,7 @@
 #define _JOBLOG_H_
 
 #include <QtGui>
+
 #include "ui_joblog.h"
 #include <pages.h>
 
diff --git a/src/qt-console/jobs/jobs.h b/src/qt-console/jobs/jobs.h
index 5e04867..c5fbae6 100644
--- a/src/qt-console/jobs/jobs.h
+++ b/src/qt-console/jobs/jobs.h
@@ -25,6 +25,7 @@
 #define _JOBS_H_
 
 #include <QtGui>
+
 #include "ui_jobs.h"
 #include <pages.h>
 
diff --git a/src/qt-console/label/label.cpp b/src/qt-console/label/label.cpp
index e056a6d..963388a 100644
--- a/src/qt-console/label/label.cpp
+++ b/src/qt-console/label/label.cpp
@@ -25,9 +25,10 @@
  * Kern Sibbald, February MMVII
  */
 
+#include <QtGui>
+
 #include "bat.h"
 #include "label.h"
-#include <QMessageBox>
 
 labelPage::labelPage() : Pages()
 {
@@ -60,7 +61,7 @@ void labelPage::showPage(QString &defString)
    storageCombo->addItems(m_console->storage_list);
    int index = storageCombo->findText(defString, Qt::MatchExactly);
    if (index != -1) {
-      storageCombo->setCurrentIndex(index);
+	  storageCombo->setCurrentIndex(index);
    }
    poolCombo->addItems(m_console->pool_list);
    connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
@@ -77,25 +78,25 @@ void labelPage::okButtonPushed()
 {
    QString scmd;
    if (volumeName->text().toUtf8().data()[0] == 0) {
-      QMessageBox::warning(this, "No Volume name", "No Volume name given",
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this, "No Volume name", "No Volume name given",
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
    this->hide();
    scmd = QString("label volume=\"%1\" pool=\"%2\" storage=\"%3\" slot=%4")
-                  .arg(volumeName->text())
-                  .arg(poolCombo->currentText())
-                  .arg(storageCombo->currentText())
-                  .arg(slotSpin->value());
+				  .arg(volumeName->text())
+				  .arg(poolCombo->currentText())
+				  .arg(storageCombo->currentText())
+				  .arg(slotSpin->value());
    if (mainWin->m_commandDebug) {
-      Pmsg1(000, "sending command : %s\n", scmd.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n", scmd.toUtf8().data());
    }
    if (m_console) {
-      m_console->write_dir(scmd.toUtf8().data());
-      m_console->displayToPrompt(m_conn);
-      m_console->notify(m_conn, true);
+	  m_console->write_dir(scmd.toUtf8().data());
+	  m_console->displayToPrompt(m_conn);
+	  m_console->notify(m_conn, true);
    } else {
-      Pmsg0(000, "m_console==NULL !!!!!!\n");
+	  Pmsg0(000, "m_console==NULL !!!!!!\n");
    }
    closeStackPage();
    mainWin->resetFocus();
@@ -105,9 +106,9 @@ void labelPage::cancelButtonPushed()
 {
    this->hide();
    if (m_console) {
-      m_console->notify(m_conn, true);
+	  m_console->notify(m_conn, true);
    } else {
-      Pmsg0(000, "m_console==NULL !!!!!!\n");
+	  Pmsg0(000, "m_console==NULL !!!!!!\n");
    }
    closeStackPage();
    mainWin->resetFocus();
diff --git a/src/qt-console/label/label.h b/src/qt-console/label/label.h
index 6b75613..3b490ba 100644
--- a/src/qt-console/label/label.h
+++ b/src/qt-console/label/label.h
@@ -25,6 +25,7 @@
 #define _LABEL_H_
 
 #include <QtGui>
+
 #include "ui_label.h"
 #include "pages.h"
 
diff --git a/src/qt-console/main.cpp b/src/qt-console/main.cpp
index 85403e8..e1cb48a 100644
--- a/src/qt-console/main.cpp
+++ b/src/qt-console/main.cpp
@@ -24,9 +24,9 @@
  * Kern Sibbald, January MMVII
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QApplication>
-#include <QTranslator>
 
 /*
  * We need Qt version 4.7.4 or later to be able to comple correctly
@@ -67,11 +67,12 @@ int main(int argc, char *argv[])
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
 
    QTranslator qtTranslator;
-   qtTranslator.load(QString("qt_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
-   app->installTranslator(&qtTranslator);
-
    QTranslator batTranslator;
-   batTranslator.load(QString("bat_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+
+   qtTranslator.load(QString("qt_%1").arg(QLocale::system().name()),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+   batTranslator.load(QString("bat_%1").arg(QLocale::system().name()),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+
+   app->installTranslator(&qtTranslator);
    app->installTranslator(&batTranslator);
 
    register_message_callback(message_callback);
@@ -101,43 +102,43 @@ int main(int argc, char *argv[])
 
 
    while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) {
-      switch (ch) {
-      case 'c':                    /* configuration file */
-         if (configfile != NULL) {
-            free(configfile);
-         }
-         configfile = bstrdup(optarg);
-         break;
-
-      case 'd':
-         debug_level = atoi(optarg);
-         if (debug_level <= 0)
-            debug_level = 1;
-         break;
-
-      case 's':                    /* turn off signals */
-         no_signals = true;
-         break;
-
-      case 't':
-         test_config = true;
-         break;
-
-      case '?':
-      default:
-         usage();
-      }
+	  switch (ch) {
+	  case 'c':                    /* configuration file */
+		 if (configfile != NULL) {
+			free(configfile);
+		 }
+		 configfile = bstrdup(optarg);
+		 break;
+
+	  case 'd':
+		 debug_level = atoi(optarg);
+		 if (debug_level <= 0)
+			debug_level = 1;
+		 break;
+
+	  case 's':                    /* turn off signals */
+		 no_signals = true;
+		 break;
+
+	  case 't':
+		 test_config = true;
+		 break;
+
+	  case '?':
+	  default:
+		 usage();
+	  }
    }
    argc -= optind;
    argv += optind;
 
 
    if (!no_signals) {
-      init_signals(terminate_console);
+	  init_signals(terminate_console);
    }
 
    if (argc) {
-      usage();
+	  usage();
    }
 
    OSDependentInit();
@@ -146,21 +147,21 @@ int main(int argc, char *argv[])
 #endif
 
    if (configfile == NULL) {
-      configfile = bstrdup(CONFIG_FILE);
+	  configfile = bstrdup(CONFIG_FILE);
    }
 
    config = new_config_parser();
    parse_bat_config(config, configfile, M_ERROR_TERM);
 
    if (init_crypto() != 0) {
-      Emsg0(M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
+	  Emsg0(M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
    }
 
    if (!check_resources()) {
-      Emsg1(M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
+	  Emsg1(M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
    }
    if (test_config) {
-      exit(0);
+	  exit(0);
    }
 
    mainWin = new MainWin;
@@ -206,55 +207,55 @@ static int check_resources()
 
    numdir = 0;
    foreach_res(director, R_DIRECTOR) {
-      numdir++;
-      /* tls_require implies tls_enable */
-      if (director->tls_require) {
-         if (have_tls) {
-            director->tls_enable = true;
-         } else {
-            Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bareos.\n"));
-            ok = false;
-            continue;
-         }
-      }
-      tls_needed = director->tls_enable || director->tls_authenticate;
-
-      if ((!director->tls_ca_certfile && !director->tls_ca_certdir) && tls_needed) {
-         Emsg2(M_FATAL, 0, _("Neither \"TLS CA Certificate\""
-                             " or \"TLS CA Certificate Dir\" are defined for Director \"%s\" in %s."
-                             " At least one CA certificate store is required.\n"),
-                             director->hdr.name, configfile);
-         ok = false;
-      }
+	  numdir++;
+	  /* tls_require implies tls_enable */
+	  if (director->tls_require) {
+		 if (have_tls) {
+			director->tls_enable = true;
+		 } else {
+			Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bareos.\n"));
+			ok = false;
+			continue;
+		 }
+	  }
+	  tls_needed = director->tls_enable || director->tls_authenticate;
+
+	  if ((!director->tls_ca_certfile && !director->tls_ca_certdir) && tls_needed) {
+		 Emsg2(M_FATAL, 0, _("Neither \"TLS CA Certificate\""
+							 " or \"TLS CA Certificate Dir\" are defined for Director \"%s\" in %s."
+							 " At least one CA certificate store is required.\n"),
+							 director->hdr.name, configfile);
+		 ok = false;
+	  }
    }
 
    if (numdir == 0) {
-      Emsg1(M_FATAL, 0, _("No Director resource defined in %s\n"
-                          "Without that I don't how to speak to the Director :-(\n"), configfile);
-      ok = false;
+	  Emsg1(M_FATAL, 0, _("No Director resource defined in %s\n"
+						  "Without that I don't how to speak to the Director :-(\n"), configfile);
+	  ok = false;
    }
 
    CONRES *cons;
    /* Loop over Consoles */
    foreach_res(cons, R_CONSOLE) {
-      /* tls_require implies tls_enable */
-      if (cons->tls_require) {
-         if (have_tls) {
-            cons->tls_enable = true;
-         } else {
-            Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bareos.\n"));
-            ok = false;
-            continue;
-         }
-      }
-      tls_needed = cons->tls_enable || cons->tls_authenticate;
-
-      if ((!cons->tls_ca_certfile && !cons->tls_ca_certdir) && tls_needed) {
-         Emsg2(M_FATAL, 0, _("Neither \"TLS CA Certificate\""
-                             " or \"TLS CA Certificate Dir\" are defined for Console \"%s\" in %s.\n"),
-                             cons->hdr.name, configfile);
-         ok = false;
-      }
+	  /* tls_require implies tls_enable */
+	  if (cons->tls_require) {
+		 if (have_tls) {
+			cons->tls_enable = true;
+		 } else {
+			Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bareos.\n"));
+			ok = false;
+			continue;
+		 }
+	  }
+	  tls_needed = cons->tls_enable || cons->tls_authenticate;
+
+	  if ((!cons->tls_ca_certfile && !cons->tls_ca_certdir) && tls_needed) {
+		 Emsg2(M_FATAL, 0, _("Neither \"TLS CA Certificate\""
+							 " or \"TLS CA Certificate Dir\" are defined for Console \"%s\" in %s.\n"),
+							 cons->hdr.name, configfile);
+		 ok = false;
+	  }
    }
 
    UnlockRes();
diff --git a/src/qt-console/mainwin.h b/src/qt-console/mainwin.h
index b1ec13d..22534b7 100644
--- a/src/qt-console/mainwin.h
+++ b/src/qt-console/mainwin.h
@@ -30,7 +30,7 @@
 #define _MAINWIN_H_
 
 #include <QtGui>
-#include <QList>
+
 #include "ui_main.h"
 
 class Console;
@@ -66,7 +66,7 @@ public:
    /* This is a list of consoles */
    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
    void createPageJobList(const QString &, const QString &,
-            const QString &, const QString &, QTreeWidgetItem *);
+			const QString &, const QString &, QTreeWidgetItem *);
    QString m_dtformat;
    /* Begin Preferences variables */
    bool m_commDebug;
diff --git a/src/qt-console/mediaedit/mediaedit.cpp b/src/qt-console/mediaedit/mediaedit.cpp
index 8d3de2b..119166d 100644
--- a/src/qt-console/mediaedit/mediaedit.cpp
+++ b/src/qt-console/mediaedit/mediaedit.cpp
@@ -22,10 +22,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QTableWidgetItem>
-#include <QMessageBox>
 #include "mediaedit.h"
 
 /*
@@ -59,132 +58,132 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId)
 
    /* The media's Status */
    QStringList statusList = (QStringList() << "Full" << "Used" << "Append"
-       << "Error" << "Purged" << "Recycle" << "Read-Only" << "Cleaning");
+	   << "Error" << "Purged" << "Recycle" << "Read-Only" << "Cleaning");
    statusCombo->addItems(statusList);
 
    /* Set up the query for the default values */
    QStringList FieldList = (QStringList()
-      << "Media.VolumeName" << "Pool.Name" << "Media.VolStatus" << "Media.Slot"
-      << "Media.VolRetention" << "Media.VolUseDuration" << "Media.MaxVolJobs"
-      << "Media.MaxVolFiles" << "Media.MaxVolBytes" << "Media.Recycle" << "Media.Enabled"
-      << "Pol.Name");
+	  << "Media.VolumeName" << "Pool.Name" << "Media.VolStatus" << "Media.Slot"
+	  << "Media.VolRetention" << "Media.VolUseDuration" << "Media.MaxVolJobs"
+	  << "Media.MaxVolFiles" << "Media.MaxVolBytes" << "Media.Recycle" << "Media.Enabled"
+	  << "Pol.Name");
    QStringList AsList = (QStringList()
-      << "VolumeName" << "PoolName" << "Status" << "Slot"
-      << "Retention" << "UseDuration" << "MaxJobs"
-      << "MaxFiles" << "MaxBytes" << "Recycle" << "Enabled"
-      << "RecyclePool");
+	  << "VolumeName" << "PoolName" << "Status" << "Slot"
+	  << "Retention" << "UseDuration" << "MaxJobs"
+	  << "MaxFiles" << "MaxBytes" << "Recycle" << "Enabled"
+	  << "RecyclePool");
    int i = 0;
    QString query("SELECT ");
    foreach (QString field, FieldList) {
-      if (i != 0) {
-         query += ", ";
-      }
-      query += field + " AS " + AsList[i];
-      i += 1;
+	  if (i != 0) {
+		 query += ", ";
+	  }
+	  query += field + " AS " + AsList[i];
+	  i += 1;
    }
 
    QString where = " WHERE Media.VolumeName = '" + mediaId + "' ";
    if (mediaId.contains(QRegExp("^[0-9]+$"))) {
-      where = " WHERE Media.MediaId=" + mediaId;
+	  where = " WHERE Media.MediaId=" + mediaId;
    }
    query += " FROM Media"
-            " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
-            " LEFT OUTER JOIN Pool AS Pol ON (Media.RecyclePoolId=Pol.PoolId)"
-            + where;
+			" JOIN Pool ON (Media.PoolId=Pool.PoolId)"
+			" LEFT OUTER JOIN Pool AS Pol ON (Media.RecyclePoolId=Pol.PoolId)"
+			+ where;
 
    if (mainWin->m_sqlDebug) {
-      Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data());
+	  Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data());
    }
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
-      QString field;
-      QStringList fieldlist;
+	  QString field;
+	  QStringList fieldlist;
 
-      /* Iterate through the lines of results, there should only be one. */
-      foreach (QString resultline, results) {
-         fieldlist = resultline.split("\t");
-         i = 0;
+	  /* Iterate through the lines of results, there should only be one. */
+	  foreach (QString resultline, results) {
+		 fieldlist = resultline.split("\t");
+		 i = 0;
 
-         /* Iterate through fields in the record */
-         foreach (field, fieldlist) {
-            field = field.trimmed();  /* strip leading & trailing spaces */
-            bool ok;
-            if (i == 0) {
-               m_mediaName = field;
-               volumeLabel->setText(QString("Volume : %1").arg(m_mediaName));
-            } else if (i == 1) {
-               m_pool = field;
-            } else if (i == 2) {
-               m_status = field;
-            } else if (i == 3) {
-               m_slot = field.toInt(&ok, 10);
-               if (!ok){ m_slot = 0; }
-            } else if (i == 4) {
-               m_retention = field.toInt(&ok, 10);
-               if (!ok){ m_retention = 0; }
-            } else if (i == 5) {
-               m_useDuration = field.toInt(&ok, 10);
-               if (!ok){ m_useDuration = 0; }
-            } else if (i == 6) {
-               m_maxVolJobs = field.toInt(&ok, 10);
-               if (!ok){ m_maxVolJobs = 0; }
-            } else if (i == 7) {
-               m_maxVolFiles = field.toInt(&ok, 10);
-               if (!ok){ m_maxVolFiles = 0; }
-            } else if (i == 8) {
-               m_maxVolBytes = field.toInt(&ok, 10);
-               if (!ok){ m_maxVolBytes = 0; }
-            } else if (i == 9) {
-               if (field == "1") m_recycle = true;
-               else m_recycle = false;
-            } else if (i == 10) {
-               if (field == "1") m_enabled = true;
-               else m_enabled = false;
-            } else if (i == 11) {
-               m_recyclePool = field;
-            }
-            i++;
-         } /* foreach field */
-      } /* foreach resultline */
+		 /* Iterate through fields in the record */
+		 foreach (field, fieldlist) {
+			field = field.trimmed();  /* strip leading & trailing spaces */
+			bool ok;
+			if (i == 0) {
+			   m_mediaName = field;
+			   volumeLabel->setText(QString("Volume : %1").arg(m_mediaName));
+			} else if (i == 1) {
+			   m_pool = field;
+			} else if (i == 2) {
+			   m_status = field;
+			} else if (i == 3) {
+			   m_slot = field.toInt(&ok, 10);
+			   if (!ok){ m_slot = 0; }
+			} else if (i == 4) {
+			   m_retention = field.toInt(&ok, 10);
+			   if (!ok){ m_retention = 0; }
+			} else if (i == 5) {
+			   m_useDuration = field.toInt(&ok, 10);
+			   if (!ok){ m_useDuration = 0; }
+			} else if (i == 6) {
+			   m_maxVolJobs = field.toInt(&ok, 10);
+			   if (!ok){ m_maxVolJobs = 0; }
+			} else if (i == 7) {
+			   m_maxVolFiles = field.toInt(&ok, 10);
+			   if (!ok){ m_maxVolFiles = 0; }
+			} else if (i == 8) {
+			   m_maxVolBytes = field.toInt(&ok, 10);
+			   if (!ok){ m_maxVolBytes = 0; }
+			} else if (i == 9) {
+			   if (field == "1") m_recycle = true;
+			   else m_recycle = false;
+			} else if (i == 10) {
+			   if (field == "1") m_enabled = true;
+			   else m_enabled = false;
+			} else if (i == 11) {
+			   m_recyclePool = field;
+			}
+			i++;
+		 } /* foreach field */
+	  } /* foreach resultline */
    } /* if results from query */
 
    if (m_mediaName != "") {
-      int index;
-      /* default value for pool */
-      index = poolCombo->findText(m_pool, Qt::MatchExactly);
-      if (index != -1) {
-         poolCombo->setCurrentIndex(index);
-      }
+	  int index;
+	  /* default value for pool */
+	  index = poolCombo->findText(m_pool, Qt::MatchExactly);
+	  if (index != -1) {
+		 poolCombo->setCurrentIndex(index);
+	  }
 
-      /* default value for status */
-      index = statusCombo->findText(m_status, Qt::MatchExactly);
-      if (index != -1) {
-         statusCombo->setCurrentIndex(index);
-      }
-      slotSpin->setValue(m_slot);
-      retentionSpin->setValue(m_retention);
-      useDurationSpin->setValue(m_useDuration);
-      setSpins(retentionSpin->value());
-      retentionRadio->setChecked(true);
-      maxJobsSpin->setValue(m_maxVolJobs);
-      maxFilesSpin->setValue(m_maxVolFiles);
-      maxBytesSpin->setValue(m_maxVolBytes);
-      if (m_recycle) recycleCheck->setCheckState(Qt::Checked);
-      else recycleCheck->setCheckState(Qt::Unchecked);
-      if (m_enabled) enabledCheck->setCheckState(Qt::Checked);
-      else enabledCheck->setCheckState(Qt::Unchecked);
-      /* default for recycle pool */
-      recyclePoolCombo->addItems(m_console->pool_list);
-      recyclePoolCombo->insertItem(0, "*None*");
-      index = recyclePoolCombo->findText(m_recyclePool, Qt::MatchExactly);
-      if (index == -1) {
-         index = 0;
-      }
-      recyclePoolCombo->setCurrentIndex(index);
+	  /* default value for status */
+	  index = statusCombo->findText(m_status, Qt::MatchExactly);
+	  if (index != -1) {
+		 statusCombo->setCurrentIndex(index);
+	  }
+	  slotSpin->setValue(m_slot);
+	  retentionSpin->setValue(m_retention);
+	  useDurationSpin->setValue(m_useDuration);
+	  setSpins(retentionSpin->value());
+	  retentionRadio->setChecked(true);
+	  maxJobsSpin->setValue(m_maxVolJobs);
+	  maxFilesSpin->setValue(m_maxVolFiles);
+	  maxBytesSpin->setValue(m_maxVolBytes);
+	  if (m_recycle) recycleCheck->setCheckState(Qt::Checked);
+	  else recycleCheck->setCheckState(Qt::Unchecked);
+	  if (m_enabled) enabledCheck->setCheckState(Qt::Checked);
+	  else enabledCheck->setCheckState(Qt::Unchecked);
+	  /* default for recycle pool */
+	  recyclePoolCombo->addItems(m_console->pool_list);
+	  recyclePoolCombo->insertItem(0, "*None*");
+	  index = recyclePoolCombo->findText(m_recyclePool, Qt::MatchExactly);
+	  if (index == -1) {
+		 index = 0;
+	  }
+	  recyclePoolCombo->setCurrentIndex(index);
    } else {
-      QMessageBox::warning(this, tr("No Volume name"), tr("No Volume name given"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this, tr("No Volume name"), tr("No Volume name given"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
 }
 
@@ -197,68 +196,68 @@ void MediaEdit::okButtonPushed()
    this->hide();
    bool docmd = false;
    scmd = QString("update volume=\"%1\"")
-                  .arg(m_mediaName);
+				  .arg(m_mediaName);
    if (m_pool != poolCombo->currentText()) {
-      scmd += " pool=\"" + poolCombo->currentText() + "\"";
-      docmd = true;
+	  scmd += " pool=\"" + poolCombo->currentText() + "\"";
+	  docmd = true;
    }
    if (m_status != statusCombo->currentText()) {
-      scmd += " volstatus=\"" + statusCombo->currentText() + "\"";
-      docmd = true;
+	  scmd += " volstatus=\"" + statusCombo->currentText() + "\"";
+	  docmd = true;
    }
    if (m_slot != slotSpin->value()) {
-      scmd += " slot=" + QString().setNum(slotSpin->value());
-      docmd = true;
+	  scmd += " slot=" + QString().setNum(slotSpin->value());
+	  docmd = true;
    }
    if (m_retention != retentionSpin->value()) {
-      scmd += " VolRetention=" + QString().setNum(retentionSpin->value());
-      docmd = true;
+	  scmd += " VolRetention=" + QString().setNum(retentionSpin->value());
+	  docmd = true;
    }
    if (m_useDuration != useDurationSpin->value()) {
-      scmd += " VolUse=" + QString().setNum(useDurationSpin->value());
-      docmd = true;
+	  scmd += " VolUse=" + QString().setNum(useDurationSpin->value());
+	  docmd = true;
    }
    if (m_maxVolJobs != maxJobsSpin->value()) {
-      scmd += " MaxVolJobs=" + QString().setNum(maxJobsSpin->value());
-      docmd = true;
+	  scmd += " MaxVolJobs=" + QString().setNum(maxJobsSpin->value());
+	  docmd = true;
    }
    if (m_maxVolFiles != maxFilesSpin->value()) {
-      scmd += " MaxVolFiles=" + QString().setNum(maxFilesSpin->value());
-      docmd = true;
+	  scmd += " MaxVolFiles=" + QString().setNum(maxFilesSpin->value());
+	  docmd = true;
    }
    if (m_maxVolBytes != maxBytesSpin->value()) {
-      scmd += " MaxVolBytes=" + QString().setNum(maxBytesSpin->value());
-      docmd = true;
+	  scmd += " MaxVolBytes=" + QString().setNum(maxBytesSpin->value());
+	  docmd = true;
    }
    if ((m_recycle) && (recycleCheck->checkState() == Qt::Unchecked)) {
-      scmd += " Recycle=no";
-      docmd = true;
+	  scmd += " Recycle=no";
+	  docmd = true;
    }
    if ((!m_recycle) && (recycleCheck->checkState() == Qt::Checked)) {
-      scmd += " Recycle=yes";
-      docmd = true;
+	  scmd += " Recycle=yes";
+	  docmd = true;
    }
    if ((m_enabled) && (enabledCheck->checkState() == Qt::Unchecked)) {
-      scmd += " enabled=no";
-      docmd = true;
+	  scmd += " enabled=no";
+	  docmd = true;
    }
    if ((!m_enabled) && (enabledCheck->checkState() == Qt::Checked)) {
-      scmd += " enabled=yes";
-      docmd = true;
+	  scmd += " enabled=yes";
+	  docmd = true;
    }
    if (m_recyclePool != recyclePoolCombo->currentText()) {
-      scmd += " recyclepool=\"";
-      if (recyclePoolCombo->currentText() != "*None*") {
-         scmd += recyclePoolCombo->currentText();
-      }
-      scmd += "\"";
-      docmd = true;
+	  scmd += " recyclepool=\"";
+	  if (recyclePoolCombo->currentText() != "*None*") {
+		 scmd += recyclePoolCombo->currentText();
+	  }
+	  scmd += "\"";
+	  docmd = true;
    }
    if (docmd) {
-      if (mainWin->m_commandDebug) {
-         Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
-      }
-      consoleCommand(scmd);
+	  if (mainWin->m_commandDebug) {
+		 Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
+	  }
+	  consoleCommand(scmd);
    }
    closeStackPage();
 }
@@ -321,69 +320,69 @@ void MediaEdit::durationChanged()
 {
    disconnectSpins();
    if (secondsSpin->value() == -1) {
-      secondsSpin->setValue(59);
-      minutesSpin->setValue(minutesSpin->value()-1);
+	  secondsSpin->setValue(59);
+	  minutesSpin->setValue(minutesSpin->value()-1);
    }
    if (minutesSpin->value() == -1) {
-      minutesSpin->setValue(59);
-      hoursSpin->setValue(hoursSpin->value()-1);
+	  minutesSpin->setValue(59);
+	  hoursSpin->setValue(hoursSpin->value()-1);
    }
    if (hoursSpin->value() == -1) {
-      hoursSpin->setValue(23);
-      daysSpin->setValue(daysSpin->value()-1);
+	  hoursSpin->setValue(23);
+	  daysSpin->setValue(daysSpin->value()-1);
    }
    if (daysSpin->value() == -1) {
-      daysSpin->setValue(29);
-      monthsSpin->setValue(monthsSpin->value()-1);
+	  daysSpin->setValue(29);
+	  monthsSpin->setValue(monthsSpin->value()-1);
    }
    if (monthsSpin->value() == -1) {
-      monthsSpin->setValue(11);
-      yearsSpin->setValue(yearsSpin->value()-1);
+	  monthsSpin->setValue(11);
+	  yearsSpin->setValue(yearsSpin->value()-1);
    }
    if (yearsSpin->value() == -1) {
-      yearsSpin->setValue(0);
+	  yearsSpin->setValue(0);
    }
 
    if (secondsSpin->value() == 60) {
-      secondsSpin->setValue(0);
-      minutesSpin->setValue(minutesSpin->value()+1);
+	  secondsSpin->setValue(0);
+	  minutesSpin->setValue(minutesSpin->value()+1);
    }
    if (minutesSpin->value() == 60) {
-      minutesSpin->setValue(0);
-      hoursSpin->setValue(hoursSpin->value()+1);
+	  minutesSpin->setValue(0);
+	  hoursSpin->setValue(hoursSpin->value()+1);
    }
    if (hoursSpin->value() == 24) {
-      hoursSpin->setValue(0);
-      daysSpin->setValue(daysSpin->value()+1);
+	  hoursSpin->setValue(0);
+	  daysSpin->setValue(daysSpin->value()+1);
    }
    if (daysSpin->value() == 30) {
-      daysSpin->setValue(0);
-      monthsSpin->setValue(monthsSpin->value()+1);
+	  daysSpin->setValue(0);
+	  monthsSpin->setValue(monthsSpin->value()+1);
    }
    if (monthsSpin->value() == 12) {
-      monthsSpin->setValue(0);
-      yearsSpin->setValue(yearsSpin->value()+1);
+	  monthsSpin->setValue(0);
+	  yearsSpin->setValue(yearsSpin->value()+1);
    }
    connectSpins();
    if (retentionRadio->isChecked()) {
-      int retention;
-      retention = secondsSpin->value() + minutesSpin->value() * 60 +
-         hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
-         monthsSpin->value() * 2592000 +
-         yearsSpin->value() * 31536000;
-      disconnect(retentionSpin, SIGNAL(valueChanged(int)), this, SLOT(retentionChanged()));
-      retentionSpin->setValue(retention);
-      connect(retentionSpin, SIGNAL(valueChanged(int)), this, SLOT(retentionChanged()));
+	  int retention;
+	  retention = secondsSpin->value() + minutesSpin->value() * 60 +
+		 hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
+		 monthsSpin->value() * 2592000 +
+		 yearsSpin->value() * 31536000;
+	  disconnect(retentionSpin, SIGNAL(valueChanged(int)), this, SLOT(retentionChanged()));
+	  retentionSpin->setValue(retention);
+	  connect(retentionSpin, SIGNAL(valueChanged(int)), this, SLOT(retentionChanged()));
    }
    if (useDurationRadio->isChecked()) {
-      int useDuration;
-      useDuration = secondsSpin->value() + minutesSpin->value() * 60 +
-         hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
-         monthsSpin->value() * 2592000 +
-         yearsSpin->value() * 31536000;
-      disconnect(useDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(useDurationChanged()));
-      useDurationSpin->setValue(useDuration);
-      connect(useDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(useDurationChanged()));
+	  int useDuration;
+	  useDuration = secondsSpin->value() + minutesSpin->value() * 60 +
+		 hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
+		 monthsSpin->value() * 2592000 +
+		 yearsSpin->value() * 31536000;
+	  disconnect(useDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(useDurationChanged()));
+	  useDurationSpin->setValue(useDuration);
+	  connect(useDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(useDurationChanged()));
    }
 }
 
diff --git a/src/qt-console/mediaedit/mediaedit.h b/src/qt-console/mediaedit/mediaedit.h
index e9a5287..6f27487 100644
--- a/src/qt-console/mediaedit/mediaedit.h
+++ b/src/qt-console/mediaedit/mediaedit.h
@@ -25,6 +25,7 @@
 #define _MEDIAEDIT_H_
 
 #include <QtGui>
+
 #include "ui_mediaedit.h"
 #include <pages.h>
 
diff --git a/src/qt-console/mediainfo/mediainfo.cpp b/src/qt-console/mediainfo/mediainfo.cpp
index 27b9520..b174410 100644
--- a/src/qt-console/mediainfo/mediainfo.cpp
+++ b/src/qt-console/mediainfo/mediainfo.cpp
@@ -19,10 +19,9 @@
    02110-1301, USA.
 */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QTableWidgetItem>
-#include <QMessageBox>
 #include "mediaedit/mediaedit.h"
 #include "relabel/relabel.h"
 #include "run/run.h"
@@ -76,21 +75,21 @@ void MediaInfo::pruneVol()
 void MediaInfo::purgeVol()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to purge ??  !!!.\n"
+	  tr("Are you sure you want to purge ??  !!!.\n"
 "The Purge command will delete associated Catalog database records from Jobs and"
 " Volumes without considering the retention period. Purge  works only on the"
 " Catalog database and does not affect data written to Volumes. This command can"
 " be dangerous because you can delete catalog records associated with current"
 " backups of files, and we recommend that you do not use it unless you know what"
 " you are doing.\n"
-      "Press OK to proceed with the purge operation?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with the purge operation?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QString scmd;
 
    scmd = QString("purge volume=\"%1\"")
-                  .arg(m_mediaName);
+				  .arg(m_mediaName);
 
    consoleCommand(scmd);
 }
@@ -98,21 +97,21 @@ void MediaInfo::purgeVol()
 void MediaInfo::deleteVol()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to delete??  !!!.\n"
+	  tr("Are you sure you want to delete??  !!!.\n"
 "This delete command is used to delete a Volume record and all associated catalog"
 " records that were created. This command operates only on the Catalog"
 " database and has no effect on the actual data written to a Volume. This"
 " command can be dangerous and we strongly recommend that you do not use"
 " it unless you know what you are doing.  All Jobs and all associated"
 " records (File and JobMedia) will be deleted from the catalog."
-      "Press OK to proceed with delete operation.?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with delete operation.?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QString scmd;
 
    scmd = QString("delete volume=\"%1\"")
-                  .arg(m_mediaName);
+				  .arg(m_mediaName);
 
    consoleCommand(scmd);
 }
@@ -128,7 +127,7 @@ void MediaInfo::importVol()
    QString scmd;
 
    scmd = QString("import volume=\"%1\"")
-                    .arg(m_mediaName);
+					.arg(m_mediaName);
 
    consoleCommand(scmd);
 }
@@ -138,7 +137,7 @@ void MediaInfo::exportVol()
    QString scmd;
 
    scmd = QString("export volume=\"%1\"")
-                    .arg(m_mediaName);
+					.arg(m_mediaName);
 
    consoleCommand(scmd);
 }
@@ -155,70 +154,70 @@ void MediaInfo::populateForm()
    struct tm tm;
    char buf[256];
    QString query =
-      "SELECT MediaId, VolumeName, Pool.Name, MediaType, FirstWritten,"
-      "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 "
-      "FROM Media JOIN Pool USING (PoolId) LEFT JOIN Pool AS RecyclePool "
-      "ON (Media.RecyclePoolId=RecyclePool.PoolId) "
-      "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) "
-      "WHERE Media.VolumeName='" + m_mediaName + "'";
+	  "SELECT MediaId, VolumeName, Pool.Name, MediaType, FirstWritten,"
+	  "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 "
+	  "FROM Media JOIN Pool USING (PoolId) LEFT JOIN Pool AS RecyclePool "
+	  "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());
+	  Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data());
    }
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
-      QString resultline;
-      QStringList fieldlist;
-
-      foreach (resultline, results) { // should have only one result
-         fieldlist = resultline.split("\t");
-         QStringListIterator fld(fieldlist);
-         m_mediaId = fld.next();
-
-         label_VolumeName->setText(fld.next());
-         label_Pool->setText(fld.next());
-         label_MediaType->setText(fld.next());
-         label_FirstWritten->setText(fld.next());
-         LastWritten = fld.next();
-         label_LastWritten->setText(LastWritten);
+	  QString resultline;
+	  QStringList fieldlist;
+
+	  foreach (resultline, results) { // should have only one result
+		 fieldlist = resultline.split("\t");
+		 QStringListIterator fld(fieldlist);
+		 m_mediaId = fld.next();
+
+		 label_VolumeName->setText(fld.next());
+		 label_Pool->setText(fld.next());
+		 label_MediaType->setText(fld.next());
+		 label_FirstWritten->setText(fld.next());
+		 LastWritten = fld.next();
+		 label_LastWritten->setText(LastWritten);
 //         label_VolFiles->setText(fld.next());
-         label_VolMounts->setText(fld.next());
-         label_VolBytes->setText(convertBytesSI(fld.next().toULongLong()));
-         label_Enabled->setPixmap(QPixmap(":/images/inflag" + fld.next() + ".png"));
-         label_Location->setText(fld.next());
-         label_VolStatus->setText(fld.next());
-         label_RecyclePool->setText(fld.next());
-         chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked);
-         edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
-         label_VolReadTime->setText(QString(buf));
-
-         edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
-         label_VolWriteTime->setText(QString(buf));
-
-         edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
-         label_VolUseDuration->setText(QString(buf));
-
-         label_MaxVolJobs->setText(fld.next());
-         label_MaxVolFiles->setText(fld.next());
-         label_MaxVolBytes->setText(fld.next());
-
-         stat = fld.next();
-         edit_utime(stat.toULongLong(), buf, sizeof(buf));
-         label_VolRetention->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_VolMounts->setText(fld.next());
+		 label_VolBytes->setText(convertBytesSI(fld.next().toULongLong()));
+		 label_Enabled->setPixmap(QPixmap(":/images/inflag" + fld.next() + ".png"));
+		 label_Location->setText(fld.next());
+		 label_VolStatus->setText(fld.next());
+		 label_RecyclePool->setText(fld.next());
+		 chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked);
+		 edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
+		 label_VolReadTime->setText(QString(buf));
+
+		 edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
+		 label_VolWriteTime->setText(QString(buf));
+
+		 edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
+		 label_VolUseDuration->setText(QString(buf));
+
+		 label_MaxVolJobs->setText(fld.next());
+		 label_MaxVolFiles->setText(fld.next());
+		 label_MaxVolBytes->setText(fld.next());
+
+		 stat = fld.next();
+		 edit_utime(stat.toULongLong(), buf, sizeof(buf));
+		 label_VolRetention->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());
 
@@ -227,55 +226,55 @@ void MediaInfo::populateForm()
 //         jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf));
 //         stat = buf;
 //
-      }
+	  }
    }
 
    query =
-      "SELECT DISTINCT JobId, Name, StartTime, Type, Level, JobFiles,"
-      "JobBytes,JobStatus "
-      "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
-      "WHERE Media.VolumeName = '" + m_mediaName + "'";
+	  "SELECT DISTINCT JobId, Name, StartTime, Type, Level, JobFiles,"
+	  "JobBytes,JobStatus "
+	  "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());
+	  Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data());
    }
    results.clear();
    if (m_console->sql_cmd(query, results)) {
-      QString resultline;
-      QStringList fieldlist;
-      int row = 0;
-      tableJob->setRowCount(results.size());
-      foreach (resultline, results) {
-         fieldlist = resultline.split("\t");
-         QStringListIterator fld(fieldlist);
-         int index=0;
-         TableItemFormatter jobitem(*tableJob, row);
+	  QString resultline;
+	  QStringList fieldlist;
+	  int row = 0;
+	  tableJob->setRowCount(results.size());
+	  foreach (resultline, results) {
+		 fieldlist = resultline.split("\t");
+		 QStringListIterator fld(fieldlist);
+		 int index=0;
+		 TableItemFormatter jobitem(*tableJob, row);
 
-         /* JobId */
-         jobitem.setNumericFld(index++, fld.next());
+		 /* JobId */
+		 jobitem.setNumericFld(index++, fld.next());
 
-         /* job name */
-         jobitem.setTextFld(index++, fld.next());
+		 /* job name */
+		 jobitem.setTextFld(index++, fld.next());
 
-         /* job starttime */
-         jobitem.setTextFld(index++, fld.next(), true);
+		 /* job starttime */
+		 jobitem.setTextFld(index++, fld.next(), true);
 
-         /* job type */
-         jobitem.setJobTypeFld(index++, fld.next());
+		 /* job type */
+		 jobitem.setJobTypeFld(index++, fld.next());
 
-         /* job level */
-         jobitem.setJobLevelFld(index++, fld.next());
+		 /* job level */
+		 jobitem.setJobLevelFld(index++, fld.next());
 
-         /* job files */
-         jobitem.setNumericFld(index++, fld.next());
+		 /* job files */
+		 jobitem.setNumericFld(index++, fld.next());
 
-         /* job bytes */
-         jobitem.setBytesFld(index++, fld.next());
+		 /* job bytes */
+		 jobitem.setBytesFld(index++, fld.next());
 
-         /* job status */
-         jobitem.setJobStatusFld(index++, fld.next());
-         row++;
-      }
+		 /* job status */
+		 jobitem.setJobStatusFld(index++, fld.next());
+		 row++;
+	  }
    }
 
    tableJob->resizeColumnsToContents();
diff --git a/src/qt-console/mediainfo/mediainfo.h b/src/qt-console/mediainfo/mediainfo.h
index 53c0c6d..da8be14 100644
--- a/src/qt-console/mediainfo/mediainfo.h
+++ b/src/qt-console/mediainfo/mediainfo.h
@@ -22,6 +22,7 @@
 #define _MEDIAINFO_H_
 
 #include <QtGui>
+
 #include "ui_mediainfo.h"
 #include <pages.h>
 
diff --git a/src/qt-console/medialist/medialist.cpp b/src/qt-console/medialist/medialist.cpp
index 68e2c69..8ee7cbb 100644
--- a/src/qt-console/medialist/medialist.cpp
+++ b/src/qt-console/medialist/medialist.cpp
@@ -27,9 +27,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QMenu>
 #include <math.h>
 #include "medialist.h"
 #include "mediaedit/mediaedit.h"
@@ -53,14 +53,14 @@ MediaList::MediaList() : Pages()
    m_checkcurwidget = true;
    m_closeable = false;
    /* add context sensitive menu items specific to this classto the page
-    * selector tree. m_contextActions is QList of QActions */
+	* selector tree. m_contextActions is QList of QActions */
    m_contextActions.append(actionRefreshMediaList);
 }
 
 MediaList::~MediaList()
 {
    if (m_populated) {
-      writeExpandedSettings();
+	  writeExpandedSettings();
    }
 }
 
@@ -73,18 +73,18 @@ void MediaList::populateTree()
    QTreeWidgetItem *pooltreeitem = NULL;
 
    if (m_populated) {
-      writeExpandedSettings();
+	  writeExpandedSettings();
    }
    m_populated = true;
 
    Freeze frz(*mp_treeWidget); /* disable updating*/
 
    QStringList headerlist = (QStringList()
-      << tr("Volume Name") << tr("Id") << tr("Status") << tr("Enabled") << tr("Bytes") << tr("Files")
-      << tr("Jobs") << tr("Retention") << tr("Media Type") << tr("Slot") << tr("Use Duration")
-      << tr("Max Jobs") << tr("Max Files") << tr("Max Bytes") << tr("Recycle")
-      << tr("Last Written") << tr("First Written") << tr("Read Time")
-      << tr("Write Time") << tr("Recycle Count") << tr("Recycle Pool"));
+	  << tr("Volume Name") << tr("Id") << tr("Status") << tr("Enabled") << tr("Bytes") << tr("Files")
+	  << tr("Jobs") << tr("Retention") << tr("Media Type") << tr("Slot") << tr("Use Duration")
+	  << tr("Max Jobs") << tr("Max Files") << tr("Max Bytes") << tr("Recycle")
+	  << tr("Last Written") << tr("First Written") << tr("Read Time")
+	  << tr("Write Time") << tr("Recycle Count") << tr("Recycle Pool"));
 
    m_checkcurwidget = false;
    mp_treeWidget->clear();
@@ -106,152 +106,152 @@ void MediaList::populateTree()
    bool first = true;
    QString pool_comsep("");
    foreach (QString pool_listItem, m_console->pool_list) {
-      if (first) {
-         pool_comsep += "'" + pool_listItem + "'";
-         first = false;
-      }
-      else
-         pool_comsep += ",'" + pool_listItem + "'";
+	  if (first) {
+		 pool_comsep += "'" + pool_listItem + "'";
+		 first = false;
+	  }
+	  else
+		 pool_comsep += ",'" + pool_listItem + "'";
    }
    /* Now use pool_comsep list to perform just one query */
    if (pool_comsep != "") {
-      query =  "SELECT Pool.Name AS pul,"
-         " Media.VolumeName AS Media, "
-         " Media.MediaId AS Id, Media.VolStatus AS VolStatus,"
-         " Media.Enabled AS Enabled, Media.VolBytes AS Bytes,"
-         " Media.VolFiles AS FileCount, Media.VolJobs AS JobCount,"
-         " Media.VolRetention AS VolumeRetention, Media.MediaType AS MediaType,"
-         " Media.InChanger AS InChanger, Media.Slot AS Slot, "
-         " Media.VolUseDuration AS UseDuration,"
-         " Media.MaxVolJobs AS MaxJobs, Media.MaxVolFiles AS MaxFiles,"
-         " Media.MaxVolBytes AS MaxBytes, Media.Recycle AS Recycle,"
-         " Media.LastWritten AS LastWritten,"
-         " Media.FirstWritten AS FirstWritten,"
-         " (VolReadTime/1000000) AS ReadTime, (VolWriteTime/1000000) AS WriteTime,"
-         " RecycleCount AS ReCyCount,"
-         " RecPool.Name AS RecyclePool"
-         " FROM Media"
-         " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
-         " LEFT OUTER JOIN Pool AS RecPool ON (Media.RecyclePoolId=RecPool.PoolId)"
-         " WHERE ";
-      query += " Pool.Name IN (" + pool_comsep + ")";
-      query += " ORDER BY Pool.Name, Media";
-
-      if (mainWin->m_sqlDebug) {
-         Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data());
-      }
-      QStringList results;
-      int counter = 0;
-      if (m_console->sql_cmd(query, results)) {
-         QStringList fieldlist;
-         QString prev_pool("");
-         QString this_pool("");
-
-         /* Iterate through the lines of results. */
-         foreach (QString resultline, results) {
-            fieldlist = resultline.split("\t");
-            this_pool = fieldlist.takeFirst();
-            if (prev_pool != this_pool) {
-               prev_pool = this_pool;
-               pooltreeitem = new QTreeWidgetItem(m_topItem);
-               pooltreeitem->setText(0, this_pool);
-               pooltreeitem->setData(0, Qt::UserRole, 1);
-            }
-            if(settings.contains(this_pool)) {
-               pooltreeitem->setExpanded(settings.value(this_pool).toBool());
-            } else {
-               pooltreeitem->setExpanded(true);
-            }
-
-            if (fieldlist.size() < 18) {
-               Pmsg1(0, "Discarding %s\n", resultline.data());
-               continue; /* Some fields missing, ignore row */
-            }
-
-            int index = 0;
-            TreeItemFormatter mediaitem(*pooltreeitem, 2);
-
-            /* Iterate through fields in the record */
-            QStringListIterator fld(fieldlist);
-
-            /* volname */
-            mediaitem.setTextFld(index++, fld.next());
-
-            /* id */
-            mediaitem.setNumericFld(index++, fld.next());
-
-            /* status */
-            mediaitem.setVolStatusFld(index++, fld.next());
-
-            /* enabled */
-            mediaitem.setBoolFld(index++, fld.next());
-
-            /* bytes */
-            mediaitem.setBytesFld(index++, fld.next());
-
-            /* files */
-            mediaitem.setNumericFld(index++, fld.next());
-
-            /* jobs */
-            mediaitem.setNumericFld(index++, fld.next());
-
-            /* retention */
-            mediaitem.setDurationFld(index++, fld.next());
-
-            /* media type */
-            mediaitem.setTextFld(index++, fld.next());
-
-            /* inchanger + slot */
-            int inchanger = fld.next().toInt();
-            if (inchanger) {
-               mediaitem.setNumericFld(index++, fld.next());
-            } else {
-               /* volume not in changer, show blank slot */
-               mediaitem.setNumericFld(index++, "");
-               fld.next();
-            }
-
-            /* use duration */
-            mediaitem.setDurationFld(index++, fld.next());
-
-            /* max jobs */
-            mediaitem.setNumericFld(index++, fld.next());
-
-            /* max files */
-            mediaitem.setNumericFld(index++, fld.next());
-
-            /* max bytes */
-            mediaitem.setBytesFld(index++, fld.next());
-
-            /* recycle */
-            mediaitem.setBoolFld(index++, fld.next());
-
-            /* last written */
-            mediaitem.setTextFld(index++, fld.next());
-
-            /* first written */
-            mediaitem.setTextFld(index++, fld.next());
-
-            /* read time */
-            mediaitem.setDurationFld(index++, fld.next());
-
-            /* write time */
-            mediaitem.setDurationFld(index++, fld.next());
-
-            /* Recycle Count */
-            mediaitem.setNumericFld(index++, fld.next());
+	  query =  "SELECT Pool.Name AS pul,"
+		 " Media.VolumeName AS Media, "
+		 " Media.MediaId AS Id, Media.VolStatus AS VolStatus,"
+		 " Media.Enabled AS Enabled, Media.VolBytes AS Bytes,"
+		 " Media.VolFiles AS FileCount, Media.VolJobs AS JobCount,"
+		 " Media.VolRetention AS VolumeRetention, Media.MediaType AS MediaType,"
+		 " Media.InChanger AS InChanger, Media.Slot AS Slot, "
+		 " Media.VolUseDuration AS UseDuration,"
+		 " Media.MaxVolJobs AS MaxJobs, Media.MaxVolFiles AS MaxFiles,"
+		 " Media.MaxVolBytes AS MaxBytes, Media.Recycle AS Recycle,"
+		 " Media.LastWritten AS LastWritten,"
+		 " Media.FirstWritten AS FirstWritten,"
+		 " (VolReadTime/1000000) AS ReadTime, (VolWriteTime/1000000) AS WriteTime,"
+		 " RecycleCount AS ReCyCount,"
+		 " RecPool.Name AS RecyclePool"
+		 " FROM Media"
+		 " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
+		 " LEFT OUTER JOIN Pool AS RecPool ON (Media.RecyclePoolId=RecPool.PoolId)"
+		 " WHERE ";
+	  query += " Pool.Name IN (" + pool_comsep + ")";
+	  query += " ORDER BY Pool.Name, Media";
+
+	  if (mainWin->m_sqlDebug) {
+		 Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data());
+	  }
+	  QStringList results;
+	  int counter = 0;
+	  if (m_console->sql_cmd(query, results)) {
+		 QStringList fieldlist;
+		 QString prev_pool("");
+		 QString this_pool("");
+
+		 /* Iterate through the lines of results. */
+		 foreach (QString resultline, results) {
+			fieldlist = resultline.split("\t");
+			this_pool = fieldlist.takeFirst();
+			if (prev_pool != this_pool) {
+			   prev_pool = this_pool;
+			   pooltreeitem = new QTreeWidgetItem(m_topItem);
+			   pooltreeitem->setText(0, this_pool);
+			   pooltreeitem->setData(0, Qt::UserRole, 1);
+			}
+			if(settings.contains(this_pool)) {
+			   pooltreeitem->setExpanded(settings.value(this_pool).toBool());
+			} else {
+			   pooltreeitem->setExpanded(true);
+			}
+
+			if (fieldlist.size() < 18) {
+			   Pmsg1(0, "Discarding %s\n", resultline.data());
+			   continue; /* Some fields missing, ignore row */
+			}
+
+			int index = 0;
+			TreeItemFormatter mediaitem(*pooltreeitem, 2);
+
+			/* Iterate through fields in the record */
+			QStringListIterator fld(fieldlist);
+
+			/* volname */
+			mediaitem.setTextFld(index++, fld.next());
+
+			/* id */
+			mediaitem.setNumericFld(index++, fld.next());
+
+			/* status */
+			mediaitem.setVolStatusFld(index++, fld.next());
+
+			/* enabled */
+			mediaitem.setBoolFld(index++, fld.next());
+
+			/* bytes */
+			mediaitem.setBytesFld(index++, fld.next());
+
+			/* files */
+			mediaitem.setNumericFld(index++, fld.next());
+
+			/* jobs */
+			mediaitem.setNumericFld(index++, fld.next());
+
+			/* retention */
+			mediaitem.setDurationFld(index++, fld.next());
+
+			/* media type */
+			mediaitem.setTextFld(index++, fld.next());
+
+			/* inchanger + slot */
+			int inchanger = fld.next().toInt();
+			if (inchanger) {
+			   mediaitem.setNumericFld(index++, fld.next());
+			} else {
+			   /* volume not in changer, show blank slot */
+			   mediaitem.setNumericFld(index++, "");
+			   fld.next();
+			}
+
+			/* use duration */
+			mediaitem.setDurationFld(index++, fld.next());
+
+			/* max jobs */
+			mediaitem.setNumericFld(index++, fld.next());
+
+			/* max files */
+			mediaitem.setNumericFld(index++, fld.next());
+
+			/* max bytes */
+			mediaitem.setBytesFld(index++, fld.next());
+
+			/* recycle */
+			mediaitem.setBoolFld(index++, fld.next());
+
+			/* last written */
+			mediaitem.setTextFld(index++, fld.next());
+
+			/* first written */
+			mediaitem.setTextFld(index++, fld.next());
+
+			/* read time */
+			mediaitem.setDurationFld(index++, fld.next());
+
+			/* write time */
+			mediaitem.setDurationFld(index++, fld.next());
+
+			/* Recycle Count */
+			mediaitem.setNumericFld(index++, fld.next());
 
-            /* recycle pool */
-            mediaitem.setTextFld(index++, fld.next());
+			/* recycle pool */
+			mediaitem.setTextFld(index++, fld.next());
 
-         } /* foreach resultline */
-         counter += 1;
-      } /* if results from query */
+		 } /* foreach resultline */
+		 counter += 1;
+	  } /* if results from query */
    } /* foreach pool_listItem */
    settings.endGroup();
    /* Resize the columns */
    for(int cnter=0; cnter<headerlist.count(); cnter++) {
-      mp_treeWidget->resizeColumnToContents(cnter);
+	  mp_treeWidget->resizeColumnToContents(cnter);
    }
 }
 
@@ -291,11 +291,11 @@ void MediaList::viewVolume()
 void MediaList::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateTree();
-      createContextMenu();
+	  populateTree();
+	  createContextMenu();
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -307,30 +307,30 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
 {
    /* m_checkcurwidget checks to see if this is during a refresh, which will segfault */
    if (m_checkcurwidget) {
-      /* The Previous item */
-      if (previouswidgetitem) { /* avoid a segfault if first time */
-         foreach(QAction* mediaAction, mp_treeWidget->actions()) {
-            mp_treeWidget->removeAction(mediaAction);
-         }
-      }
-
-      int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
-      m_currentVolumeName=currentwidgetitem->text(0);
-      mp_treeWidget->addAction(actionRefreshMediaList);
-      if (treedepth == 2){
-         m_currentVolumeId=currentwidgetitem->text(1);
-         mp_treeWidget->addAction(actionEditVolume);
-         mp_treeWidget->addAction(actionListJobsOnVolume);
-         mp_treeWidget->addAction(actionDeleteVolume);
-         mp_treeWidget->addAction(actionPruneVolume);
-         mp_treeWidget->addAction(actionPurgeVolume);
-         mp_treeWidget->addAction(actionImportVolume);
-         mp_treeWidget->addAction(actionExportVolume);
-         mp_treeWidget->addAction(actionRelabelVolume);
-         mp_treeWidget->addAction(actionVolumeFromPool);
-      } else if (treedepth == 1) {
-         mp_treeWidget->addAction(actionAllVolumesFromPool);
-      }
+	  /* The Previous item */
+	  if (previouswidgetitem) { /* avoid a segfault if first time */
+		 foreach(QAction* mediaAction, mp_treeWidget->actions()) {
+			mp_treeWidget->removeAction(mediaAction);
+		 }
+	  }
+
+	  int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
+	  m_currentVolumeName=currentwidgetitem->text(0);
+	  mp_treeWidget->addAction(actionRefreshMediaList);
+	  if (treedepth == 2){
+		 m_currentVolumeId=currentwidgetitem->text(1);
+		 mp_treeWidget->addAction(actionEditVolume);
+		 mp_treeWidget->addAction(actionListJobsOnVolume);
+		 mp_treeWidget->addAction(actionDeleteVolume);
+		 mp_treeWidget->addAction(actionPruneVolume);
+		 mp_treeWidget->addAction(actionPurgeVolume);
+		 mp_treeWidget->addAction(actionImportVolume);
+		 mp_treeWidget->addAction(actionExportVolume);
+		 mp_treeWidget->addAction(actionRelabelVolume);
+		 mp_treeWidget->addAction(actionVolumeFromPool);
+	  } else if (treedepth == 1) {
+		 mp_treeWidget->addAction(actionAllVolumesFromPool);
+	  }
    }
 }
 
@@ -352,11 +352,11 @@ void MediaList::createContextMenu()
    connect(actionExportVolume, SIGNAL(triggered()), this, SLOT(exportVolume()));
    connect(actionRelabelVolume, SIGNAL(triggered()), this, SLOT(relabelVolume()));
    connect(mp_treeWidget, SIGNAL(
-           currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
-           this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
+		   currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
+		   this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
    /* connect to the action specific to this pages class */
    connect(actionRefreshMediaList, SIGNAL(triggered()), this,
-                SLOT(populateTree()));
+				SLOT(populateTree()));
    connect(actionAllVolumes, SIGNAL(triggered()), this, SLOT(allVolumes()));
    connect(actionAllVolumesFromPool, SIGNAL(triggered()), this, SLOT(allVolumesFromPool()));
    connect(actionVolumeFromPool, SIGNAL(triggered()), this, SLOT(volumeFromPool()));
@@ -368,14 +368,14 @@ void MediaList::createContextMenu()
 void MediaList::currentStackItem()
 {
    if (!m_populated || m_needs_repopulate) {
-      populateTree();
+	  populateTree();
    }
 
    /*
-    * Create the context menu for the medialist tree
-    */
+	* Create the context menu for the medialist tree
+	*/
    if (!m_populated) {
-      createContextMenu();
+	  createContextMenu();
    }
 }
 
@@ -385,27 +385,27 @@ void MediaList::currentStackItem()
 void MediaList::deleteVolume()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to delete??  !!!.\n"
+	  tr("Are you sure you want to delete??  !!!.\n"
 "This delete command is used to delete a Volume record and all associated catalog"
 " records that were created. This command operates only on the Catalog"
 " database and has no effect on the actual data written to a Volume. This"
 " command can be dangerous and we strongly recommend that you do not use"
 " it unless you know what you are doing.  All Jobs and all associated"
 " records (File and JobMedia) will be deleted from the catalog."
-      "Press OK to proceed with delete operation.?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with delete operation.?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QString scmd;
 
    scmd = QString("delete volume=\"%1\"")
-                  .arg(m_currentVolumeName);
+				  .arg(m_currentVolumeName);
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -415,27 +415,27 @@ void MediaList::deleteVolume()
 void MediaList::purgeVolume()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to purge ??  !!!.\n"
+	  tr("Are you sure you want to purge ??  !!!.\n"
 "The Purge command will delete associated Catalog database records from Jobs and"
 " Volumes without considering the retention period. Purge  works only on the"
 " Catalog database and does not affect data written to Volumes. This command can"
 " be dangerous because you can delete catalog records associated with current"
 " backups of files, and we recommend that you do not use it unless you know what"
 " you are doing.\n"
-      "Press OK to proceed with the purge operation?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with the purge operation?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QString scmd;
 
    scmd = QString("purge volume=\"%1\"")
-                  .arg(m_currentVolumeName);
+				  .arg(m_currentVolumeName);
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -452,13 +452,13 @@ void MediaList::importVolume()
    QString scmd;
 
    scmd = QString("import volume=\"%1\"")
-                  .arg(m_currentVolumeName);
+				  .arg(m_currentVolumeName);
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -467,13 +467,13 @@ void MediaList::exportVolume()
    QString scmd;
 
    scmd = QString("export volume=\"%1\"")
-                  .arg(m_currentVolumeName);
+				  .arg(m_currentVolumeName);
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -495,8 +495,8 @@ void MediaList::allVolumesFromPool()
    consoleCommand(cmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -506,8 +506,8 @@ void MediaList::allVolumes()
    consoleCommand(cmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -522,14 +522,14 @@ void MediaList::volumeFromPool()
    QString scmd;
 
    scmd = QString("update volume=\"%1\" frompool=\"%2\"")
-                  .arg(m_currentVolumeName)
-                  .arg(pool);
+				  .arg(m_currentVolumeName)
+				  .arg(pool);
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -539,13 +539,13 @@ void MediaList::volumeFromPool()
 void MediaList::writeExpandedSettings()
 {
    if (m_topItem) {
-      QSettings settings(m_console->m_dir->name(), "bat");
-      settings.beginGroup("MediaListTreeExpanded");
-      int childcount = m_topItem->childCount();
-      for (int cnt=0; cnt<childcount; cnt++) {
-         QTreeWidgetItem *poolitem = m_topItem->child(cnt);
-         settings.setValue(poolitem->text(0), poolitem->isExpanded());
-      }
-      settings.endGroup();
+	  QSettings settings(m_console->m_dir->name(), "bat");
+	  settings.beginGroup("MediaListTreeExpanded");
+	  int childcount = m_topItem->childCount();
+	  for (int cnt=0; cnt<childcount; cnt++) {
+		 QTreeWidgetItem *poolitem = m_topItem->child(cnt);
+		 settings.setValue(poolitem->text(0), poolitem->isExpanded());
+	  }
+	  settings.endGroup();
    }
 }
diff --git a/src/qt-console/medialist/medialist.h b/src/qt-console/medialist/medialist.h
index 8f18b49..18dfee2 100644
--- a/src/qt-console/medialist/medialist.h
+++ b/src/qt-console/medialist/medialist.h
@@ -27,8 +27,8 @@
 #define _MEDIALIST_H_
 
 #include <QtGui>
+
 #include "ui_medialist.h"
-#include <qstringlist.h>
 #include <pages.h>
 
 class MediaList : public Pages, public Ui::MediaListForm
diff --git a/src/qt-console/medialist/mediaview.cpp b/src/qt-console/medialist/mediaview.cpp
index aaa02df..e43529f 100644
--- a/src/qt-console/medialist/mediaview.cpp
+++ b/src/qt-console/medialist/mediaview.cpp
@@ -21,9 +21,9 @@
    02110-1301, USA.
 */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QMenu>
 #include <math.h>
 #include "mediaview.h"
 #include "mediaedit/mediaedit.h"
@@ -49,7 +49,7 @@ MediaView::MediaView() : Pages()
    connect(m_pbExport, SIGNAL(pressed()), this, SLOT(exportPushed()));
 
    connect(m_tableMedia, SIGNAL(itemDoubleClicked(QTableWidgetItem*)),
-           this, SLOT(showInfoForMedia(QTableWidgetItem *)));
+		   this, SLOT(showInfoForMedia(QTableWidgetItem *)));
 
    /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
    m_populated = false;
@@ -79,28 +79,28 @@ bool MediaView::getSelection(QStringList &list)
    QList<QTableWidgetItem*> items = m_tableMedia->selectedItems();
 
    /*
-    * See if anything is selected.
-    */
+	* See if anything is selected.
+	*/
    nb = items.count();
    if (!nb) {
-      return false;
+	  return false;
    }
 
    /*
-    * Create a nibble map for each row so we can see if its
-    * selected or not.
-    */
+	* Create a nibble map for each row so we can see if its
+	* selected or not.
+	*/
    nr_rows = m_tableMedia->rowCount();
    tab = (bool *)malloc (nr_rows * sizeof(bool));
    memset(tab, 0, sizeof(bool) * nr_rows);
 
    for (i = 0; i < nb; i++) {
-      row = items[i]->row();
-      if (!tab[row]) {
-         tab[row] = true;
-         it = m_tableMedia->item(row, 0);
-         list.append(it->text());
-      }
+	  row = items[i]->row();
+	  if (!tab[row]) {
+		 tab[row] = true;
+		 it = m_tableMedia->item(row, 0);
+		 list.append(it->text());
+	  }
    }
    free(tab);
 
@@ -119,24 +119,24 @@ void MediaView::editPushed()
    getSelection(sel);
 
    for(int i=0; i<sel.count(); i++) {
-      cmd = sel.at(i);
-      new MediaEdit(mainWin->getFromHash(this), cmd);
+	  cmd = sel.at(i);
+	  new MediaEdit(mainWin->getFromHash(this), cmd);
    }
 }
 
 void MediaView::purgePushed()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to purge ??  !!!.\n"
+	  tr("Are you sure you want to purge ??  !!!.\n"
 "The Purge command will delete associated Catalog database records from Jobs and"
 " Volumes without considering the retention period. Purge  works only on the"
 " Catalog database and does not affect data written to Volumes. This command can"
 " be dangerous because you can delete catalog records associated with current"
 " backups of files, and we recommend that you do not use it unless you know what"
 " you are doing.\n"
-      "Press OK to proceed with the purge operation?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with the purge operation?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QStringList sel;
    QString scmd;
@@ -144,14 +144,14 @@ void MediaView::purgePushed()
 
    getSelection(sel);
    for (i = 0; i < sel.count(); i++) {
-      scmd = QString("purge volume=\"%1\"")
-                     .arg(sel.at(i));
-      consoleCommand(scmd);
+	  scmd = QString("purge volume=\"%1\"")
+					 .arg(sel.at(i));
+	  consoleCommand(scmd);
    }
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -163,14 +163,14 @@ void MediaView::prunePushed()
 
    getSelection(sel);
    for (i = 0; i < sel.count(); i++) {
-      scmd = QString("prune volume=\"%1\"")
-                     .arg(sel.at(i));
-      consoleCommand(scmd);
+	  scmd = QString("prune volume=\"%1\"")
+					 .arg(sel.at(i));
+	  consoleCommand(scmd);
    }
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -182,27 +182,27 @@ void MediaView::importPushed()
 
    getSelection(sel);
    if (sel.count() == 0) {
-      return;
+	  return;
    }
 
    scmd = "import ";
    for (i = 0; i < sel.count(); i++) {
-      scmd += QString("volume=\"%1\" ")
-                      .arg(sel.at(i));
+	  scmd += QString("volume=\"%1\" ")
+					  .arg(sel.at(i));
    }
 
    /*
-    * Strip the trailing space.
-    */
+	* Strip the trailing space.
+	*/
    if (i > 0) {
-      scmd.chop(1);
+	  scmd.chop(1);
    }
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -214,43 +214,43 @@ void MediaView::exportPushed()
 
    getSelection(sel);
    if (sel.count() == 0) {
-      return;
+	  return;
    }
 
    scmd = "export ";
    for (i = 0; i < sel.count(); i++) {
-      scmd += QString("volume=\"%1\" ")
-                      .arg(sel.at(i));
+	  scmd += QString("volume=\"%1\" ")
+					  .arg(sel.at(i));
    }
 
    /*
-    * Strip the trailing space.
-    */
+	* Strip the trailing space.
+	*/
    if (i > 0) {
-      scmd.chop(1);
+	  scmd.chop(1);
    }
 
    consoleCommand(scmd);
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
 void MediaView::deletePushed()
 {
    if (QMessageBox::warning(this, "Bat",
-      tr("Are you sure you want to delete??  !!!.\n"
+	  tr("Are you sure you want to delete??  !!!.\n"
 "This delete command is used to delete a Volume record and all associated catalog"
 " records that were created. This command operates only on the Catalog"
 " database and has no effect on the actual data written to a Volume. This"
 " command can be dangerous and we strongly recommend that you do not use"
 " it unless you know what you are doing.  All Jobs and all associated"
 " records (File and JobMedia) will be deleted from the catalog."
-      "Press OK to proceed with delete operation.?"),
-      QMessageBox::Ok | QMessageBox::Cancel)
-      == QMessageBox::Cancel) { return; }
+	  "Press OK to proceed with delete operation.?"),
+	  QMessageBox::Ok | QMessageBox::Cancel)
+	  == QMessageBox::Cancel) { return; }
 
    QStringList sel;
    QString scmd;
@@ -258,14 +258,14 @@ void MediaView::deletePushed()
 
    getSelection(sel);
    for (i = 0; i < sel.count(); i++) {
-      scmd = QString("delete volume=\"%1\"")
-                     .arg(sel.at(i));
-      consoleCommand(scmd);
+	  scmd = QString("delete volume=\"%1\"")
+					 .arg(sel.at(i));
+	  consoleCommand(scmd);
    }
 
    /*
-    * Volume list needs (re)populate.
-    */
+	* Volume list needs (re)populate.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -300,22 +300,22 @@ void MediaView::filterExipired(QStringList &list)
 
    /* We should now in advance how many rows we will have */
    if (m_chkExpired->isChecked()) {
-      for (int i=list.size() -1; i >= 0; i--) {
-         fieldlist = list.at(i).split("\t");
-         ASSERT(fieldlist.size() != 9);
-         LastWritten = fieldlist.at(7);
-         if (LastWritten == "") {
-            list.removeAt(i);
-
-         } else {
-            stat = fieldlist.at(8);
-            t = str_to_utime(LastWritten.toAscii().data());
-            t = t + stat.toULongLong();
-            if (t > now) {
-               list.removeAt(i);
-            }
-         }
-      }
+	  for (int i=list.size() -1; i >= 0; i--) {
+		 fieldlist = list.at(i).split("\t");
+		 ASSERT(fieldlist.size() != 9);
+		 LastWritten = fieldlist.at(7);
+		 if (LastWritten == "") {
+			list.removeAt(i);
+
+		 } else {
+			stat = fieldlist.at(8);
+			t = str_to_utime(LastWritten.toAscii().data());
+			t = t + stat.toULongLong();
+			if (t > now) {
+			   list.removeAt(i);
+			}
+		 }
+	  }
    }
 }
 
@@ -341,144 +341,144 @@ void MediaView::populateTable()
    QStringList where;
    QString cmd;
    if (m_cbPool->currentText() != "") {
-      cmd = " Pool.Name = '" + m_cbPool->currentText() + "'";
-      where.append(cmd);
+	  cmd = " Pool.Name = '" + m_cbPool->currentText() + "'";
+	  where.append(cmd);
    }
 
    if (m_cbStatus->currentText() != "") {
-      cmd = " Media.VolStatus = '" + m_cbStatus->currentText() + "'";
-      where.append(cmd);
+	  cmd = " Media.VolStatus = '" + m_cbStatus->currentText() + "'";
+	  where.append(cmd);
    }
 
    if (m_cbStatus->currentText() != "") {
-      cmd = " Media.VolStatus = '" + m_cbStatus->currentText() + "'";
-      where.append(cmd);
+	  cmd = " Media.VolStatus = '" + m_cbStatus->currentText() + "'";
+	  where.append(cmd);
    }
 
    if (m_cbMediaType->currentText() != "") {
-      cmd = " Media.MediaType = '" + m_cbMediaType->currentText() + "'";
-      where.append(cmd);
+	  cmd = " Media.MediaType = '" + m_cbMediaType->currentText() + "'";
+	  where.append(cmd);
    }
 
    if (m_cbLocation->currentText() != "") {
-      cmd = " Location.Location = '" + m_cbLocation->currentText() + "'";
-      where.append(cmd);
+	  cmd = " Location.Location = '" + m_cbLocation->currentText() + "'";
+	  where.append(cmd);
    }
 
    if (m_textName->text() != "") {
-      cmd = " Media.VolumeName like '%" + m_textName->text() + "%'";
-      where.append(cmd);
+	  cmd = " Media.VolumeName like '%" + m_textName->text() + "%'";
+	  where.append(cmd);
    }
 
    if (where.size() > 0) {
-      cmd = " WHERE " + where.join(" AND ");
+	  cmd = " WHERE " + where.join(" AND ");
    } else {
-      cmd = "";
+	  cmd = "";
    }
 
    query =
-      "SELECT AVG(VolBytes) AS size, COUNT(1) as nb, "
-      "MediaType  FROM Media "
-      "WHERE VolStatus IN ('Full', 'Used') "
-      "GROUP BY MediaType";
+	  "SELECT AVG(VolBytes) AS size, COUNT(1) as nb, "
+	  "MediaType  FROM Media "
+	  "WHERE VolStatus IN ('Full', 'Used') "
+	  "GROUP BY MediaType";
 
    if (mainWin->m_sqlDebug) {
-      Pmsg1(000, "MediaView query cmd : %s\n",query.toUtf8().data());
+	  Pmsg1(000, "MediaView query cmd : %s\n",query.toUtf8().data());
    }
    if (m_console->sql_cmd(query, results)) {
-      foreach (resultline, results) {
-         fieldlist = resultline.split("\t");
-         if (fieldlist.at(1).toInt() >= 1) {
-            //           MediaType
-            hash_size[fieldlist.at(2)]
-               = fieldlist.at(0).toFloat();
-         }
-      }
+	  foreach (resultline, results) {
+		 fieldlist = resultline.split("\t");
+		 if (fieldlist.at(1).toInt() >= 1) {
+			//           MediaType
+			hash_size[fieldlist.at(2)]
+			   = fieldlist.at(0).toFloat();
+		 }
+	  }
    }
 
    m_tableMedia->clearContents();
    query =
-      "SELECT VolumeName, InChanger, "
-      "Slot, MediaType, VolStatus, VolBytes, Pool.Name,  "
-      "LastWritten, Media.VolRetention "
-      "FROM Media JOIN Pool USING (PoolId) "
-      "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) "
-      + cmd +
-      " ORDER BY VolumeName LIMIT " + m_sbLimit->cleanText();
+	  "SELECT VolumeName, InChanger, "
+	  "Slot, MediaType, VolStatus, VolBytes, Pool.Name,  "
+	  "LastWritten, Media.VolRetention "
+	  "FROM Media JOIN Pool USING (PoolId) "
+	  "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) "
+	  + cmd +
+	  " ORDER BY VolumeName LIMIT " + m_sbLimit->cleanText();
 
    m_tableMedia->sortByColumn(0, Qt::AscendingOrder);
    m_tableMedia->setSortingEnabled(false); /* Don't sort during insert */
    results.clear();
    if (mainWin->m_sqlDebug) {
-      Pmsg1(000, "MediaView query cmd : %s\n",query.toUtf8().data());
+	  Pmsg1(000, "MediaView query cmd : %s\n",query.toUtf8().data());
    }
    if (m_console->sql_cmd(query, results)) {
-      int row=0;
-      filterExipired(results);
-      m_tableMedia->setRowCount(results.size());
-
-      foreach (resultline, results) { // should have only one result
-         int index = 0;
-         QString VolBytes, MediaType, LastWritten, VolStatus;
-         fieldlist = resultline.split("\t");
-         if (fieldlist.size() != 10) {
-            Pmsg1(0, "Discarding %s\n", resultline.data());
-            continue;
-         }
-         QStringListIterator fld(fieldlist);
-         TableItemFormatter mediaitem(*m_tableMedia, row);
-
-         /* VolumeName */
-         mediaitem.setTextFld(index++, fld.next());
-
-         /* Online */
-         mediaitem.setInChanger(index++, fld.next());
-
-         /* Slot */
-         mediaitem.setNumericFld(index++, fld.next());
-
-         MediaType = fld.next();
-         VolStatus = fld.next();
-
-         /* Volume bytes */
-         VolBytes = fld.next();
-         mediaitem.setBytesFld(index++, VolBytes);
-
-         /* Usage */
-         usage = 0;
-         if (hash_size.contains(MediaType) &&
-             hash_size[MediaType] != 0) {
-            usage = VolBytes.toLongLong() * 100 / hash_size[MediaType];
-         }
-         mediaitem.setPercent(index++, usage);
-
-         /* Volstatus */
-         mediaitem.setVolStatusFld(index++, VolStatus);
-
-         /* Pool */
-         mediaitem.setTextFld(index++, fld.next());
-
-         /* MediaType */
-         mediaitem.setTextFld(index++, MediaType);
-
-         LastWritten = fld.next();
-         buf[0] = 0;
-         if (LastWritten != "") {
-            stat = fld.next();  // VolUseDuration
-            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);
-         }
-
-         /* LastWritten */
-         mediaitem.setTextFld(index++, LastWritten);
-
-         /* When expired */
-         mediaitem.setTextFld(index++, buf);
-         row++;
-      }
+	  int row=0;
+	  filterExipired(results);
+	  m_tableMedia->setRowCount(results.size());
+
+	  foreach (resultline, results) { // should have only one result
+		 int index = 0;
+		 QString VolBytes, MediaType, LastWritten, VolStatus;
+		 fieldlist = resultline.split("\t");
+		 if (fieldlist.size() != 10) {
+			Pmsg1(0, "Discarding %s\n", resultline.data());
+			continue;
+		 }
+		 QStringListIterator fld(fieldlist);
+		 TableItemFormatter mediaitem(*m_tableMedia, row);
+
+		 /* VolumeName */
+		 mediaitem.setTextFld(index++, fld.next());
+
+		 /* Online */
+		 mediaitem.setInChanger(index++, fld.next());
+
+		 /* Slot */
+		 mediaitem.setNumericFld(index++, fld.next());
+
+		 MediaType = fld.next();
+		 VolStatus = fld.next();
+
+		 /* Volume bytes */
+		 VolBytes = fld.next();
+		 mediaitem.setBytesFld(index++, VolBytes);
+
+		 /* Usage */
+		 usage = 0;
+		 if (hash_size.contains(MediaType) &&
+			 hash_size[MediaType] != 0) {
+			usage = VolBytes.toLongLong() * 100 / hash_size[MediaType];
+		 }
+		 mediaitem.setPercent(index++, usage);
+
+		 /* Volstatus */
+		 mediaitem.setVolStatusFld(index++, VolStatus);
+
+		 /* Pool */
+		 mediaitem.setTextFld(index++, fld.next());
+
+		 /* MediaType */
+		 mediaitem.setTextFld(index++, MediaType);
+
+		 LastWritten = fld.next();
+		 buf[0] = 0;
+		 if (LastWritten != "") {
+			stat = fld.next();  // VolUseDuration
+			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);
+		 }
+
+		 /* LastWritten */
+		 mediaitem.setTextFld(index++, LastWritten);
+
+		 /* When expired */
+		 mediaitem.setTextFld(index++, buf);
+		 row++;
+	  }
    }
    m_tableMedia->resizeColumnsToContents();
    m_tableMedia->resizeRowsToContents();
@@ -496,11 +496,11 @@ void MediaView::populateTable()
 void MediaView::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateForm();
-      populateTable();
+	  populateForm();
+	  populateTable();
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -510,10 +510,10 @@ void MediaView::PgSeltreeWidgetClicked()
 void MediaView::currentStackItem()
 {
    if (!m_populated) {
-      populateForm();
+	  populateForm();
    }
    if (!m_populated || m_needs_repopulate) {
-      populateTable();
+	  populateTable();
    }
 }
 
diff --git a/src/qt-console/medialist/mediaview.h b/src/qt-console/medialist/mediaview.h
index 4af6e71..d041613 100644
--- a/src/qt-console/medialist/mediaview.h
+++ b/src/qt-console/medialist/mediaview.h
@@ -22,8 +22,8 @@
 #define _MEDIAVIEW_H_
 
 #include <QtGui>
+
 #include "ui_mediaview.h"
-#include <qstringlist.h>
 #include <pages.h>
 
 class MediaView : public Pages, public Ui::MediaViewForm
diff --git a/src/qt-console/mount/mount.cpp b/src/qt-console/mount/mount.cpp
index fc0cff4..0e8b235 100644
--- a/src/qt-console/mount/mount.cpp
+++ b/src/qt-console/mount/mount.cpp
@@ -25,9 +25,10 @@
  * Kern Sibbald, February MMVII
  */
 
+#include <QtGui>
+
 #include "bat.h"
 #include "mount/mount.h"
-#include <QMessageBox>
 
 /*
  * A constructor
@@ -48,16 +49,16 @@ void mountDialog::accept()
 {
    QString scmd;
    if (m_storageName == "") {
-      QMessageBox::warning(this, tr("No Storage name"), tr("No Storage name given"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this, tr("No Storage name"), tr("No Storage name given"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
    this->hide();
    scmd = QString("mount storage=\"%1\" slot=%2")
-                  .arg(m_storageName)
-                  .arg(slotSpin->value());
+				  .arg(m_storageName)
+				  .arg(slotSpin->value());
    if (mainWin->m_commandDebug) {
-      Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
    }
 
    m_console->display_text( tr("Context sensitive command :\n\n"));
diff --git a/src/qt-console/mount/mount.h b/src/qt-console/mount/mount.h
index 61773f0..7c4bf42 100644
--- a/src/qt-console/mount/mount.h
+++ b/src/qt-console/mount/mount.h
@@ -26,6 +26,7 @@
 #define _MOUNT_H_
 
 #include <QtGui>
+
 #include "ui_mount.h"
 #include <console/console.h>
 
diff --git a/src/qt-console/pages.h b/src/qt-console/pages.h
index 8126f94..f1012ac 100644
--- a/src/qt-console/pages.h
+++ b/src/qt-console/pages.h
@@ -27,7 +27,6 @@
 #define _PAGES_H_
 
 #include <QtGui>
-#include <QList>
 
 /*
  *  The Pages Class
diff --git a/src/qt-console/qstd.h b/src/qt-console/qstd.h
index aeb47c2..41b0981 100644
--- a/src/qt-console/qstd.h
+++ b/src/qt-console/qstd.h
@@ -1,75 +1,73 @@
 #ifndef QSTD_H
 #define QSTD_H
 
-#include <QTextStream>
-#include <QFile>
-#include <QString>
+#include <QtCore>
 
 /** @short helper objects and functions which help reduce the
-       need for char[] and the standard library.
+	   need for char[] and the standard library.
 
-    defines three @ref QTextStream instances
-    which behave like the c++ standard iostreams, bound to the
-    standard in/out/error.
+	defines three @ref QTextStream instances
+	which behave like the c++ standard iostreams, bound to the
+	standard in/out/error.
 
-    Also provided, some helper functions for writing
-    interactive stdin/stdout applications.
+	Also provided, some helper functions for writing
+	interactive stdin/stdout applications.
 */
 //start
 namespace qstd {
 
-    /** @short  An alias for standard input
-     */
-    extern QTextStream cin;  /* declared only, defined in the .cpp file */
-    /** @short  An alias for standard output
-     */
-    extern QTextStream cout;
-    /** @short  An alias for standard error
-     */
-    extern QTextStream cerr;
-    /** yes/no prompt
-        interactive stdin UI - prompts user with
-        a yes/no question. Repeatedly-asks
-        until user supplies a valid answer.
+	/** @short  An alias for standard input
+	 */
+	extern QTextStream cin;  /* declared only, defined in the .cpp file */
+	/** @short  An alias for standard output
+	 */
+	extern QTextStream cout;
+	/** @short  An alias for standard error
+	 */
+	extern QTextStream cerr;
+	/** yes/no prompt
+		interactive stdin UI - prompts user with
+		a yes/no question. Repeatedly-asks
+		until user supplies a valid answer.
 
-        @param yesNoQuestion the yes/no question
-        @return true/false depending on what the
-        user responded.
-    */
-    bool yes(QString yesNoQuestion);
-    /** Convenience function that feeds a  specific question
-        to the yes() function.
-        @usage do {.....} while(more ("foobar"));
-        so that user sees the question: "Another foobar (y/n)? "
-        @param name of the item being handled by the loop.
-    */
-    bool more(QString prompt);
-    /** A function for safely taking an int from the keyboard.
-        Takes data into a  QString and tests to make sure it
-        can be converted to int before returning.
-        @param base allows choice of number base.
-        @return returns validated int.
-    */
-    int promptInt(int base = 10);
-    /** A function for safely taking a double from the keyboard.
-        Takes data into a  QString and tests to make sure it
-        can be converted to double before returning.
-        @return returns validated int.
-    */
-    double promptDouble();
-    /** Complete dialog for opening a file for output.
-        Asks user for file name, checks to see if
-        file already exists and, if so, asks the user if
-        it is ok to overwrite.
-        @param Reference QFile parameter is set to point
-        to the (eventually) opened file.
-    */
-    /** @short Dialog for a output file prompt
-     */
-    void promptOutputFile(QFile& outfile);
+		@param yesNoQuestion the yes/no question
+		@return true/false depending on what the
+		user responded.
+	*/
+	bool yes(QString yesNoQuestion);
+	/** Convenience function that feeds a  specific question
+		to the yes() function.
+		@usage do {.....} while(more ("foobar"));
+		so that user sees the question: "Another foobar (y/n)? "
+		@param name of the item being handled by the loop.
+	*/
+	bool more(QString prompt);
+	/** A function for safely taking an int from the keyboard.
+		Takes data into a  QString and tests to make sure it
+		can be converted to int before returning.
+		@param base allows choice of number base.
+		@return returns validated int.
+	*/
+	int promptInt(int base = 10);
+	/** A function for safely taking a double from the keyboard.
+		Takes data into a  QString and tests to make sure it
+		can be converted to double before returning.
+		@return returns validated int.
+	*/
+	double promptDouble();
+	/** Complete dialog for opening a file for output.
+		Asks user for file name, checks to see if
+		file already exists and, if so, asks the user if
+		it is ok to overwrite.
+		@param Reference QFile parameter is set to point
+		to the (eventually) opened file.
+	*/
+	/** @short Dialog for a output file prompt
+	 */
+	void promptOutputFile(QFile& outfile);
 
-    /** @short Dialog for input file prompt */
-    void promptInputFile(QFile& infile);
+	/** @short Dialog for input file prompt */
+	void promptInputFile(QFile& infile);
 
 
 //end
diff --git a/src/qt-console/relabel/relabel.cpp b/src/qt-console/relabel/relabel.cpp
index 9b9dc97..345cba7 100644
--- a/src/qt-console/relabel/relabel.cpp
+++ b/src/qt-console/relabel/relabel.cpp
@@ -25,9 +25,10 @@
  * Kern Sibbald, February MMVII
  */
 
+#include <QtGui>
+
 #include "bat.h"
 #include "relabel.h"
-#include <QMessageBox>
 
 /*
  * An overload of the constructor to have a default storage show in the
@@ -47,8 +48,8 @@ relabelDialog::relabelDialog(Console *console, QString &fromVolume)
    fromLabel->setText(fromText);
    QStringList defFields;
    if (getDefs(defFields) >= 1) {
-      poolCombo->setCurrentIndex(poolCombo->findText(defFields[1], Qt::MatchExactly));
-      storageCombo->setCurrentIndex(storageCombo->findText(defFields[0], Qt::MatchExactly));
+	  poolCombo->setCurrentIndex(poolCombo->findText(defFields[1], Qt::MatchExactly));
+	  storageCombo->setCurrentIndex(storageCombo->findText(defFields[0], Qt::MatchExactly));
    }
    this->show();
 }
@@ -67,11 +68,11 @@ int relabelDialog::getDefs(QStringList &fieldlist)
    if (mainWin->m_sqlDebug) { Pmsg1(000, "query = %s\n", query.toUtf8().data()); }
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
-      QString field;
-      /* Iterate through the lines of results, there should only be one. */
-      foreach (QString resultline, results) {
-         fieldlist = resultline.split("\t");
-      } /* foreach resultline */
+	  QString field;
+	  /* Iterate through the lines of results, there should only be one. */
+	  foreach (QString resultline, results) {
+		 fieldlist = resultline.split("\t");
+	  } /* foreach resultline */
    } /* if results from query */
    return results.count();
 }
@@ -80,26 +81,26 @@ void relabelDialog::accept()
 {
    QString scmd;
    if (volumeName->text().toUtf8().data()[0] == 0) {
-      QMessageBox::warning(this, tr("No Volume name"), tr("No Volume name given"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this, tr("No Volume name"), tr("No Volume name given"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
    if (m_fromVolume == volumeName->text().toUtf8()) {
-      QMessageBox::warning(this, tr("New name must be different"),
-                           tr("New name must be different"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this, tr("New name must be different"),
+						   tr("New name must be different"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
 
    this->hide();
    scmd = QString("relabel storage=\"%1\" oldvolume=\"%2\" volume=\"%3\" pool=\"%4\" slot=%5")
-                  .arg(storageCombo->currentText())
-                  .arg(m_fromVolume)
-                  .arg(volumeName->text())
-                  .arg(poolCombo->currentText())
-                  .arg(slotSpin->value());
+				  .arg(storageCombo->currentText())
+				  .arg(m_fromVolume)
+				  .arg(volumeName->text())
+				  .arg(poolCombo->currentText())
+				  .arg(slotSpin->value());
    if (mainWin->m_commandDebug) {
-      Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
    }
    m_console->write_dir(scmd.toUtf8().data());
    m_console->displayToPrompt(m_conn);
diff --git a/src/qt-console/relabel/relabel.h b/src/qt-console/relabel/relabel.h
index 046a98c..7f2407c 100644
--- a/src/qt-console/relabel/relabel.h
+++ b/src/qt-console/relabel/relabel.h
@@ -26,6 +26,7 @@
 #define _RELABEL_H_
 
 #include <QtGui>
+
 #include "ui_relabel.h"
 #include <console/console.h>
 
diff --git a/src/qt-console/restore/restore.h b/src/qt-console/restore/restore.h
index 2488cfb..e4e1dac 100644
--- a/src/qt-console/restore/restore.h
+++ b/src/qt-console/restore/restore.h
@@ -26,8 +26,9 @@
 #ifndef _RESTORE_H_
 #define _RESTORE_H_
 
-#include <bat.h>
 #include <QtGui>
+
+#include <bat.h>
 #include "pages.h"
 #include "ui_runrestore.h"
 
@@ -38,7 +39,7 @@ private:
    QPoint dragStartPosition;
 public:
    bRestoreTable(QWidget *parent)
-      : QTableWidget(parent)
+	  : QTableWidget(parent)
    {
    }
    void mousePressEvent(QMouseEvent *event);
@@ -137,7 +138,7 @@ public:
    QString m_client;
    QString m_jobids;
    void get_info_from_selection(QStringList &fileids, QStringList &jobids,
-                                QStringList &dirids, QStringList &fileindexes);
+								QStringList &dirids, QStringList &fileindexes);
 
 public slots:
    void setClient();
@@ -156,7 +157,7 @@ private:
    bool m_populated;
    void displayFiles(int64_t pathid, QString path);
    void displayFileVersion(QString pathid, QString fnid,
-                           QString client, QString filename);
+						   QString client, QString filename);
 };
 
 class bRunRestore : public QDialog, public Ui::bRunRestoreForm
diff --git a/src/qt-console/restore/restoretree.h b/src/qt-console/restore/restoretree.h
index 0058303..1432df8 100644
--- a/src/qt-console/restore/restoretree.h
+++ b/src/qt-console/restore/restoretree.h
@@ -27,6 +27,7 @@
 #define _RESTORETREE_H_
 
 #include <QtGui>
+
 #include "pages.h"
 #include "ui_restoretree.h"
 
@@ -44,10 +45,10 @@ public:
    virtual void currentStackItem();
    enum folderCheckState
    {
-      FolderUnchecked = 0,
-      FolderGreenChecked = 1,
-      FolderWhiteChecked = 2,
-      FolderBothChecked = 3
+	  FolderUnchecked = 0,
+	  FolderGreenChecked = 1,
+	  FolderWhiteChecked = 2,
+	  FolderBothChecked = 3
    };
 
 private slots:
diff --git a/src/qt-console/run/run.h b/src/qt-console/run/run.h
index e2be46c..1bd446c 100644
--- a/src/qt-console/run/run.h
+++ b/src/qt-console/run/run.h
@@ -25,6 +25,7 @@
 #define _RUN_H_
 
 #include <QtGui>
+
 #include "ui_run.h"
 #include "ui_runcmd.h"
 #include "ui_estimate.h"
@@ -41,11 +42,11 @@ public:
    runPage(const QString &defJob);
 
    runPage(const QString &defJob,
-           const QString &level,
-           const QString &pool,
-           const QString &storage,
-           const QString &client,
-           const QString &fileset);
+		   const QString &level,
+		   const QString &pool,
+		   const QString &storage,
+		   const QString &client,
+		   const QString &fileset);
 
 public slots:
    void okButtonPushed();
diff --git a/src/qt-console/select/select.h b/src/qt-console/select/select.h
index 83c331b..4d3ffc5 100644
--- a/src/qt-console/select/select.h
+++ b/src/qt-console/select/select.h
@@ -22,6 +22,7 @@
 #define _SELECT_H_
 
 #include <QtGui>
+
 #include "ui_select.h"
 #include <console/console.h>
 
diff --git a/src/qt-console/select/textinput.h b/src/qt-console/select/textinput.h
index 0ea23aa..36b7a03 100644
--- a/src/qt-console/select/textinput.h
+++ b/src/qt-console/select/textinput.h
@@ -22,6 +22,7 @@
 #define _TEXTENTRY_H_
 
 #include <QtGui>
+
 #include "ui_textinput.h"
 #include <console/console.h>
 
diff --git a/src/qt-console/status/clientstat.cpp b/src/qt-console/status/clientstat.cpp
index c77a92d..9df49a1 100644
--- a/src/qt-console/status/clientstat.cpp
+++ b/src/qt-console/status/clientstat.cpp
@@ -22,9 +22,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QTableWidgetItem>
 #include "clientstat.h"
 
 /* This probably should be on a mutex */
@@ -92,13 +92,13 @@ void ClientStat::timerTriggered()
    double value = timerDisplay->value();
    value -= 1;
    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)) {
-         populateAll();
-      }
-      working = false;
+	  working = true;
+	  value = spinBox->value();
+	  bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this);
+	  if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) {
+		 populateAll();
+	  }
+	  working = false;
    }
    timerDisplay->display(value);
 }
@@ -107,9 +107,9 @@ void ClientStat::timerTriggered()
 void ClientStat::populateCurrentTab(int index)
 {
    if (index == 0)
-      populateRunning();
+	  populateRunning();
    if (index == 1)
-      populateHeader();
+	  populateHeader();
 }
 
 /*
@@ -119,15 +119,15 @@ void ClientStat::populateHeader()
 {
    QString command = QString(".status client=\"" + m_client + "\" header");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditHeader->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditHeader->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditHeader->insertPlainText(line);
+	  }
    }
 }
 
@@ -138,50 +138,50 @@ void ClientStat::populateTerminated()
 {
    QString command = QString(".status client=\"" + m_client + "\" terminated");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    QBrush blackBrush(Qt::black);
 
    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 Name"));
+	  << tr("Job Id") << tr("Job Level") << tr("Job Files")
+	  << tr("Job Bytes") << tr("Job Status") << tr("Job Time")
+	  << tr("Job Name"));
    QStringList flaglist = (QStringList()
-      << "R" << "L" << "R" << "R" << "LC"
-      << "L" << "L");
+	  << "R" << "L" << "R" << "R" << "LC"
+	  << "L" << "L");
 
    terminatedTable->setColumnCount(headerlist.size());
    terminatedTable->setHorizontalHeaderLabels(headerlist);
 
    if (m_console->dir_cmd(command, results)) {
-      int row = 0;
-      QTableWidgetItem* p_tableitem;
-      terminatedTable->setRowCount(results.size());
-      foreach (QString line, results) {
-         /* Iterate through the record returned from the query */
-         QStringList fieldlist = line.split("\t");
-         int column = 0;
-         QString statusCode("");
-         /* Iterate through fields in the record */
-         foreach (QString field, fieldlist) {
-            field = field.trimmed();  /* strip leading & trailing spaces */
-            p_tableitem = new QTableWidgetItem(field, 1);
-            p_tableitem->setForeground(blackBrush);
-            p_tableitem->setFlags(0);
-            if (flaglist[column].contains("R"))
-               p_tableitem->setTextAlignment(Qt::AlignRight);
-            if (flaglist[column].contains("C")) {
-               if (field == "OK")
-                  p_tableitem->setBackground(Qt::green);
-               else
-                 p_tableitem->setBackground(Qt::red);
-            }
-            terminatedTable->setItem(results.size() - row - 1, column, p_tableitem);
-            column += 1;
-         }
-         row += 1;
-      }
+	  int row = 0;
+	  QTableWidgetItem* p_tableitem;
+	  terminatedTable->setRowCount(results.size());
+	  foreach (QString line, results) {
+		 /* Iterate through the record returned from the query */
+		 QStringList fieldlist = line.split("\t");
+		 int column = 0;
+		 QString statusCode("");
+		 /* Iterate through fields in the record */
+		 foreach (QString field, fieldlist) {
+			field = field.trimmed();  /* strip leading & trailing spaces */
+			p_tableitem = new QTableWidgetItem(field, 1);
+			p_tableitem->setForeground(blackBrush);
+			p_tableitem->setFlags(0);
+			if (flaglist[column].contains("R"))
+			   p_tableitem->setTextAlignment(Qt::AlignRight);
+			if (flaglist[column].contains("C")) {
+			   if (field == "OK")
+				  p_tableitem->setBackground(Qt::green);
+			   else
+				 p_tableitem->setBackground(Qt::red);
+			}
+			terminatedTable->setItem(results.size() - row - 1, column, p_tableitem);
+			column += 1;
+		 }
+		 row += 1;
+	  }
    }
    terminatedTable->resizeColumnsToContents();
    terminatedTable->resizeRowsToContents();
@@ -195,15 +195,15 @@ void ClientStat::populateRunning()
 {
    QString command = QString(".status client=\"" + m_client + "\" running");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditRunning->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditRunning->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditRunning->insertPlainText(line);
+	  }
    }
 }
 
@@ -214,8 +214,8 @@ void ClientStat::populateRunning()
 void ClientStat::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateAll();
-      m_populated=true;
+	  populateAll();
+	  m_populated=true;
    }
 }
 
@@ -229,7 +229,7 @@ void ClientStat::currentStackItem()
    timerDisplay->display(spinBox->value());
 
    if (!m_populated) {
-      m_populated=true;
+	  m_populated=true;
    }
 }
 
diff --git a/src/qt-console/status/clientstat.h b/src/qt-console/status/clientstat.h
index bd55f47..d8779c0 100644
--- a/src/qt-console/status/clientstat.h
+++ b/src/qt-console/status/clientstat.h
@@ -25,6 +25,7 @@
 #define _CLIENTSTAT_H_
 
 #include <QtGui>
+
 #include "ui_clientstat.h"
 #include "pages.h"
 
diff --git a/src/qt-console/status/dirstat.cpp b/src/qt-console/status/dirstat.cpp
index 7ffeef3..6d3e251 100644
--- a/src/qt-console/status/dirstat.cpp
+++ b/src/qt-console/status/dirstat.cpp
@@ -22,9 +22,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QTableWidgetItem>
 #include "dirstat.h"
 
 static bool working = false;         /* prevent timer recursion */
@@ -91,13 +91,13 @@ void DirStat::timerTriggered()
    double value = timerDisplay->value();
    value -= 1;
    if (value <= 0 && !working) {
-      working = true;
-      value = spinBox->value();
-      bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this);
-      if (((isDocked() && iscurrent) || ((!isDocked()) && isOnceDocked())) && (checkBox->checkState() == Qt::Checked)) {
-         populateAll();
-      }
-      working = false;
+	  working = true;
+	  value = spinBox->value();
+	  bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this);
+	  if (((isDocked() && iscurrent) || ((!isDocked()) && isOnceDocked())) && (checkBox->checkState() == Qt::Checked)) {
+		 populateAll();
+	  }
+	  working = false;
    }
    timerDisplay->display(value);
 }
@@ -109,15 +109,15 @@ void DirStat::populateHeader()
 {
    QString command = QString(".status dir header");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEdit->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEdit->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEdit->insertPlainText(line);
+	  }
    }
 }
 
@@ -128,50 +128,50 @@ void DirStat::populateTerminated()
 {
    QString command = QString(".status dir terminated");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    QBrush blackBrush(Qt::black);
 
    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 Name"));
+	  << tr("Job Id") << tr("Job Level") << tr("Job Files")
+	  << tr("Job Bytes") << tr("Job Status") << tr("Job Time")
+	  << tr("Job Name"));
    QStringList flaglist = (QStringList()
-      << "R" << "L" << "R" << "R" << "LC"
-      << "L" << "L");
+	  << "R" << "L" << "R" << "R" << "LC"
+	  << "L" << "L");
 
    terminatedTable->setColumnCount(headerlist.size());
    terminatedTable->setHorizontalHeaderLabels(headerlist);
 
    if (m_console->dir_cmd(command, results)) {
-      int row = 0;
-      QTableWidgetItem* p_tableitem;
-      terminatedTable->setRowCount(results.size());
-      foreach (QString line, results) {
-         /* Iterate through the record returned from the query */
-         QStringList fieldlist = line.split("\t");
-         int column = 0;
-         QString statusCode("");
-         /* Iterate through fields in the record */
-         foreach (QString field, fieldlist) {
-            field = field.trimmed();  /* strip leading & trailing spaces */
-            p_tableitem = new QTableWidgetItem(field, 1);
-            p_tableitem->setForeground(blackBrush);
-            p_tableitem->setFlags(0);
-            if (flaglist[column].contains("R"))
-               p_tableitem->setTextAlignment(Qt::AlignRight);
-            if (flaglist[column].contains("C")) {
-               if (field == "OK")
-                  p_tableitem->setBackground(Qt::green);
-               else
-                  p_tableitem->setBackground(Qt::red);
-            }
-            terminatedTable->setItem(results.size() - row - 1, column, p_tableitem);
-            column += 1;
-         }
-         row += 1;
-      }
+	  int row = 0;
+	  QTableWidgetItem* p_tableitem;
+	  terminatedTable->setRowCount(results.size());
+	  foreach (QString line, results) {
+		 /* Iterate through the record returned from the query */
+		 QStringList fieldlist = line.split("\t");
+		 int column = 0;
+		 QString statusCode("");
+		 /* Iterate through fields in the record */
+		 foreach (QString field, fieldlist) {
+			field = field.trimmed();  /* strip leading & trailing spaces */
+			p_tableitem = new QTableWidgetItem(field, 1);
+			p_tableitem->setForeground(blackBrush);
+			p_tableitem->setFlags(0);
+			if (flaglist[column].contains("R"))
+			   p_tableitem->setTextAlignment(Qt::AlignRight);
+			if (flaglist[column].contains("C")) {
+			   if (field == "OK")
+				  p_tableitem->setBackground(Qt::green);
+			   else
+				  p_tableitem->setBackground(Qt::red);
+			}
+			terminatedTable->setItem(results.size() - row - 1, column, p_tableitem);
+			column += 1;
+		 }
+		 row += 1;
+	  }
    }
    terminatedTable->resizeColumnsToContents();
    terminatedTable->resizeRowsToContents();
@@ -185,16 +185,16 @@ void DirStat::populateScheduled()
 {
    QString command = QString(".status dir scheduled");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    QBrush blackBrush(Qt::black);
 
    scheduledTable->clear();
    QStringList headerlist = (QStringList()
-      << tr("Job Level") << tr("Job Type") << tr("Priority") << tr("Job Time")
-      << tr("Job Name") << tr("Volume"));
+	  << 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");
+	  << "L" << "L" << "R" << "L" << "L" << "L");
 
    scheduledTable->setColumnCount(headerlist.size());
    scheduledTable->setHorizontalHeaderLabels(headerlist);
@@ -202,24 +202,24 @@ void DirStat::populateScheduled()
    scheduledTable->setSelectionMode(QAbstractItemView::SingleSelection);
 
    if (m_console->dir_cmd(command, results)) {
-      int row = 0;
-      QTableWidgetItem* p_tableitem;
-      scheduledTable->setRowCount(results.size());
-      foreach (QString line, results) {
-         /* Iterate through the record returned from the query */
-         QStringList fieldlist = line.split("\t");
-         int column = 0;
-         QString statusCode("");
-         /* Iterate through fields in the record */
-         foreach (QString field, fieldlist) {
-            field = field.trimmed();  /* strip leading & trailing spaces */
-            p_tableitem = new QTableWidgetItem(field, 1);
-            p_tableitem->setForeground(blackBrush);
-            scheduledTable->setItem(row, column, p_tableitem);
-            column += 1;
-         }
-         row += 1;
-      }
+	  int row = 0;
+	  QTableWidgetItem* p_tableitem;
+	  scheduledTable->setRowCount(results.size());
+	  foreach (QString line, results) {
+		 /* Iterate through the record returned from the query */
+		 QStringList fieldlist = line.split("\t");
+		 int column = 0;
+		 QString statusCode("");
+		 /* Iterate through fields in the record */
+		 foreach (QString field, fieldlist) {
+			field = field.trimmed();  /* strip leading & trailing spaces */
+			p_tableitem = new QTableWidgetItem(field, 1);
+			p_tableitem->setForeground(blackBrush);
+			scheduledTable->setItem(row, column, p_tableitem);
+			column += 1;
+		 }
+		 row += 1;
+	  }
    }
    scheduledTable->resizeColumnsToContents();
    scheduledTable->resizeRowsToContents();
@@ -233,37 +233,37 @@ void DirStat::populateRunning()
 {
    QString command = QString(".status dir running");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    QBrush blackBrush(Qt::black);
 
    runningTable->clear();
    QStringList headerlist = (QStringList()
-      << tr("Job Id") << tr("Job Level") << tr("Job Data") << tr("Job Info"));
+	  << tr("Job Id") << tr("Job Level") << tr("Job Data") << tr("Job Info"));
 
    runningTable->setColumnCount(headerlist.size());
    runningTable->setHorizontalHeaderLabels(headerlist);
    runningTable->setSelectionBehavior(QAbstractItemView::SelectRows);
 
    if (m_console->dir_cmd(command, results)) {
-      int row = 0;
-      QTableWidgetItem* p_tableitem;
-      runningTable->setRowCount(results.size());
-      foreach (QString line, results) {
-         /* Iterate through the record returned from the query */
-         QStringList fieldlist = line.split("\t");
-         int column = 0;
-         QString statusCode("");
-         /* Iterate through fields in the record */
-         foreach (QString field, fieldlist) {
-            field = field.trimmed();  /* strip leading & trailing spaces */
-            p_tableitem = new QTableWidgetItem(field, 1);
-            p_tableitem->setForeground(blackBrush);
-            runningTable->setItem(row, column, p_tableitem);
-            column += 1;
-         }
-         row += 1;
-      }
+	  int row = 0;
+	  QTableWidgetItem* p_tableitem;
+	  runningTable->setRowCount(results.size());
+	  foreach (QString line, results) {
+		 /* Iterate through the record returned from the query */
+		 QStringList fieldlist = line.split("\t");
+		 int column = 0;
+		 QString statusCode("");
+		 /* Iterate through fields in the record */
+		 foreach (QString field, fieldlist) {
+			field = field.trimmed();  /* strip leading & trailing spaces */
+			p_tableitem = new QTableWidgetItem(field, 1);
+			p_tableitem->setForeground(blackBrush);
+			runningTable->setItem(row, column, p_tableitem);
+			column += 1;
+		 }
+		 row += 1;
+	  }
    }
    runningTable->resizeColumnsToContents();
    runningTable->resizeRowsToContents();
@@ -277,11 +277,11 @@ void DirStat::populateRunning()
 void DirStat::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateAll();
-      m_populated=true;
+	  populateAll();
+	  m_populated=true;
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -294,7 +294,7 @@ void DirStat::currentStackItem()
    populateAll();
    timerDisplay->display(spinBox->value());
    if (!m_populated) {
-      m_populated=true;
+	  m_populated=true;
    }
 }
 
@@ -357,22 +357,22 @@ void DirStat::consoleCancelJob()
    QList<int> rowList;
    QList<QTableWidgetItem *> sitems = runningTable->selectedItems();
    foreach (QTableWidgetItem *sitem, sitems) {
-      int row = sitem->row();
-      if (!rowList.contains(row)) {
-         rowList.append(row);
-      }
+	  int row = sitem->row();
+	  if (!rowList.contains(row)) {
+		 rowList.append(row);
+	  }
    }
 
    QStringList selectedJobsList;
    foreach(int row, rowList) {
-      QTableWidgetItem * sitem = runningTable->item(row, 0);
-      selectedJobsList.append(sitem->text());
+	  QTableWidgetItem * sitem = runningTable->item(row, 0);
+	  selectedJobsList.append(sitem->text());
    }
    foreach( QString job, selectedJobsList )
    {
-      QString cmd("cancel jobid=");
-      cmd += job;
-      consoleCommand(cmd);
+	  QString cmd("cancel jobid=");
+	  cmd += job;
+	  consoleCommand(cmd);
    }
 }
 
@@ -384,9 +384,9 @@ void DirStat::consoleDisableJob()
    int currentrow = scheduledTable->currentRow();
    QTableWidgetItem *item = scheduledTable->item(currentrow, 4);
    if (item) {
-      QString text = item->text();
-      QString cmd("disable job=\"");
-      cmd += text + '"';
-      consoleCommand(cmd);
+	  QString text = item->text();
+	  QString cmd("disable job=\"");
+	  cmd += text + '"';
+	  consoleCommand(cmd);
    }
 }
diff --git a/src/qt-console/status/dirstat.h b/src/qt-console/status/dirstat.h
index 1282991..3386c9a 100644
--- a/src/qt-console/status/dirstat.h
+++ b/src/qt-console/status/dirstat.h
@@ -25,6 +25,7 @@
 #define _DIRSTAT_H_
 
 #include <QtGui>
+
 #include "ui_dirstat.h"
 #include <pages.h>
 
diff --git a/src/qt-console/status/storstat.cpp b/src/qt-console/status/storstat.cpp
index cd30316..9db12d4 100644
--- a/src/qt-console/status/storstat.cpp
+++ b/src/qt-console/status/storstat.cpp
@@ -22,9 +22,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QTableWidgetItem>
 #include "storstat.h"
 #include "mount/mount.h"
 #include "label/label.h"
@@ -108,13 +108,13 @@ void StorStat::timerTriggered()
    double value = timerDisplay->value();
    value -= 1;
    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)) {
-         populateAll();
-      }
-      working = false;
+	  working = true;
+	  value = spinBox->value();
+	  bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this);
+	  if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) {
+		 populateAll();
+	  }
+	  working = false;
    }
    timerDisplay->display(value);
 }
@@ -126,15 +126,15 @@ void StorStat::populateHeader()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" header");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditHeader->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditHeader->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditHeader->insertPlainText(line);
+	  }
    }
 }
 
@@ -142,15 +142,15 @@ void StorStat::populateWaitReservation()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" waitreservation");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditWaitReservation->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditWaitReservation->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditWaitReservation->insertPlainText(line);
+	  }
    }
 }
 
@@ -158,15 +158,15 @@ void StorStat::populateDevices()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" devices");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditDevices->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditDevices->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditDevices->insertPlainText(line);
+	  }
    }
 }
 
@@ -174,15 +174,15 @@ void StorStat::populateVolumes()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" volumes");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditVolumes->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditVolumes->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditVolumes->insertPlainText(line);
+	  }
    }
 }
 
@@ -190,15 +190,15 @@ void StorStat::populateSpooling()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" spooling");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditSpooling->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditSpooling->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditSpooling->insertPlainText(line);
+	  }
    }
 }
 
@@ -206,15 +206,15 @@ void StorStat::populateRunning()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" running");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    textEditRunning->clear();
 
    if (m_console->dir_cmd(command, results)) {
-      foreach (QString line, results) {
-         line += "\n";
-         textEditRunning->insertPlainText(line);
-      }
+	  foreach (QString line, results) {
+		 line += "\n";
+		 textEditRunning->insertPlainText(line);
+	  }
    }
 }
 
@@ -225,50 +225,50 @@ void StorStat::populateTerminated()
 {
    QString command = QString(".status storage=\"" + m_storage + "\" terminated");
    if (mainWin->m_commandDebug)
-      Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
+	  Pmsg1(000, "sending command : %s\n",command.toUtf8().data());
    QStringList results;
    QBrush blackBrush(Qt::black);
 
    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 Name"));
+	  << tr("Job Id") << tr("Job Level") << tr("Job Files")
+	  << tr("Job Bytes") << tr("Job Status") << tr("Job Time")
+	  << tr("Job Name"));
    QStringList flaglist = (QStringList()
-      << "R" << "L" << "R" << "R" << "LC"
-      << "L" << "L");
+	  << "R" << "L" << "R" << "R" << "LC"
+	  << "L" << "L");
 
    terminatedTable->setColumnCount(headerlist.size());
    terminatedTable->setHorizontalHeaderLabels(headerlist);
 
    if (m_console->dir_cmd(command, results)) {
-      int row = 0;
-      QTableWidgetItem* p_tableitem;
-      terminatedTable->setRowCount(results.size());
-      foreach (QString line, results) {
-         /* Iterate through the record returned from the query */
-         QStringList fieldlist = line.split("\t");
-         int column = 0;
-         QString statusCode("");
-         /* Iterate through fields in the record */
-         foreach (QString field, fieldlist) {
-            field = field.trimmed();  /* strip leading & trailing spaces */
-            p_tableitem = new QTableWidgetItem(field, 1);
-            p_tableitem->setForeground(blackBrush);
-            p_tableitem->setFlags(0);
-            if (flaglist[column].contains("R"))
-               p_tableitem->setTextAlignment(Qt::AlignRight);
-            if (flaglist[column].contains("C")) {
-               if (field == "OK")
-                  p_tableitem->setBackground(Qt::green);
-               else
-                  p_tableitem->setBackground(Qt::red);
-            }
-            terminatedTable->setItem(row, column, p_tableitem);
-            column += 1;
-         }
-         row += 1;
-      }
+	  int row = 0;
+	  QTableWidgetItem* p_tableitem;
+	  terminatedTable->setRowCount(results.size());
+	  foreach (QString line, results) {
+		 /* Iterate through the record returned from the query */
+		 QStringList fieldlist = line.split("\t");
+		 int column = 0;
+		 QString statusCode("");
+		 /* Iterate through fields in the record */
+		 foreach (QString field, fieldlist) {
+			field = field.trimmed();  /* strip leading & trailing spaces */
+			p_tableitem = new QTableWidgetItem(field, 1);
+			p_tableitem->setForeground(blackBrush);
+			p_tableitem->setFlags(0);
+			if (flaglist[column].contains("R"))
+			   p_tableitem->setTextAlignment(Qt::AlignRight);
+			if (flaglist[column].contains("C")) {
+			   if (field == "OK")
+				  p_tableitem->setBackground(Qt::green);
+			   else
+				  p_tableitem->setBackground(Qt::red);
+			}
+			terminatedTable->setItem(row, column, p_tableitem);
+			column += 1;
+		 }
+		 row += 1;
+	  }
    }
    terminatedTable->resizeColumnsToContents();
    terminatedTable->resizeRowsToContents();
@@ -282,8 +282,8 @@ void StorStat::populateTerminated()
 void StorStat::PgSeltreeWidgetClicked()
 {
    if (!m_populated) {
-      populateAll();
-      m_populated=true;
+	  populateAll();
+	  m_populated=true;
    }
 }
 
@@ -296,7 +296,7 @@ void StorStat::currentStackItem()
    populateAll();
    timerDisplay->display(spinBox->value());
    if (!m_populated) {
-      m_populated=true;
+	  m_populated=true;
    }
 }
 
@@ -358,17 +358,17 @@ void StorStat::readSettings()
 void StorStat::populateCurrentTab(int index)
 {
    if (index == 0)
-      populateHeader();
+	  populateHeader();
    if (index == 1)
-      populateWaitReservation();
+	  populateWaitReservation();
    if (index == 2)
-      populateDevices();
+	  populateDevices();
    if (index == 3)
-      populateVolumes();
+	  populateVolumes();
    if (index == 4)
-      populateSpooling();
+	  populateSpooling();
    if (index == 5)
-      populateRunning();
+	  populateRunning();
 }
 
 /*
@@ -380,43 +380,43 @@ void StorStat::mountButtonPushed()
 
    /* Set up query QString and header QStringList */
    QString query("SELECT AutoChanger AS Changer"
-            " FROM Storage WHERE Name='" + m_storage + "'"
-            " ORDER BY Name" );
+			" FROM Storage WHERE Name='" + m_storage + "'"
+			" ORDER BY Name" );
 
    QStringList results;
    /* This could be a log item */
    if (mainWin->m_sqlDebug) {
-      Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data());
+	  Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data());
    }
    if (m_console->sql_cmd(query, results)) {
-      int resultCount = results.count();
-      if (resultCount == 1){
-         QString resultline;
-         QString field;
-         QStringList fieldlist;
-         /* there will only be one of these */
-         foreach (resultline, results) {
-            fieldlist = resultline.split("\t");
-            int index = 0;
-            /* Iterate through fields in the record */
-            foreach (field, fieldlist) {
-               field = field.trimmed();  /* strip leading & trailing spaces */
-               haschanger = field.toInt();
-               index++;
-            }
-         }
-      }
+	  int resultCount = results.count();
+	  if (resultCount == 1){
+		 QString resultline;
+		 QString field;
+		 QStringList fieldlist;
+		 /* there will only be one of these */
+		 foreach (resultline, results) {
+			fieldlist = resultline.split("\t");
+			int index = 0;
+			/* Iterate through fields in the record */
+			foreach (field, fieldlist) {
+			   field = field.trimmed();  /* strip leading & trailing spaces */
+			   haschanger = field.toInt();
+			   index++;
+			}
+		 }
+	  }
    }
 
    Pmsg1(000, "haschanger is : %i\n", haschanger);
    if (haschanger == 0){
-      /* no autochanger, just execute the command in the console */
-      QString cmd("mount storage=" + m_storage);
-      consoleCommand(cmd);
+	  /* no autochanger, just execute the command in the console */
+	  QString cmd("mount storage=" + m_storage);
+	  consoleCommand(cmd);
    } else if (haschanger != 3) {
-      setConsoleCurrent();
-      /* if this storage is an autochanger, lets ask for the slot */
-      new mountDialog(m_console, m_storage);
+	  setConsoleCurrent();
+	  /* if this storage is an autochanger, lets ask for the slot */
+	  new mountDialog(m_console, m_storage);
    }
 }
 
diff --git a/src/qt-console/status/storstat.h b/src/qt-console/status/storstat.h
index 373789f..d0b59b4 100644
--- a/src/qt-console/status/storstat.h
+++ b/src/qt-console/status/storstat.h
@@ -25,6 +25,7 @@
 #define _STORSTAT_H_
 
 #include <QtGui>
+
 #include "ui_storstat.h"
 #include "pages.h"
 
diff --git a/src/qt-console/storage/content.cpp b/src/qt-console/storage/content.cpp
index 0c93611..f461cac 100644
--- a/src/qt-console/storage/content.cpp
+++ b/src/qt-console/storage/content.cpp
@@ -21,9 +21,9 @@
    02110-1301, USA.
 */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QMenu>
 #include "content.h"
 #include "label/label.h"
 #include "mediainfo/mediainfo.h"
@@ -48,37 +48,37 @@ Content::Content(QString storage, QTreeWidgetItem *parentWidget) : Pages()
    m_currentStorage = storage;
 
    connect(pbUpdate, SIGNAL(clicked()), this,
-           SLOT(consoleUpdateSlots()));
+		   SLOT(consoleUpdateSlots()));
 
    connect(pbLabel, SIGNAL(clicked()), this,
-           SLOT(consoleLabelStorage()));
+		   SLOT(consoleLabelStorage()));
 
    connect(pbMount, SIGNAL(clicked()), this,
-           SLOT(consoleMountStorage()));
+		   SLOT(consoleMountStorage()));
 
    connect(pbUnmount, SIGNAL(clicked()), this,
-           SLOT(consoleUnMountStorage()));
+		   SLOT(consoleUnMountStorage()));
 
    connect(pbImport, SIGNAL(clicked()), this,
-           SLOT(consoleImportStorage()));
+		   SLOT(consoleImportStorage()));
 
    connect(pbExport, SIGNAL(clicked()), this,
-           SLOT(consoleExportStorage()));
+		   SLOT(consoleExportStorage()));
 
    connect(pbMoveUp, SIGNAL(clicked()), this,
-           SLOT(consoleMoveUpStorage()));
+		   SLOT(consoleMoveUpStorage()));
 
    connect(pbMoveDown, SIGNAL(clicked()), this,
-           SLOT(consoleMoveDownStorage()));
+		   SLOT(consoleMoveDownStorage()));
 
    connect(pbStatus, SIGNAL(clicked()), this,
-           SLOT(statusStorageWindow()));
+		   SLOT(statusStorageWindow()));
 
    connect(pbRelease, SIGNAL(clicked()), this,
-           SLOT(consoleRelease()));
+		   SLOT(consoleRelease()));
 
    connect(tableContent, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this,
-           SLOT(showMediaInfo(QTableWidgetItem *)));
+		   SLOT(showMediaInfo(QTableWidgetItem *)));
 
    dockPage();
    setCurrent();
@@ -94,7 +94,7 @@ void Content::showMediaInfo(QTableWidgetItem * item)
    QString vol = tableContent->item(row, 1)->text();
 
    if (vol != "") {
-      new MediaInfo(pageSelectorTreeWidgetItem, vol);
+	  new MediaInfo(pageSelectorTreeWidgetItem, vol);
    }
 }
 
@@ -102,133 +102,133 @@ static int table_get_selection(QTableWidget *table, QString &sel)
 {
    int i, size, cnt;
    int start_range = -1,
-       end_range = -1;
+	   end_range = -1;
    bool *sel_rows;
    QTableWidgetItem *item;
 
    /*
-    * When there are now rows in this table there is also nothing selected.
-    */
+	* When there are now rows in this table there is also nothing selected.
+	*/
    size = table->rowCount();
    if (size == 0) {
-      return 0;
+	  return 0;
    }
 
    /*
-    * The QT selection returns each cell, so you
-    * have x times the same row number...
-    * We take only one instance
-    */
+	* The QT selection returns each cell, so you
+	* have x times the same row number...
+	* We take only one instance
+	*/
    sel_rows = (bool *)malloc(size * sizeof(bool));
    memset(sel_rows, 0, size * sizeof(bool));
 
    /*
-    * Fill an internal array with per slot a marker if its selected or not.
-    */
+	* Fill an internal array with per slot a marker if its selected or not.
+	*/
    foreach (item, table->selectedItems()) {
-      sel_rows[item->row()] = true;
+	  sel_rows[item->row()] = true;
    }
 
    /*
-    * A selection starts with a = and then the slot selection.
-    */
+	* A selection starts with a = and then the slot selection.
+	*/
    sel += "=";
 
    /*
-    * Try to be smart if we can use ranges
-    */
+	* Try to be smart if we can use ranges
+	*/
    cnt = 0;
    for (i = 0; i < size; i++) {
-      if (sel_rows[i]) {
-         /*
-          * Keep track of the number of elements selected.
-          */
-         cnt++;
-
-         /*
-          * If no range is started, mark this as the start of
-          * a new one and continue with the next item.
-          */
-         if (start_range == -1) {
-            start_range = i;
-            end_range = i;
-            continue;
-         } else {
-            /*
-             * See if this is the next item in the range.
-             */
-            if (i == end_range + 1) {
-               end_range = i;
-               continue;
-            } else {
-               /*
-                * Not the next in a range flush the previous range if any
-                * or when just a single slot also flush it.
-                *
-                * See if this is a proper range.
-                */
-               if (start_range != -1 && start_range != end_range) {
-                  sel += table->item(start_range, 0)->text() + "-" + table->item(end_range, 0)->text();
-                  sel += ",";
-                  start_range = i;
-                  end_range = i;
-                  continue;
-               } else {
-                  /*
-                   * Only a single slot was selected not a range.
-                   */
-                  sel += table->item(start_range, 0)->text();
-                  sel += ",";
-                  start_range = i;
-                  end_range = i;
-                  continue;
-               }
-
-            }
-         }
-      } else {
-         /*
-          * Slot is not selected so the range (if started ends here)
-          *
-          * See if this is a proper range.
-          */
-         if (start_range != -1 && start_range != end_range) {
-            sel += table->item(start_range, 0)->text() + "-" + table->item(end_range, 0)->text();
-            sel += ",";
-            start_range = -1;
-            end_range = -1;
-         } else if (start_range != -1) {
-            /*
-             * Only a single slot was selected not a range.
-             */
-            sel += table->item(start_range, 0)->text();
-            sel += ",";
-            start_range = -1;
-            end_range = -1;
-         }
-      }
+	  if (sel_rows[i]) {
+		 /*
+		  * Keep track of the number of elements selected.
+		  */
+		 cnt++;
+
+		 /*
+		  * If no range is started, mark this as the start of
+		  * a new one and continue with the next item.
+		  */
+		 if (start_range == -1) {
+			start_range = i;
+			end_range = i;
+			continue;
+		 } else {
+			/*
+			 * See if this is the next item in the range.
+			 */
+			if (i == end_range + 1) {
+			   end_range = i;
+			   continue;
+			} else {
+			   /*
+				* Not the next in a range flush the previous range if any
+				* or when just a single slot also flush it.
+				*
+				* See if this is a proper range.
+				*/
+			   if (start_range != -1 && start_range != end_range) {
+				  sel += table->item(start_range, 0)->text() + "-" + table->item(end_range, 0)->text();
+				  sel += ",";
+				  start_range = i;
+				  end_range = i;
+				  continue;
+			   } else {
+				  /*
+				   * Only a single slot was selected not a range.
+				   */
+				  sel += table->item(start_range, 0)->text();
+				  sel += ",";
+				  start_range = i;
+				  end_range = i;
+				  continue;
+			   }
+
+			}
+		 }
+	  } else {
+		 /*
+		  * Slot is not selected so the range (if started ends here)
+		  *
+		  * See if this is a proper range.
+		  */
+		 if (start_range != -1 && start_range != end_range) {
+			sel += table->item(start_range, 0)->text() + "-" + table->item(end_range, 0)->text();
+			sel += ",";
+			start_range = -1;
+			end_range = -1;
+		 } else if (start_range != -1) {
+			/*
+			 * Only a single slot was selected not a range.
+			 */
+			sel += table->item(start_range, 0)->text();
+			sel += ",";
+			start_range = -1;
+			end_range = -1;
+		 }
+	  }
    }
 
    /*
-    * See if there are any unflushed ranges. e.g. when we run out of slots
-    * but the range is not flushed to the cmdline.
-    *
-    * See if this is a proper range.
-    */
+	* See if there are any unflushed ranges. e.g. when we run out of slots
+	* but the range is not flushed to the cmdline.
+	*
+	* See if this is a proper range.
+	*/
    if (start_range != -1 && start_range != end_range) {
-      sel += table->item(start_range, 0)->text() + "-" + table->item(end_range, 0)->text();
-      sel += ",";
+	  sel += table->item(start_range, 0)->text() + "-" + table->item(end_range, 0)->text();
+	  sel += ",";
    } else if (start_range != -1) {
-      /*
-       * Only a single slot was selected not a range.
-       */
-      sel += table->item(start_range, 0)->text();
-      sel += ",";
+	  /*
+	   * Only a single slot was selected not a range.
+	   */
+	  sel += table->item(start_range, 0)->text();
+	  sel += ",";
    }
 
    /*
-    * remove trailing , or useless =
-    */
+	* remove trailing , or useless =
+	*/
    sel.chop(1);
 
    free(sel_rows);
@@ -245,48 +245,48 @@ void Content::consoleLabelStorage()
 
    sel_cnt = table_get_selection(tableContent, sel);
    if (sel_cnt == 0) {
-      new labelPage(m_currentStorage);
+	  new labelPage(m_currentStorage);
    } else {
-      /*
-       * See if there is more then 1 drive in this changer.
-       * If there is the user should select which drive to
-       * use for the label by selecting that drive in the
-       * drives pane.
-       */
-      if (tableDrive->rowCount() > 1) {
-         drive_cnt = table_get_selection(tableDrive, drive_sel);
-         switch (drive_cnt) {
-         case 0:
-            QMessageBox::warning(this,
-                                 tr("Drive Selection"),
-                                 tr("Please select drive in drive pane"),
-                                 QMessageBox::Ok, QMessageBox::Ok);
-            return;
-         case 1:
-            cmd = QString("label barcodes slots%1 storage=\"%2\" drive%3")
-                          .arg(sel)
-                          .arg(m_currentStorage)
-                          .arg(drive_sel);
-            break;
-         default:
-            QMessageBox::warning(this,
-                                 tr("Drive Selection"),
-                                 tr("Please select only one drive in drive pane"),
-                                 QMessageBox::Ok, QMessageBox::Ok);
-            return;
-         }
-      } else {
-         cmd = QString("label barcodes slots%1 storage=\"%2\"")
-                       .arg(sel)
-                       .arg(m_currentStorage);
-      }
+	  /*
+	   * See if there is more then 1 drive in this changer.
+	   * If there is the user should select which drive to
+	   * use for the label by selecting that drive in the
+	   * drives pane.
+	   */
+	  if (tableDrive->rowCount() > 1) {
+		 drive_cnt = table_get_selection(tableDrive, drive_sel);
+		 switch (drive_cnt) {
+		 case 0:
+			QMessageBox::warning(this,
+								 tr("Drive Selection"),
+								 tr("Please select drive in drive pane"),
+								 QMessageBox::Ok, QMessageBox::Ok);
+			return;
+		 case 1:
+			cmd = QString("label barcodes slots%1 storage=\"%2\" drive%3")
+						  .arg(sel)
+						  .arg(m_currentStorage)
+						  .arg(drive_sel);
+			break;
+		 default:
+			QMessageBox::warning(this,
+								 tr("Drive Selection"),
+								 tr("Please select only one drive in drive pane"),
+								 QMessageBox::Ok, QMessageBox::Ok);
+			return;
+		 }
+	  } else {
+		 cmd = QString("label barcodes slots%1 storage=\"%2\"")
+					   .arg(sel)
+					   .arg(m_currentStorage);
+	  }
    }
 
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -299,69 +299,69 @@ void Content::consoleMountStorage()
    QString sel, drive_sel, cmd;
 
    /*
-    * See if there is more then 1 drive in this changer.
-    * If there is the user should select which drive to
-    * use for the mount by selecting that drive in the
-    * drives pane. If she/he does not we fall back to
-    * the normal behaviour of showing the mountDialog.
-    */
+	* See if there is more then 1 drive in this changer.
+	* If there is the user should select which drive to
+	* use for the mount by selecting that drive in the
+	* drives pane. If she/he does not we fall back to
+	* the normal behaviour of showing the mountDialog.
+	*/
    if (tableDrive->rowCount() > 1) {
-      drive_cnt = table_get_selection(tableDrive, drive_sel);
-      switch (drive_cnt) {
-      case 0:
-      case 1:
-         /*
-          * See if One slot is selected in the content table.
-          */
-         sel_cnt = table_get_selection(tableContent, sel);
-         if (sel_cnt == 1) {
-            switch (drive_cnt) {
-            case 0:
-               cmd = QString("mount storage=\"%1\" slot%2 drive=0")
-                             .arg(m_currentStorage)
-                             .arg(sel);
-               consoleCommand(cmd);
-
-               /*
-                * Volumes have moved so (re)populate the view.
-                */
-               m_needs_repopulate = true;
-               return;
-            case 1:
-               cmd = QString("mount storage=\"%1\" slot%2 drive%3")
-                             .arg(m_currentStorage)
-                             .arg(sel)
-                             .arg(drive_sel);
-               consoleCommand(cmd);
-
-               /*
-                * Volumes have moved so (re)populate the view.
-                */
-               m_needs_repopulate = true;
-               return;
-            default:
-               break;
-            }
-         }
-         break;
-      default:
-         break;
-      }
+	  drive_cnt = table_get_selection(tableDrive, drive_sel);
+	  switch (drive_cnt) {
+	  case 0:
+	  case 1:
+		 /*
+		  * See if One slot is selected in the content table.
+		  */
+		 sel_cnt = table_get_selection(tableContent, sel);
+		 if (sel_cnt == 1) {
+			switch (drive_cnt) {
+			case 0:
+			   cmd = QString("mount storage=\"%1\" slot%2 drive=0")
+							 .arg(m_currentStorage)
+							 .arg(sel);
+			   consoleCommand(cmd);
+
+			   /*
+				* Volumes have moved so (re)populate the view.
+				*/
+			   m_needs_repopulate = true;
+			   return;
+			case 1:
+			   cmd = QString("mount storage=\"%1\" slot%2 drive%3")
+							 .arg(m_currentStorage)
+							 .arg(sel)
+							 .arg(drive_sel);
+			   consoleCommand(cmd);
+
+			   /*
+				* Volumes have moved so (re)populate the view.
+				*/
+			   m_needs_repopulate = true;
+			   return;
+			default:
+			   break;
+			}
+		 }
+		 break;
+	  default:
+		 break;
+	  }
    }
 
    /*
-    * Fallback to old interactive mount dialog.
-    */
+	* Fallback to old interactive mount dialog.
+	*/
    setConsoleCurrent();
 
    /*
-    * If this storage is an autochanger, lets ask for the slot
-    */
+	* If this storage is an autochanger, lets ask for the slot
+	*/
    new mountDialog(m_console, m_currentStorage);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -374,42 +374,42 @@ void Content::consoleUnMountStorage()
    QString drive_sel, cmd;
 
    /*
-    * See if there is more then 1 drive in this changer.
-    * If there is the user should select which drive to
-    * use for the unmount by selecting that drive in the
-    * drives pane.
-    */
+	* See if there is more then 1 drive in this changer.
+	* If there is the user should select which drive to
+	* use for the unmount by selecting that drive in the
+	* drives pane.
+	*/
    if (tableDrive->rowCount() > 1) {
-      drive_cnt = table_get_selection(tableDrive, drive_sel);
-      switch (drive_cnt) {
-      case 0:
-         QMessageBox::warning(this,
-                              tr("Drive Selection"),
-                              tr("Please select drive in drive pane"),
-                              QMessageBox::Ok, QMessageBox::Ok);
-         return;
-      case 1:
-         cmd = QString("umount storage=\"%1\" drive%2")
-                       .arg(m_currentStorage)
-                       .arg(drive_sel);
-         break;
-      default:
-         QMessageBox::warning(this,
-                              tr("Drive Selection"),
-                              tr("Please select only one drive in drive pane"),
-                              QMessageBox::Ok, QMessageBox::Ok);
-         return;
-      }
+	  drive_cnt = table_get_selection(tableDrive, drive_sel);
+	  switch (drive_cnt) {
+	  case 0:
+		 QMessageBox::warning(this,
+							  tr("Drive Selection"),
+							  tr("Please select drive in drive pane"),
+							  QMessageBox::Ok, QMessageBox::Ok);
+		 return;
+	  case 1:
+		 cmd = QString("umount storage=\"%1\" drive%2")
+					   .arg(m_currentStorage)
+					   .arg(drive_sel);
+		 break;
+	  default:
+		 QMessageBox::warning(this,
+							  tr("Drive Selection"),
+							  tr("Please select only one drive in drive pane"),
+							  QMessageBox::Ok, QMessageBox::Ok);
+		 return;
+	  }
    } else {
-      cmd = QString("umount storage=\"%1\"")
-                    .arg(m_currentStorage);
+	  cmd = QString("umount storage=\"%1\"")
+					.arg(m_currentStorage);
    }
 
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -422,15 +422,15 @@ void Content::consoleImportStorage()
    QString srcslots, dstslots, cmd;
 
    cmd = QString("import storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    src_cnt = table_get_selection(tableTray, srcslots);
    if (src_cnt > 0) {
-      cmd += " srcslots" + srcslots;
+	  cmd += " srcslots" + srcslots;
    }
    dst_cnt = table_get_selection(tableContent, dstslots);
    if (dst_cnt > 0) {
-      cmd += " dstslots" + dstslots;
+	  cmd += " dstslots" + dstslots;
    }
 
    Pmsg1(0, "cmd=%s\n", cmd.toUtf8().data());
@@ -438,8 +438,8 @@ void Content::consoleImportStorage()
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -452,15 +452,15 @@ void Content::consoleExportStorage()
    QString srcslots, dstslots, cmd;
 
    cmd = QString("export storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    src_cnt = table_get_selection(tableContent, srcslots);
    if (src_cnt > 0) {
-      cmd += " srcslots" + srcslots;
+	  cmd += " srcslots" + srcslots;
    }
    dst_cnt = table_get_selection(tableTray, dstslots);
    if (dst_cnt > 0) {
-      cmd += " dstslots" + dstslots;
+	  cmd += " dstslots" + dstslots;
    }
 
    Pmsg1(0, "cmd=%s\n", cmd.toUtf8().data());
@@ -468,8 +468,8 @@ void Content::consoleExportStorage()
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -483,55 +483,55 @@ void Content::consoleMoveUpStorage()
    QString srcslots, dstslots, selslots, cmd;
 
    cmd = QString("move storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    /*
-    * For a move operation no import/export slots may be selected.
-    */
+	* For a move operation no import/export slots may be selected.
+	*/
    sel_cnt = table_get_selection(tableTray, selslots);
    if (sel_cnt > 0) {
-      QMessageBox::warning(this,
-                           tr("Slot Selection"),
-                           tr("Please deselect any import/export slots which are invalid for a move operation"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this,
+						   tr("Slot Selection"),
+						   tr("Please deselect any import/export slots which are invalid for a move operation"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
 
    /*
-    * See what slots are selected and try to split it into exactly two ranges.
-    */
+	* See what slots are selected and try to split it into exactly two ranges.
+	*/
    sel_cnt = table_get_selection(tableContent, selslots);
    if (sel_cnt > 0) {
-      QStringList fieldlist;
-
-      fieldlist = selslots.split(",");
-      /*
-       * There are not 2 ranges selected this ain't gonna work for a move operation.
-       */
-      if (fieldlist.size() != 2) {
-         QMessageBox::warning(this,
-                              tr("Slot Selection"),
-                              tr("Please select two slot ranges for the move operation"),
-                              QMessageBox::Ok, QMessageBox::Ok);
-         return;
-      }
-
-      QStringListIterator fld(fieldlist);
-
-      dstslots = fld.next();
-      srcslots = fld.next();
-
-      cmd += " srcslots=" + srcslots;
-      cmd += " dstslots" + dstslots;
+	  QStringList fieldlist;
+
+	  fieldlist = selslots.split(",");
+	  /*
+	   * There are not 2 ranges selected this ain't gonna work for a move operation.
+	   */
+	  if (fieldlist.size() != 2) {
+		 QMessageBox::warning(this,
+							  tr("Slot Selection"),
+							  tr("Please select two slot ranges for the move operation"),
+							  QMessageBox::Ok, QMessageBox::Ok);
+		 return;
+	  }
+
+	  QStringListIterator fld(fieldlist);
+
+	  dstslots = fld.next();
+	  srcslots = fld.next();
+
+	  cmd += " srcslots=" + srcslots;
+	  cmd += " dstslots" + dstslots;
    } else {
-      /*
-       * Nothing selected this ain't gonna work for a move operation.
-       */
-      QMessageBox::warning(this,
-                           tr("Slot Selection"),
-                           tr("Please select two slot ranges for the move operation"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  /*
+	   * Nothing selected this ain't gonna work for a move operation.
+	   */
+	  QMessageBox::warning(this,
+						   tr("Slot Selection"),
+						   tr("Please select two slot ranges for the move operation"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
 
    Pmsg1(0, "cmd=%s\n", cmd.toUtf8().data());
@@ -539,8 +539,8 @@ void Content::consoleMoveUpStorage()
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -550,55 +550,55 @@ void Content::consoleMoveDownStorage()
    QString srcslots, dstslots, selslots, cmd;
 
    cmd = QString("move storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    /*
-    * For a move operation no import/export slots may be selected.
-    */
+	* For a move operation no import/export slots may be selected.
+	*/
    sel_cnt = table_get_selection(tableTray, selslots);
    if (sel_cnt > 0) {
-      QMessageBox::warning(this,
-                           tr("Slot Selection"),
-                           tr("Please deselect any import/export slots which are invalid for a move operation"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  QMessageBox::warning(this,
+						   tr("Slot Selection"),
+						   tr("Please deselect any import/export slots which are invalid for a move operation"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
 
    /*
-    * See what slots are selected and try to split it into exactly two ranges.
-    */
+	* See what slots are selected and try to split it into exactly two ranges.
+	*/
    sel_cnt = table_get_selection(tableContent, selslots);
    if (sel_cnt > 0) {
-      QStringList fieldlist;
-
-      fieldlist = selslots.split(",");
-      /*
-       * There are not 2 ranges selected this ain't gonna work for a move operation.
-       */
-      if (fieldlist.size() != 2) {
-         QMessageBox::warning(this,
-                              tr("Slot Selection"),
-                              tr("Please select two slot ranges for the move operation"),
-                              QMessageBox::Ok, QMessageBox::Ok);
-         return;
-      }
-
-      QStringListIterator fld(fieldlist);
-
-      srcslots = fld.next();
-      dstslots = fld.next();
-
-      cmd += " srcslots" + srcslots;
-      cmd += " dstslots=" + dstslots;
+	  QStringList fieldlist;
+
+	  fieldlist = selslots.split(",");
+	  /*
+	   * There are not 2 ranges selected this ain't gonna work for a move operation.
+	   */
+	  if (fieldlist.size() != 2) {
+		 QMessageBox::warning(this,
+							  tr("Slot Selection"),
+							  tr("Please select two slot ranges for the move operation"),
+							  QMessageBox::Ok, QMessageBox::Ok);
+		 return;
+	  }
+
+	  QStringListIterator fld(fieldlist);
+
+	  srcslots = fld.next();
+	  dstslots = fld.next();
+
+	  cmd += " srcslots" + srcslots;
+	  cmd += " dstslots=" + dstslots;
    } else {
-      /*
-       * Nothing selected this ain't gonna work for a move operation.
-       */
-      QMessageBox::warning(this,
-                           tr("Slot Selection"),
-                           tr("Please select two slot ranges for the move operation"),
-                           QMessageBox::Ok, QMessageBox::Ok);
-      return;
+	  /*
+	   * Nothing selected this ain't gonna work for a move operation.
+	   */
+	  QMessageBox::warning(this,
+						   tr("Slot Selection"),
+						   tr("Please select two slot ranges for the move operation"),
+						   QMessageBox::Ok, QMessageBox::Ok);
+	  return;
    }
 
    Pmsg1(0, "cmd=%s\n", cmd.toUtf8().data());
@@ -606,8 +606,8 @@ void Content::consoleMoveDownStorage()
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -617,22 +617,22 @@ void Content::consoleMoveDownStorage()
 void Content::statusStorageWindow()
 {
    /*
-    * If one exists, then just set it current
-    */
+	* If one exists, then just set it current
+	*/
    bool found = false;
 
    foreach(Pages *page, mainWin->m_pagehash) {
-      if (mainWin->currentConsole() == page->console()) {
-         if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) {
-            found = true;
-            page->setCurrent();
-         }
-      }
+	  if (mainWin->currentConsole() == page->console()) {
+		 if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) {
+			found = true;
+			page->setCurrent();
+		 }
+	  }
    }
 
    if (!found) {
-      QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-      new StorStat(m_currentStorage, parentItem);
+	  QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
+	  new StorStat(m_currentStorage, parentItem);
    }
 }
 
@@ -646,12 +646,12 @@ void Content::consoleUpdateSlots()
 
    sel_cnt = table_get_selection(tableContent, sel);
    if (sel_cnt > 0) {
-      cmd = QString("update slots%1 storage=\"%2\"")
-                    .arg(sel)
-                    .arg(m_currentStorage);
+	  cmd = QString("update slots%1 storage=\"%2\"")
+					.arg(sel)
+					.arg(m_currentStorage);
    } else {
-      cmd = QString("update slots storage=\"%1\"")
-                    .arg(m_currentStorage);
+	  cmd = QString("update slots storage=\"%1\"")
+					.arg(m_currentStorage);
    }
 
    Pmsg1(0, "cmd=%s\n", cmd.toUtf8().data());
@@ -659,8 +659,8 @@ void Content::consoleUpdateSlots()
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -673,42 +673,42 @@ void Content::consoleRelease()
    QString drive_sel, cmd;
 
    /*
-    * See if there is more then 1 drive in this changer.
-    * If there is the user should select which drive to
-    * use for the release by selecting that drive in the
-    * drives pane.
-    */
+	* See if there is more then 1 drive in this changer.
+	* If there is the user should select which drive to
+	* use for the release by selecting that drive in the
+	* drives pane.
+	*/
    if (tableDrive->rowCount() > 1) {
-      drive_cnt = table_get_selection(tableDrive, drive_sel);
-      switch (drive_cnt) {
-      case 0:
-         QMessageBox::warning(this,
-                              tr("Drive Selection"),
-                              tr("Please select drive in drive pane"),
-                              QMessageBox::Ok, QMessageBox::Ok);
-         return;
-      case 1:
-         cmd = QString("release storage=\"%1\" drive%2")
-                       .arg(m_currentStorage)
-                       .arg(drive_sel);
-         break;
-      default:
-         QMessageBox::warning(this,
-                              tr("Drive Selection"),
-                              tr("Please select only one drive in drive pane"),
-                              QMessageBox::Ok, QMessageBox::Ok);
-         return;
-      }
+	  drive_cnt = table_get_selection(tableDrive, drive_sel);
+	  switch (drive_cnt) {
+	  case 0:
+		 QMessageBox::warning(this,
+							  tr("Drive Selection"),
+							  tr("Please select drive in drive pane"),
+							  QMessageBox::Ok, QMessageBox::Ok);
+		 return;
+	  case 1:
+		 cmd = QString("release storage=\"%1\" drive%2")
+					   .arg(m_currentStorage)
+					   .arg(drive_sel);
+		 break;
+	  default:
+		 QMessageBox::warning(this,
+							  tr("Drive Selection"),
+							  tr("Please select only one drive in drive pane"),
+							  QMessageBox::Ok, QMessageBox::Ok);
+		 return;
+	  }
    } else {
-      cmd = QString("release storage=\"%1\"")
-                    .arg(m_currentStorage);
+	  cmd = QString("release storage=\"%1\"")
+					.arg(m_currentStorage);
    }
 
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -726,7 +726,7 @@ void Content::populateContent()
    QString cmd;
 
    cmd = QString("status slots storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
    m_console->dir_cmd(cmd, results_all);
 
    Freeze frz(*tableContent); /* disable updating */
@@ -734,8 +734,8 @@ void Content::populateContent()
    Freeze frz3(*tableDrive);
 
    /*
-    * Populate Content pane.
-    */
+	* Populate Content pane.
+	*/
    tableContent->clearContents();
 
    QStringList results = results_all.filter(QRegExp("^S\\|[0-9]+\\|"));
@@ -746,55 +746,55 @@ void Content::populateContent()
    int row = 0;
 
    foreach (resultline, results) {
-      fieldlist = resultline.split("|");
-      if (fieldlist.size() < 10) {
-         Pmsg1(0, "Discarding %s\n", resultline.data());
-         continue; /* some fields missing, ignore row */
-      }
-
-      int index = 0;
-      QStringListIterator fld(fieldlist);
-      TableItemFormatter slotitem(*tableContent, row);
-
-       /* Slot type. */
-      fld.next();
-
-      /* Slot */
-      slotitem.setNumericFld(index++, fld.next());
-
-      /* Filled Slot */
-      if (fld.next() != "") {
-
-         /* Volume */
-         slotitem.setTextFld(index++, fld.next());
-
-         /* Bytes */
-         slotitem.setBytesFld(index++, fld.next());
-
-         /* Status */
-         slotitem.setVolStatusFld(index++, fld.next());
-
-         /* MediaType */
-         slotitem.setTextFld(index++, fld.next());
-
-         /* Pool */
-         slotitem.setTextFld(index++, fld.next());
-
-         tim = fld.next().toInt();
-         if (tim > 0) {
-            /* LastW */
-            localtime_r(&tim, &tm);
-            strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
-            slotitem.setTextFld(index++, QString(buf));
-
-            /* Expire */
-            tim = fld.next().toInt();
-            localtime_r(&tim, &tm);
-            strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
-            slotitem.setTextFld(index++, QString(buf));
-         }
-      }
-      row++;
+	  fieldlist = resultline.split("|");
+	  if (fieldlist.size() < 10) {
+		 Pmsg1(0, "Discarding %s\n", resultline.data());
+		 continue; /* some fields missing, ignore row */
+	  }
+
+	  int index = 0;
+	  QStringListIterator fld(fieldlist);
+	  TableItemFormatter slotitem(*tableContent, row);
+
+	   /* Slot type. */
+	  fld.next();
+
+	  /* Slot */
+	  slotitem.setNumericFld(index++, fld.next());
+
+	  /* Filled Slot */
+	  if (fld.next() != "") {
+
+		 /* Volume */
+		 slotitem.setTextFld(index++, fld.next());
+
+		 /* Bytes */
+		 slotitem.setBytesFld(index++, fld.next());
+
+		 /* Status */
+		 slotitem.setVolStatusFld(index++, fld.next());
+
+		 /* MediaType */
+		 slotitem.setTextFld(index++, fld.next());
+
+		 /* Pool */
+		 slotitem.setTextFld(index++, fld.next());
+
+		 tim = fld.next().toInt();
+		 if (tim > 0) {
+			/* LastW */
+			localtime_r(&tim, &tm);
+			strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
+			slotitem.setTextFld(index++, QString(buf));
+
+			/* Expire */
+			tim = fld.next().toInt();
+			localtime_r(&tim, &tm);
+			strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
+			slotitem.setTextFld(index++, QString(buf));
+		 }
+	  }
+	  row++;
    }
 
    tableContent->verticalHeader()->hide();
@@ -806,8 +806,8 @@ void Content::populateContent()
    tableContent->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
    /*
-    * Populate Input/Ouput pane.
-    */
+	* Populate Input/Ouput pane.
+	*/
    tableTray->clearContents();
 
    QStringList io_results = results_all.filter(QRegExp("^I\\|[0-9]+\\|"));
@@ -815,28 +815,28 @@ void Content::populateContent()
 
    int row_io = 0;
    foreach (resultline, io_results) {
-      fieldlist = resultline.split("|");
-      if (fieldlist.size() < 10) {
-         Pmsg1(0, "Discarding %s\n", resultline.data());
-         continue; /* some fields missing, ignore row */
-      }
+	  fieldlist = resultline.split("|");
+	  if (fieldlist.size() < 10) {
+		 Pmsg1(0, "Discarding %s\n", resultline.data());
+		 continue; /* some fields missing, ignore row */
+	  }
 
-      QStringListIterator fld(fieldlist);
+	  QStringListIterator fld(fieldlist);
 
-      /* Slot type. */
-      fld.next();
+	  /* Slot type. */
+	  fld.next();
 
-      TableItemFormatter ioitem(*tableTray, row_io++);
-      ioitem.setNumericFld(0, fieldlist[1]);
-      ioitem.setTextFld(1, fieldlist[3]);
+	  TableItemFormatter ioitem(*tableTray, row_io++);
+	  ioitem.setNumericFld(0, fieldlist[1]);
+	  ioitem.setTextFld(1, fieldlist[3]);
    }
 
    tableTray->verticalHeader()->hide();
    tableTray->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
    /*
-    * Populate Drive pane.
-    */
+	* Populate Drive pane.
+	*/
    tableDrive->verticalHeader()->hide();
 
    tableDrive->clearContents();
@@ -846,27 +846,27 @@ void Content::populateContent()
 
    int row_drive = 0;
    foreach (resultline, drives) {
-      fieldlist = resultline.split("|");
-      if (fieldlist.size() < 4)
-         continue; /* some fields missing, ignore row */
+	  fieldlist = resultline.split("|");
+	  if (fieldlist.size() < 4)
+		 continue; /* some fields missing, ignore row */
 
-      int index = 0;
-      QStringListIterator fld(fieldlist);
-      TableItemFormatter slotitem(*tableDrive, row_drive);
+	  int index = 0;
+	  QStringListIterator fld(fieldlist);
+	  TableItemFormatter slotitem(*tableDrive, row_drive);
 
-      /* Drive type */
-      fld.next();
+	  /* Drive type */
+	  fld.next();
 
-      /* Number */
-      slotitem.setNumericFld(index++, fld.next());
+	  /* Number */
+	  slotitem.setNumericFld(index++, fld.next());
 
-      /* Slot */
-      fld.next();
+	  /* Slot */
+	  fld.next();
 
-      /* Volume */
-      slotitem.setTextFld(index++, fld.next());
+	  /* Volume */
+	  slotitem.setTextFld(index++, fld.next());
 
-      row_drive++;
+	  row_drive++;
    }
 
    tableDrive->resizeRowsToContents();
@@ -881,7 +881,7 @@ void Content::populateContent()
 void Content::currentStackItem()
 {
    if (!m_populated || m_needs_repopulate) {
-      populateContent();
+	  populateContent();
    }
 }
 
diff --git a/src/qt-console/storage/content.h b/src/qt-console/storage/content.h
index 168b4f3..515b367 100644
--- a/src/qt-console/storage/content.h
+++ b/src/qt-console/storage/content.h
@@ -22,6 +22,7 @@
 #define _CONTENT_H_
 
 #include <QtGui>
+
 #include "ui_content.h"
 #include "pages.h"
 
diff --git a/src/qt-console/storage/storage.cpp b/src/qt-console/storage/storage.cpp
index 92dc919..33da691 100644
--- a/src/qt-console/storage/storage.cpp
+++ b/src/qt-console/storage/storage.cpp
@@ -27,9 +27,9 @@
  * Dirk Bartley, March 2007
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QAbstractEventDispatcher>
-#include <QMenu>
 #include "storage.h"
 #include "content.h"
 #include "label/label.h"
@@ -52,14 +52,14 @@ Storage::Storage() : Pages()
    m_closeable = false;
    m_currentStorage = "";
    /* add context sensitive menu items specific to this classto the page
-    * selector tree. m_contextActions is QList of QActions */
+	* selector tree. m_contextActions is QList of QActions */
    m_contextActions.append(actionRefreshStorage);
 }
 
 Storage::~Storage()
 {
    if (m_populated) {
-      writeExpandedSettings();
+	  writeExpandedSettings();
    }
 }
 
@@ -70,7 +70,7 @@ Storage::~Storage()
 void Storage::populateTree()
 {
    if (m_populated) {
-      writeExpandedSettings();
+	  writeExpandedSettings();
    }
    m_populated = true;
 
@@ -81,8 +81,8 @@ void Storage::populateTree()
    m_checkcurwidget = true;
 
    QStringList headerlist = (QStringList() << tr("Name") << tr("Id")
-        << tr("Changer") << tr("Slot") << tr("Status") << tr("Enabled") << tr("Pool")
-        << tr("Media Type") );
+		<< tr("Changer") << tr("Slot") << tr("Status") << tr("Enabled") << tr("Pool")
+		<< tr("Media Type") );
 
    m_topItem = new QTreeWidgetItem(mp_treeWidget);
    m_topItem->setText(0, tr("Storage"));
@@ -99,64 +99,64 @@ void Storage::populateTree()
    QString storage_comsep("");
    QString storageName;
    foreach(storageName, m_console->storage_list){
-      if (first) {
-         storage_comsep += "'" + storageName + "'";
-         first = false;
-      }
-      else
-         storage_comsep += ",'" + storageName + "'";
+	  if (first) {
+		 storage_comsep += "'" + storageName + "'";
+		 first = false;
+	  }
+	  else
+		 storage_comsep += ",'" + storageName + "'";
    }
    if (storage_comsep != "") {
 
-      /* Set up query QString and header QStringList */
-      QString query("SELECT"
-               " Name AS StorageName,"
-               " StorageId AS ID, AutoChanger AS Changer"
-               " FROM Storage "
-               " WHERE StorageId IN (SELECT MAX(StorageId) FROM Storage WHERE");
-      query += " Name IN (" + storage_comsep + ")";
-      query += " GROUP BY Name) ORDER BY Name";
-
-      QStringList results;
-      /* This could be a log item */
-      if (mainWin->m_sqlDebug) {
-         Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data());
-      }
-      if (m_console->sql_cmd(query, results)) {
-
-         QStringList fieldlist;
-         foreach (QString resultline, results) {
-            fieldlist = resultline.split("\t");
-            storageName = fieldlist.takeFirst();
-            if (m_firstpopulation) {
-               settingsOpenStatus(storageName);
-            }
-            TreeItemFormatter storageItem(*m_topItem, 1);
-            storageItem.setTextFld(0, storageName);
-            if(settings.contains(storageName))
-               storageItem.widget()->setExpanded(settings.value(storageName).toBool());
-            else
-               storageItem.widget()->setExpanded(true);
-
-            int index = 1;
-            QStringListIterator fld(fieldlist);
-
-            /* storage id */
-            storageItem.setNumericFld(index++, fld.next());
-
-            /* changer */
-            QString changer = fld.next();
-            storageItem.setBoolFld(index++, changer);
-
-            if (changer == "1") {
-               mediaList(storageItem.widget(), fieldlist.first());
-            }
-         }
-      }
+	  /* Set up query QString and header QStringList */
+	  QString query("SELECT"
+			   " Name AS StorageName,"
+			   " StorageId AS ID, AutoChanger AS Changer"
+			   " FROM Storage "
+			   " WHERE StorageId IN (SELECT MAX(StorageId) FROM Storage WHERE");
+	  query += " Name IN (" + storage_comsep + ")";
+	  query += " GROUP BY Name) ORDER BY Name";
+
+	  QStringList results;
+	  /* This could be a log item */
+	  if (mainWin->m_sqlDebug) {
+		 Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data());
+	  }
+	  if (m_console->sql_cmd(query, results)) {
+
+		 QStringList fieldlist;
+		 foreach (QString resultline, results) {
+			fieldlist = resultline.split("\t");
+			storageName = fieldlist.takeFirst();
+			if (m_firstpopulation) {
+			   settingsOpenStatus(storageName);
+			}
+			TreeItemFormatter storageItem(*m_topItem, 1);
+			storageItem.setTextFld(0, storageName);
+			if(settings.contains(storageName))
+			   storageItem.widget()->setExpanded(settings.value(storageName).toBool());
+			else
+			   storageItem.widget()->setExpanded(true);
+
+			int index = 1;
+			QStringListIterator fld(fieldlist);
+
+			/* storage id */
+			storageItem.setNumericFld(index++, fld.next());
+
+			/* changer */
+			QString changer = fld.next();
+			storageItem.setBoolFld(index++, changer);
+
+			if (changer == "1") {
+			   mediaList(storageItem.widget(), fieldlist.first());
+			}
+		 }
+	  }
    }
    /* Resize the columns */
    for(int cnter=0; cnter<headerlist.size(); cnter++) {
-      mp_treeWidget->resizeColumnToContents(cnter);
+	  mp_treeWidget->resizeColumnToContents(cnter);
    }
    m_firstpopulation = false;
 }
@@ -167,57 +167,57 @@ void Storage::populateTree()
 void Storage::mediaList(QTreeWidgetItem *parent, const QString &storageID)
 {
    QString query("SELECT Media.VolumeName AS Media, Media.Slot AS Slot,"
-                 " Media.VolStatus AS VolStatus, Media.Enabled AS Enabled,"
-                 " Pool.Name AS MediaPool, Media.MediaType AS MediaType"
-                 " From Media"
-                 " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
-                 " WHERE Media.StorageId='" + storageID + "'"
-                 " AND Media.InChanger<>0"
-                 " ORDER BY Media.Slot");
+				 " Media.VolStatus AS VolStatus, Media.Enabled AS Enabled,"
+				 " Pool.Name AS MediaPool, Media.MediaType AS MediaType"
+				 " From Media"
+				 " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
+				 " WHERE Media.StorageId='" + storageID + "'"
+				 " AND Media.InChanger<>0"
+				 " ORDER BY Media.Slot");
 
    QStringList results;
    /* This could be a log item */
    if (mainWin->m_sqlDebug) {
-      Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data());
+	  Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data());
    }
    if (m_console->sql_cmd(query, results)) {
-      QString resultline;
-      QString field;
-      QStringList fieldlist;
+	  QString resultline;
+	  QString field;
+	  QStringList fieldlist;
 
-      foreach (resultline, results) {
-         fieldlist = resultline.split("\t");
-         if (fieldlist.size() < 6) {
-             Pmsg1(0, "Discarding %s\n", resultline.data());
-             continue;
-         }
+	  foreach (resultline, results) {
+		 fieldlist = resultline.split("\t");
+		 if (fieldlist.size() < 6) {
+			 Pmsg1(0, "Discarding %s\n", resultline.data());
+			 continue;
+		 }
 
-         /* Iterate through fields in the record */
-         QStringListIterator fld(fieldlist);
-         int index = 0;
-         TreeItemFormatter fmt(*parent, 2);
+		 /* Iterate through fields in the record */
+		 QStringListIterator fld(fieldlist);
+		 int index = 0;
+		 TreeItemFormatter fmt(*parent, 2);
 
-         /* volname */
-         fmt.setTextFld(index++, fld.next());
+		 /* volname */
+		 fmt.setTextFld(index++, fld.next());
 
-         /* skip the next two columns, unused by media */
-         index += 2;
+		 /* skip the next two columns, unused by media */
+		 index += 2;
 
-         /* slot */
-         fmt.setNumericFld(index++, fld.next());
+		 /* slot */
+		 fmt.setNumericFld(index++, fld.next());
 
-         /* status */
-         fmt.setVolStatusFld(index++, fld.next());
+		 /* status */
+		 fmt.setVolStatusFld(index++, fld.next());
 
-         /* enabled */
-         fmt.setBoolFld(index++, fld.next());
+		 /* enabled */
+		 fmt.setBoolFld(index++, fld.next());
 
-         /* pool */
-         fmt.setTextFld(index++, fld.next());
+		 /* pool */
+		 fmt.setTextFld(index++, fld.next());
 
-         /* media type */
-         fmt.setTextFld(index++, fld.next());
-      }
+		 /* media type */
+		 fmt.setTextFld(index++, fld.next());
+	  }
    }
 }
 
@@ -228,11 +228,11 @@ void Storage::mediaList(QTreeWidgetItem *parent, const QString &storageID)
 void Storage::PgSeltreeWidgetClicked()
 {
    if(!m_populated) {
-      populateTree();
-      createContextMenu();
+	  populateTree();
+	  createContextMenu();
    }
    if (!isOnceDocked()) {
-      dockPage();
+	  dockPage();
    }
 }
 
@@ -244,59 +244,59 @@ void Storage::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetIte
 {
    /* m_checkcurwidget checks to see if this is during a refresh, which will segfault */
    if (m_checkcurwidget) {
-      /* The Previous item */
-      if (previouswidgetitem) { /* avoid a segfault if first time */
-         int treedepth = previouswidgetitem->data(0, Qt::UserRole).toInt();
-         if (treedepth == 1){
-            mp_treeWidget->removeAction(actionStatusStorageInConsole);
-            mp_treeWidget->removeAction(actionStatusStorageWindow);
-            mp_treeWidget->removeAction(actionLabelStorage);
-            mp_treeWidget->removeAction(actionMountStorage);
-            mp_treeWidget->removeAction(actionUnMountStorage);
-            mp_treeWidget->removeAction(actionUpdateSlots);
-            mp_treeWidget->removeAction(actionUpdateSlotsScan);
-            mp_treeWidget->removeAction(actionRelease);
-            mp_treeWidget->removeAction(actionImportStorage);
-         }
-      }
-
-      int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
-      if (treedepth == 1){
-         /* set a hold variable to the storage name in case the context sensitive
-          * menu is used */
-         m_currentStorage = currentwidgetitem->text(0);
-         m_currentAutoChanger = currentwidgetitem->text(2) == tr("Yes");
-         mp_treeWidget->addAction(actionStatusStorageInConsole);
-         mp_treeWidget->addAction(actionStatusStorageWindow);
-         mp_treeWidget->addAction(actionLabelStorage);
-         mp_treeWidget->addAction(actionMountStorage);
-         mp_treeWidget->addAction(actionUnMountStorage);
-         mp_treeWidget->addAction(actionRelease);
-         QString text;
-         text = tr("Status Storage \"%1\"").arg(m_currentStorage);;
-         actionStatusStorageInConsole->setText(text);
-         text = tr("Status Storage \"%1\" in Window").arg(m_currentStorage);;
-         actionStatusStorageWindow->setText(text);
-         text = tr("Label media in Storage \"%1\"").arg(m_currentStorage);
-         actionLabelStorage->setText(text);
-         text = tr("Mount media in Storage \"%1\"").arg(m_currentStorage);
-         actionMountStorage->setText(text);
-         text = tr("\"UN\" Mount media in Storage \"%1\"").arg(m_currentStorage);
-         actionUnMountStorage->setText(text);
-         text = tr("Release media in Storage \"%1\"").arg(m_currentStorage);
-         actionRelease->setText(text);
-         if (m_currentAutoChanger) {
-            mp_treeWidget->addAction(actionUpdateSlots);
-            mp_treeWidget->addAction(actionUpdateSlotsScan);
-            mp_treeWidget->addAction(actionImportStorage);
-            text = tr("Barcode Scan media in Storage \"%1\"").arg(m_currentStorage);
-            actionUpdateSlots->setText(text);
-            text = tr("Read scan media in Storage \"%1\"").arg( m_currentStorage);
-            actionUpdateSlotsScan->setText(text);
-            text = tr("Import volumes in Storage \"%1\"").arg(m_currentStorage);
-            actionImportStorage->setText(text);
-         }
-      }
+	  /* The Previous item */
+	  if (previouswidgetitem) { /* avoid a segfault if first time */
+		 int treedepth = previouswidgetitem->data(0, Qt::UserRole).toInt();
+		 if (treedepth == 1){
+			mp_treeWidget->removeAction(actionStatusStorageInConsole);
+			mp_treeWidget->removeAction(actionStatusStorageWindow);
+			mp_treeWidget->removeAction(actionLabelStorage);
+			mp_treeWidget->removeAction(actionMountStorage);
+			mp_treeWidget->removeAction(actionUnMountStorage);
+			mp_treeWidget->removeAction(actionUpdateSlots);
+			mp_treeWidget->removeAction(actionUpdateSlotsScan);
+			mp_treeWidget->removeAction(actionRelease);
+			mp_treeWidget->removeAction(actionImportStorage);
+		 }
+	  }
+
+	  int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
+	  if (treedepth == 1){
+		 /* set a hold variable to the storage name in case the context sensitive
+		  * menu is used */
+		 m_currentStorage = currentwidgetitem->text(0);
+		 m_currentAutoChanger = currentwidgetitem->text(2) == tr("Yes");
+		 mp_treeWidget->addAction(actionStatusStorageInConsole);
+		 mp_treeWidget->addAction(actionStatusStorageWindow);
+		 mp_treeWidget->addAction(actionLabelStorage);
+		 mp_treeWidget->addAction(actionMountStorage);
+		 mp_treeWidget->addAction(actionUnMountStorage);
+		 mp_treeWidget->addAction(actionRelease);
+		 QString text;
+		 text = tr("Status Storage \"%1\"").arg(m_currentStorage);;
+		 actionStatusStorageInConsole->setText(text);
+		 text = tr("Status Storage \"%1\" in Window").arg(m_currentStorage);;
+		 actionStatusStorageWindow->setText(text);
+		 text = tr("Label media in Storage \"%1\"").arg(m_currentStorage);
+		 actionLabelStorage->setText(text);
+		 text = tr("Mount media in Storage \"%1\"").arg(m_currentStorage);
+		 actionMountStorage->setText(text);
+		 text = tr("\"UN\" Mount media in Storage \"%1\"").arg(m_currentStorage);
+		 actionUnMountStorage->setText(text);
+		 text = tr("Release media in Storage \"%1\"").arg(m_currentStorage);
+		 actionRelease->setText(text);
+		 if (m_currentAutoChanger) {
+			mp_treeWidget->addAction(actionUpdateSlots);
+			mp_treeWidget->addAction(actionUpdateSlotsScan);
+			mp_treeWidget->addAction(actionImportStorage);
+			text = tr("Barcode Scan media in Storage \"%1\"").arg(m_currentStorage);
+			actionUpdateSlots->setText(text);
+			text = tr("Read scan media in Storage \"%1\"").arg( m_currentStorage);
+			actionUpdateSlotsScan->setText(text);
+			text = tr("Import volumes in Storage \"%1\"").arg(m_currentStorage);
+			actionImportStorage->setText(text);
+		 }
+	  }
    }
 }
 
@@ -310,38 +310,38 @@ void Storage::createContextMenu()
    mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
    mp_treeWidget->addAction(actionRefreshStorage);
    connect(mp_treeWidget, SIGNAL(
-           currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
-           this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
+		   currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
+		   this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
    /* connect to the action specific to this pages class */
    connect(actionRefreshStorage, SIGNAL(triggered()), this,
-                SLOT(populateTree()));
+				SLOT(populateTree()));
    connect(actionStatusStorageInConsole, SIGNAL(triggered()), this,
-                SLOT(consoleStatusStorage()));
+				SLOT(consoleStatusStorage()));
    connect(actionLabelStorage, SIGNAL(triggered()), this,
-                SLOT(consoleLabelStorage()));
+				SLOT(consoleLabelStorage()));
    connect(actionMountStorage, SIGNAL(triggered()), this,
-                SLOT(consoleMountStorage()));
+				SLOT(consoleMountStorage()));
    connect(actionUnMountStorage, SIGNAL(triggered()), this,
-                SLOT(consoleUnMountStorage()));
+				SLOT(consoleUnMountStorage()));
    connect(actionUpdateSlots, SIGNAL(triggered()), this,
-                SLOT(consoleUpdateSlots()));
+				SLOT(consoleUpdateSlots()));
    connect(actionUpdateSlotsScan, SIGNAL(triggered()), this,
-                SLOT(consoleUpdateSlotsScan()));
+				SLOT(consoleUpdateSlotsScan()));
    connect(actionImportStorage, SIGNAL(triggered()), this,
-                SLOT(consoleImportStorage()));
+				SLOT(consoleImportStorage()));
    connect(actionRelease, SIGNAL(triggered()), this,
-                SLOT(consoleRelease()));
+				SLOT(consoleRelease()));
    connect(actionStatusStorageWindow, SIGNAL(triggered()), this,
-                SLOT(statusStorageWindow()));
+				SLOT(statusStorageWindow()));
    connect(mp_treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
-           this, SLOT(contentWindow()));
+		   this, SLOT(contentWindow()));
 }
 
 void Storage::contentWindow()
 {
    if (m_currentStorage != "" && m_currentAutoChanger) {
-      QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-      new Content(m_currentStorage, parentItem);
+	  QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
+	  new Content(m_currentStorage, parentItem);
    }
 }
 
@@ -351,18 +351,18 @@ void Storage::contentWindow()
 void Storage::currentStackItem()
 {
    if (!m_populated || m_needs_repopulate) {
-      /*
-       * If things are not populated yet we do both
-       * the populate and create the context menu for the
-       * storage tree. When its a (Re)populate we only do
-       * a populateTree.
-       */
-      if (!m_populated) {
-         populateTree();
-         createContextMenu();
-      } else {
-         populateTree();
-      }
+	  /*
+	   * If things are not populated yet we do both
+	   * the populate and create the context menu for the
+	   * storage tree. When its a (Re)populate we only do
+	   * a populateTree.
+	   */
+	  if (!m_populated) {
+		 populateTree();
+		 createContextMenu();
+	  } else {
+		 populateTree();
+	  }
    }
 }
 
@@ -375,7 +375,7 @@ void Storage::consoleStatusStorage()
    QString cmd;
 
    cmd = QString("status storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    consoleCommand(cmd);
 }
@@ -390,17 +390,17 @@ void Storage::consoleLabelStorage()
 void Storage::consoleMountStorage()
 {
    if (m_currentAutoChanger == 0) {
-      /* no autochanger, just execute the command in the console */
-      QString cmd;
+	  /* no autochanger, just execute the command in the console */
+	  QString cmd;
 
-      cmd = QString("mount storage=\"%1\"")
-                    .arg(m_currentStorage);
+	  cmd = QString("mount storage=\"%1\"")
+					.arg(m_currentStorage);
 
-      consoleCommand(cmd);
+	  consoleCommand(cmd);
    } else {
-      setConsoleCurrent();
-      /* if this storage is an autochanger, lets ask for the slot */
-      new mountDialog(m_console, m_currentStorage);
+	  setConsoleCurrent();
+	  /* if this storage is an autochanger, lets ask for the slot */
+	  new mountDialog(m_console, m_currentStorage);
    }
 }
 
@@ -410,7 +410,7 @@ void Storage::consoleUnMountStorage()
    QString cmd;
 
    cmd = QString("umount storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    consoleCommand(cmd);
 }
@@ -421,13 +421,13 @@ void Storage::consoleUpdateSlots()
    QString cmd;
 
    cmd = QString("update slots storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    consoleCommand(cmd);
 
    /*
-    * Database is updated so (re)populate the view.
-    */
+	* Database is updated so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -437,13 +437,13 @@ void Storage::consoleUpdateSlotsScan()
    QString cmd;
 
    cmd = QString("update slots scan storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    consoleCommand(cmd);
 
    /*
-    * Database is updated so (re)populate the view.
-    */
+	* Database is updated so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -453,13 +453,13 @@ void Storage::consoleImportStorage()
    QString cmd;
 
    cmd = QString("import storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    consoleCommand(cmd);
 
    /*
-    * Volumes have moved so (re)populate the view.
-    */
+	* Volumes have moved so (re)populate the view.
+	*/
    m_needs_repopulate = true;
 }
 
@@ -469,7 +469,7 @@ void Storage::consoleRelease()
    QString cmd;
 
    cmd = QString("release storage=\"%1\"")
-                 .arg(m_currentStorage);
+				 .arg(m_currentStorage);
 
    consoleCommand(cmd);
 }
@@ -482,16 +482,16 @@ void Storage::statusStorageWindow()
    /* if one exists, then just set it current */
    bool found = false;
    foreach(Pages *page, mainWin->m_pagehash) {
-      if (mainWin->currentConsole() == page->console()) {
-         if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) {
-            found = true;
-            page->setCurrent();
-         }
-      }
+	  if (mainWin->currentConsole() == page->console()) {
+		 if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) {
+			found = true;
+			page->setCurrent();
+		 }
+	  }
    }
    if (!found) {
-      QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-      new StorStat(m_currentStorage, parentItem);
+	  QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
+	  new StorStat(m_currentStorage, parentItem);
    }
 }
 
@@ -504,8 +504,8 @@ void Storage::writeExpandedSettings()
    settings.beginGroup("StorageTreeExpanded");
    int childcount = m_topItem->childCount();
    for (int cnt=0; cnt<childcount; cnt++) {
-      QTreeWidgetItem *item = m_topItem->child(cnt);
-      settings.setValue(item->text(0), item->isExpanded());
+	  QTreeWidgetItem *item = m_topItem->child(cnt);
+	  settings.setValue(item->text(0), item->isExpanded());
    }
    settings.endGroup();
 }
@@ -521,16 +521,16 @@ void Storage::settingsOpenStatus(QString &storage)
    settings.beginGroup("OpenOnExit");
    QString toRead = "StorageStatus_" + storage;
    if (settings.value(toRead) == 1) {
-      if (mainWin->m_sqlDebug) {
-         Pmsg1(000, "Do open Storage Status window for : %s\n", storage.toUtf8().data());
-      }
-      new StorStat(storage, mainWin->getFromHash(this));
-      setCurrent();
-      mainWin->getFromHash(this)->setExpanded(true);
+	  if (mainWin->m_sqlDebug) {
+		 Pmsg1(000, "Do open Storage Status window for : %s\n", storage.toUtf8().data());
+	  }
+	  new StorStat(storage, mainWin->getFromHash(this));
+	  setCurrent();
+	  mainWin->getFromHash(this)->setExpanded(true);
    } else {
-      if (mainWin->m_sqlDebug) {
-         Pmsg1(000, "Do NOT open Storage Status window for : %s\n", storage.toUtf8().data());
-      }
+	  if (mainWin->m_sqlDebug) {
+		 Pmsg1(000, "Do NOT open Storage Status window for : %s\n", storage.toUtf8().data());
+	  }
    }
    settings.endGroup();
 }
diff --git a/src/qt-console/storage/storage.h b/src/qt-console/storage/storage.h
index 56eb28d..be731a9 100644
--- a/src/qt-console/storage/storage.h
+++ b/src/qt-console/storage/storage.h
@@ -27,6 +27,7 @@
 #define _STORAGE_H_
 
 #include <QtGui>
+
 #include "ui_storage.h"
 #include "pages.h"
 
diff --git a/src/qt-console/util/comboutil.cpp b/src/qt-console/util/comboutil.cpp
index e64222f..ce8acea 100644
--- a/src/qt-console/util/comboutil.cpp
+++ b/src/qt-console/util/comboutil.cpp
@@ -25,10 +25,9 @@
  * Riccardo Ghetta, May 2008
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QComboBox>
-#include <QString>
-#include <QStringList>
 #include "fmtwidgetitem.h"
 #include "comboutil.h"
 
@@ -40,7 +39,7 @@ void comboSel(QComboBox *combo, const QString &val)
 {
   int index = combo->findText(val, Qt::MatchExactly);
   if (index != -1) {
-     combo->setCurrentIndex(index);
+	 combo->setCurrentIndex(index);
   }
 }
 
@@ -50,7 +49,7 @@ void comboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname
 {
    int index = combo->currentIndex();
    if (index != -1 && combo->itemText(index) != QS_ANY) {
-      cndlist.append( QString("%1='%2'").arg(fldname).arg(combo->itemText(index)) );
+	  cndlist.append( QString("%1='%2'").arg(fldname).arg(combo->itemText(index)) );
    }
 }
 
@@ -67,8 +66,8 @@ void boolComboCond(QStringList &cndlist, const QComboBox *combo, const char *fld
 {
    int index = combo->currentIndex();
    if (index != -1 && combo->itemData(index).toInt() >= 0 ) {
-      QString cnd = combo->itemData(index).toString();
-      cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
+	  QString cnd = combo->itemData(index).toString();
+	  cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
    }
 }
 
@@ -92,8 +91,8 @@ void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fl
 {
    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) );
+	  QString cnd = combo->itemData(index).toChar();
+	  cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
    }
 }
 
@@ -101,36 +100,36 @@ void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fl
 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'};
+			  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]);
+	 combo->addItem(convertJobStatus( QString(js[pos]) ), js[pos]);
    }
 }
 
@@ -138,7 +137,7 @@ void jobStatusComboCond(QStringList &cndlist, const QComboBox *combo, const char
 {
    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) );
+	  QString cnd = combo->itemData(index).toChar();
+	  cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) );
    }
 }
diff --git a/src/qt-console/util/fmtwidgetitem.cpp b/src/qt-console/util/fmtwidgetitem.cpp
index 7cf775f..de78be0 100644
--- a/src/qt-console/util/fmtwidgetitem.cpp
+++ b/src/qt-console/util/fmtwidgetitem.cpp
@@ -25,13 +25,9 @@
  * Riccardo Ghetta, May 2008
  */
 
+#include <QtGui>
+
 #include "bat.h"
-#include <QTreeWidgetItem>
-#include <QTableWidget>
-#include <QTableWidgetItem>
-#include <QBrush>
-#include <QString>
-#include <QStringList>
 #include <math.h>
 #include "fmtwidgetitem.h"
 
@@ -45,7 +41,7 @@ QString convertJobStatus(const QString &sts)
 {
    QString code( sts.trimmed() );
    if ( code.size() != 1) {
-      return QObject::tr("Invalid job status %1").arg(sts);
+	  return QObject::tr("Invalid job status %1").arg(sts);
    }
 
    char buf[256];
@@ -65,8 +61,8 @@ qw(&q)
 Freeze::~Freeze()
 {
    if (qw) {
-      qw->setUpdatesEnabled(true);
-      qw->update();
+	  qw->setUpdatesEnabled(true);
+	  qw->update();
    }
 }
 
@@ -89,38 +85,38 @@ QString convertBytesIEC(qint64 qfld)
    static const qint64 EB = (PB * KB);
 
    /* note: division is integer, so to have some decimals we divide for a
-      smaller unit (e.g. GB for a TB number and so on) */
+	  smaller unit (e.g. GB for a TB number and so on) */
    char suffix;
    if (qfld >= EB) {
-      qfld /= PB;
-      suffix = 'E';
+	  qfld /= PB;
+	  suffix = 'E';
    }
    else if (qfld >= PB) {
-      qfld /= TB;
-      suffix = 'P';
+	  qfld /= TB;
+	  suffix = 'P';
    }
    else if (qfld >= TB) {
-      qfld /= GB;
-      suffix = 'T';
+	  qfld /= GB;
+	  suffix = 'T';
    }
    else if (qfld >= GB) {
-      qfld /= MB;
-      suffix = 'G';
+	  qfld /= MB;
+	  suffix = 'G';
    }
    else if (qfld >= MB) {
-      qfld /= KB;
-      suffix = 'M';
+	  qfld /= KB;
+	  suffix = 'M';
    }
    else if (qfld >= KB) {
-      suffix = 'K';
+	  suffix = 'K';
    }
    else  {
-      /* plain bytes, no need to reformat */
-      return QString("%1 B").arg(qfld);
+	  /* plain bytes, no need to reformat */
+	  return QString("%1 B").arg(qfld);
    }
 
    /* having divided for a smaller unit, now we can safely convert to double and
-      use the extra room for decimals */
+	  use the extra room for decimals */
    return QString("%1 %2iB").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix);
 }
 
@@ -135,38 +131,38 @@ QString convertBytesSI(qint64 qfld)
    static const qint64 EB = (PB * KB);
 
    /* note: division is integer, so to have some decimals we divide for a
-      smaller unit (e.g. GB for a TB number and so on) */
+	  smaller unit (e.g. GB for a TB number and so on) */
    char suffix;
    if (qfld >= EB) {
-      qfld /= PB;
-      suffix = 'E';
+	  qfld /= PB;
+	  suffix = 'E';
    }
    else if (qfld >= PB) {
-      qfld /= TB;
-      suffix = 'P';
+	  qfld /= TB;
+	  suffix = 'P';
    }
    else if (qfld >= TB) {
-      qfld /= GB;
-      suffix = 'T';
+	  qfld /= GB;
+	  suffix = 'T';
    }
    else if (qfld >= GB) {
-      qfld /= MB;
-      suffix = 'G';
+	  qfld /= MB;
+	  suffix = 'G';
    }
    else if (qfld >= MB) {
-      qfld /= KB;
-      suffix = 'M';
+	  qfld /= KB;
+	  suffix = 'M';
    }
    else if (qfld >= KB) {
-      suffix = 'k'; /* SI uses lowercase k */
+	  suffix = 'k'; /* SI uses lowercase k */
    }
    else  {
-      /* plain bytes, no need to reformat */
-      return QString("%1 B").arg(qfld);
+	  /* plain bytes, no need to reformat */
+	  return QString("%1 B").arg(qfld);
    }
 
    /* having divided for a smaller unit, now we can safely convert to double and
-      use the extra room for decimals */
+	  use the extra room for decimals */
    return QString("%1 %2B").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix);
 }
 
@@ -191,19 +187,19 @@ void ItemFormatterBase::setPercent(int index, float value)
    QString val = buf;
    QString pix;
    if (value < 8) {
-      pix = ":images/0p.png";
+	  pix = ":images/0p.png";
    } else if (value < 24) {
-      pix = ":images/16p.png";
+	  pix = ":images/16p.png";
    } else if (value < 40) {
-      pix = ":images/32p.png";
+	  pix = ":images/32p.png";
    } else if (value < 56) {
-      pix = ":images/48p.png";
+	  pix = ":images/48p.png";
    } else if (value < 72) {
-      pix = ":images/64p.png";
+	  pix = ":images/64p.png";
    } else if (value < 88) {
-      pix = ":images/80p.png";
+	  pix = ":images/80p.png";
    } else {
-      pix = ":images/96p.png";
+	  pix = ":images/96p.png";
    }
    setPixmap(index, QPixmap(pix), val);
    //setSortValue(index, (int) value);
@@ -214,7 +210,7 @@ void ItemFormatterBase::setPercent(int index, float value)
  * the tooltip stuff
  */
 void ItemFormatterBase::setPixmap(int index, const QPixmap &pix,
-                                  const QString & /* tip */)
+								  const QString & /* tip */)
 {
    setPixmap(index, pix);
 }
@@ -235,7 +231,7 @@ void ItemFormatterBase::setTextFld(int index, const QString &fld, bool center)
 {
    setText(index, fld.trimmed());
    if (center) {
-      setTextAlignment(index, Qt::AlignCenter);
+	  setTextAlignment(index, Qt::AlignCenter);
    }
 }
 
@@ -245,7 +241,7 @@ void ItemFormatterBase::setDateFld(int index, utime_t fld, bool center)
    bstrutime(buf, sizeof(buf), fld);
    setText(index, QString(buf).trimmed());
    if (center) {
-      setTextAlignment(index, Qt::AlignCenter);
+	  setTextAlignment(index, Qt::AlignCenter);
    }
 }
 
@@ -258,17 +254,17 @@ void ItemFormatterBase::setRightFld(int index, const QString &fld)
 void ItemFormatterBase::setBoolFld(int index, const QString &fld, bool center)
 {
    if (fld.trimmed().toInt())
-     setTextFld(index, QObject::tr("Yes"), center);
+	 setTextFld(index, QObject::tr("Yes"), center);
    else
-     setTextFld(index, QObject::tr("No"), center);
+	 setTextFld(index, QObject::tr("No"), center);
 }
 
 void ItemFormatterBase::setBoolFld(int index, int fld, bool center)
 {
    if (fld)
-     setTextFld(index, QObject::tr("Yes"), center);
+	 setTextFld(index, QObject::tr("Yes"), center);
    else
-     setTextFld(index, QObject::tr("No"), center);
+	 setTextFld(index, QObject::tr("No"), center);
 }
 
 void ItemFormatterBase::setNumericFld(int index, const QString &fld)
@@ -289,17 +285,17 @@ void ItemFormatterBase::setBytesFld(int index, const QString &fld)
    QString msg;
    switch (cnvFlag) {
    case BYTES_CONVERSION_NONE:
-      msg = QString::number(qfld);
-      break;
+	  msg = QString::number(qfld);
+	  break;
    case BYTES_CONVERSION_IEC:
-      msg = convertBytesIEC(qfld);
-      break;
+	  msg = convertBytesIEC(qfld);
+	  break;
    case BYTES_CONVERSION_SI:
-      msg = convertBytesSI(qfld);
-      break;
+	  msg = convertBytesSI(qfld);
+	  break;
    default:
-      msg = " ";
-      break;
+	  msg = " ";
+	  break;
    }
 
    setNumericFld(index, msg, QVariant(qfld));
@@ -319,30 +315,30 @@ void ItemFormatterBase::setDurationFld(int index, const QString &fld)
 
    char suffix = 's';
    if (dfld) {
-      for (int pos = 0 ; sufs[pos] ; ++pos) {
-          if (dfld % divs[pos] == 0) {
-             dfld /= divs[pos];
-             suffix = sufs[pos];
-             break;
-          }
-      }
+	  for (int pos = 0 ; sufs[pos] ; ++pos) {
+		  if (dfld % divs[pos] == 0) {
+			 dfld /= divs[pos];
+			 suffix = sufs[pos];
+			 break;
+		  }
+	  }
    }
    QString msg;
    if (dfld < 100) {
-      msg = QString("%1%2").arg(dfld).arg(suffix);
+	  msg = QString("%1%2").arg(dfld).arg(suffix);
    } else {
-      /* previous check returned a number too big. The original specification perhaps
-         was mixed, like 1d 2h, so we try to match with this routine */
-      dfld = fld.trimmed().toLongLong();
-      msg = "";
-      for (int pos = 0 ; sufs[pos] ; ++pos) {
-          if (dfld / divs[pos] != 0) {
-             msg += QString(" %1%2").arg(dfld / divs[pos]).arg(sufs[pos]);
-             dfld %= divs[pos];
-          }
-      }
-      if (dfld)
-         msg += QString(" %1s").arg(dfld);
+	  /* previous check returned a number too big. The original specification perhaps
+		 was mixed, like 1d 2h, so we try to match with this routine */
+	  dfld = fld.trimmed().toLongLong();
+	  msg = "";
+	  for (int pos = 0 ; sufs[pos] ; ++pos) {
+		  if (dfld / divs[pos] != 0) {
+			 msg += QString(" %1%2").arg(dfld / divs[pos]).arg(sufs[pos]);
+			 dfld %= divs[pos];
+		  }
+	  }
+	  if (dfld)
+		 msg += QString(" %1s").arg(dfld);
    }
 
    setNumericFld(index, msg, QVariant(fld.trimmed().toLongLong()));
@@ -354,13 +350,13 @@ void ItemFormatterBase::setVolStatusFld(int index, const QString &fld, bool cent
    setTextFld(index, volume_status_to_str(mp.toUtf8()), center);
 
    if (mp == "Append" ) {
-      setBackground(index, Qt::green);
+	  setBackground(index, Qt::green);
    } else if (mp == "Error") {
-      setBackground(index, Qt::red);
+	  setBackground(index, Qt::red);
    } else if (mp == "Used" || mp == "Full"){
-      setBackground(index, Qt::yellow);
+	  setBackground(index, Qt::yellow);
    } else if (mp == "Read-only" || mp == "Disabled"){
-      setBackground(index, Qt::lightGray);
+	  setBackground(index, Qt::lightGray);
    }
 }
 
@@ -375,11 +371,11 @@ void ItemFormatterBase::setJobStatusFld(int index, const QString &status, bool c
 
    QString st(status.trimmed());
    if (greenchars.contains(st, Qt::CaseSensitive)) {
-      setBackground(index, Qt::green);
+	  setBackground(index, Qt::green);
    } else if (redchars.contains(st, Qt::CaseSensitive)) {
-      setBackground(index, Qt::red);
+	  setBackground(index, Qt::red);
    } else if (yellowchars.contains(st, Qt::CaseSensitive)){
-      setBackground(index, Qt::yellow);
+	  setBackground(index, Qt::yellow);
    }
 }
 
@@ -387,9 +383,9 @@ void ItemFormatterBase::setJobTypeFld(int index, const QString &fld, bool center
 {
    QByteArray jtype(fld.trimmed().toAscii());
    if (jtype.size()) {
-      setTextFld(index, job_type_to_str(jtype[0]), center);
+	  setTextFld(index, job_type_to_str(jtype[0]), center);
    } else {
-      setTextFld(index, "", center);
+	  setTextFld(index, "", center);
    }
 }
 
@@ -397,9 +393,9 @@ void ItemFormatterBase::setJobLevelFld(int index, const QString &fld, bool cente
 {
    QByteArray lvl(fld.trimmed().toAscii());
    if (lvl.size()) {
-      setTextFld(index, job_level_to_str(lvl[0]), center);
+	  setTextFld(index, job_level_to_str(lvl[0]), center);
    } else {
-      setTextFld(index, "", center);
+	  setTextFld(index, "", center);
    }
 }
 
@@ -463,17 +459,17 @@ bool TableItemFormatter::BatSortingTableItem::operator< ( const QTableWidgetItem
    QVariant my = data(SORTDATA_ROLE);
    QVariant other = o.data(SORTDATA_ROLE);
    if (!my.isValid() || !other.isValid() || my.type() != other.type())
-      return QTableWidgetItem::operator< (o); /* invalid combination, revert to default sorting */
+	  return QTableWidgetItem::operator< (o); /* invalid combination, revert to default sorting */
 
    /* 64bit integers must be handled separately, others can be converted to double */
    if (QVariant::ULongLong == my.type()) {
-      return my.toULongLong() < other.toULongLong();
+	  return my.toULongLong() < other.toULongLong();
    } else if (QVariant::LongLong == my.type()) {
-      return my.toLongLong() < other.toLongLong();
+	  return my.toLongLong() < other.toLongLong();
    } else if (my.canConvert(QVariant::Double)) {
-      return my.toDouble() < other.toDouble();
+	  return my.toDouble() < other.toDouble();
    } else {
-      return QTableWidgetItem::operator< (o); /* invalid combination, revert to default sorting */
+	  return QTableWidgetItem::operator< (o); /* invalid combination, revert to default sorting */
    }
 }
 
@@ -500,14 +496,14 @@ void TableItemFormatter::setPixmap(int index, const QPixmap &pix)
 }
 
 void TableItemFormatter::setPixmap(int index, const QPixmap &pix,
-                                   const QString &tips)
+								   const QString &tips)
 {
 // Centered, but not sortable !
    QLabel *lbl = new QLabel();
    lbl->setAlignment(Qt::AlignCenter);
    lbl->setPixmap(pix);
    if (!tips.isEmpty()) {
-      lbl->setToolTip(tips);
+	  lbl->setToolTip(tips);
    }
    parent->setCellWidget(row, index, lbl);
 
-- 
1.8.3.1

tuxmaster

tuxmaster

2013-12-30 09:21

reporter  

tuxmaster

tuxmaster

2013-12-30 09:21

reporter  

0003-make-the-.pro-file-near-to-QtCreator-style.patch (4,225 bytes)   
From aa1ce57c45285981dc2d4dc7eea16e41bc1bc218 Mon Sep 17 00:00:00 2001
From: tuxmaster <frank@bart.netz-von-frank>
Date: Mon, 30 Dec 2013 01:09:44 +0100
Subject: [PATCH 3/3] - make the .pro file near to QtCreator style - make it
 ready for Qt 5

---
 src/qt-console/bat.pro.in | 100 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 69 insertions(+), 31 deletions(-)

diff --git a/src/qt-console/bat.pro.in b/src/qt-console/bat.pro.in
index bd19c95..2736fc6 100644
--- a/src/qt-console/bat.pro.in
+++ b/src/qt-console/bat.pro.in
@@ -6,6 +6,8 @@
 #
 #   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
 CONFIG += qt
 CONFIG -= debug_and_release
 CONFIG( debug, debug|release )  {
@@ -43,34 +45,60 @@ macx {
 }
 
 RESOURCES    = main.qrc
-MOC_DIR      = moc
-OBJECTS_DIR  = obj
-UI_DIR       = ui
+
+# make the build cleaner
+UI_DIR=tmp/ui
+MOC_DIR=tmp/moc
+OBJECTS_DIR=tmp/obj
+RCC_DIR=tmp/rcc
+
 
 # Main window
-FORMS += main.ui
-FORMS += prefs.ui
-FORMS += label/label.ui
-FORMS += relabel/relabel.ui
-FORMS += mount/mount.ui
-FORMS += console/console.ui
-FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
-FORMS += restore/runrestore.ui
-FORMS += restore/restoretree.ui
-FORMS += run/run.ui run/runcmd.ui run/estimate.ui run/prune.ui
-FORMS += select/select.ui select/textinput.ui
-FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
-FORMS += medialist/mediaview.ui
-FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui
-FORMS += joblog/joblog.ui jobs/jobs.ui job/job.ui
-FORMS += help/help.ui mediainfo/mediainfo.ui
-FORMS += status/dirstat.ui storage/content.ui
-FORMS += status/clientstat.ui
-FORMS += status/storstat.ui
+FORMS += main.ui \
+	 prefs.ui \
+	 label/label.ui \
+	 relabel/relabel.ui \
+	 mount/mount.ui \
+	 console/console.ui \
+	 restore/restore.ui \
+	 restore/prerestore.ui \
+	 restore/brestore.ui \
+	 restore/runrestore.ui \
+	 restore/restoretree.ui \
+	 run/run.ui \
+	 run/runcmd.ui \
+	 run/estimate.ui \
+	 run/prune.ui \
+	 select/select.ui \
+	 select/textinput.ui \
+	 medialist/medialist.ui \
+	 mediaedit/mediaedit.ui \
+	 joblist/joblist.ui \
+	 medialist/mediaview.ui \
+	 clients/clients.ui \
+	 storage/storage.ui \
+	 fileset/fileset.ui \
+	 joblog/joblog.ui \
+	 jobs/jobs.ui \
+	 job/job.ui \
+	 help/help.ui \
+	 mediainfo/mediainfo.ui \
+	 status/dirstat.ui \
+	 storage/content.ui \
+	 status/clientstat.ui \
+	 status/storstat.ui
 
 # Main directory
-HEADERS += mainwin.h bat.h bat_conf.h qstd.h pages.h
-SOURCES += main.cpp bat_conf.cpp mainwin.cpp qstd.cpp pages.cpp
+HEADERS += mainwin.h \
+	   bat.h \
+	   bat_conf.h \
+	   qstd.h \
+	   pages.h
+SOURCES += main.cpp \
+	   bat_conf.cpp \
+	   mainwin.cpp \
+	   qstd.cpp \
+	   pages.cpp
 
 # bcomm
 HEADERS += bcomm/dircomm.h
@@ -82,7 +110,9 @@ SOURCES += console/console.cpp
 
 # Restore
 HEADERS += restore/restore.h
-SOURCES += restore/prerestore.cpp restore/restore.cpp restore/brestore.cpp
+SOURCES += restore/prerestore.cpp \
+	   restore/restore.cpp \
+	   restore/brestore.cpp
 
 # Label dialog
 HEADERS += label/label.h
@@ -98,11 +128,16 @@ SOURCES += mount/mount.cpp
 
 # Run dialog
 HEADERS += run/run.h
-SOURCES += run/run.cpp run/runcmd.cpp run/estimate.cpp run/prune.cpp
+SOURCES += run/run.cpp \
+	   run/runcmd.cpp \
+	   run/estimate.cpp \
+	   run/prune.cpp
 
 # Select dialog
-HEADERS += select/select.h select/textinput.h
-SOURCES += select/select.cpp select/textinput.cpp
+HEADERS += select/select.h \
+	   select/textinput.h
+SOURCES += select/select.cpp \
+	   select/textinput.cpp
 
 ## MediaList
 HEADERS += medialist/medialist.h
@@ -173,11 +208,14 @@ HEADERS += status/storstat.h
 SOURCES += status/storstat.cpp
 
 # Utility sources
-HEADERS += util/fmtwidgetitem.h util/comboutil.h
-SOURCES += util/fmtwidgetitem.cpp util/comboutil.cpp
+HEADERS += util/fmtwidgetitem.h \
+	   util/comboutil.h
+SOURCES += util/fmtwidgetitem.cpp \
+	   util/comboutil.cpp
 
 INSTALLS = bins confs help icons desktopentries
 
 QMAKE_EXTRA_TARGETS += depend
 
-TRANSLATIONS += ts/bat_fr.ts ts/bat_de.ts
+TRANSLATIONS += ts/bat_fr.ts \
+		ts/bat_de.ts
-- 
1.8.3.1

pstorz

pstorz

2014-01-07 11:28

administrator   ~0000781

Hello tuxmaster,

first of all, thanks for subnmitting patches to our project.
To make it easier to communicate, I would like to ask you to fill in your complete name so that we can add your name to the AUTHORS file when we accept your code. It also makes communication much smoother than only talking to a synonym.

Now to your patches, I have two main points regarding them:

1.: INDENTATION:

The problem with your patches is, that the indentation of many lines that were not changed was altered, so that the patch is much bigger than what has really changed. Please do not change the indentation of code that was not changed, as this makes it very hard to see what was changed.

The standard for indentation in the whole bareos project is 3 spaces, so please use this standard also for new code that you write.


2.: DESCRIPTION

Could you please give us a rough overview what is the intention of your patches? What have you done and why? This would make it much easier to understand.

Thanks for supporting bareos, and I would be very happy if you could give us a short description what you are doing in your patches and send us patches that really only patch what was changed.

If you have any questions or suggestions, please tell me,

best regards,

Philipp
tuxmaster

tuxmaster

2014-01-26 12:44

reporter   ~0000797

Hello Philip,
for part 2. I think the bat tool must complete redesign, because it often crash and it don't use the modern MVF programming design. Bur until it is ready it must be keep alive so long it is possible. So I have try my best to get it working under Qt5 the successor of Qt4. The big different are only the part of the table widget. Where the function call's are get new names. This is why inside the code the #ifdef rules exits. And the other are only the new include files, because of the redesign of the gui part in Qt5.

For part one.
I think it comes form the QtCreator the official code editor from the Qt project, witch have it's own coding style.
pstorz

pstorz

2015-03-31 14:39

administrator   ~0001668

We will not put more effort into BAT

Issue History

Date Modified Username Field Change
2013-12-30 09:21 tuxmaster New Issue
2013-12-30 09:21 tuxmaster File Added: 0001-make-the-code-more-Qt-compliant.patch
2013-12-30 09:21 tuxmaster File Added: 0002-make-it-work-under-Qt-5.patch
2013-12-30 09:21 tuxmaster File Added: 0003-make-the-.pro-file-near-to-QtCreator-style.patch
2014-01-07 11:28 pstorz Note Added: 0000781
2014-01-07 11:28 pstorz Assigned To => pstorz
2014-01-07 11:28 pstorz Status new => feedback
2014-01-26 12:44 tuxmaster Note Added: 0000797
2014-01-26 12:44 tuxmaster Status feedback => assigned
2015-03-31 14:39 pstorz Note Added: 0001668
2015-03-31 14:39 pstorz Status assigned => closed
2015-03-31 14:39 pstorz Resolution open => fixed