From: Eric Bollengier Date: Sat, 2 Oct 2010 20:06:03 +0000 (+0200) Subject: bat: Add new form to run a restore X-Git-Tag: Release-5.2.1~1056 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ae303dfee6e4421c663d0a41bedfd5adc95856ce;p=bacula%2Fbacula bat: Add new form to run a restore --- diff --git a/bacula/src/qt-console/restore/brestore.cpp b/bacula/src/qt-console/restore/brestore.cpp index 762329b7ca..65908b990a 100644 --- a/bacula/src/qt-console/restore/brestore.cpp +++ b/bacula/src/qt-console/restore/brestore.cpp @@ -311,6 +311,12 @@ void bRestore::clearRestoreList() RestoreList->setRowCount(0); } +void bRestore::runRestore() +{ + bRunRestore *r = new bRunRestore(this); + r->setVisible(true); +} + void bRestore::setupPage() { ClientList->addItem("Client list"); @@ -324,6 +330,7 @@ void bRestore::setupPage() connect(LocationBp, SIGNAL(pressed()), this, SLOT(applyLocation())); connect(MergeChk, SIGNAL(clicked()), this, SLOT(setJob())); connect(ClearBp, SIGNAL(clicked()), this, SLOT(clearRestoreList())); + connect(RestoreBp, SIGNAL(clicked()), this, SLOT(runRestore())); m_populated = true; } @@ -433,3 +440,63 @@ void bRestoreTable::dropEvent(QDropEvent *event) } } +void bRunRestore::UFRcb() +{ + if (UseFileRelocationChk->checkState() == Qt::Checked) { + WhereEntry->setEnabled(false); + UseRegexpChk->setEnabled(true); + if (UseRegexpChk->checkState() == Qt::Checked) { + AddSuffixEntry->setEnabled(false); + AddPrefixEntry->setEnabled(false); + StripPrefixEntry->setEnabled(false); + WhereRegexpEntry->setEnabled(true); + } else { + AddSuffixEntry->setEnabled(true); + AddPrefixEntry->setEnabled(true); + StripPrefixEntry->setEnabled(true); + WhereRegexpEntry->setEnabled(false); + } + } else { + WhereEntry->setEnabled(true); + AddSuffixEntry->setEnabled(false); + AddPrefixEntry->setEnabled(false); + StripPrefixEntry->setEnabled(false); + UseRegexpChk->setEnabled(false); + WhereRegexpEntry->setEnabled(false); + } +} + +void bRunRestore::useRegexp() +{ + if (UseRegexpChk->checkState() == Qt::Checked) { + AddSuffixEntry->setEnabled(false); + AddPrefixEntry->setEnabled(false); + StripPrefixEntry->setEnabled(false); + WhereRegexpEntry->setEnabled(true); + } else { + AddSuffixEntry->setEnabled(true); + AddPrefixEntry->setEnabled(true); + StripPrefixEntry->setEnabled(true); + WhereRegexpEntry->setEnabled(false); + } +} + +bRunRestore::bRunRestore(bRestore *parent) +{ + setupUi(this); + ClientCb->addItems(parent->console()->client_list); + int i = ClientCb->findText(parent->m_client); + if (i >= 0) { + ClientCb->setCurrentIndex(i); + } + StorageCb->addItem(QString("")); + RestoreCb->addItems(parent->console()->restore_list); + WhenEditor->setDateTime(QDateTime::currentDateTime()); + StorageCb->addItems(parent->console()->storage_list); + connect(UseFileRelocationChk, SIGNAL(clicked()), this, SLOT(UFRcb())); + connect(UseRegexpChk, SIGNAL(clicked()), this, SLOT(useRegexp())); + struct job_defaults jd; + jd.job_name = parent->console()->restore_list[0]; + parent->console()->get_job_defaults(jd); + WhereEntry->setText(jd.where); +} diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index 64c81e25cf..8280a5d6c6 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -36,7 +36,7 @@ #include #include "pages.h" - +#include "ui_runrestore.h" class bRestoreTable : public QTableWidget { @@ -141,6 +141,8 @@ public: bRestore(); ~bRestore(); void PgSeltreeWidgetClicked(); + QString m_client; + QString m_jobids; public slots: void setClient(); @@ -148,10 +150,9 @@ public slots: void showInfoForFile(QTableWidgetItem *); void applyLocation(); void clearVersions(QTableWidgetItem *); - + void clearRestoreList(); + void runRestore(); private: - QString m_client; - QString m_jobids; QString m_path; int64_t m_pathid; QTableWidgetItem *m_current; @@ -162,4 +163,16 @@ private: QString client, QString filename); }; +class bRunRestore : public QDialog, public Ui::bRunRestoreForm +{ + Q_OBJECT + +public: + bRunRestore(bRestore *parent); + ~bRunRestore() {} +public slots: + void useRegexp(); + void UFRcb(); +}; + #endif /* _RESTORE_H_ */ diff --git a/bacula/src/qt-console/restore/runrestore.ui b/bacula/src/qt-console/restore/runrestore.ui index e94d8923f9..558febdffe 100644 --- a/bacula/src/qt-console/restore/runrestore.ui +++ b/bacula/src/qt-console/restore/runrestore.ui @@ -1,13 +1,13 @@ - Dialog - + bRunRestoreForm + 0 0 385 - 437 + 438 @@ -30,7 +30,10 @@ Restore options - + + QFormLayout::ExpandingFieldsGrow + + Client: @@ -40,10 +43,10 @@ - + - + Where: @@ -53,10 +56,10 @@ - + - + Replace: @@ -66,10 +69,10 @@ - + - + Comment: @@ -79,7 +82,7 @@ - + @@ -218,34 +221,38 @@ regexp: Other options - + When: - + Priority: - - + + + + 10 + + - + Storage: - + - + + + + + Job: + + + + + + - label_5 - label_6 - label_7 - PrioritySb - StorageCb - groupBox_3 - WhenEditor @@ -290,7 +300,7 @@ regexp: buttonBox accepted() - Dialog + bRunRestoreForm accept() @@ -306,7 +316,7 @@ regexp: buttonBox rejected() - Dialog + bRunRestoreForm reject()