From 845fed839318e45116663db1b182f8d505c616c9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 21 Feb 2007 13:10:58 +0000 Subject: [PATCH] Implement restore job defs git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4229 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/restore/restore.cpp | 54 ++++++++++++++++++++++- bacula/src/qt-console/restore/restore.h | 5 +++ bacula/src/qt-console/run/run.cpp | 30 +++++++++---- bacula/src/qt-console/run/run.h | 1 + 4 files changed, 79 insertions(+), 11 deletions(-) diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 5e3d8a3422..f37891d1fb 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -45,9 +45,59 @@ restoreDialog::restoreDialog(Console *parent) this->show(); } -prerestoreDialog::prerestoreDialog(Console *parent) +prerestoreDialog::prerestoreDialog(Console *console) { - (void)parent; /* keep compiler quiet */ + m_console = console; /* keep compiler quiet */ setupUi(this); + jobCombo->addItems(console->job_list); + filesetCombo->addItems(console->fileset_list); + clientCombo->addItems(console->client_list); + poolCombo->addItems(console->pool_list); + storageCombo->addItems(console->storage_list); + job_name_change(0); + connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int))); + this->show(); } + +void prerestoreDialog::accept() +{ + QString cmd; + + this->hide(); + + cmd = QString( + "restore select current fileset=\"%1\" client=\"%2\" pool=\"%3\" " + "storage=\"%4\"\n") + .arg(filesetCombo->currentText()) + .arg(clientCombo->currentText()) + .arg(poolCombo->currentText()) + .arg(storageCombo->currentText()); + +// m_console->write(cmd); + m_console->display_text(cmd); + delete this; +} + + +void prerestoreDialog::reject() +{ + mainWin->set_status("Canceled"); + this->hide(); + delete this; +} + + +void prerestoreDialog::job_name_change(int index) +{ + job_defaults job_defs; + + (void)index; + job_defs.job_name = jobCombo->currentText(); + if (m_console->get_job_defaults(job_defs)) { + filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly)); + clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); + poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly)); + storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly)); + } +} diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index 60210018ce..d5823d6d62 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -49,8 +49,12 @@ public: prerestoreDialog(Console *parent); public slots: + void accept(); + void reject(); + void job_name_change(int index); private: + Console *m_console; }; @@ -62,6 +66,7 @@ public: restoreDialog(Console *parent); public slots: + private: diff --git a/bacula/src/qt-console/run/run.cpp b/bacula/src/qt-console/run/run.cpp index e8ac824b3e..82f1f2257b 100644 --- a/bacula/src/qt-console/run/run.cpp +++ b/bacula/src/qt-console/run/run.cpp @@ -39,7 +39,6 @@ runDialog::runDialog(Console *console) { QDateTime dt; - job_defaults job_defs; m_console = console; setupUi(this); @@ -50,14 +49,8 @@ runDialog::runDialog(Console *console) poolCombo->addItems(console->pool_list); storageCombo->addItems(console->storage_list); dateTimeEdit->setDateTime(dt.currentDateTime()); - job_defs.job_name = jobCombo->currentText(); - if (console->get_job_defaults(job_defs)) { - filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly)); - levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly)); - clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); - poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly)); - storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly)); - } + job_name_change(0); + connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int))); this->show(); } @@ -92,3 +85,22 @@ void runDialog::reject() this->hide(); delete this; } + +void runDialog::job_name_change(int index) +{ + job_defaults job_defs; + + (void)index; + job_defs.job_name = jobCombo->currentText(); + if (m_console->get_job_defaults(job_defs)) { + filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly)); + levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly)); + clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); + poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly)); + storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly)); + while (typeCombo->count() > 0) { + typeCombo->removeItem(0); + } + typeCombo->addItem(job_defs.type); + } +} diff --git a/bacula/src/qt-console/run/run.h b/bacula/src/qt-console/run/run.h index 4d22b5fdf4..7feb08381e 100644 --- a/bacula/src/qt-console/run/run.h +++ b/bacula/src/qt-console/run/run.h @@ -16,6 +16,7 @@ public: public slots: void accept(); void reject(); + void job_name_change(int index); private: Console *m_console; -- 2.39.5