/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2010 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
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
/*
- * Version $Id$
*
* Restore Class
*
QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
thisitem->setIcon(0, QIcon(QString::fromUtf8(":images/browse.png")));
- m_closeable = true;
m_populated = false;
- dockPage();
m_debugCnt = 0;
m_debugTrap = true;
area->setObjectName(QString::fromUtf8("area"));
area->setWidget(widget);
area->setWidgetResizable(true);
- m_splitter->addWidget(splitter);
m_splitter->addWidget(area);
- splitter->setCollapsible(0, false);
+ m_splitter->addWidget(splitter);
+ splitter->setChildrenCollapsible(false);
gridLayout->addWidget(m_splitter, 0, 0, 1, 1);
daysSpinBox->setValue(mainWin->m_daysLimitVal);
readSettings();
m_nullFileNameId = -1;
+ dockPage();
+ setCurrent();
}
restoreTree::~restoreTree()
fieldcnt += 1;
}
}
+ } else {
+ return;
}
} else {
QMessageBox::warning(this, "Bat",
" AND File.Jobid IN (" + m_checkedJobs + ")"
" AND Filename.Name!=''"
" ORDER BY FileName";
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
- if (mainWin->m_sqlDebug) {
- Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
- }
QStringList results;
if (m_console->sql_cmd(cmd, results)) {
* | Qt::ItemIsEnabled | Qt::ItemIsTristate; */
tableItem->setForeground(blackBrush);
/* Just in case a column ever gets added */
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Column=%d\n", column);
if (column == 0) {
Qt::ItemFlags flag = Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate;
tableItem->setFlags(flag);
" AND Job.Jobid IN (" + m_checkedJobs + ")"
" ORDER BY Job.EndTime DESC";
- if (mainWin->m_sqlDebug)
- Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
QStringList results;
if (m_console->sql_cmd(cmd, results)) {
tableItem->setForeground(blackBrush);
tableItem->setData(Qt::UserRole, QVariant(directory));
versionTable->setItem(row, column, tableItem);
-
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Column=%d\n", column);
if (column == 0) {
Qt::ItemFlags flag = Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate;
tableItem->setFlags(flag);
void restoreTree::readSettings()
{
m_groupText = tr("RestoreTreePage");
- m_splitText1 = "splitterSizes1_2";
- m_splitText2 = "splitterSizes2_2";
+ m_splitText1 = "splitterSizes1_3";
+ m_splitText2 = "splitterSizes2_3";
QSettings settings(m_console->m_dir->name(), "bat");
settings.beginGroup(m_groupText);
- m_splitter->restoreState(settings.value(m_splitText1).toByteArray());
- splitter->restoreState(settings.value(m_splitText2).toByteArray());
+ if (settings.contains(m_splitText1)) { m_splitter->restoreState(settings.value(m_splitText1).toByteArray()); }
+ if (settings.contains(m_splitText2)) { splitter->restoreState(settings.value(m_splitText2).toByteArray()); }
settings.endGroup();
}
if (mainWin->m_rtPopDirDebug) Pmsg0(000, "Repopulating the Job Table\n");
QStringList headerlist = (QStringList()
- << tr("Job Id") << tr("End Time") << tr("Level")
+ << tr("Job Id") << tr("End Time") << tr("Level") << tr("Type")
<< tr("Name") << tr("Purged") << tr("TU") << tr("TD"));
m_toggleUpIndex = headerlist.indexOf(tr("TU"));
m_toggleDownIndex = headerlist.indexOf(tr("TD"));
int purgedIndex = headerlist.indexOf(tr("Purged"));
+ int typeIndex = headerlist.indexOf(tr("Type"));
jobTable->clear();
jobTable->setColumnCount(headerlist.size());
jobTable->setHorizontalHeaderLabels(headerlist);
QString jobQuery =
- "SELECT Job.Jobid AS Id,Job.EndTime AS EndTime,Job.Level AS Level,"
- "Job.Name AS JobName,Job.purgedfiles AS Purged"
+ "SELECT Job.Jobid AS Id, Job.EndTime AS EndTime,"
+ " Job.Level AS Level, Job.Type AS Type,"
+ " Job.Name AS JobName, Job.purgedfiles AS Purged"
" FROM Job"
/* INNER JOIN FileSet eliminates all restore jobs */
" INNER JOIN Client ON (Job.ClientId=Client.ClientId)"
" INNER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)"
" WHERE"
+ " Job.JobStatus IN ('T','W') AND Job.Type='B' AND"
" Client.Name='" + clientCombo->currentText() + "'";
if ((jobCombo->currentIndex() >= 0) && (jobCombo->currentText() != tr("Any"))) {
jobQuery += " AND Job.name = '" + jobCombo->currentText() + "'";
limit.setNum(limitSpinBox->value());
jobQuery += " LIMIT " + limit;
}
- if (mainWin->m_sqlDebug)
- Pmsg1(000, "Query cmd : %s\n", jobQuery.toUtf8().data());
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", jobQuery.toUtf8().data());
+
QStringList results;
if (m_console->sql_cmd(jobQuery, results)) {
foreach (field, fieldlist) {
field = field.trimmed(); /* strip leading & trailing spaces */
if (field != "") {
+ if (column == typeIndex) {
+ QByteArray jtype(field.trimmed().toAscii());
+ if (jtype.size()) {
+ field = job_type_to_str(jtype[0]);
+ }
+ }
tableItem = new QTableWidgetItem(field, 1);
tableItem->setFlags(0);
tableItem->setForeground(blackBrush);
jobTable->setItem(row, column, tableItem);
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Column=%d\n", column);
if (column == 0) {
bool ok;
int purged = fieldlist[purgedIndex].toInt(&ok, 10);
/* determine the default state */
Qt::CheckState defState;
+ if (mainWin->m_sqlDebug) Pmsg1(000, "row=%d\n", row);
if (row == 0) {
defState = Qt::PartiallyChecked;
if (fileState == Qt::Unchecked)
defState = Qt::Unchecked;
- }
- else
+ } else {
defState = Qt::Unchecked;
+ }
/* determine if it is already in the versionExceptionHash */
QString directory = directoryTree->currentItem()->data(0, Qt::UserRole).toString();
m_versionExceptionHash.remove(fullPath);
} else if (prevState != curState) {
if (mainWin->m_rtVerTabICDebug) Pmsg2(000, " THE STATE OF THE version Check has changed, Setting StateList[%i] to %i\n", row, curState);
- if ((curState == Qt::Checked) || (curState == Qt::PartiallyChecked && row != 0)) {
+ if ((curState == Qt::Checked) || (curState == Qt::PartiallyChecked)) {
if (mainWin->m_rtVerTabICDebug) Pmsg2(000, "Inserting into m_versionExceptionHash %s, %i\n", fullPath.toUtf8().data(), thisJobNum);
m_versionExceptionHash.insert(fullPath, thisJobNum);
if (fileState != Qt::Checked) {
int qfileIndex = 0;
QString directory, fileName;
int index = fullPath.lastIndexOf("/", -2);
+ if (mainWin->m_sqlDebug) Pmsg1(000, "Index=%d\n", index);
if (index != -1) {
directory = fileName = fullPath;
directory.replace(index+1, fullPath.length()-index-1, "");
" AND Filename.Name='" + fileName + "'"
" AND Job.Jobid='" + QString("%1").arg(jobId) + "'"
" GROUP BY File.FileIndex";
-
if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
QStringList results;
if (m_console->sql_cmd(cmd, results)) {
}
}
} /* if (index != -1) */
+ if (mainWin->m_sqlDebug) Pmsg1(000, "qfileIndex=%d\n", qfileIndex);
return qfileIndex;
}
+
+
+void restoreTree::PgSeltreeWidgetClicked()
+{
+ if (!isOnceDocked()) {
+ dockPage();
+ }
+}