From: Kern Sibbald Date: Sun, 18 Feb 2007 14:25:13 +0000 (+0000) Subject: Get job defaults X-Git-Tag: Release-7.0.0~6875 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=83a8b2d1af3d18003840e6407065175c6f7a784f;p=bacula%2Fbacula Get job defaults git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4202 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 416cca7b11..73c2657834 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -62,7 +62,7 @@ Console::Console(QStackedWidget *parent) m_dir = (DIRRES *)GetNextRes(R_DIRECTOR, NULL); UnlockRes(); - /* Dummy setup of treeWidget */ + /* ***FIXME*** Dummy setup of treeWidget */ treeWidget->clear(); treeWidget->setColumnCount(1); treeWidget->setHeaderLabel("Selection"); @@ -182,20 +182,84 @@ QStringList Console::get_list(char *cmd) * Send a job name to the director, and read all the resulting * defaults. */ -bool Console::get_job_defaults(char *job_name, struct job_defaults &job_defs) +bool Console::get_job_defaults(struct job_defaults &job_defs) { char cmd[1000]; int stat; + char *def; setEnabled(false); - bsnprintf(cmd, sizeof(cmd), ".defaults job=\"%s\"", job_name); + bsnprintf(cmd, sizeof(cmd), ".defaults job=\"%s\"", job_defs.job_name); write(cmd); while ((stat = read()) > 0) { - strip_trailing_junk(msg()); - set_text(msg()); + def = strchr(msg(), '='); + if (!def) { + continue; + } + /* Pointer to default value */ + *def++ = 0; + strip_trailing_junk(def); + + if (strcmp(msg(), "job") == 0) { + if (strcmp(def, job_defs.job_name) != 0) { + goto bail_out; + } + continue; + } + if (strcmp(msg(), "pool") == 0) { + bstrncpy(job_defs.pool_name, def, sizeof(job_defs.pool_name)); + continue; + } + if (strcmp(msg(), "messages") == 0) { + bstrncpy(job_defs.messages_name, def, sizeof(job_defs.messages_name)); + continue; + } + if (strcmp(msg(), "client") == 0) { + bstrncpy(job_defs.client_name, def, sizeof(job_defs.client_name)); + continue; + } + if (strcmp(msg(), "storage") == 0) { + bstrncpy(job_defs.store_name, def, sizeof(job_defs.store_name)); + continue; + } + if (strcmp(msg(), "where") == 0) { + bstrncpy(job_defs.where, def, sizeof(job_defs.where)); + continue; + } + if (strcmp(msg(), "level") == 0) { + bstrncpy(job_defs.level, def, sizeof(job_defs.level)); + continue; + } + if (strcmp(msg(), "type") == 0) { + bstrncpy(job_defs.type, def, sizeof(job_defs.type)); + continue; + } + if (strcmp(msg(), "fileset") == 0) { + bstrncpy(job_defs.fileset_name, def, sizeof(job_defs.fileset_name)); + continue; + } + if (strcmp(msg(), "catalog") == 0) { + bstrncpy(job_defs.catalog_name, def, sizeof(job_defs.catalog_name)); + continue; + } + if (strcmp(msg(), "enabled") == 0) { + job_defs.enabled = *def == '1' ? true : false; + continue; + } } + bsnprintf(cmd, sizeof(cmd), "job=%s pool=%s client=%s storage=%s where=%s\n" + "level=%s type=%s fileset=%s catalog=%s enabled=%d\n", + job_defs.job_name, job_defs.pool_name, job_defs.client_name, + job_defs.pool_name, job_defs.messages_name, job_defs.store_name, + job_defs.where, job_defs.level, job_defs.type, job_defs.fileset_name, + job_defs.catalog_name, job_defs.enabled); + setEnabled(true); return true; + +bail_out: + setEnabled(true); + return false; } diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index eaea4fba41..c693c9ed6e 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -48,6 +48,7 @@ struct job_defaults { char messages_name[MAX_NAME_LENGTH]; char client_name[MAX_NAME_LENGTH]; char store_name[MAX_NAME_LENGTH]; + char where[MAX_NAME_LENGTH]; char level[MAX_NAME_LENGTH]; char type[MAX_NAME_LENGTH]; char fileset_name[MAX_NAME_LENGTH]; @@ -79,7 +80,7 @@ public: char *msg(); void setEnabled(bool enable) { m_notifier->setEnabled(enable); }; QStringList get_list(char *cmd); - bool get_job_defaults(char *job_name, struct job_defaults &); + bool get_job_defaults(struct job_defaults &); QStringList job_list; QStringList client_list; diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 58973fb6c1..c38923a6c4 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2007 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. @@ -27,9 +27,9 @@ */ /* - * Version $Id: $ + * Version $Id: restore.cpp 0 2007-02-12 10:39:38Z kerns $ * - * Restore Class (Eric's brestore) + * Restore Class * * Kern Sibbald, February MMVI * @@ -40,12 +40,14 @@ restoreDialog::restoreDialog(Console *parent) { + (void)parent; setupUi(this); this->show(); } prerestoreDialog::prerestoreDialog(Console *parent) { + (void)parent; setupUi(this); this->show(); } diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index b1b43f495d..60210018ce 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -4,7 +4,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2007 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.