]> git.sur5r.net Git - bacula/bacula/commitdiff
Add feature to run a couple of commands from within context in the status dir
authorDirk H Bartley <dbartley@schupan.com>
Tue, 19 Feb 2008 21:53:56 +0000 (21:53 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Tue, 19 Feb 2008 21:53:56 +0000 (21:53 +0000)
window.

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

bacula/src/qt-console/fileset/fileset.cpp
bacula/src/qt-console/status/dirstat.cpp
bacula/src/qt-console/status/dirstat.h
bacula/src/qt-console/status/dirstat.ui
bacula/src/qt-console/storage/storage.cpp

index ab4b818325de3c0f8a46f17e2f712ac053d464d7..9e6a0334e2633c6ddfb6fdb34bd795837a2dabd3 100644 (file)
@@ -79,7 +79,7 @@ void FileSet::populateTree()
    mp_treeWidget->clear();
    m_checkcurwidget = true;
 
-   QStringList headerlist = (QStringList() << tr("  FileSet Name  ") << tr("FileSet Id")
+   QStringList headerlist = (QStringList() << tr("FileSet Name") << tr("FileSet Id")
        << tr("Create Time"));
 
    topItem = new QTreeWidgetItem(mp_treeWidget);
@@ -132,10 +132,9 @@ void FileSet::populateTree()
       }
    }
    /* Resize the columns */
-   for (int cnter=1; cnter<headerlist.size(); cnter++) {
+   for (int cnter=0; cnter<headerlist.size(); cnter++) {
       mp_treeWidget->resizeColumnToContents(cnter);
    }
-
 }
 
 /*
index a12c833f9db823a4879df880a889c6ce1078ee7f..540ee8b8aa03c148d8e71160136a4d5d87449de7 100644 (file)
@@ -54,6 +54,8 @@ DirStat::DirStat()
    m_timer = new QTimer(this);
    QWidget::connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered()));
    m_timer->start(mainWin->m_refreshStatusDirInterval*1000);
+
+   createConnections();
 }
 
 void DirStat::getFont()
@@ -292,6 +294,21 @@ void DirStat::currentStackItem()
  */
 void DirStat::createConnections()
 {
+   connect(actionRefresh, SIGNAL(triggered()), this,
+                   SLOT(populateAll()));
+   connect(actionCancelRunning, SIGNAL(triggered()), this,
+                   SLOT(consoleCancelJob()));
+   connect(actionDisableScheduledJob, SIGNAL(triggered()), this,
+                   SLOT(consoleDisableJob()));
+
+   scheduledTable->setContextMenuPolicy(Qt::ActionsContextMenu);
+   scheduledTable->addAction(actionRefresh);
+   scheduledTable->addAction(actionDisableScheduledJob);
+   terminatedTable->setContextMenuPolicy(Qt::ActionsContextMenu);
+   terminatedTable->addAction(actionRefresh);
+   runningTable->setContextMenuPolicy(Qt::ActionsContextMenu);
+   runningTable->addAction(actionRefresh);
+   runningTable->addAction(actionCancelRunning);
 }
 
 /*
@@ -317,3 +334,34 @@ void DirStat::readSettings()
    splitter->restoreState(settings.value(m_splitText).toByteArray());
    settings.endGroup();
 }
+
+/*
+ * Cancel a running job
+ */
+void DirStat::consoleCancelJob()
+{
+   int currentrow = runningTable->currentRow();
+   QTableWidgetItem *item = runningTable->item(currentrow, 0);
+   if (item) {
+      QString text = item->text();
+      QString cmd("cancel jobid=");
+      cmd += text;
+      consoleCommand(cmd);
+   }
+}
+
+/*
+ * Disable a scheduled Job
+ */
+void DirStat::consoleDisableJob()
+{
+   int currentrow = scheduledTable->currentRow();
+   QTableWidgetItem *item = scheduledTable->item(currentrow, 4);
+   if (item) {
+      QString text = item->text();
+      QString cmd("disable job=\"");
+      cmd += text + '"';
+      consoleCommand(cmd);
+   }
+}
+
index de8fbfdab4b769798ad27a18d53079f97c2b017d..8c81c1304f7b340dcf444a92c1fe6f7db83ae2b5 100644 (file)
@@ -57,6 +57,8 @@ public slots:
 
 private slots:
    void timerTriggered();
