]> git.sur5r.net Git - bacula/bacula/commitdiff
jobs: add actions and slots for performing commands.
authorDirk H Bartley <dbartley@schupan.com>
Wed, 30 May 2007 17:06:58 +0000 (17:06 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Wed, 30 May 2007 17:06:58 +0000 (17:06 +0000)
mainwin: small cleanup of 2 line functions only used once.
mainwin clients medialist use const "" when creating jobList instances.

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

bacula/src/qt-console/COMMANDS
bacula/src/qt-console/clients/clients.cpp
bacula/src/qt-console/joblist/joblist.cpp
bacula/src/qt-console/joblist/joblist.h
bacula/src/qt-console/jobs/jobs.cpp
bacula/src/qt-console/jobs/jobs.h
bacula/src/qt-console/jobs/jobs.ui
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/medialist/medialist.cpp

index 0dd14a58fcb2a14b201c0bd95e9fb7317865fea1..e156016664911ebc27758538fbdd84ba365a6c44 100644 (file)
@@ -1,21 +1,11 @@
-cancel [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".
+cancel ujobid=<unique-jobid>
 
 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 resource window which is not yet created
-
 list
    list ujobid<unique job name> (list job with unique name)
-   list files job=<job-name>
-  do this as a context option on page selector on joblist
-   list volumes job=<job-name>
-   list nextvolume job=<job-name>
-   list nextvol job=<job-name>
    list nextvol job=<job-name> days=nnn
 
 unmount [ jobid=<id> | job=<job-name> ]
@@ -70,10 +60,13 @@ DONE
 automount on/off
 Added buttons to the label dialog box to execute automount command
 
-cancel jobid=<number>
+cancel jobid=<number> job=<job-name>
 
 delete [volume=<vol-name> job jobid=<id>]
 
+disable job<job-name>     and     enable job<job-name>
+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.
 
@@ -96,6 +89,12 @@ list
      list pools
    Accomplishable with the clients class graphically
      list clients
+   list files job=<job-name>
+  do this as a context option on page selector on joblist
+   list volumes job=<job-name>
+   list nextvolume job=<job-name>
+   list nextvol job=<job-name>
+
 help
   context sensitive from page selector console
 
index b6d021d7123b8a8f356c4f496ed4f0aef760d196..922ee9056ff79ac87bc6f7c78b25d7be9aa2497d 100644 (file)
@@ -212,9 +212,8 @@ void Clients::createContextMenu()
  */
 void Clients::showJobs()
 {
-   QString emptymedia("");
    QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-   mainWin->createPageJobList(emptymedia, m_currentlyselected, parentItem);
+   mainWin->createPageJobList("", m_currentlyselected, parentItem);
 }
 
 /*
index eb0a83f3c241a428e880492ee58947dce346a163..bc1585affac8b2e60d1ccbde3f2fc5da00db36b2 100644 (file)
@@ -41,7 +41,7 @@
 /*
  * Constructor for the class
  */
-JobList::JobList(QString &mediaName, QString &clientname,
+JobList::JobList(const QString &mediaName, const QString &clientname,
          QTreeWidgetItem *parentTreeWidgetItem)
 {
    setupUi(this);
index ed1e7bc7c8758d6ae0f4cdd82dba28a289b7e224..df4b0fcd49c67d0110ef890afed13ff13fed9b09 100644 (file)
@@ -43,7 +43,7 @@ class JobList : public Pages, public Ui::JobListForm
    Q_OBJECT 
 
 public:
-   JobList(QString &medianame, QString &clientname, QTreeWidgetItem *);
+   JobList(const QString &medianame, const QString &clientname, QTreeWidgetItem *);
    virtual void PgSeltreeWidgetClicked();
    virtual void currentStackItem();
    int m_resultCount;
index 2174a7df922a709c99f9a0753497ad949f61cce4..8d3314457a116faea187ac46718689aa1455e256 100644 (file)
@@ -95,19 +95,7 @@ void Jobs::populateTree()
 
       for (int i=0; i<headerlist.count(); i++)
          jobsItem->setData(i, Qt::UserRole, 1);
-/*struct job_defaults {
-   QString job_name;
-   QString pool_name;
-   QString messages_name;
-   QString client_name;
-   QString store_name;
-   QString where;
-   QString level;
-   QString type;
-   QString fileset_name;
-   QString catalog_name;
-   bool enabled;
-};*/
+
       job_defaults job_defs;
       job_defs.job_name = jobName;
       if (m_console->get_job_defaults(job_defs)) {
@@ -127,7 +115,6 @@ void Jobs::populateTree()
             jobsItem->setText(col++, "No");
          }
       }
-
    }
    /* Resize the columns */
    for(int cnter=0; cnter<headerlist.size(); cnter++) {
@@ -159,7 +146,13 @@ void Jobs::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetItem *
       if (previouswidgetitem) { /* avoid a segfault if first time */
          int treedepth = previouswidgetitem->data(0, Qt::UserRole).toInt();
          if (treedepth == 1){
-            //mp_treeWidget->removeAction(actionListJobsofClient);
+            mp_treeWidget->removeAction(actionConsoleListFiles);
+            mp_treeWidget->removeAction(actionConsoleListVolumes);
+            mp_treeWidget->removeAction(actionConsoleListNextVolume);
+            mp_treeWidget->removeAction(actionConsoleEnableJob);
+            mp_treeWidget->removeAction(actionConsoleDisableJob);
+            mp_treeWidget->removeAction(actionConsoleCancel);
+            mp_treeWidget->removeAction(actionJobListQuery);
          }
       }
 
@@ -168,7 +161,13 @@ void Jobs::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetItem *
          /* set a hold variable to the client name in case the context sensitive
           * menu is used */
          m_currentlyselected=currentwidgetitem->text(0);
-         //mp_treeWidget->addAction(actionListJobsofClient);
+         mp_treeWidget->addAction(actionConsoleListFiles);
+         mp_treeWidget->addAction(actionConsoleListVolumes);
+         mp_treeWidget->addAction(actionConsoleListNextVolume);
+         mp_treeWidget->addAction(actionConsoleEnableJob);
+         mp_treeWidget->addAction(actionConsoleDisableJob);
+         mp_treeWidget->addAction(actionConsoleCancel);
+         mp_treeWidget->addAction(actionJobListQuery);
       }
    }
 }
