From 4f7a302979a1889b5c34aa97194b3304abffb32b Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Tue, 19 Feb 2008 21:53:56 +0000 Subject: [PATCH] Add feature to run a couple of commands from within context in the status dir 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 | 5 +- bacula/src/qt-console/status/dirstat.cpp | 48 ++++++++++++ bacula/src/qt-console/status/dirstat.h | 2 + bacula/src/qt-console/status/dirstat.ui | 91 +++++++++++++++++++---- bacula/src/qt-console/storage/storage.cpp | 2 +- 5 files changed, 129 insertions(+), 19 deletions(-) diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index ab4b818325..9e6a0334e2 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -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; cnterresizeColumnToContents(cnter); } - } /* diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index a12c833f9d..540ee8b8aa 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -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); + } +} + diff --git a/bacula/src/qt-console/status/dirstat.h b/bacula/src/qt-console/status/dirstat.h index de8fbfdab4..8c81c1304f 100644 --- a/bacula/src/qt-console/status/dirstat.h +++ b/bacula/src/qt-console/status/dirstat.h @@ -57,6 +57,8 @@ public slots: private slots: void timerTriggered(); + void consoleCancelJob(); + void consoleDisableJob(); private: void createConnections(); diff --git a/bacula/src/qt-console/status/dirstat.ui b/bacula/src/qt-console/status/dirstat.ui index c17270273c..715f808cc8 100644 --- a/bacula/src/qt-console/status/dirstat.ui +++ b/bacula/src/qt-console/status/dirstat.ui @@ -13,10 +13,22 @@ Form - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 @@ -26,9 +38,7 @@ - - 7 - 7 + 200 0 @@ -85,14 +95,23 @@ true - + - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -116,12 +135,21 @@ p, li { white-space: pre-wrap; } - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -145,12 +173,21 @@ p, li { white-space: pre-wrap; } - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -175,6 +212,30 @@ p, li { white-space: pre-wrap; } + + + :/images/view-refresh.png + + + Refresh + + + + + :/images/utilities-terminal.png + + + Cancel Running Job + + + + + :/images/utilities-terminal.png + + + Disable Scheduled Job + + diff --git a/bacula/src/qt-console/storage/storage.cpp b/bacula/src/qt-console/storage/storage.cpp index 6129c35e3c..5808c825e9 100644 --- a/bacula/src/qt-console/storage/storage.cpp +++ b/bacula/src/qt-console/storage/storage.cpp @@ -132,7 +132,7 @@ void Storage::populateTree() } } /* Resize the columns */ - for(int cnter=1; cnterresizeColumnToContents(cnter); } } -- 2.39.5