]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/console/console.h
bat: Add restore job list in console
[bacula/bacula] / bacula / src / qt-console / console / console.h
index 295ebfeabb77fffe17aa42c8c89d8078c49907fe..8d23a6c035140f59f652f4ec7baf84987ab21138 100644 (file)
@@ -3,26 +3,26 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   modify it under the terms of version three of the GNU Affero General Public
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -36,6 +36,7 @@
 #include <QtGui>
 #include "pages.h"
 #include "ui_console.h"
+#include "bcomm/dircomm.h"
 
 #ifndef MAX_NAME_LENGTH
 #define MAX_NAME_LENGTH 128
@@ -58,52 +59,75 @@ struct job_defaults {
    bool enabled;
 };
 
-class DIRRES;
-class BSOCK;
-class JCR;
-class CONRES;
+//class DIRRES;
+//class BSOCK;
+//class JCR;
+//class CONRES;
 
 class Console : public Pages, public Ui::ConsoleForm
 {
    Q_OBJECT 
+   friend class DirComm;
 
 public:
-   Console(QStackedWidget *parent);
+   Console(QTabWidget *parent);
    ~Console();
-   void display_text(const char *buf);
-   void display_text(const QString buf);
-   void display_textf(const char *fmt, ...);
-   void display_html(const QString buf);
-   void update_cursor(void);
-   void write_dir(const char *buf);
+   int read(int conn);
+   char *msg(int conn);
+   void discardToPrompt(int conn);
+   int write(int conn, const char *msg);
+   int write(int conn, QString msg);
+   int notifyOff(); // enables/disables socket notification - returns the previous state
+   bool notify(int conn, bool enable); // enables/disables socket notification - returns the previous state
+   bool is_notify_enabled(int conn) const;
+   bool getDirComm(int &conn);  
+   bool findDirComm(int &conn);
+   void displayToPrompt(int conn);
+   QString returnFromPrompt(int conn);
+
+   bool dir_cmd(int conn, const char *cmd, QStringList &results);
    bool dir_cmd(const char *cmd, QStringList &results);
    bool dir_cmd(QString &cmd, QStringList &results);
    bool sql_cmd(const char *cmd, QStringList &results);
    bool sql_cmd(QString &cmd, QStringList &results);
-   bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, 
-          char *buf, int buflen);
-   bool is_connected() { return m_sock != NULL; };
-   bool is_connectedGui();
-   bool preventInUseConnect();
-   const QFont get_font();
+   bool sql_cmd(int &conn, QString &cmd, QStringList &results);
+   bool sql_cmd(int &conn, const char *cmd, QStringList &results, bool donotify);
+   int write_dir(const char *buf);
+   int write_dir(const char *buf, bool dowait);
+   void write_dir(int conn, const char *buf);
+   void write_dir(int conn, const char *buf, bool dowait);
+   void getDirResName(QString &);
+   void setDirRes(DIRRES *dir);
    void writeSettings();
    void readSettings();
-   char *msg();
-   void notify(bool enable);
-   QStringList get_list(char *cmd);
-   bool get_job_defaults(struct job_defaults &);
-   void terminate();
-   void beginNewCommand();
-   void displayToPrompt();
-   void discardToPrompt();
    void setDirectorTreeItem(QTreeWidgetItem *);
-   void setDirRes(DIRRES *dir);
+   void terminate();
+   bool is_messagesPending() { return m_messages_pending; };
+   bool is_connected();
+   bool is_connected(int conn);
    QTreeWidgetItem *directorTreeItem() { return m_directorTreeItem; };
-   void getDirResName(QString &);
    void startTimer();
+   void display_text(const char *buf);
+   void display_text(const QString buf);
+   void display_textf(const char *fmt, ...);
+   void display_html(const QString buf);
+   bool get_job_defaults(struct job_defaults &);
+   bool get_job_defaults(int &conn, struct job_defaults &);
+   const QFont get_font();
+   void beginNewCommand(int conn);
+   void populateLists(bool forcenew);
+
+private:
+   bool get_job_defaults(int &conn, struct job_defaults &, bool donotify);
+   void update_cursor(void);
    void stopTimer();
+   bool is_connectedGui();
+   bool newDirComm(int &conn);
+   void populateLists(int conn);
 
+public:
    QStringList job_list;
+   QStringList restore_list;
    QStringList client_list;
    QStringList fileset_list;
    QStringList messages_list;
@@ -111,34 +135,33 @@ public:
    QStringList storage_list;
    QStringList type_list;
    QStringList level_list;
-
+   QStringList volstatus_list;
+   QStringList mediatype_list;
+   QStringList location_list;
 
 public slots:
    void connect_dir();                     
-   void read_dir(int fd);
-   int read(void);
-   int write(const char *msg);
-   int write(QString msg);
    void status_dir(void);
    void messages(void);
    void set_font(void);
    void poll_messages(void);
    void consoleHelp();
+   void consoleReload();
 
 public:
    DIRRES *m_dir;                  /* so various pages can reference it */
+   bool m_warningPrevent;
 
 private:
    QTextEdit *m_textEdit;
-   BSOCK *m_sock;   
-   bool m_at_prompt;
-   bool m_at_main_prompt;
-   QSocketNotifier *m_notifier;
    QTextCursor *m_cursor;
    QTreeWidgetItem *m_directorTreeItem;
-   bool m_api_set;
    bool m_messages_pending;
    QTimer *m_timer;
+   bool messagesPending(bool pend);
+   bool hasFocus();
+   QHash<int, DirComm*> m_dircommHash;
+   int m_dircommCounter;
 };
 
 #endif /* _CONSOLE_H_ */