From: Dirk H Bartley Date: Wed, 30 May 2007 17:06:58 +0000 (+0000) Subject: jobs: add actions and slots for performing commands. X-Git-Tag: Release-7.0.0~6204 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6a61a16e3f80a223ad138dd9683baa36f5f1e7f3;p=bacula%2Fbacula jobs: add actions and slots for performing commands. 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 --- diff --git a/bacula/src/qt-console/COMMANDS b/bacula/src/qt-console/COMMANDS index 0dd14a58fc..e156016664 100644 --- a/bacula/src/qt-console/COMMANDS +++ b/bacula/src/qt-console/COMMANDS @@ -1,21 +1,11 @@ -cancel [job= ujobid=] -To be done in the context of a status dir graphical window. -Also in a "job resources window for job-name". +cancel ujobid= delete pool= should ask if this would have bad effects if say media existed in the pool the pool existed in the configuration file. -disable job and enable job -Could be done in the context of a jobs resource window which is not yet created - list list ujobid (list job with unique name) - list files job= - do this as a context option on page selector on joblist - list volumes job= - list nextvolume job= - list nextvol job= list nextvol job= days=nnn unmount [ jobid= | job= ] @@ -70,10 +60,13 @@ DONE automount on/off Added buttons to the label dialog box to execute automount command -cancel jobid= +cancel jobid= job= delete [volume= job jobid=] +disable job and enable job +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= + do this as a context option on page selector on joblist + list volumes job= + list nextvolume job= + list nextvol job= + help context sensitive from page selector console diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index b6d021d712..922ee9056f 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -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); } /* diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index eb0a83f3c2..bc1585affa 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -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); diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index ed1e7bc7c8..df4b0fcd49 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -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; diff --git a/bacula/src/qt-console/jobs/jobs.cpp b/bacula/src/qt-console/jobs/jobs.cpp index 2174a7df92..8d3314457a 100644 --- a/bacula/src/qt-console/jobs/jobs.cpp +++ b/bacula/src/qt-console/jobs/jobs.cpp @@ -95,19 +95,7 @@ void Jobs::populateTree() for (int i=0; isetData(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; cnterdata(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"); +} diff --git a/bacula/src/qt-console/jobs/jobs.h b/bacula/src/qt-console/jobs/jobs.h index 94a657f44e..5fc8bec55c 100644 --- a/bacula/src/qt-console/jobs/jobs.h +++ b/bacula/src/qt-console/jobs/jobs.h @@ -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(); diff --git a/bacula/src/qt-console/jobs/jobs.ui b/bacula/src/qt-console/jobs/jobs.ui index de7876d822..8b0af20e68 100644 --- a/bacula/src/qt-console/jobs/jobs.ui +++ b/bacula/src/qt-console/jobs/jobs.ui @@ -34,6 +34,119 @@ Requery the director for the list of clients. + + + :/images/utilities-terminal.svg + + + List Files Command + + + List Files Command + + + List Files Command + + + List Files Command + + + + + :/images/utilities-terminal.svg + + + List Volumes Command + + + List Volumes Command + + + List Volumes Command + + + List Volumes Command + + + + + :/images/utilities-terminal.svg + + + List Next Volume Command + + + List Next Volume Command + + + List Next Volume Command + + + List Next Volume Command + + + + + :/images/utilities-terminal.svg + + + Enable Job Command + + + Enable Job Command + + + Enable Job Command + + + Enable Job Command + + + + + :/images/utilities-terminal.svg + + + Disable Job Command + + + Disable Job Command + + + Disable Job Command + + + Disable Job Command + + + + + :/images/emblem-system.svg + + + Open JobList on Job + + + Open JobList on Job + + + Open JobList on Job + + + Open JobList on Job + + + + + :/images/utilities-terminal.svg + + + Cancel Job Command + + + Cancel Job Command + + diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 12a943221a..95a6e157e1 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -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. diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index b79ff405d7..a0a5ed7d89 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -68,7 +68,7 @@ public: QHash m_widgethash; /* This is a list of consoles */ QHash 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; diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index dc1e974c6f..ec16038705 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -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); } /*