]> git.sur5r.net Git - bacula/bacula/commitdiff
Add context sensitive from page selector's console widget for: status dir,
authorDirk H Bartley <dbartley@schupan.com>
Sun, 27 May 2007 19:23:35 +0000 (19:23 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sun, 27 May 2007 19:23:35 +0000 (19:23 +0000)
messages and help.
Add purge jobs client= from clients
Add buttons to set automount on or off in the label dialog.
Add estimate dialog.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4920 91ce42f0-d328-0410-95d8-f526ca767f89

17 files changed:
bacula/src/qt-console/COMMANDS
bacula/src/qt-console/bat.pro.in
bacula/src/qt-console/clients/clients.cpp
bacula/src/qt-console/clients/clients.h
bacula/src/qt-console/clients/clients.ui
bacula/src/qt-console/console/console.cpp
bacula/src/qt-console/console/console.h
bacula/src/qt-console/console/console.ui
bacula/src/qt-console/label/label.cpp
bacula/src/qt-console/label/label.h
bacula/src/qt-console/label/label.ui
bacula/src/qt-console/main.ui
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/run/estimate.cpp [new file with mode: 0644]
bacula/src/qt-console/run/estimate.ui [new file with mode: 0644]
bacula/src/qt-console/run/run.h

index 0d2c16065e0221c22c0efa37d0cdea96d58a0364..f2ffca09dbde2248ef9bb2d4a9a735c1f0d2d2d8 100644 (file)
@@ -1,41 +1,26 @@
-autodisplay on/off
-could be done in the context of the console
-
-automount on/off
-could be done in the context of the console, because is for after a label
-command as opposed to a property of a storage device
-
 cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>]
 To be done in the context of a status dir graphical window.
+Also in a "job resources window for job-name".
 
 delete pool=<pool-name>
+   should ask if this would have bad effects if say media existed in the pool
+   the pool existed in the configuration file.
 
 disable job<job-name>     and     enable job<job-name>
-Could be done in the context of a jobs window which is not yet created
+Could be done in the context of a jobs resource window which is not yet created
 
 estimate
 Could be a dialog in the context of a jobs window.
 
-help
-could be in the console window
-
 list
 many are done or are reproduced by having windows
 
 llist
 same as list
 
-python
-not needed from bat??
-
 prune files|jobs|volume client=<client-name> volume=<volume-name>
 Should add as a dialog box from both client and medialist
 
-purge files jobid=<jobid>|job=<job-name>|client=<client-name>
-purge jobs client=<client-name> (of all jobs)
-purge volume|volume=<vol-name> (of all jobs)
-  this one is done from media
-
 release storage=<storage-name>
 Would need to explain what this does in bat with a dialog
 
@@ -86,14 +71,32 @@ These are done from config files
 create [pool=<pool-name>]
 Done in a config file
 
+CHOOSE NOT TO (for now at least)
+===========================
+autodisplay on/off
+could be done in the context of the console
+   This may interfere with our connection issues
+   Also, there is a configurable qt timer to automatically ask for messages
+
+python
+not needed from bat??
 
 DONE
 ===========================
+automount on/off
+Added buttons to the label dialog box to execute automount command
+
+delete [volume=<vol-name> job jobid=<id>]
+
+help
+could be in the console window
 
 label
 Done by kern before I started
 
-delete [volume=<vol-name> job jobid=<id>]
+purge files jobid=<jobid>|job=<job-name>|client=<client-name>
+purge volume|volume=<vol-name> (of all jobs)
+purge jobs client=<client-name> (of all jobs)
 
 relabel
 done
index 7b0edb3e1d2e421495420e7b73ca77c3b29dedeb..587cb9d6ae36e69c818c2f19143b5a842dc9c990 100644 (file)
@@ -35,7 +35,7 @@ FORMS += relabel/relabel.ui
 FORMS += mount/mount.ui
 FORMS += console/console.ui
 FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
-FORMS += run/run.ui run/runcmd.ui
+FORMS += run/run.ui run/runcmd.ui run/estimate.ui
 FORMS += select/select.ui
 FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
 FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui
