]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/console/console.cpp
Oops. When I changed the contents of the field earlier, I forgot to make this change
[bacula/bacula] / bacula / src / qt-console / console / console.cpp
index 6dea2901080351d2d21f0e26c9e686375a99cb08..f3e3ae4577eab9fb48e12721d91c410678cd96e2 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -34,7 +34,6 @@
  *
  */ 
 
-//#include <QAbstractEventDispatcher>
 #include "bat.h"
 #include "console.h"
 #include "restore.h"
@@ -104,6 +103,9 @@ void Console::poll_messages()
 void Console::terminate()
 {
    if (m_sock) {
+      notify(false);
+      delete m_notifier;
+      m_notifier = NULL;
       stopTimer();
       m_sock->close();
       m_sock = NULL;
@@ -119,6 +121,8 @@ void Console::connect_dir()
    utime_t heart_beat;
    char buf[1024];
    CONRES *cons;
+      
+   buf[0] = 0;
 
    m_textEdit = textEdit;   /* our console screen */
 
@@ -214,6 +218,7 @@ void Console::connect_dir()
       display_text(buf);
       goto bail_out;
    }
+
    if (buf[0]) {
       display_text(buf);
    }
@@ -626,11 +631,14 @@ int Console::read()
          }
       }
       switch (m_sock->msglen) {
-      case BNET_MSGS_PENDING:
-         if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n");
-         write_dir(".messages");
-         displayToPrompt();
-         m_messages_pending = false;
+      case BNET_MSGS_PENDING :
+         if (m_notifier->isEnabled()) {
+            if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n");
+            write_dir(".messages");
+            displayToPrompt();
+            m_messages_pending = false;
+         }
+         m_messages_pending = true;
          continue;
       case BNET_CMD_OK:
          if (mainWin->m_commDebug) Pmsg0(000, "CMD OK\n");
@@ -676,10 +684,21 @@ int Console::read()
          if (mainWin->m_commDebug) Pmsg0(000, "START SELECT\n");
          new selectDialog(this);    
          break;
+      case BNET_YESNO:
+         if (mainWin->m_commDebug) Pmsg0(000, "YESNO\n");
+         new yesnoPopUp(this);
+         break;
       case BNET_RUN_CMD:
          if (mainWin->m_commDebug) Pmsg0(000, "RUN CMD\n");
          new runCmdPage();
          break;
+      case BNET_START_RTREE:
+         if (mainWin->m_commDebug) Pmsg0(000, "START RTREE CMD\n");
+         new restorePage();
+         break;
+      case BNET_END_RTREE:
+         if (mainWin->m_commDebug) Pmsg0(000, "END RTREE CMD\n");
+         break;
       case BNET_ERROR_MSG:
          if (mainWin->m_commDebug) Pmsg0(000, "ERROR MSG\n");
          m_sock->recv();              /* get the message */
@@ -854,3 +873,41 @@ void Console::consoleReload()
    QString cmd("reload");
    consoleCommand(cmd);
 }
+
+/* Function to get a list of volumes */
+void Console::getVolumeList(QStringList &volumeList)
+{
+   QString query("SELECT VolumeName AS Media FROM Media ORDER BY Media");
+   if (mainWin->m_sqlDebug) {
+      Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
+   }
+   QStringList results;
+   if (sql_cmd(query, results)) {
+      QString field;
+      QStringList fieldlist;
+      /* Iterate through the lines of results. */
+      foreach (QString resultline, results) {
+         fieldlist = resultline.split("\t");
+         volumeList.append(fieldlist[0]);
+      } /* foreach resultline */
+   } /* if results from query */
+}
+
+/* Function to get a list of volumes */
+void Console::getStatusList(QStringList &statusLongList)
+{
+   QString statusQuery("SELECT JobStatusLong FROM Status");
+   if (mainWin->m_sqlDebug) {
+      Pmsg1(000, "Query cmd : %s\n",statusQuery.toUtf8().data());
+   }
+   QStringList statusResults;
+   if (sql_cmd(statusQuery, statusResults)) {
+      QString field;
+      QStringList fieldlist;
+      /* Iterate through the lines of results. */
+      foreach (QString resultline, statusResults) {
+         fieldlist = resultline.split("\t");
+         statusLongList.append(fieldlist[0]);
+      } /* foreach resultline */
+   } /* if results from statusquery */
+}