From: Kern Sibbald Date: Mon, 26 Mar 2007 16:59:48 +0000 (+0000) Subject: Implement new dir_cmd() X-Git-Tag: Release-7.0.0~6695 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f99c665b55078ddcc65da198771b1ff2d542e3e1;p=bacula%2Fbacula Implement new dir_cmd() git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4430 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index ea29925880..7af520a198 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -138,39 +138,35 @@ void Console::connect() discardToPrompt(); beginNewCommand(); - job_list = get_list(".jobs"); - client_list = get_list(".clients"); - fileset_list = get_list(".filesets"); - messages_list = get_list(".messages"); - pool_list = get_list(".pools"); - storage_list = get_list(".storage"); - type_list = get_list(".types"); - level_list = get_list(".levels"); + dir_cmd(".jobs", job_list); + dir_cmd(".clients", client_list); + dir_cmd(".filesets", fileset_list); + dir_cmd(".messages", messages_list); + dir_cmd(".pools", pool_list); + dir_cmd(".storage", storage_list); + dir_cmd(".types", type_list); + dir_cmd(".levels", level_list); mainWin->set_status(_("Connected")); return; } - -/* - * Send a command to the director, and read all the resulting - * output into a list. - */ -QStringList Console::get_list(char *cmd) +bool Console::dir_cmd(const char *cmd, QStringList &results) { - QStringList list; int stat; notify(false); write(cmd); while ((stat = read()) > 0) { strip_trailing_junk(msg()); - list << msg(); + results << msg(); } notify(true); - return list; + discardToPrompt(); + return true; /* ***FIXME*** return any command error */ } + /* * Send a job name to the director, and read all the resulting * defaults. @@ -597,7 +593,7 @@ void Console::dosql(QString* sqlcmd, QStringList& strlstret) QString line = msg(); QRegExp regex("^Using Catalog"); if ( regex.indexIn(line) < 0 ){ - strlstret.append(line); + strlstret.append(line); } } } diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 1d76d5b40a..264651fe1f 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -76,6 +76,7 @@ public: void display_textf(const char *fmt, ...); void update_cursor(void); void write_dir(const char *buf); + bool dir_cmd(const char *cmd, QStringList &results); bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons); bool is_connected() { return m_sock != NULL; }; const QFont get_font();