joblist. I also want a table to convert termination code into human readable
text.
-move behavior of:
- MainWin::setContextMenuDockText
- MainWin::setTreeWidgetItemDockColor
-to the pages class
-
Test left pane of restore with 2 windows drives in one backup job.
User preferences. With log to stdout options.
============================================================
DONE:
============================================================
+move behavior of:
+ MainWin::setContextMenuDockText
+ MainWin::setTreeWidgetItemDockColor
+to the pages class
+
preempt all connections to console with
if (!is_connectedGui())
or some other mechanism. May find more as users start finding them.
if (volumeIndex != -1) {
volumeComboBox->setCurrentIndex(volumeIndex);
}
+ jobComboBox->addItem("Any");
+ jobComboBox->addItems(m_console->job_list);
+ levelComboBox->addItem("Any");
+ levelComboBox->addItems( QStringList() << "F" << "D" << "I");
+ statusComboBox->addItem("Any");
+ statusComboBox->addItems( QStringList() << "T");
+ purgedComboBox->addItem("Any");
+ purgedComboBox->addItems( QStringList() << "0" << "1");
}
/* Set up query QString and header QStringList */
query += "SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client,"
" Job.Starttime AS JobStart, Job.Type AS JobType,"
" Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
- " Job.JobBytes AS Bytes, Job.JobStatus AS Status"
+ " Job.JobBytes AS Bytes, Job.JobStatus AS Status,"
+ " Job.PurgedFiles AS Purged"
" FROM Job, JobMedia, Media, Client"
" WHERE JobMedia.JobId=Job.JobId and JobMedia.MediaId=Media.MediaId"
" and Client.ClientId=Job.ClientId";
query += " AND Client.Name='" + m_clientName + "'";
m_closeable=true;
}
+ int jobIndex = jobComboBox->currentIndex();
+ if ((jobIndex != -1) && (jobComboBox->itemText(jobIndex) != "Any")) {
+ query += " AND Job.Name='" + jobComboBox->itemText(jobIndex) + "'";
+ }
+ int levelIndex = levelComboBox->currentIndex();
+ if ((levelIndex != -1) && (levelComboBox->itemText(levelIndex) != "Any")) {
+ query += " AND Job.Level='" + levelComboBox->itemText(levelIndex) + "'";
+ }
+ int statusIndex = statusComboBox->currentIndex();
+ if ((statusIndex != -1) && (statusComboBox->itemText(statusIndex) != "Any")) {
+ query += " AND Job.JobStatus='" + statusComboBox->itemText(statusIndex) + "'";
+ }
+ int purgedIndex = purgedComboBox->currentIndex();
+ if ((purgedIndex != -1) && (purgedComboBox->itemText(purgedIndex) != "Any")) {
+ query += " AND Job.PurgedFiles='" + purgedComboBox->itemText(purgedIndex) + "'";
+ }
/* If Limit check box For limit by days is checked */
if (daysCheckBox->checkState() == Qt::Checked) {
QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value());
}
QStringList headerlist = (QStringList()
<< "Job Id" << "Job Name" << "Client" << "Job Starttime" << "Job Type"
- << "Job Level" << "Job Files" << "Job Bytes" << "Job Status" );
+ << "Job Level" << "Job Files" << "Job Bytes" << "Job Status" << "Purged" );
/* Initialize the QTableWidget */
m_checkCurrentWidget = false;
mp_tableWidget->addAction(actionDeleteJob);
mp_tableWidget->addAction(actionPurgeFiles);
mp_tableWidget->addAction(actionRestoreFromJob);
+ mp_tableWidget->addAction(actionRestoreFromTime);
/* Make Connections */
connect(actionLongListJob, SIGNAL(triggered()), this,
SLOT(consolePurgeFiles()));
connect(actionRestoreFromJob, SIGNAL(triggered()), this,
SLOT(preRestoreFromJob()));
+ connect(actionRestoreFromTime, SIGNAL(triggered()), this,
+ SLOT(preRestoreFromTime()));
}
/*
*/
void JobList::preRestoreFromJob()
{
- new prerestorePage(m_currentJob);
+ new prerestorePage(m_currentJob, R_JOBIDLIST);
+}
+
+/*
+ * Subroutine to call preRestore to restore from a select job
+ */
+void JobList::preRestoreFromTime()
+{
+ new prerestorePage(m_currentJob, R_JOBDATETIME);
}
void consoleDeleteJob();
void consolePurgeFiles();
void preRestoreFromJob();
+ void preRestoreFromTime();
private:
void createConnections();
<rect>
<x>0</x>
<y>0</y>
- <width>621</width>
- <height>500</height>
+ <width>547</width>
+ <height>361</height>
</rect>
</property>
<property name="windowTitle" >
<property name="spacing" >
<number>6</number>
</property>
+ <item row="0" column="0" >
+ <widget class="QTableWidget" name="mp_tableWidget" />
+ </item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
- <number>6</number>
+ <number>0</number>
</property>
<item>
<layout class="QVBoxLayout" >
<number>6</number>
</property>
<item>
- <widget class="QCheckBox" name="limitCheckBox" >
- <property name="text" >
- <string>Record Limit</string>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
</property>
- </widget>
+ <item>
+ <widget class="QCheckBox" name="limitCheckBox" >
+ <property name="text" >
+ <string>Record Limit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="limitSpinBox" >
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="singleStep" >
+ <number>25</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QSpinBox" name="limitSpinBox" >
- <property name="maximum" >
- <number>10000</number>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
</property>
- <property name="singleStep" >
- <number>25</number>
+ <property name="spacing" >
+ <number>6</number>
</property>
- </widget>
+ <item>
+ <widget class="QCheckBox" name="daysCheckBox" >
+ <property name="text" >
+ <string>Days Limit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="daysSpinBox" >
+ <property name="singleStep" >
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</item>
<number>6</number>
</property>
<item>
- <widget class="QCheckBox" name="daysCheckBox" >
- <property name="text" >
- <string>Days Limit</string>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
</property>
- </widget>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="clientsLabel" >
+ <property name="text" >
+ <string>Clients</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="clientsComboBox" />
+ </item>
+ </layout>
</item>
<item>
- <widget class="QSpinBox" name="daysSpinBox" >
- <property name="singleStep" >
- <number>10</number>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
</property>
- </widget>
+ <item>
+ <widget class="QLabel" name="volumeLabel" >
+ <property name="text" >
+ <string>Volume</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="volumeComboBox" />
+ </item>
+ </layout>
</item>
</layout>
</item>
<number>6</number>
</property>
<item>
- <widget class="QLabel" name="clientsLabel" >
- <property name="text" >
- <string>Clients</string>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
</property>
- </widget>
+ <item>
+ <widget class="QLabel" name="jobLabel" >
+ <property name="text" >
+ <string>Job</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="jobComboBox" />
+ </item>
+ </layout>
</item>
<item>
- <widget class="QComboBox" name="clientsComboBox" />
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="levelLabel" >
+ <property name="text" >
+ <string>Level</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="levelComboBox" />
+ </item>
+ </layout>
</item>
</layout>
</item>
<number>6</number>
</property>
<item>
- <widget class="QLabel" name="volumeLabel" >
- <property name="text" >
- <string>Volume</string>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
</property>
- </widget>
+ <item>
+ <widget class="QLabel" name="statusLabel" >
+ <property name="text" >
+ <string>Status</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="statusComboBox" />
+ </item>
+ </layout>
</item>
<item>
- <widget class="QComboBox" name="volumeComboBox" />
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="purgedLabel" >
+ <property name="text" >
+ <string>Purged</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="purgedComboBox" />
+ </item>
+ </layout>
</item>
</layout>
</item>
</item>
</layout>
</item>
- <item row="0" column="0" >
- <widget class="QTableWidget" name="mp_tableWidget" />
- </item>
</layout>
<action name="actionRefreshJobList" >
<property name="icon" >
<string>Restore From Job</string>
</property>
</action>
+ <action name="actionRestoreFromTime" >
+ <property name="icon" >
+ <iconset>../images/unmark.png</iconset>
+ </property>
+ <property name="text" >
+ <string>Restore From Time</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
nextPage->raise();
}
/* for the page selectors menu action to dock or undock, set the text */
- setContextMenuDockText(nextPage, currentitem);
+ nextPage->setContextMenuDockText();
treeWidget->addAction(actionToggleDock);
/* if this page is closeable, then add that action */
{
Pages* page = (Pages*)stackedWidget->currentWidget();
page->togglePageDocking();
- /* The window has been undocked, lets change the context menu */
- setContextMenuDockText();
}
/*
if (getFromHash(currentitem)) {
Pages* page = getFromHash(currentitem);
page->togglePageDocking();
- if (page->isDocked()) {
- stackedWidget->setCurrentWidget(page);
- }
- /* Toggle the menu item. The window's dock status has been toggled */
- setContextMenuDockText(page, currentitem);
- }
-}
-
-/*
- * Function to set the text of the toggle dock context menu when page and
- * widget item are NOT known. This is an overoaded funciton.
- * It is called from MainWin::undockWindowButton, it is not intended to change
- * for the top pages tree widget, it is for the currently active tree widget
- * item. Which is why the page is not passed.
- */
-void MainWin::setContextMenuDockText()
-{
- QTreeWidgetItem *currentitem = treeWidget->currentItem();
-
- /* Is this a page that has been inserted into the hash */
- if (getFromHash(currentitem)) {
- Pages* page = getFromHash(currentitem);
- setContextMenuDockText(page, currentitem);
- }
-}
-
-/*
- * Function to set the text of the toggle dock context menu when page and
- * widget item are known. This is the more commonly used.
- */
-void MainWin::setContextMenuDockText(Pages* page, QTreeWidgetItem* item)
-{
- QString docktext("");
- if (page->isDocked()) {
- docktext += "UnDock ";
- } else {
- docktext += "ReDock ";
- }
- docktext += item->text(0) += " Window";
-
- actionToggleDock->setText(docktext);
- setTreeWidgetItemDockColor(page, item);
-}
-
-/*
- * Function to set the color of the tree widget item based on whether it is
- * docked or not.
- */
-void MainWin::setTreeWidgetItemDockColor(Pages* page, QTreeWidgetItem* item)
-{
- if (item->text(0) != "Console") {
- if (page->isDocked()) {
- /* Set the brush to blue if undocked */
- QBrush blackBrush(Qt::black);
- item->setForeground(0, blackBrush);
- } else {
- /* Set the brush back to black if docked */
- QBrush blueBrush(Qt::blue);
- item->setForeground(0, blueBrush);
- }
- }
-}
-
-/*
- * Overload of previous function, use treeindex to get item from page
- * This is called when an undocked window is closed.
- */
-void MainWin::setTreeWidgetItemDockColor(Pages* page)
-{
- QTreeWidgetItem* item = getFromHash(page);
- if (item) {
- setTreeWidgetItemDockColor(page, item);
}
}
void writeSettings();
void readSettings();
void resetFocus() { lineEdit->setFocus(); };
- void setContextMenuDockText();
- void setContextMenuDockText(Pages *, QTreeWidgetItem *);
- void setTreeWidgetItemDockColor(Pages *, QTreeWidgetItem *);
- void setTreeWidgetItemDockColor(Pages *);
void hashInsert(QTreeWidgetItem *, Pages *);
void hashRemove(Pages *);
void hashRemove(QTreeWidgetItem *, Pages *);
* that it has the proper window flag and parent.
*/
setWindowFlags(Qt::Widget);
-// setParent(m_parent);
/* This was being done already */
m_parent->addWidget(this);
/* Set docked flag */
m_docked = true;
+ mainWin->stackedWidget->setCurrentWidget(this);
+ /* lets set the page selectors action for docking or undocking */
+ setContextMenuDockText();
}
/*
show();
/* Clear docked flag */
m_docked = false;
+ /* The window has been undocked, lets change the context menu */
+ setContextMenuDockText();
}
/*
/* A Widget was closed, lets toggle it back into the window, and set it in front. */
dockPage();
- /* is the tree widget item for "this" the current widget item */
- if (mainWin->treeWidget->currentItem() == mainWin->getFromHash(this))
- /* in case the current widget is the one which represents this, lets set the context
- * menu to undock */
- mainWin->setContextMenuDockText();
- else
- /* in case the current widget is not the one which represents this, lets set the
- * color back to black */
- mainWin->setTreeWidgetItemDockColor(this);
-
/* this fixes my woes of getting the widget to show up on top when closed */
event->ignore();
- /* put this widget on the top of the stack widget */
- m_parent->setCurrentWidget(this);
-
/* Set the current tree widget item in the Page Selector window to the item
- * which represents "this" */
+ * which represents "this"
+ * Which will also bring "this" to the top of the stacked widget */
setCurrent();
}
#ifdef xxdebugcode
m_console->display_text("Context sensitive command :\n\n");
m_console->display_text("**** ");
- m_console->display_text(command + " ****\n");
+#endif
+ m_console->display_text(command);
+ m_console->display_text("\n");
+#ifdef xxdebugcode
+ m_console->display_text(" ****\n");
m_console->display_text("Director Response :\n\n");
#endif
m_console->write_dir(command.toUtf8().data());
{
mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(this));
}
+
+/*
+ * Function to set the text of the toggle dock context menu when page and
+ * widget item are NOT known.
+ */
+void Pages::setContextMenuDockText()
+{
+ QTreeWidgetItem *item = mainWin->getFromHash(this);
+ QString docktext("");
+ if (isDocked()) {
+ docktext += "UnDock ";
+ } else {
+ docktext += "ReDock ";
+ }
+ docktext += item->text(0) += " Window";
+
+ mainWin->actionToggleDock->setText(docktext);
+ setTreeWidgetItemDockColor();
+}
+
+/*
+ * Function to set the color of the tree widget item based on whether it is
+ * docked or not.
+ */
+void Pages::setTreeWidgetItemDockColor()
+{
+ QTreeWidgetItem* item = mainWin->getFromHash(this);
+ if (item) {
+ if (item->text(0) != "Console") {
+ if (isDocked()) {
+ /* Set the brush to blue if undocked */
+ QBrush blackBrush(Qt::black);
+ item->setForeground(0, blackBrush);
+ } else {
+ /* Set the brush back to black if docked */
+ QBrush blueBrush(Qt::blue);
+ item->setForeground(0, blueBrush);
+ }
+ }
+ }
+}
void closeStackPage();
Console *console() { return m_console; };
void setCurrent();
+ void setContextMenuDockText();
+ void setTreeWidgetItemDockColor();
public slots:
/* closeEvent is a virtual function inherited from QWidget */
#include "restore.h"
/* Constructor to have job id list default in */
-prerestorePage::prerestorePage(QString &jobIdString)
+prerestorePage::prerestorePage(QString &data, unsigned int datatype)
{
- m_jobIdListIn = jobIdString;
+ m_dataIn = data;
+ m_dataInType = datatype;
buildPage();
}
/* Basic Constructor */
prerestorePage::prerestorePage()
{
- m_jobIdListIn = "";
+ m_dataIn = "";
+ m_dataInType = R_NONE;
buildPage();
}
*/
void prerestorePage::buildPage()
{
- m_dtformat = "yyyy-MM-dd HH:MM:ss";
+ m_dtformat = "yyyy-MM-dd HH:mm:ss";
m_name = "Restore";
setupUi(this);
pgInitialize();
beforeDateTime->setDateTime(QDateTime::currentDateTime());
beforeDateTime->setEnabled(false);
selectFilesRadio->setChecked(true);
- if (m_jobIdListIn == "") {
+ if (m_dataInType == R_NONE) {
selectJobsRadio->setChecked(true);
jobIdEdit->setText("Comma separted list of jobs id's");
jobIdEdit->setEnabled(false);
- } else {
+ } else if (m_dataInType == R_JOBIDLIST) {
listJobsRadio->setChecked(true);
- jobIdEdit->setText(m_jobIdListIn);
+ jobIdEdit->setText(m_dataIn);
jobsRadioClicked(false);
QStringList fieldlist;
- jobdefsFromJob(fieldlist,m_jobIdListIn);
+ 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));
+ } else if (m_dataInType == R_JOBDATETIME) {
+ selectJobsRadio->setChecked(true);
+ jobIdEdit->setText("Comma separted list of jobs id's");
+ jobIdEdit->setEnabled(false);
+ recentCheckBox->setCheckState(Qt::Unchecked);
+ jobsRadioClicked(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));
}
job_name_change(0);
connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
}
/* ***FIXME*** */
- //printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
+ printf("preRestore command \'%s\'\n", cmd.toUtf8().data());
consoleCommand(cmd);
/* Note, do not turn notifier back on here ... */
if (selectFilesRadio->isChecked()) {
{
QString job, client, fileset;
QString query("");
- query = "SELECT DISTINCT Job.Name AS JobName, Client.Name AS Client, FileSet.FileSet AS FileSet "
+ query = "SELECT DISTINCT Job.Name AS JobName, Client.Name AS Client,"
+ " FileSet.FileSet AS FileSet, Job.Starttime AS JobStart"
" From Job, Client, FileSet"
" WHERE Job.FileSetId=FileSet.FileSetId AND Job.ClientId=Client.ClientId"
" AND JobId=\'" + jobId + "\'";
"Press OK to continue?"), QMessageBox::Ok );
return false;
}
- //printf("In prerestorePage::jobIdEditFinished %s\n",line.toUtf8().data());
QStringList joblist = line.split(",", QString::SkipEmptyParts);
bool allintokay = true, alljobok = true, allisjob = true;
QString jobName(""), clientName("");
#include "ui_restore.h"
#include "ui_prerestore.h"
+enum {
+ R_NONE,
+ R_JOBIDLIST,
+ R_JOBDATETIME
+};
+
/*
* The pre-restore dialog selects the Job/Client to be restored
* It really could use considerable enhancement.
public:
prerestorePage();
- prerestorePage(QString &jobIdString);
+ prerestorePage(QString &data, unsigned int);
private slots:
void okButtonPushed();
void buildPage();
bool checkJobIdList();
QString m_dtformat;
- QString m_jobIdListIn;
+ QString m_dataIn;
+ unsigned int m_dataInType;
};
/*