4 Bacula(R) - The Network Backup Solution
6 Copyright (C) 2000-2016 Kern Sibbald
8 The original author of Bacula is Kern Sibbald, with contributions
9 from many others, a complete list can be found in the file AUTHORS.
11 You may use this file and others of this release according to the
12 license defined in the LICENSE file, which includes the Affero General
13 Public License, v3.0 ("AGPLv3") and some additional permissions and
14 terms pursuant to its AGPLv3 Section 7.
16 This notice must be preserved when any source code is
17 conveyed and/or propagated.
19 Bacula(R) is a registered trademark of Kern Sibbald.
22 * Kern Sibbald, January 2007
27 #include "ui_console.h"
28 #include "bcomm/dircomm.h"
30 #ifndef MAX_NAME_LENGTH
31 #define MAX_NAME_LENGTH 128
35 * Structure for obtaining the defaults for a job
40 QString messages_name;
56 class Console : public Pages, public Ui::ConsoleForm
62 Console(QTabWidget *parent);
66 void discardToPrompt(int conn);
67 int write(int conn, const char *msg);
68 int write(int conn, QString msg);
69 int notifyOff(); // enables/disables socket notification - returns the previous state
70 bool notify(int conn, bool enable); // enables/disables socket notification - returns the previous state
71 bool is_notify_enabled(int conn) const;
72 bool getDirComm(int &conn);
73 bool findDirComm(int &conn);
74 void displayToPrompt(int conn);
75 QString returnFromPrompt(int conn);
77 bool dir_cmd(int conn, const char *cmd, QStringList &results);
78 bool dir_cmd(const char *cmd, QStringList &results);
79 bool dir_cmd(QString &cmd, QStringList &results);
80 bool sql_cmd(const char *cmd, QStringList &results);
81 bool sql_cmd(QString &cmd, QStringList &results);
82 bool sql_cmd(int &conn, QString &cmd, QStringList &results);
83 bool sql_cmd(int &conn, const char *cmd, QStringList &results, bool donotify);
84 int write_dir(const char *buf);
85 int write_dir(const char *buf, bool dowait);
86 void write_dir(int conn, const char *buf);
87 void write_dir(int conn, const char *buf, bool dowait);
88 void getDirResName(QString &);
89 void setDirRes(DIRRES *dir);
92 void setDirectorTreeItem(QTreeWidgetItem *);
94 bool is_messagesPending() { return m_messages_pending; };
96 bool is_connected(int conn);
97 QTreeWidgetItem *directorTreeItem() { return m_directorTreeItem; };
99 void display_text(const char *buf);
100 void display_text(const QString buf);
101 void display_textf(const char *fmt, ...);
102 void display_html(const QString buf);
103 bool get_job_defaults(struct job_defaults &);
104 bool get_job_defaults(int &conn, struct job_defaults &);
105 const QFont get_font();
106 void beginNewCommand(int conn);
107 void populateLists(bool forcenew);
110 bool get_job_defaults(int &conn, struct job_defaults &, bool donotify);
111 void update_cursor(void);
113 bool is_connectedGui();
114 bool newDirComm(int &conn);
115 void populateLists(int conn);
118 QStringList job_list;
119 QStringList restore_list;
120 QStringList client_list;
121 QStringList fileset_list;
122 QStringList messages_list;
123 QStringList pool_list;
124 QStringList storage_list;
125 QStringList type_list;
126 QStringList level_list;
127 QStringList volstatus_list;
128 QStringList mediatype_list;
129 QStringList location_list;
133 void status_dir(void);
136 void poll_messages(void);
138 void consoleReload();
141 DIRRES *m_dir; /* so various pages can reference it */
142 bool m_warningPrevent;
145 QTextEdit *m_textEdit;
146 QTextCursor *m_cursor;
147 QTreeWidgetItem *m_directorTreeItem;
148 bool m_messages_pending;
150 bool messagesPending(bool pend);
152 QHash<int, DirComm*> m_dircommHash;
153 int m_dircommCounter;
156 #endif /* _CONSOLE_H_ */