From: Dirk H Bartley Date: Thu, 17 May 2007 02:52:41 +0000 (+0000) Subject: This gets the .mod command to run when the ok button has been pushed. Creates X-Git-Tag: Release-7.0.0~6329 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fd28460e8682bfc72d541e7f9853bc347ec2e045;p=bacula%2Fbacula This gets the .mod command to run when the ok button has been pushed. Creates a .mod command that puts in all the boxes except catalog and job. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4803 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/run/run.h b/bacula/src/qt-console/run/run.h index 9a8796aba8..ec55c726ea 100644 --- a/bacula/src/qt-console/run/run.h +++ b/bacula/src/qt-console/run/run.h @@ -35,6 +35,7 @@ public slots: private: void fill(); + QString m_dtformat; }; diff --git a/bacula/src/qt-console/run/runcmd.cpp b/bacula/src/qt-console/run/runcmd.cpp index a7c516b027..fe125fcbc0 100644 --- a/bacula/src/qt-console/run/runcmd.cpp +++ b/bacula/src/qt-console/run/runcmd.cpp @@ -48,6 +48,7 @@ */ runCmdPage::runCmdPage() { + m_dtformat = "yyyy-MM-dd HH:mm:ss"; m_name = "Restore Run"; pgInitialize(); setupUi(this); @@ -61,6 +62,7 @@ runCmdPage::runCmdPage() dockPage(); setCurrent(); this->show(); + } void runCmdPage::fill() @@ -69,6 +71,12 @@ void runCmdPage::fill() QStringList items; QRegExp rx("^.*:\\s*(\\S.*$)"); /* Regex to get value */ + clientCombo->addItems(m_console->client_list); + filesetCombo->addItems(m_console->fileset_list); + replaceCombo->addItems(QStringList() << "never" << "always" << "ifnewer" << "ifolder"); + storageCombo->addItems(m_console->storage_list); + dateTimeEdit->setDisplayFormat(m_dtformat); + m_console->read(); item = m_console->msg(); items = item.split("\n"); @@ -90,11 +98,11 @@ void runCmdPage::fill() continue; } if (item.startsWith("Backup Client:")) { - clientCombo->addItem(val); + clientCombo->setCurrentIndex(clientCombo->findText(val, Qt::MatchExactly)); continue; } if (item.startsWith("Storage:")) { - storageCombo->addItem(val); + storageCombo->setCurrentIndex(storageCombo->findText(val, Qt::MatchExactly)); continue; } if (item.startsWith("Where:")) { @@ -102,18 +110,26 @@ void runCmdPage::fill() continue; } if (item.startsWith("When:")) { + dateTimeEdit->setDateTime(QDateTime::fromString(val,m_dtformat)); continue; } if (item.startsWith("Catalog:")) { catalogCombo->addItem(val); continue; } - if (item.startsWith("Fileset:")) { - filesetCombo->addItem(val); + if (item.startsWith("FileSet:")) { + filesetCombo->setCurrentIndex(filesetCombo->findText(val, Qt::MatchExactly)); continue; } if (item.startsWith("Priority:")) { -// prioritySpin->setValue(atoi(val)); + bool okay; + int pri = val.toInt(&okay, 10); + if (okay) + prioritySpin->setValue(pri); + continue; + } + if (item.startsWith("Replace:")) { + replaceCombo->setCurrentIndex(replaceCombo->findText(val, Qt::MatchExactly)); continue; } } @@ -121,14 +137,22 @@ void runCmdPage::fill() void runCmdPage::okButtonPushed() { - - this->hide(); + QString cmd(".mod"); + cmd += " restoreclient=\"" + clientCombo->currentText() + "\""; + cmd += " fileset=\"" + filesetCombo->currentText() + "\""; + cmd += " storage=\"" + storageCombo->currentText() + "\""; + cmd += " replace=\"" + replaceCombo->currentText() + "\""; + cmd += " when=\"" + dateTimeEdit->dateTime().toString(m_dtformat) + "\""; + cmd += " bootstrap=\"" + bootstrap->text() + "\""; + cmd += " where=\"" + where->text() + "\""; + QString pri; + QTextStream(&pri) << "priority=\"" << prioritySpin->value() << "\""; + cmd += pri; + cmd += " yes\n"; - m_console->write_dir("yes"); - m_console->displayToPrompt(); + consoleCommand(cmd); m_console->notify(true); closeStackPage(); - mainWin->resetFocus(); } diff --git a/bacula/src/qt-console/run/runcmd.ui b/bacula/src/qt-console/run/runcmd.ui index 3176d9650e..9778231eb0 100644 --- a/bacula/src/qt-console/run/runcmd.ui +++ b/bacula/src/qt-console/run/runcmd.ui @@ -5,8 +5,8 @@ 0 0 - 678 - 386 + 704 + 466 @@ -19,8 +19,8 @@ 6 - - + + 0 @@ -28,91 +28,110 @@ 6 - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 131 - 25 - - - - - - - - - 16777215 - 30 - - - - <h3>Restore Run</h3> + + + 0 - - Qt::AlignCenter + + 6 - + + + + Priority: + + + prioritySpin + + + + + + + 10000 + + + 1 + + + 12 + + + + - Qt::Horizontal - - - QSizePolicy::Fixed + Qt::Vertical - 131 - 25 + 20 + 171 - - - - 0 + + + + Qt::Horizontal - - 6 + + + 40 + 20 + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - Cancel - - - - + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 572 + 16 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 572 + 16 + + + @@ -194,7 +213,7 @@ - false + true @@ -230,7 +249,7 @@ - false + true @@ -284,8 +303,8 @@ - - + + 0 @@ -293,139 +312,92 @@ 6 - - - 0 + + + Qt::Horizontal - - 6 + + + 40 + 20 + - - - - 10000 - - - 1 - - - 10 - - - - - - - - 5 - 0 - 0 - 0 - - - - - 150 - 0 - - - - - - - - Priority: - - - prioritySpin - - - - - - - Type: - - - typeCombo - - - - + + + + + OK + + + + + + + Cancel + + + + + + + + + 0 + + + 6 + - Qt::Vertical + Qt::Horizontal + + + QSizePolicy::Fixed - 20 - 171 + 131 + 25 + + + + + + + + + 16777215 + 30 + + + + <h3>Run Restore Job</h3> + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 131 + 25 - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 572 - 16 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 572 - 16 - - - -