@@ -67,7 +67,7 @@ SOURCES += mount/mount.cpp
 
 # Run dialog
 HEADERS += run/run.h
-SOURCES += run/run.cpp run/runcmd.cpp
+SOURCES += run/run.cpp run/runcmd.cpp run/estimate.cpp
 
 # Select dialog
 HEADERS += select/select.h
index 362400e894f94e09c488dc47e1248d3d2d72d566..3e7b5889115905172c9d22ec79ae6f92d75f751e 100644 (file)
@@ -158,6 +158,7 @@ void Clients::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetIte
          if (treedepth == 1){
             mp_treeWidget->removeAction(actionListJobsofClient);
             mp_treeWidget->removeAction(actionStatusClientInConsole);
+            mp_treeWidget->removeAction(actionPurgeJobs);
          }
       }
 
@@ -168,6 +169,7 @@ void Clients::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetIte
          m_currentlyselected=currentwidgetitem->text(0);
          mp_treeWidget->addAction(actionListJobsofClient);
          mp_treeWidget->addAction(actionStatusClientInConsole);
+         mp_treeWidget->addAction(actionPurgeJobs);
       }
    }
 }
@@ -191,6 +193,8 @@ void Clients::createContextMenu()
                 SLOT(showJobs()));
    connect(actionStatusClientInConsole, SIGNAL(triggered()), this,
                 SLOT(consoleStatusClient()));
+   connect(actionPurgeJobs, SIGNAL(triggered()), this,
+                SLOT(consolePurgeJobs()));
 }
 
 /*
@@ -231,3 +235,28 @@ void Clients::currentStackItem()
       m_populated=true;
    }
 }
+
+/*
+ * Function responding to actionPurgeJobs 
+ */
+void Clients::consolePurgeJobs()
+{
+   if (QMessageBox::warning(this, tr("Bat"),
+      tr("Are you sure you want to purge ??  !!!.\n"
+"The Purge command will delete associated Catalog database records from Jobs and"
+" Volumes without considering the retention period. Purge  works only on the"
+" Catalog database and does not affect data written to Volumes. This command can"
+" be dangerous because you can delete catalog records associated with current"
+" backups of files, and we recommend that you do not use it unless you know what"
+" you are doing.\n\n"
+" Is there any way I can get you to Click cancel here.  You really don't want to do"
+" this\n\n"
+      "Press OK to proceed with the purge operation?"),
+      QMessageBox::Ok | QMessageBox::Cancel)
+      == QMessageBox::Cancel) { return; }
+
+   QString cmd("purge jobs client=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
index 5f0044549168beb36b2312fa362b926871757ffb..ea07fb03d8d479ec3fefc51af597335852ebdb05 100644 (file)
@@ -56,6 +56,7 @@ private slots:
    void populateTree();
    void showJobs();
    void consoleStatusClient();
+   void consolePurgeJobs();
 
 private:
    void createContextMenu();
index d8bb76a20f113db04c68afa0dc73dc536be796d5..8311bc39538d7208adfa64c1d21ac9a0bffff2d6 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>763</width>
-    <height>650</height>
+    <width>413</width>
+    <height>258</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -25,7 +25,7 @@
   </layout>
   <action name="actionRefreshClients" >
    <property name="icon" >
-    <iconset>:images/run.png</iconset>
+    <iconset>../../../../../../../:images/run.png</iconset>
    </property>
    <property name="text" >
     <string>Refresh Client List</string>
@@ -36,7 +36,7 @@
   </action>
   <action name="actionListJobsofClient" >
    <property name="icon" >
-    <iconset>:images/unmark.png</iconset>
+    <iconset>../../../../../../../:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>List Jobs of Client</string>
   </action>
   <action name="actionStatusClientInConsole" >
    <property name="icon" >
-    <iconset>:images/status.png</iconset>
+    <iconset>../../../../../../../:images/status.png</iconset>
    </property>
    <property name="text" >
     <string>Status Client In Console</string>
    </property>
   </action>
+  <action name="actionPurgeJobs" >
+   <property name="text" >
+    <string>Purge Jobs</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections/>
index 5895c25f2185b054a97d54cefe23b4ab9745ae79..f9f96a7cf4f1caec0eb5dd5b04cd39bc69f80256 100644 (file)
@@ -60,6 +60,12 @@ Console::Console(QStackedWidget *parent)
    mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png"));
 
    m_timer = NULL;
+   m_contextActions.append(actionStatusDir);
+   m_contextActions.append(actionConsoleHelp);
+   m_contextActions.append(actionRequestMessages);
+   connect(actionStatusDir, SIGNAL(triggered()), this, SLOT(status_dir()));
+   connect(actionConsoleHelp, SIGNAL(triggered()), this, SLOT(consoleHelp()));
+   connect(actionRequestMessages, SIGNAL(triggered()), this, SLOT(messages()));
 }
 
 Console::~Console()
@@ -816,3 +822,10 @@ static int tls_pem_callback(char *buf, int size, const void *userdata)
    return 0;
 #endif
 }
