]> git.sur5r.net Git - bacula/bacula/commitdiff
Cancel a running job from joblist.
authorDirk H Bartley <dbartley@schupan.com>
Sun, 20 May 2007 16:04:27 +0000 (16:04 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sun, 20 May 2007 16:04:27 +0000 (16:04 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4857 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/TODO
bacula/src/qt-console/joblist/joblist.cpp
bacula/src/qt-console/joblist/joblist.h
bacula/src/qt-console/joblist/joblist.ui

index c8dd24af34a835d27b2ed003bcefc84596ba7a02..bf4d3dc4d5e5926d48653a244f1a7394b6d955fa 100644 (file)
@@ -1,10 +1,5 @@
 dhb
 ====================================================
-joblist cancel a running job.
-
-Fixes to final restore widgets.
-   all but messages done.
-
 Add context sensitive options for most commands
 status dir on page select director item
 All items with jobid= that I thought could work from joblist are done.
@@ -76,6 +71,10 @@ global one defined in the mainWin class (if I remember right).
 ============================================================
 DONE:
 ============================================================
+joblist cancel a running job.
+
+Fixes to final restore widgets.
+
 Set default for replace in run restore job to "always"??????
 
 Option in joblist like with restore from jobid but restore populating timestamp
index d31043709dc1d9794f43c36c710bbb8b05487eb9..fbca3d31969ef2705f407e3216d252c37f863c2f 100644 (file)
@@ -209,7 +209,7 @@ void JobList::populateTable()
       << "Job Level" << "Job Files" << "Job Bytes" << "Job Status"  << "Purged" << "File Set" );
    m_purgedIndex = headerlist.indexOf("Purged");
    m_typeIndex = headerlist.indexOf("Job Type");
-   statusIndex = headerlist.indexOf("Job Status");
+   m_statusIndex = headerlist.indexOf("Job Status");
 
    /* Initialize the QTableWidget */
    m_checkCurrentWidget = false;
@@ -234,20 +234,20 @@ void JobList::populateTable()
       foreach (resultline, results) {
          fieldlist = resultline.split("\t");
          int column = 0;
-         bool statusIndexDone = false;
+         bool m_statusIndexDone = false;
          QString statusCode("");
          /* Iterate through fields in the record */
          foreach (field, fieldlist) {
             field = field.trimmed();  /* strip leading & trailing spaces */
-            if ((column == statusIndex) && (!statusIndexDone)){
-               statusIndexDone = true;
+            if ((column == m_statusIndex) && (!m_statusIndexDone)){
+               m_statusIndexDone = true;
                statusCode = field;
             } else {
                p_tableitem = new QTableWidgetItem(field,1);
                p_tableitem->setFlags(0);
                p_tableitem->setForeground(blackBrush);
                mp_tableWidget->setItem(row, column, p_tableitem);
-               if (column == statusIndex)
+               if (column == m_statusIndex)
                   setStatusColor(p_tableitem, statusCode);
                column++;
             }
@@ -335,20 +335,30 @@ void JobList::tableItemChanged(QTableWidgetItem *currentItem, QTableWidgetItem *
       int row = currentItem->row();
       QTableWidgetItem* jobitem = mp_tableWidget->item(row, 0);
       m_currentJob = jobitem->text();
+
+      /* include purged action or not */
       jobitem = mp_tableWidget->item(row, m_purgedIndex);
       QString purged = jobitem->text();
       mp_tableWidget->removeAction(actionPurgeFiles);
       if (purged == "0") {
          mp_tableWidget->addAction(actionPurgeFiles);
       }
+      /* include restore from time and job action or not */
       jobitem = mp_tableWidget->item(row, m_typeIndex);
-      QString status = jobitem->text();
+      QString type = jobitem->text();
       mp_tableWidget->removeAction(actionRestoreFromJob);
       mp_tableWidget->removeAction(actionRestoreFromTime);
-      if (status == "B") {
+      if (type == "B") {
          mp_tableWidget->addAction(actionRestoreFromJob);
          mp_tableWidget->addAction(actionRestoreFromTime);
       }
+      /* include cancel action or not */
+      jobitem = mp_tableWidget->item(row, m_statusIndex);
+      QString status = jobitem->text();
+      mp_tableWidget->removeAction(actionCancelJob);
+      if (status == "Running") {
+         mp_tableWidget->addAction(actionCancelJob);
+      }
    }
 }
 
@@ -408,6 +418,8 @@ void JobList::createConnections()
                 SLOT(preRestoreFromTime()));
    connect(actionShowLogForJob, SIGNAL(triggered()), this,
                 SLOT(showLogForJob()));
+   connect(actionCancelJob, SIGNAL(triggered()), this,
+                SLOT(consoleCancelJob()));
 }
 
 /*
@@ -505,3 +517,13 @@ void JobList::showLogForJob()
    QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
    new JobLog(m_currentJob, pageSelectorTreeWidgetItem);
 }
+
+/*
+ * Cancel a running job
+ */
+void JobList::consoleCancelJob()
+{
+   QString cmd("cancel jobid=");
+   cmd += m_currentJob;
+   consoleCommand(cmd);
+}
index 2f68096b85edf9a40fc2f722bd9ea46b90ae5220..f28ec2a237dd4d8eed59149fb0d74fd1410b19cb 100644 (file)
@@ -64,6 +64,7 @@ private slots:
    void preRestoreFromJob();
    void preRestoreFromTime();
    void showLogForJob();
+   void consoleCancelJob();
 
 private:
    void createConnections();
@@ -75,6 +76,7 @@ private:
    bool m_checkCurrentWidget;
    int m_purgedIndex;
    int m_typeIndex;
+   int m_statusIndex;
 };
 
 #endif /* _JOBLIST_H_ */
index fd67d053e18cedd47fc3fc6945f57dbd9be22723..9dd5637e31f382e65be90eb3d71d76ba89d814ac 100644 (file)
   </layout>
   <action name="actionRefreshJobList" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/run.png</iconset>
+    <iconset>:images/run.png</iconset>
    </property>
    <property name="text" >
     <string>Refresh Job List</string>
   </action>
   <action name="actionListJobid" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>ListJobid</string>
   </action>
   <action name="actionListFilesOnJob" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>List Files On Job</string>
   </action>
   <action name="actionListJobMedia" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>ListJobMedia</string>
   </action>
   <action name="actionListVolumes" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>ListVolumes</string>
   </action>
   <action name="actionLongListJob" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>LongListJob</string>
   </action>
   <action name="actionDeleteJob" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>DeleteJob</string>
   </action>
   <action name="actionPurgeFiles" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>PurgeFiles</string>
   </action>
   <action name="actionRestoreFromJob" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>Restore From Job</string>
   </action>
   <action name="actionRestoreFromTime" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>Restore From Time</string>
   </action>
   <action name="actionShowLogForJob" >
    <property name="icon" >
-    <iconset>../../../../../../../:images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>Show Log for Job</string>
    </property>
   </action>
+  <action name="actionCancelJob" >
+   <property name="icon" >
+    <iconset>:images/unmark.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Cancel Currently Running Job</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections/>