From: Dirk H Bartley Date: Thu, 31 May 2007 12:33:03 +0000 (+0000) Subject: Add feature to jump from fileset to joblist pre-populating the fileset of the X-Git-Tag: Release-7.0.0~6193 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=efdf68487cb760ce81dc63bd684f663599cb8be8;p=bacula%2Fbacula Add feature to jump from fileset to joblist pre-populating the fileset of the query. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4952 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index adbbdd159f..38fb079d8b 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -213,7 +213,7 @@ void Clients::createContextMenu() void Clients::showJobs() { QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - mainWin->createPageJobList("", m_currentlyselected, "", parentItem); + mainWin->createPageJobList("", m_currentlyselected, "", "", parentItem); } /* diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index 9676de3c2f..ed0bf324da 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -165,6 +165,7 @@ void FileSet::treeItemChanged(QTreeWidgetItem *currentwidgetitem, int treedepth = previouswidgetitem->data(0, Qt::UserRole).toInt(); if (treedepth == 1) { mp_treeWidget->removeAction(actionStatusFileSetInConsole); + mp_treeWidget->removeAction(actionShowJobs); } } @@ -174,6 +175,7 @@ void FileSet::treeItemChanged(QTreeWidgetItem *currentwidgetitem, * menu is used */ m_currentlyselected=currentwidgetitem->text(0); mp_treeWidget->addAction(actionStatusFileSetInConsole); + mp_treeWidget->addAction(actionShowJobs); } } } @@ -195,6 +197,8 @@ void FileSet::createContextMenu() SLOT(populateTree())); connect(actionStatusFileSetInConsole, SIGNAL(triggered()), this, SLOT(consoleStatusFileSet())); + connect(actionShowJobs, SIGNAL(triggered()), this, + SLOT(showJobs())); } /* @@ -242,3 +246,12 @@ void FileSet::readSettings() restoreGeometry(settings.value("geometry").toByteArray()); settings.endGroup(); } + +/* + * Create a JobList object pre-populating a fileset + */ +void FileSet::showJobs() +{ + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + mainWin->createPageJobList("", "", "", m_currentlyselected, parentItem); +} diff --git a/bacula/src/qt-console/fileset/fileset.h b/bacula/src/qt-console/fileset/fileset.h index a3174be796..8ce831b70a 100644 --- a/bacula/src/qt-console/fileset/fileset.h +++ b/bacula/src/qt-console/fileset/fileset.h @@ -54,6 +54,7 @@ public slots: private slots: void populateTree(); void consoleStatusFileSet(); + void showJobs(); private: void writeSettings(); diff --git a/bacula/src/qt-console/fileset/fileset.ui b/bacula/src/qt-console/fileset/fileset.ui index 7774859eef..edabb21dac 100644 --- a/bacula/src/qt-console/fileset/fileset.ui +++ b/bacula/src/qt-console/fileset/fileset.ui @@ -5,8 +5,8 @@ 0 0 - 763 - 650 + 318 + 246 @@ -25,7 +25,7 @@ - :images/view-refresh.svg + :/images/view-refresh.svg Refresh FileSet List @@ -36,13 +36,23 @@ - :images/status.png + :/images/status.png Status FileSet In Console + + + :/images/emblem-system.svg + + + ShowJobs + + - + + + diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index a5956f858e..b491bd48dc 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -42,13 +42,15 @@ * Constructor for the class */ JobList::JobList(const QString &mediaName, const QString &clientName, - const QString &jobName, QTreeWidgetItem *parentTreeWidgetItem) + const QString &jobName, const QString &filesetName, QTreeWidgetItem *parentTreeWidgetItem) { setupUi(this); m_name = ""; /* treeWidgetName has a virtual override in this class */ m_mediaName = mediaName; m_clientName = clientName; m_jobName = jobName; + m_filesetName = filesetName; + m_filesetName = filesetName; pgInitialize(parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/emblem-system.svg"))); @@ -56,7 +58,7 @@ JobList::JobList(const QString &mediaName, const QString &clientName, m_resultCount = 0; m_populated = false; m_closeable = false; - if ((m_mediaName != "") || (m_clientName != "") || (m_jobName != "")) + if ((m_mediaName != "") || (m_clientName != "") || (m_jobName != "") || (m_filesetName != "")) m_closeable=true; m_checkCurrentWidget = true; createConnections(); @@ -125,6 +127,10 @@ void JobList::populateTable() statusComboBox->addItem("Any"); fileSetComboBox->addItem("Any"); fileSetComboBox->addItems(m_console->fileset_list); + int filesetIndex = fileSetComboBox->findText(m_filesetName, Qt::MatchExactly); + if (filesetIndex != -1) { + fileSetComboBox->setCurrentIndex(filesetIndex); + } QString statusQuery("SELECT JobStatusLong FROM Status"); if (mainWin->m_sqlDebug) { Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); @@ -188,6 +194,8 @@ void JobList::populateTable() conditions.append("Job.PurgedFiles='" + purgedComboBox->itemText(purgedIndex) + "'"); } int fileSetIndex = fileSetComboBox->currentIndex(); + if (fileSetIndex != -1) + m_filesetName = fileSetComboBox->itemText(fileSetIndex); if ((fileSetIndex != -1) && (fileSetComboBox->itemText(fileSetIndex) != "Any")) { conditions.append("FileSet.FileSet='" + fileSetComboBox->itemText(fileSetIndex) + "'"); } @@ -323,7 +331,7 @@ void JobList::currentStackItem() */ void JobList::treeWidgetName(QString &desc) { - if ((m_mediaName == "") && (m_clientName == "") && (m_jobName == "")) { + if ((m_mediaName == "") && (m_clientName == "") && (m_jobName == "") && (m_filesetName == "")) { desc = "JobList"; } else { desc = "JobList "; @@ -336,6 +344,9 @@ void JobList::treeWidgetName(QString &desc) if (m_jobName != "" ) { desc += "of Job " + m_jobName; } + if (m_filesetName != "" ) { + desc += "of fileset " + m_filesetName; + } } } diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index c6ceb80e28..6c4f90bd42 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -44,7 +44,7 @@ class JobList : public Pages, public Ui::JobListForm public: JobList(const QString &medianame, const QString &clientname, - const QString &jobname, QTreeWidgetItem *); + const QString &jobname, const QString &filesetname, QTreeWidgetItem *); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); int m_resultCount; @@ -73,6 +73,7 @@ private: QString m_mediaName; QString m_clientName; QString m_jobName; + QString m_filesetName; QString m_currentJob; bool m_populated; bool m_checkCurrentWidget; diff --git a/bacula/src/qt-console/jobs/jobs.cpp b/bacula/src/qt-console/jobs/jobs.cpp index ce31a381b0..a4feb8ea15 100644 --- a/bacula/src/qt-console/jobs/jobs.cpp +++ b/bacula/src/qt-console/jobs/jobs.cpp @@ -258,5 +258,5 @@ void Jobs::consoleCancel() void Jobs::listJobs() { QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - mainWin->createPageJobList("", "", m_currentlyselected, parentItem); + mainWin->createPageJobList("", "", m_currentlyselected, "", parentItem); } diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 990dfddb4a..1a408d678b 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -135,11 +135,11 @@ void MainWin::createPages() * Create instances in alphabetic order of the rest * of the classes that will by default exist under each Director. */ -// new new bRestore(); +// new bRestore(); new Clients(); new FileSet(); new Jobs(); - createPageJobList("", "", "", NULL); + createPageJobList("", "", "", "", NULL); new MediaList(); new Storage(); @@ -153,15 +153,15 @@ void MainWin::createPages() * create an instance of the the joblist class on the stack */ void MainWin::createPageJobList(const QString &media, const QString &client, - const QString &job, QTreeWidgetItem *parentTreeWidgetItem) + const QString &job, const QString &fileset, QTreeWidgetItem *parentTreeWidgetItem) { QTreeWidgetItem *holdItem; /* save current tree widget item in case query produces no results */ holdItem = treeWidget->currentItem(); - JobList* joblist = new JobList(media, client, job, parentTreeWidgetItem); + JobList* joblist = new JobList(media, client, job, fileset, parentTreeWidgetItem); /* If this is a query of jobs on a specific media */ - if ((media != "") || (client != "") || (job != "")) { + if ((media != "") || (client != "") || (job != "") || (fileset != "")) { joblist->setCurrent(); /* did query produce results, if not close window and set back to hold */ if (joblist->m_resultCount == 0) { diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 25f619cceb..c278242a1b 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -69,7 +69,7 @@ public: /* This is a list of consoles */ QHash m_consoleHash; void createPageJobList(const QString &, const QString &, - const QString &, QTreeWidgetItem *); + const QString &, const QString &, QTreeWidgetItem *); QString m_dtformat; /* Begin Preferences variables */ bool m_commDebug; diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 0e04993cea..d12262671f 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -182,7 +182,7 @@ void MediaList::editVolume() void MediaList::showJobs() { QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - mainWin->createPageJobList(m_currentVolumeName, "", "", parentItem); + mainWin->createPageJobList(m_currentVolumeName, "", "", "", parentItem); } /*