+
+/* Slot for responding to page selectors status help command */
+void Console::consoleHelp()
+{
+   QString cmd("help");
+   consoleCommand(cmd);
+}
index 3744bc1ec39dd4ccc6a40fa3b1b002e6fa1d7e1c..295ebfeabb77fffe17aa42c8c89d8078c49907fe 100644 (file)
@@ -123,6 +123,7 @@ public slots:
    void messages(void);
    void set_font(void);
    void poll_messages(void);
+   void consoleHelp();
 
 public:
    DIRRES *m_dir;                  /* so various pages can reference it */
index ea346108b27aa476806b806dae0580bcffca955f..d4b9c4bc1a540af0beda5c34defd0dec0f79d8d5 100644 (file)
     </widget>
    </item>
   </layout>
+  <action name="actionStatusDir" >
+   <property name="icon" >
+    <iconset>../images/status.png</iconset>
+   </property>
+   <property name="text" >
+    <string>StatusDir</string>
+   </property>
+  </action>
+  <action name="actionConsoleHelp" >
+   <property name="text" >
+    <string>ConsoleHelp</string>
+   </property>
+  </action>
+  <action name="actionRequestMessages" >
+   <property name="text" >
+    <string>Request Messages</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections/>
index b4c0ad83659fdcba4a549854d0a4abc71753b881..3f4384c7e75e404457ae927a69f729e6e98647fd 100644 (file)
@@ -72,6 +72,8 @@ void labelPage::showPage(QString &defString)
    poolCombo->addItems(m_console->pool_list);
    connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
    connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
+   connect(automountOnButton, SIGNAL(pressed()), this, SLOT(automountOnButtonPushed()));
+   connect(automountOffButton, SIGNAL(pressed()), this, SLOT(automountOffButtonPushed()));
    dockPage();
    setCurrent();
    this->show();
@@ -109,3 +111,17 @@ void labelPage::cancelButtonPushed()
    closeStackPage();
    mainWin->resetFocus();
 }
+
+/* turn automount on */
+void labelPage::automountOnButtonPushed()
+{
+   QString cmd("automount on");
+   consoleCommand(cmd);
+}
+
+/* turn automount off */
+void labelPage::automountOffButtonPushed()
+{
+   QString cmd("automount off");
+   consoleCommand(cmd);
+}
index ac97c8f7fd3ea4a7134d103237f35032b2e5f481..2828fd5ec035d7388781facffff8ef49a95d6605 100644 (file)
@@ -49,6 +49,8 @@ public:
 private slots:
    void okButtonPushed();
    void cancelButtonPushed();
+   void automountOnButtonPushed();
+   void automountOffButtonPushed();
 
 private:
 };
index ed81225c8982a876229f6a9c1d512a361a411e4d..c0fe5741ce1057ed9760e3e01859320c20b1635e 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>498</width>
-    <height>308</height>
+    <width>560</width>
+    <height>357</height>
    </rect>
   </property>
   <property name="windowTitle" >
      </property>
      <property name="sizeHint" >
       <size>
