/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-20087 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: restore.cpp 4307 2007-03-04 10:24:39Z kerns $
+ * Version $Id$
*
* preRestore -> dialog put up to determine the restore type
*
*/
void prerestorePage::buildPage()
{
- m_dtformat = "yyyy-MM-dd HH:mm:ss";
- m_name = "Restore";
+ m_name = tr("Restore");
setupUi(this);
pgInitialize();
m_console->notify(false);
m_closeable = true;
+ QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
+ thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png")));
+
+ if (!m_console->preventInUseConnect())
+ return;
jobCombo->addItems(m_console->job_list);
filesetCombo->addItems(m_console->fileset_list);
clientCombo->addItems(m_console->client_list);
- poolCombo->addItem("Any");
+ poolCombo->addItem(tr("Any"));
poolCombo->addItems(m_console->pool_list);
storageCombo->addItems(m_console->storage_list);
/* current or before . . Start out with current checked */
recentCheckBox->setCheckState(Qt::Checked);
- beforeDateTime->setDisplayFormat(m_dtformat);
+ beforeDateTime->setDisplayFormat(mainWin->m_dtformat);
beforeDateTime->setDateTime(QDateTime::currentDateTime());
beforeDateTime->setEnabled(false);
selectFilesRadio->setChecked(true);
if (m_dataInType == R_NONE) {
selectJobRadio->setChecked(true);
selectJobIdsRadio->setChecked(false);
- jobIdEdit->setText("Comma separted list of jobs id's");
+ jobIdEdit->setText(tr("Comma separted list of Job Ids"));
jobIdEdit->setEnabled(false);
} else if (m_dataInType == R_JOBIDLIST) {
selectJobIdsRadio->setChecked(true);
jobIdEdit->setText(m_dataIn);
jobRadioClicked(false);
QStringList fieldlist;
- jobdefsFromJob(fieldlist,m_dataIn);
- filesetCombo->setCurrentIndex(filesetCombo->findText(fieldlist[2], Qt::MatchExactly));
- clientCombo->setCurrentIndex(clientCombo->findText(fieldlist[1], Qt::MatchExactly));
- jobCombo->setCurrentIndex(jobCombo->findText(fieldlist[0], Qt::MatchExactly));
+ if (jobdefsFromJob(fieldlist, m_dataIn) == 1) {
+ filesetCombo->setCurrentIndex(filesetCombo->findText(fieldlist[2], Qt::MatchExactly));
+ clientCombo->setCurrentIndex(clientCombo->findText(fieldlist[1], Qt::MatchExactly));
+ jobCombo->setCurrentIndex(jobCombo->findText(fieldlist[0], Qt::MatchExactly));
+ }
} else if (m_dataInType == R_JOBDATETIME) {
selectJobRadio->setChecked(true);
selectJobIdsRadio->setChecked(false);
- jobIdEdit->setText("Comma separted list of jobs id's");
+ jobIdEdit->setText(tr("Comma separted list of Job Ids"));
jobIdEdit->setEnabled(false);
recentCheckBox->setCheckState(Qt::Unchecked);
jobRadioClicked(true);
QStringList fieldlist;
- jobdefsFromJob(fieldlist,m_dataIn);
- filesetCombo->setCurrentIndex(filesetCombo->findText(fieldlist[2], Qt::MatchExactly));
- clientCombo->setCurrentIndex(clientCombo->findText(fieldlist[1], Qt::MatchExactly));
- jobCombo->setCurrentIndex(jobCombo->findText(fieldlist[0], Qt::MatchExactly));
- beforeDateTime->setDateTime(QDateTime::fromString(fieldlist[3], m_dtformat));
+ if (jobdefsFromJob(fieldlist, m_dataIn) == 1) {
+ filesetCombo->setCurrentIndex(filesetCombo->findText(fieldlist[2], Qt::MatchExactly));
+ clientCombo->setCurrentIndex(clientCombo->findText(fieldlist[1], Qt::MatchExactly));
+ jobCombo->setCurrentIndex(jobCombo->findText(fieldlist[0], Qt::MatchExactly));
+ beforeDateTime->setDateTime(QDateTime::fromString(fieldlist[3], mainWin->m_dtformat));
+ }
}
job_name_change(0);
connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
cmd += " current";
} else {
QDateTime stamp = beforeDateTime->dateTime();
- QString before = stamp.toString(m_dtformat);
+ QString before = stamp.toString(mainWin->m_dtformat);
cmd += " before=\"" + before + "\"";
}
} else {
cmd += " all done";
}
- /* ***FIXME*** */
- printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
- consoleCommand(cmd);
+ if (mainWin->m_commandDebug) {
+ Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
+ }
+ m_console->write_dir(cmd.toUtf8().data());
+// consoleCommand(cmd);
+
/* Note, do not turn notifier back on here ... */
if (selectFilesRadio->isChecked()) {
setConsoleCurrent();
- new restorePage();
+// new restorePage();
closeStackPage();
} else {
- m_console->notify(true);
closeStackPage();
mainWin->resetFocus();
}
+ m_console->notify(true);
}
*/
void prerestorePage::cancelButtonPushed()
{
- mainWin->set_status("Canceled");
+ mainWin->set_status(tr("Canceled"));
this->hide();
m_console->notify(true);
closeStackPage();
* For when jobs list is to be used, return a list which is the needed items from
* the job record
*/
-void prerestorePage::jobdefsFromJob(QStringList &fieldlist, QString jobId)
+int prerestorePage::jobdefsFromJob(QStringList &fieldlist, QString &jobId)
{
QString job, client, fileset;
QString query("");
query = "SELECT DISTINCT Job.Name AS JobName, Client.Name AS Client,"
- " FileSet.FileSet AS FileSet, Job.EndTime AS JobEnd"
+ " FileSet.FileSet AS FileSet, Job.EndTime AS JobEnd,"
+ " Job.Type AS JobType"
" From Job, Client, FileSet"
" WHERE Job.FileSetId=FileSet.FileSetId AND Job.ClientId=Client.ClientId"
" AND JobId=\'" + jobId + "\'";
- //printf("query = %s\n", query.toUtf8().data());
+ if (mainWin->m_sqlDebug) { Pmsg1(000, "query = %s\n", query.toUtf8().data()); }
QStringList results;
if (m_console->sql_cmd(query, results)) {
QString field;
fieldlist = resultline.split("\t");
} /* foreach resultline */
} /* if results from query */
+ return results.count();
}
/*
/* Need to check and make sure the text is a comma separated list of integers */
QString line = jobIdEdit->text();
if (line.contains(" ")) {
- QMessageBox::warning(this, tr("Bat"),
+ QMessageBox::warning(this, "Bat",
tr("There can be no spaces in the text for the joblist.\n"
"Press OK to continue?"), QMessageBox::Ok );
return false;
bool intok;
job.toInt(&intok, 10);
if (intok) {
- /* are the intergers representing a list of jobs all with the same job
+ /* are the integers representing a list of jobs all with the same job
* and client */
QStringList fields;
- jobdefsFromJob(fields, job);
- int count = fields.count();
- if (count > 0) {
+ if (jobdefsFromJob(fields, job) == 1) {
if (jobName == "")
jobName = fields[0];
else if (jobName != fields[0])
}
}
if (!allintokay){
- QMessageBox::warning(this, tr("Bat"),
- tr("The string is not a comma separated list if integers.\n"
+ QMessageBox::warning(this, "Bat",
+ tr("The string is not a comma separated list of integers.\n"
"Press OK to continue?"), QMessageBox::Ok );
return false;
}
if (!allisjob){
QMessageBox::warning(this, tr("Bat"),
- tr("At least one of the jobs is not a valid job.\n"
+ tr("At least one of the jobs is not a valid job of type \"Backup\".\n"
"Press OK to continue?"), QMessageBox::Ok );
return false;
}
if (!alljobok){
- QMessageBox::warning(this, tr("Bat"),
+ QMessageBox::warning(this, "Bat",
tr("All jobs in the list must be of the same jobName and same client.\n"
"Press OK to continue?"), QMessageBox::Ok );
return false;