+   void consoleCancelJob();
+   void consoleDisableJob();
 
 private:
    void createConnections();
index c17270273c0cc684e0f45fc421808d16c5dc551c..715f808cc8833259cd4013f3980c591fc145c382 100644 (file)
    <string>Form</string>
   </property>
   <layout class="QGridLayout" >
-   <property name="margin" >
+   <property name="leftMargin" >
     <number>9</number>
    </property>
-   <property name="spacing" >
+   <property name="topMargin" >
+    <number>9</number>
+   </property>
+   <property name="rightMargin" >
+    <number>9</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>9</number>
+   </property>
+   <property name="horizontalSpacing" >
+    <number>6</number>
+   </property>
+   <property name="verticalSpacing" >
     <number>6</number>
    </property>
    <item row="0" column="0" >
@@ -26,9 +38,7 @@
      </property>
      <widget class="QTextEdit" name="textEdit" >
       <property name="sizePolicy" >
-       <sizepolicy>
-        <hsizetype>7</hsizetype>
-        <vsizetype>7</vsizetype>
+       <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
         <horstretch>200</horstretch>
         <verstretch>0</verstretch>
        </sizepolicy>
        <bool>true</bool>
       </property>
      </widget>
-     <widget class="QWidget" name="" >
+     <widget class="QWidget" name="layoutWidget" >
       <layout class="QVBoxLayout" >
-       <property name="margin" >
-        <number>0</number>
-       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
+       <property name="leftMargin" >
+        <number>0</number>
+       </property>
+       <property name="topMargin" >
+        <number>0</number>
+       </property>
+       <property name="rightMargin" >
+        <number>0</number>
+       </property>
+       <property name="bottomMargin" >
+        <number>0</number>
+       </property>
        <item>
         <widget class="QLabel" name="scheduledLabel" >
          <property name="layoutDirection" >
@@ -116,12 +135,21 @@ p, li { white-space: pre-wrap; }
      </widget>
      <widget class="QWidget" name="layoutWidget_2" >
       <layout class="QVBoxLayout" >
-       <property name="margin" >
-        <number>0</number>
-       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
+       <property name="leftMargin" >
+        <number>0</number>
+       </property>
+       <property name="topMargin" >
+        <number>0</number>
+       </property>
+       <property name="rightMargin" >
+        <number>0</number>
+       </property>
+       <property name="bottomMargin" >
+        <number>0</number>
+       </property>
        <item>
         <widget class="QLabel" name="runningLabel" >
          <property name="layoutDirection" >
@@ -145,12 +173,21 @@ p, li { white-space: pre-wrap; }
      </widget>
      <widget class="QWidget" name="layoutWidget" >
       <layout class="QVBoxLayout" >
-       <property name="margin" >
-        <number>0</number>
-       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
+       <property name="leftMargin" >
+        <number>0</number>
+       </property>
+       <property name="topMargin" >
+        <number>0</number>
+       </property>
+       <property name="rightMargin" >
+        <number>0</number>
+       </property>
+       <property name="bottomMargin" >
+        <number>0</number>
+       </property>
        <item>
         <widget class="QLabel" name="terminatedLabel" >
          <property name="layoutDirection" >
@@ -175,6 +212,30 @@ p, li { white-space: pre-wrap; }
     </widget>
    </item>
   </layout>
+  <action name="actionRefresh" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/view-refresh.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Refresh</string>
+   </property>
+  </action>
+  <action name="actionCancelRunning" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Cancel Running Job</string>
+   </property>
+  </action>
+  <action name="actionDisableScheduledJob" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Disable Scheduled Job</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="../main.qrc" />
index 6129c35e3c03597e32f11c511a8978cfa033e89c..5808c825e9bc73f8951275ce1e64cc0c8bc45a1c 100644 (file)
@@ -132,7 +132,7 @@ void Storage::populateTree()
       }
    }
    /* Resize the columns */
-   for(int cnter=1; cnter<headerlist.size(); cnter++) {
+   for(int cnter=0; cnter<headerlist.size(); cnter++) {
       mp_treeWidget->resizeColumnToContents(cnter);
    }
 }