-       <width>351</width>
-       <height>20</height>
+       <width>421</width>
+       <height>48</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="1" column="2" >
+   <item row="2" column="1" >
     <spacer>
      <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
      </property>
      <property name="sizeHint" >
       <size>
-       <width>40</width>
-       <height>131</height>
+       <width>431</width>
+       <height>48</height>
       </size>
      </property>
     </spacer>
      <property name="spacing" >
       <number>6</number>
      </property>
-     <item row="4" column="1" >
-      <widget class="QSpinBox" name="slotSpin" >
-       <property name="maximum" >
-        <number>10000</number>
-       </property>
-      </widget>
-     </item>
      <item row="5" column="0" colspan="2" >
       <layout class="QHBoxLayout" >
        <property name="margin" >
        </item>
       </layout>
      </item>
+     <item row="3" column="0" >
+      <widget class="QLabel" name="label_5" >
+       <property name="text" >
+        <string>Volume Name:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>volumeName</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" >
+      <widget class="QComboBox" name="poolCombo" />
+     </item>
+     <item row="1" column="0" >
+      <widget class="QLabel" name="label_2" >
+       <property name="text" >
+        <string>Storage:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>storageCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="1" >
+      <widget class="QLineEdit" name="volumeName" >
+       <property name="minimumSize" >
+        <size>
+         <width>200</width>
+         <height>0</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="1" >
+      <widget class="QSpinBox" name="slotSpin" >
+       <property name="maximum" >
+        <number>10000</number>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="0" >
+      <widget class="QLabel" name="label_4" >
+       <property name="text" >
+        <string>Slot:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>slotSpin</cstring>
+       </property>
+      </widget>
+     </item>
+     <item rowspan="6" row="0" column="2" >
+      <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <widget class="QLabel" name="label_6" >
+         <property name="text" >
+          <string>Execute Automount</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="automountOnButton" >
+         <property name="text" >
+          <string>On</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="automountOffButton" >
+         <property name="text" >
+          <string>Off</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>61</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+     <item row="1" column="1" >
+      <widget class="QComboBox" name="storageCombo" />
+     </item>
+     <item row="2" column="0" >
+      <widget class="QLabel" name="label_3" >
+       <property name="text" >
+        <string>Pool:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>poolCombo</cstring>
+       </property>
+      </widget>
+     </item>
      <item row="0" column="0" colspan="2" >
       <layout class="QHBoxLayout" >
        <property name="margin" >
@@ -152,65 +255,9 @@ p, li { white-space: pre-wrap; }
        </item>
       </layout>
      </item>
-     <item row="2" column="1" >
-      <widget class="QComboBox" name="poolCombo" />
-     </item>
-     <item row="1" column="0" >
-      <widget class="QLabel" name="label_2" >
-       <property name="text" >
-        <string>Storage:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>storageCombo</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="4" column="0" >
-      <widget class="QLabel" name="label_4" >
-       <property name="text" >
-        <string>Slot:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>slotSpin</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="1" >
-      <widget class="QLineEdit" name="volumeName" >
-       <property name="minimumSize" >
-        <size>
-         <width>200</width>
-         <height>0</height>
-        </size>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1" >
-      <widget class="QComboBox" name="storageCombo" />
-     </item>
-     <item row="2" column="0" >
-      <widget class="QLabel" name="label_3" >
-       <property name="text" >
-        <string>Pool:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>poolCombo</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="0" >
-      <widget class="QLabel" name="label_5" >
-       <property name="text" >
-        <string>Volume Name:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>volumeName</cstring>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
-   <item row="1" column="0" >
+   <item row="1" column="2" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
@@ -218,23 +265,20 @@ p, li { white-space: pre-wrap; }
      <property name="sizeHint" >
       <size>
        <width>40</width>
-       <height>121</height>
+       <height>131</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="2" column="1" >
+   <item row="1" column="0" >
     <spacer>
      <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
+      <enum>Qt::Horizontal</enum>
      </property>
      <property name="sizeHint" >
       <size>
-       <width>331</width>
-       <height>20</height>
+       <width>40</width>
+       <height>121</height>
       </size>
      </property>
     </spacer>
