]> git.sur5r.net Git - bacula/bacula/commitdiff
bat: Add new form to run a restore
authorEric Bollengier <eric@eb.homelinux.org>
Sat, 2 Oct 2010 20:06:03 +0000 (22:06 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Wed, 6 Oct 2010 09:11:01 +0000 (11:11 +0200)
bacula/src/qt-console/restore/brestore.cpp
bacula/src/qt-console/restore/restore.h
bacula/src/qt-console/restore/runrestore.ui

index 762329b7ca6c8b5ec21879bdb2429922d025135c..65908b990a6c79f8229555f2cad4b79863fbcfe4 100644 (file)
@@ -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);
+}
index 64c81e25cf43d16011ad5419b34f6b2250f4d907..8280a5d6c6027ca73475cd20239baa6763fed4d3 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <QtGui>
 #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_ */
index e94d8923f9b9f04e8fdeb5442a5f826b4a1e8dfb..558febdffef0cc8b0b82dfc6a04df8cc8934e637 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>Dialog</class>
- <widget class="QDialog" name="Dialog">
+ <class>bRunRestoreForm</class>
+ <widget class="QDialog" name="bRunRestoreForm">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>385</width>
-    <height>437</height>
+    <height>438</height>
    </rect>
   </property>
   <property name="windowTitle">
           <string>Restore options</string>
          </property>
          <layout class="QFormLayout" name="formLayout">
-          <item row="0" column="0">
+          <property name="fieldGrowthPolicy">
+           <enum>QFormLayout::ExpandingFieldsGrow</enum>
+          </property>
+          <item row="1" column="0">
            <widget class="QLabel" name="label">
             <property name="text">
              <string>Client:</string>
             </property>
            </widget>
           </item>
-          <item row="0" column="1">
+          <item row="1" column="1">
            <widget class="QComboBox" name="ClientCb"/>
           </item>
-          <item row="1" column="0">
+          <item row="2" column="0">
            <widget class="QLabel" name="label_2">
             <property name="text">
              <string>Where:</string>
             </property>
            </widget>
           </item>
-          <item row="1" column="1">
+          <item row="2" column="1">
            <widget class="QLineEdit" name="WhereEntry"/>
           </item>
-          <item row="2" column="0">
+          <item row="3" column="0">
            <widget class="QLabel" name="label_3">
             <property name="text">
              <string>Replace:</string>
             </property>
            </widget>
           </item>
-          <item row="2" column="1">
+          <item row="3" column="1">
            <widget class="QComboBox" name="ReplaceCb"/>
           </item>
-          <item row="3" column="0">
+          <item row="4" column="0">
            <widget class="QLabel" name="label_4">
             <property name="text">
              <string>Comment:</string>
@@ -79,7 +82,7 @@
             </property>
            </widget>
           </item>
-          <item row="3" column="1">
+          <item row="4" column="1">
            <widget class="QLineEdit" name="CommentEntry"/>
           </item>
          </layout>
@@ -218,34 +221,38 @@ regexp:</string>
           <string>Other options</string>
          </property>
          <layout class="QFormLayout" name="formLayout_3">
-          <item row="0" column="0">
+          <item row="2" column="0">
            <widget class="QLabel" name="label_5">
             <property name="text">
              <string>When:</string>
             </property>
            </widget>
           </item>
-          <item row="1" column="0">
+          <item row="3" column="0">
            <widget class="QLabel" name="label_6">
             <property name="text">
              <string>Priority:</string>
             </property>
            </widget>
           </item>
-          <item row="1" column="1">
-           <widget class="QSpinBox" name="PrioritySb"/>
+          <item row="3" column="1">
+           <widget class="QSpinBox" name="PrioritySb">
+            <property name="value">
+             <number>10</number>
+            </property>
+           </widget>
           </item>
-          <item row="3" column="0">
+          <item row="5" column="0">
            <widget class="QLabel" name="label_7">
             <property name="text">
              <string>Storage:</string>
             </property>
            </widget>
           </item>
-          <item row="3" column="1">
+          <item row="5" column="1">
            <widget class="QComboBox" name="StorageCb"/>
           </item>
-          <item row="0" column="1">
+          <item row="2" column="1">
            <widget class="QDateTimeEdit" name="WhenEditor">
             <property name="time">
              <time>
@@ -259,14 +266,17 @@ regexp:</string>
             </property>
            </widget>
           </item>
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_14">
+            <property name="text">
+             <string>Job:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QComboBox" name="RestoreCb"/>
+          </item>
          </layout>
-         <zorder>label_5</zorder>
-         <zorder>label_6</zorder>
-         <zorder>label_7</zorder>
-         <zorder>PrioritySb</zorder>
-         <zorder>StorageCb</zorder>
-         <zorder>groupBox_3</zorder>
-         <zorder>WhenEditor</zorder>
         </widget>
        </item>
       </layout>
@@ -290,7 +300,7 @@ regexp:</string>
   <connection>
    <sender>buttonBox</sender>
    <signal>accepted()</signal>
-   <receiver>Dialog</receiver>
+   <receiver>bRunRestoreForm</receiver>
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
@@ -306,7 +316,7 @@ regexp:</string>
   <connection>
    <sender>buttonBox</sender>
    <signal>rejected()</signal>
-   <receiver>Dialog</receiver>
+   <receiver>bRunRestoreForm</receiver>
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">