@@ -188,6 +187,13 @@ void Jobs::createContextMenu()
    /* connect to the action specific to this pages class */
    connect(actionRefreshJobs, SIGNAL(triggered()), this,
                 SLOT(populateTree()));
+   connect(actionConsoleListFiles, SIGNAL(triggered()), this, SLOT(consoleListFiles()));
+   connect(actionConsoleListVolumes, SIGNAL(triggered()), this, SLOT(consoleListVolume()));
+   connect(actionConsoleListNextVolume, SIGNAL(triggered()), this, SLOT(consoleListNextVolume()));
+   connect(actionConsoleEnableJob, SIGNAL(triggered()), this, SLOT(consoleEnable()));
+   connect(actionConsoleDisableJob, SIGNAL(triggered()), this, SLOT(consoleDisable()));
+   connect(actionConsoleCancel, SIGNAL(triggered()), this, SLOT(consoleCancel()));
+   connect(actionJobListQuery, SIGNAL(triggered()), this, SLOT(listJobs()));
 }
 
 /*
@@ -195,9 +201,61 @@ void Jobs::createContextMenu()
  */
 void Jobs::currentStackItem()
 {
+   populateTree();
    if(!m_populated) {
-      populateTree();
       /* Create the context menu for the client tree */
       m_populated=true;
    }
 }