index 813686036b6cad672ef36956d566578d21d35b1f..9bc9687b5c001e3d5385f66c0ed81e81b19b6eb3 100644 (file)
    <addaction name="actionRestore" />
    <addaction name="actionRun" />
    <addaction name="actionUndock" />
+   <addaction name="actionEstimate" />
   </widget>
   <widget class="QDockWidget" name="dockWidget" >
    <property name="sizePolicy" >
     <string>Run a Job</string>
    </property>
   </action>
+  <action name="actionEstimate" >
+   <property name="checked" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset>:images/run.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Estimate Job</string>
+   </property>
+   <property name="iconText" >
+    <string>Estimate Job</string>
+   </property>
+   <property name="toolTip" >
+    <string>Estimate Job</string>
+   </property>
+   <property name="statusTip" >
+    <string>Estimate a Job</string>
+   </property>
+  </action>
   <action name="actionStatusDir" >
    <property name="icon" >
     <iconset>:images/status.png</iconset>
index a56c8c68c1668a237af5abfc2393e589af9185b3..4ba65496d0041433957052e5471effa5956c0abd 100644 (file)
@@ -282,6 +282,7 @@ void MainWin::createConnections()
    connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
    connect(actionLabel, SIGNAL(triggered()), this,  SLOT(labelButtonClicked()));
    connect(actionRun, SIGNAL(triggered()), this,  SLOT(runButtonClicked()));
+   connect(actionEstimate, SIGNAL(triggered()), this,  SLOT(estimateButtonClicked()));
    connect(actionRestore, SIGNAL(triggered()), this,  SLOT(restoreButtonClicked()));
    connect(actionUndock, SIGNAL(triggered()), this,  SLOT(undockWindowButton()));
    connect(actionToggleDock, SIGNAL(triggered()), this,  SLOT(toggleDockContextWindow()));
@@ -459,6 +460,11 @@ void MainWin::runButtonClicked()
    new runPage();
 }
 
