/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
modify it under the terms of version two of the GNU General Public
- License as published by the Free Software Foundation plus additions
- that are listed in the file LICENSE.
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
*/
/*
- * Version $Id: client.cpp 4230 2007-02-21 20:07:37Z kerns $
+ * Version $Id$
*
* Jobs Class
*
*
*/
-//#include <QAbstractEventDispatcher>
-//#include <QMenu>
#include "bat.h"
#include "jobs/jobs.h"
+#include "run/run.h"
Jobs::Jobs()
{
setupUi(this);
- m_name = "Jobs";
+ m_name = tr("Jobs");
pgInitialize();
QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/run.png")));
m_checkcurwidget = false;
mp_treeWidget->clear();
m_checkcurwidget = true;
- QStringList headerlist = (QStringList() << "Job Name" << "Pool" << "Messages"
- << "Client" << "Storage" << "Where" << "Level" << "Type" << "FileSet"
- << "Catalog" << "Enabled");
+ QStringList headerlist = (QStringList() << tr("Job Name") << tr("Pool") << tr("Messages")
+ << tr("Client") << tr("Storage") << tr("Where") << tr("Level") << tr("Type")
+ << tr("FileSet")
+ << tr("Catalog") << tr("Enabled"));
+ m_typeIndex = headerlist.indexOf(tr("Type"));
topItem = new QTreeWidgetItem(mp_treeWidget);
- topItem->setText(0, "Jobs");
+ topItem->setText(0, tr("Jobs"));
topItem->setData(0, Qt::UserRole, 0);
topItem->setExpanded(true);
if (m_checkcurwidget) {
/* The Previous item */
if (previouswidgetitem) { /* avoid a segfault if first time */
- int treedepth = previouswidgetitem->data(0, Qt::UserRole).toInt();
- if (treedepth == 1){
- 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);
+ foreach(QAction* jobAction, mp_treeWidget->actions()) {
+ mp_treeWidget->removeAction(jobAction);
}
}
mp_treeWidget->addAction(actionConsoleDisableJob);
mp_treeWidget->addAction(actionConsoleCancel);
mp_treeWidget->addAction(actionJobListQuery);
+ if (currentwidgetitem->text(m_typeIndex) == tr("Backup"))
+ mp_treeWidget->addAction(actionRunJob);
}
}
}
connect(actionConsoleDisableJob, SIGNAL(triggered()), this, SLOT(consoleDisable()));
connect(actionConsoleCancel, SIGNAL(triggered()), this, SLOT(consoleCancel()));
connect(actionJobListQuery, SIGNAL(triggered()), this, SLOT(listJobs()));
+ connect(actionRunJob, SIGNAL(triggered()), this, SLOT(runJob()));
}
/*
void Jobs::consoleListFiles()
{
- QString cmd("list files job=");
- cmd += m_currentlyselected;
+ QString cmd = "list files job=\"" + m_currentlyselected + "\"";
+ if (mainWin->m_longList) { cmd.prepend("l"); }
consoleCommand(cmd);
}
void Jobs::consoleListVolume()
{
- QString cmd("list volumes job=");
- cmd += m_currentlyselected;
+ QString cmd = "list volumes job=\"" + m_currentlyselected + "\"";
+ if (mainWin->m_longList) { cmd.prepend("l"); }
consoleCommand(cmd);
}
void Jobs::consoleListNextVolume()
{
- QString cmd("list nextvolume job=");
- cmd += m_currentlyselected;
+ QString cmd = "list nextvolume job=\"" + m_currentlyselected + "\"";
+ if (mainWin->m_longList) { cmd.prepend("l"); }
consoleCommand(cmd);
}
void Jobs::consoleEnable()
{
- QString cmd("enable job=");
- cmd += m_currentlyselected;
+ QString cmd = "enable job=\"" + m_currentlyselected + "\"";
consoleCommand(cmd);
}
void Jobs::consoleDisable()
{
- QString cmd("disable job=");
- cmd += m_currentlyselected;
+ QString cmd = "disable job=\"" + m_currentlyselected + "\"";
consoleCommand(cmd);
}
void Jobs::consoleCancel()
{
- QString cmd("cancel job=");
- cmd += m_currentlyselected;
+ QString cmd = "cancel job=\"" + m_currentlyselected + "\"";
consoleCommand(cmd);
}
void Jobs::listJobs()
{
QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
- mainWin->createPageJobList("", "", m_currentlyselected, parentItem);
+ mainWin->createPageJobList("", "", m_currentlyselected, "", parentItem);
+}
+
+/*
+ * Open a new job run page with the currentley selected "Backup" job
+ * defaulted In
+ */
+void Jobs::runJob()
+{
+ new runPage(m_currentlyselected);
}