4 Bacula® - The Network Backup Solution
6 Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
8 The main author of Bacula is Kern Sibbald, with contributions from
9 many others, a complete list can be found in the file AUTHORS.
10 This program is Free Software; you can redistribute it and/or
11 modify it under the terms of version two of the GNU General Public
12 License as published by the Free Software Foundation and included
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Bacula® is a registered trademark of Kern Sibbald.
26 The licensor of Bacula is the Free Software Foundation Europe
27 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
28 Switzerland, email:ftf@fsfeurope.org.
33 * Kern Sibbald, January 2007
38 #include "ui_console.h"
40 #ifndef MAX_NAME_LENGTH
41 #define MAX_NAME_LENGTH 128
45 * Structure for obtaining the defaults for a job
50 QString messages_name;
66 class Console : public Pages, public Ui::ConsoleForm
71 Console(QStackedWidget *parent);
73 void display_text(const char *buf);
74 void display_text(const QString buf);
75 void display_textf(const char *fmt, ...);
76 void display_html(const QString buf);
77 void update_cursor(void);
78 void write_dir(const char *buf);
80 bool dir_cmd(const char *cmd, QStringList &results);
81 bool dir_cmd(QString &cmd, QStringList &results);
82 bool sql_cmd(const char *cmd, QStringList &results);
83 bool sql_cmd(QString &cmd, QStringList &results);
84 bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons,
85 char *buf, int buflen);
86 bool is_connected() { return m_sock != NULL; };
87 bool is_ready() { return is_connected() && m_at_prompt && m_at_main_prompt; };
88 bool is_connectedGui();
89 bool preventInUseConnect();
90 const QFont get_font();
94 bool notify(bool enable); // enables/disables socket notification - returns the previous state
95 bool is_notify_enabled() const;
96 QStringList get_list(char *cmd);
97 bool get_job_defaults(struct job_defaults &);
99 void beginNewCommand();
100 void displayToPrompt();
101 void discardToPrompt();
102 void setDirectorTreeItem(QTreeWidgetItem *);
103 void setDirRes(DIRRES *dir);
104 QTreeWidgetItem *directorTreeItem() { return m_directorTreeItem; };
105 void getDirResName(QString &);
108 void getVolumeList(QStringList &);
109 void getStatusList(QStringList &);
110 bool is_messagesPending() { return m_messages_pending; };
112 QStringList job_list;
113 QStringList client_list;
114 QStringList fileset_list;
115 QStringList messages_list;
116 QStringList pool_list;
117 QStringList storage_list;
118 QStringList type_list;
119 QStringList level_list;
124 void read_dir(int fd);
126 int write(const char *msg);
127 int write(QString msg);
128 void status_dir(void);
131 void poll_messages(void);
133 void consoleReload();
136 DIRRES *m_dir; /* so various pages can reference it */
139 QTextEdit *m_textEdit;
142 bool m_at_main_prompt;
143 QSocketNotifier *m_notifier;
144 QTextCursor *m_cursor;
145 QTreeWidgetItem *m_directorTreeItem;
147 bool m_messages_pending;
150 bool messagesPending(bool pend);
153 #endif /* _CONSOLE_H_ */