+void MainWin::estimateButtonClicked() 
+{
+   new estimatePage();
+}
+
 void MainWin::restoreButtonClicked() 
 {
    new prerestorePage();
index f724536b9844515f12bfb9fa7be5d3c188059a35..a134210c5f11d6254cbcf9b3cb3618561ee1e0a6 100644 (file)
@@ -90,6 +90,7 @@ public slots:
    void treeItemClicked(QTreeWidgetItem *item, int column);
    void labelButtonClicked();
    void runButtonClicked();
+   void estimateButtonClicked();
    void restoreButtonClicked();
    void undockWindowButton();
    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
diff --git a/bacula/src/qt-console/run/estimate.cpp b/bacula/src/qt-console/run/estimate.cpp
new file mode 100644 (file)
index 0000000..d3295d7
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ *  Run Dialog class
+ *
+ *   Kern Sibbald, February MMVII
+ *
+ *  $Id: estimate.cpp 4856 2007-05-20 15:28:43Z bartleyd2 $
+ */ 
+
+#include "bat.h"
+#include "run.h"
+
+/*
+ * Setup all the combo boxes and display the dialog
+ */
+estimatePage::estimatePage()
+{
+   QDateTime dt;
+
+   m_name = "Estimate";
+   pgInitialize();
+   setupUi(this);
+   m_console->notify(false);
+
+   m_console->beginNewCommand();
+   jobCombo->addItems(m_console->job_list);
+   filesetCombo->addItems(m_console->fileset_list);
+   levelCombo->addItems(m_console->level_list);
+   clientCombo->addItems(m_console->client_list);
+   job_name_change(0);
+   connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
+   connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
+   connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
+
+   dockPage();
+   setCurrent();
+   this->show();
+}
+
+void estimatePage::okButtonPushed()
+{
+   this->hide();
+   QString cmd;
+   QTextStream(&cmd) << "estimate" << 
+      " job=\"" << jobCombo->currentText() << "\"" <<
+      " fileset=\"" << filesetCombo->currentText() << "\"" <<
+      " level=\"" << levelCombo->currentText() << "\"" <<
+      " client=\"" << clientCombo->currentText() << "\"";
+   if (listingCheckBox->checkState() == Qt::Checked) {
+      cmd += " listing";
+   }
+
+   if (mainWin->m_commandDebug) {
+      Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
+   }
+
+   consoleCommand(cmd);
+   m_console->notify(true);
+   closeStackPage();
+   mainWin->resetFocus();
+}
+
+
+void estimatePage::cancelButtonPushed()
+{
+   mainWin->set_status(" Canceled");
+   this->hide();
+   m_console->notify(true);
+   closeStackPage();
+   mainWin->resetFocus();
+}
+
+/*
+ * Called here when the jobname combo box is changed.
+ *  We load the default values for the new job in the
+ *  other combo boxes.
+ */
+void estimatePage::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));
+   }
+}
diff --git a/bacula/src/qt-console/run/estimate.ui b/bacula/src/qt-console/run/estimate.ui
new file mode 100644 (file)
index 0000000..bc5e638
--- /dev/null
@@ -0,0 +1,281 @@
+<ui version="4.0" >
+ <class>estimateForm</class>
+ <widget class="QWidget" name="estimateForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>562</width>
+    <height>308</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="1" column="1" >
+    <layout class="QGridLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item row="2" column="0" >
+      <layout class="QHBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <widget class="QCheckBox" name="listingCheckBox" >
+         <property name="layoutDirection" >
+          <enum>Qt::RightToLeft</enum>
+         </property>
+         <property name="text" >
+          <string>List Files</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+     <item row="1" column="0" >
+      <layout class="QGridLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item row="3" column="1" >
+        <widget class="QComboBox" name="filesetCombo" />
+       </item>
+       <item row="2" column="0" >
+        <widget class="QLabel" name="label_11" >
+         <property name="text" >
+          <string>Level:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>levelCombo</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1" >
+        <widget class="QComboBox" name="levelCombo" />
+       </item>
+       <item row="1" column="1" >
+        <widget class="QComboBox" name="clientCombo" />
+       </item>
+       <item row="1" column="0" >
+        <widget class="QLabel" name="label_8" >
+         <property name="text" >
+          <string>Client:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>clientCombo</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1" >
+        <widget class="QComboBox" name="jobCombo" />
+       </item>
+       <item row="0" column="0" >
+        <widget class="QLabel" name="label_6" >
+         <property name="maximumSize" >
+          <size>
+           <width>65</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="text" >
+          <string>Job:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>jobCombo</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" >
+        <widget class="QLabel" name="label_9" >
+         <property name="text" >
+          <string>FileSet:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>filesetCombo</cstring>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item row="0" column="0" >
+      <layout class="QHBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>71</width>
+           <height>21</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="run" >
+         <property name="maximumSize" >
+          <size>
+           <width>16777215</width>
+           <height>30</height>
+          </size>
+         </property>
+         <property name="text" >
+          <string>&lt;h3>Estimate a backup Job&lt;/h3></string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>81</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+     <item row="3" column="0" >
+      <layout class="QHBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="okButton" >
+         <property name="text" >
+          <string>OK</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="cancelButton" >
+         <property name="text" >
+          <string>Cancel</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>351</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>351</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 9a8796aba867dfb22c0cf9fa6fa3a1da10ea385b..f077d4e4f64ad2022bbebbf7ae696a53bad76bf3 100644 (file)
@@ -5,6 +5,7 @@
 #include <QtGui>
 #include "ui_run.h"
 #include "ui_runcmd.h"
+#include "ui_estimate.h"
 #include "console.h"
 
 class runPage : public Pages, public Ui::runForm
@@ -37,5 +38,19 @@ private:
    void fill();
 };
 
+class estimatePage : public Pages, public Ui::estimateForm
+{
+   Q_OBJECT 
+
+public:
+   estimatePage();
+
+public slots:
+   void okButtonPushed();
+   void cancelButtonPushed();
+   void job_name_change(int index);
+
+private:
+};
 
 #endif /* _RUN_H_ */