]> git.sur5r.net Git - bacula/bacula/commitdiff
Implement restore job defs
authorKern Sibbald <kern@sibbald.com>
Wed, 21 Feb 2007 13:10:58 +0000 (13:10 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 21 Feb 2007 13:10:58 +0000 (13:10 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4229 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/restore/restore.cpp
bacula/src/qt-console/restore/restore.h
bacula/src/qt-console/run/run.cpp
bacula/src/qt-console/run/run.h

index 5e3d8a3422023f7c1f9667db4c94a327cd339739..f37891d1fb458243d81e78a3d435eded04f93533 100644 (file)
@@ -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));
+   }
+}
index 60210018cefd566e19383237dc2b7ff2a864545d..d5823d6d625d3328e730d4bda9bbe7e9f4b78148 100644 (file)
@@ -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:
 
index e8ac824b3eed1fa00d910fcb8c07e922c84fcb6f..82f1f2257bc8ba68c3cefb03bff286515d5843f3 100644 (file)
@@ -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);
+   }
+}
index 4d22b5fdf439a42ff98b1700b35650cf43eeb1ff..7feb08381e7f5626448f2a3797f4634c398bb18c 100644 (file)
@@ -16,6 +16,7 @@ public:
 public slots:
    void accept();
    void reject();
+   void job_name_change(int index);
 
 private:
    Console *m_console;