+
+/*
+ * The following functions are slots responding to users clicking on the context
+ * sensitive menu
+ */
+
+void Jobs::consoleListFiles()
+{
+   QString cmd("list files job=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
+void Jobs::consoleListVolume()
+{
+   QString cmd("list volumes job=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
+void Jobs::consoleListNextVolume()
+{
+   QString cmd("list nextvolume job=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
+void Jobs::consoleEnable()
+{
+   QString cmd("enable job=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
+void Jobs::consoleDisable()
+{
+   QString cmd("disable job=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
+void Jobs::consoleCancel()
+{
+   QString cmd("cancel job=");
+   cmd += m_currentlyselected;
+   consoleCommand(cmd);
+}
+
+void Jobs::listJobs()
+{
+   printf("In Jobs::listJobs\n");
+}
index 94a657f44edc96f3c8ef08ed1eaafcd7fb994267..5fc8bec55c9e3f6df7bc1ca4ed63409f3dbc74e5 100644 (file)
@@ -53,6 +53,13 @@ public slots:
 
 private slots:
    void populateTree();
+   void consoleListFiles();
+   void consoleListVolume();
+   void consoleListNextVolume();
+   void consoleEnable();
+   void consoleDisable();
+   void consoleCancel();
+   void listJobs();
 
 private:
    void createContextMenu();
index de7876d822f603316db2febeb4efdbaee471458a..8b0af20e68f769e8b1d5826ecb94a5ece9a87cda 100644 (file)
     <string>Requery the director for the list of clients.</string>
    </property>
   </action>
+  <action name="actionConsoleListFiles" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>List Files Command</string>
+   </property>
+   <property name="iconText" >
+    <string>List Files Command</string>
+   </property>
+   <property name="toolTip" >
+    <string>List Files Command</string>
+   </property>
+   <property name="statusTip" >
+    <string>List Files Command</string>
+   </property>
+  </action>
+  <action name="actionConsoleListVolumes" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>List Volumes Command</string>
+   </property>
+   <property name="iconText" >
+    <string>List Volumes Command</string>
+   </property>
+   <property name="toolTip" >
+    <string>List Volumes Command</string>
+   </property>
+   <property name="statusTip" >
+    <string>List Volumes Command</string>
+   </property>
+  </action>
+  <action name="actionConsoleListNextVolume" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>List Next Volume Command</string>
+   </property>
+   <property name="iconText" >
+    <string>List Next Volume Command</string>
+   </property>
+   <property name="toolTip" >
+    <string>List Next Volume Command</string>
+   </property>
+   <property name="statusTip" >
+    <string>List Next Volume Command</string>
+   </property>
+  </action>
+  <action name="actionConsoleEnableJob" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>Enable Job Command</string>
+   </property>
+   <property name="iconText" >
+    <string>Enable Job Command</string>
+   </property>
+   <property name="toolTip" >
+    <string>Enable Job Command</string>
+   </property>
+   <property name="statusTip" >
+    <string>Enable Job Command</string>
+   </property>
+  </action>
+  <action name="actionConsoleDisableJob" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>Disable Job Command</string>
+   </property>
+   <property name="iconText" >
+    <string>Disable Job Command</string>
+   </property>
+   <property name="toolTip" >
+    <string>Disable Job Command</string>
+   </property>
+   <property name="statusTip" >
+    <string>Disable Job Command</string>
+   </property>
+  </action>
+  <action name="actionJobListQuery" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/emblem-system.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>Open JobList on Job</string>
+   </property>
+   <property name="iconText" >
+    <string>Open JobList on Job</string>
+   </property>
+   <property name="toolTip" >
+    <string>Open JobList on Job</string>
+   </property>
+   <property name="statusTip" >
+    <string>Open JobList on Job</string>
+   </property>
+  </action>
+  <action name="actionConsoleCancel" >
+   <property name="icon" >
+    <iconset resource="../main.qrc" >:/images/utilities-terminal.svg</iconset>
+   </property>
+   <property name="text" >
+    <string>Cancel Job Command</string>
+   </property>
+   <property name="statusTip" >
+    <string>Cancel Job Command</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="../main.qrc" />
index 12a943221a0735b5d2ab8a81eb81d7a5fc712689..95a6e157e1a330d34a65ef162b6204cdbfe0a791 100644 (file)
@@ -106,7 +106,8 @@ void MainWin::createPages()
       m_currentConsole->readSettings();
 
       /* The top tree item representing the director */
-      topItem = createTopPage(dir->name());
+      topItem = new QTreeWidgetItem(treeWidget);
+      topItem->setText(0, dir->name());
       topItem->setIcon(0, QIcon(":images/server.png"));
       /* Set background to grey for ease of identification of inactive Director */
       QBrush greyBrush(Qt::lightGray);
@@ -115,7 +116,8 @@ void MainWin::createPages()
       m_consoleHash.insert(topItem, m_currentConsole);
 
       /* Create Tree Widget Item */
-      item = createPage("Console", topItem);
+      item = new QTreeWidgetItem(topItem);
+      item->setText(0, "Console");
       if (!m_firstItem){ m_firstItem = item; }
       item->setIcon(0,QIcon(QString::fromUtf8(":images/utilities-terminal.svg")));
 
@@ -137,8 +139,7 @@ void MainWin::createPages()
       new Clients();
       new FileSet();
       new Jobs();
-      QString emptymedia(""), emptyclient("");
-      createPageJobList(emptymedia, emptyclient, NULL);
+      createPageJobList("", "", NULL);
       new MediaList();
       new Storage();
 
@@ -151,7 +152,7 @@ void MainWin::createPages()
 /*
  * create an instance of the the joblist class on the stack
  */
-void MainWin::createPageJobList(QString &media, QString &client,
+void MainWin::createPageJobList(const QString &media, const QString &client,
               QTreeWidgetItem *parentTreeWidgetItem)
 {
    QTreeWidgetItem *holdItem;
@@ -170,22 +171,6 @@ void MainWin::createPageJobList(QString &media, QString &client,
    }
 }
 
-/* Create a root Tree Widget */
-QTreeWidgetItem *MainWin::createTopPage(char *name)
-{
-   QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget);
-   item->setText(0, name);
-   return item;
-}
-
-/* Create A Tree Widget Item which will be associated with a Page in the stacked widget */
-QTreeWidgetItem *MainWin::createPage(char *name, QTreeWidgetItem *parent)
-{
-   QTreeWidgetItem *item = new QTreeWidgetItem(parent);
-   item->setText(0, name);
-   return item;
-}
-
 /*
  * Handle up and down arrow keys for the command line
  *  history.
index b79ff405d727a56bfc6ae76e98f528a9c30d45d9..a0a5ed7d89d11f8f67066a2eebfe541ff351b0aa 100644 (file)
@@ -68,7 +68,7 @@ public:
    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
    /* This is a list of consoles */
    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
-   void createPageJobList(QString &, QString &, QTreeWidgetItem *);
+   void createPageJobList(const QString &, const QString &, QTreeWidgetItem *);
    QString m_dtformat;
    /* Begin Preferences variables */
    bool m_commDebug;
@@ -108,8 +108,6 @@ protected:
 private:
    void createConnections(); 
    void createPages();
-   QTreeWidgetItem *createTopPage(char *name);
-   QTreeWidgetItem *createPage(char *name, QTreeWidgetItem *parent);
 
 private:
    Console *m_currentConsole;
index dc1e974c6f6886251c341a27606daecb2fbfadd2..ec160387050c55ecca6a790bee86a7dc9dcaf558 100644 (file)
@@ -181,9 +181,8 @@ void MediaList::editVolume()
  */
 void MediaList::showJobs()
 {
-   QString emptyclient("");
    QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-   mainWin->createPageJobList(m_currentVolumeName, emptyclient, parentItem);
+   mainWin->createPageJobList(m_currentVolumeName, "", parentItem);
 }
 
 /*