bRestore::bRestore()
{
- m_name = "bRestore";
+ m_name = tr("bRestore");
+ m_client = "";
setupUi(this);
pgInitialize();
+ QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
+ thisitem->setIcon(0, QIcon(QString::fromUtf8(":images/browse.png")));
dockPage();
+ m_populated = false;
+}
+
+void bRestore::setClient()
+{
+ Pmsg0(000, "Repopulating client table\n");
+ // Select the same client, don't touch
+ if (m_client == ClientList->currentText()) {
+ return;
+ }
+ m_client = ClientList->currentText();
+ FileList->clearContents();
+ FileRevisions->clearContents();
+ JobList->clear();
+ JobList->setEnabled(true);
+ LocationEntry->clear();
+
+ if (ClientList->currentIndex() < 1) {
+ return;
+ }
+
+ JobList->addItem("Job list for " + m_client);
+
+ QString jobQuery =
+ "SELECT Job.Jobid AS JobId, Job.StartTime AS StartTime,"
+ " Job.Level AS Level,"
+ " Job.Name AS Name"
+ " FROM Job JOIN Client USING (ClientId)"
+ " WHERE"
+ " Job.JobStatus IN ('T','W') AND Job.Type='B' AND"
+ " Client.Name='" + m_client + "' ORDER BY StartTime DESC" ;
+
+ QString job;
+ QStringList results;
+ if (m_console->sql_cmd(jobQuery, results)) {
+ QString field;
+ QStringList fieldlist;
+
+ /* Iterate through the record returned from the query */
+ foreach (QString resultline, results) {
+ fieldlist = resultline.split("\t");
+ job = fieldlist[1] + " " + fieldlist[3] + "(" + fieldlist[2] + ")";
+ JobList->addItem(job, QVariant(fieldlist[0]));
+ }
+ }
+}
+
+
+void bRestore::setJob()
+{
+ if (JobList->currentIndex() < 1) {
+ return ;
+ }
+ QStringList results;
+ QVariant tmp = JobList->itemData(JobList->currentIndex(), Qt::UserRole);
+ m_jobids = tmp.toString();
+ QString cmd = ".bvfs_update jobid=" + m_jobids;
+ m_console->dir_cmd(cmd, results);
+ displayFiles("/");
+ Pmsg0(000, "update done\n");
+}
+
+void bRestore::displayFiles(uint64_t pathid)
+{
+
+}
+
+void bRestore::displayFiles(QString path)
+{
+ QString q = ".bvfs_lsdir jobid=" + m_jobids + " path=" + path;
+ QStringList results;
+ if (m_console->dir_cmd(q, results)) {
+ QString field;
+ QStringList fieldlist;
+
+ foreach (QString resultline, results) {
+ fieldlist = resultline.split("\t");
+ }
+ }
+}
+
+void bRestore::PgSeltreeWidgetClicked()
+{
+ if(!m_populated) {
+ setupPage();
+ }
+ if (!isOnceDocked()) {
+ dockPage();
+ }
+}
+
+void bRestore::setupPage()
+{
+ Pmsg0(000, "Setup page\n");
+ ClientList->addItem("Client list");
+ ClientList->addItems(m_console->client_list);
+ connect(ClientList, SIGNAL(currentIndexChanged(int)), this, SLOT(setClient()));
+ connect(JobList, SIGNAL(currentIndexChanged(int)), this, SLOT(setJob()));
+ m_populated = true;
}
bRestore::~bRestore()
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>bRestoreForm</class>
- <widget class="QWidget" name="bRestoreForm" >
- <property name="geometry" >
+ <widget class="QWidget" name="bRestoreForm">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>555</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>brestore</string>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
+ <layout class="QGridLayout">
+ <property name="margin">
<number>9</number>
</property>
- <property name="spacing" >
+ <property name="spacing">
<number>6</number>
</property>
- <item row="1" column="0" >
- <widget class="QSplitter" name="splitter_2" >
- <property name="orientation" >
+ <item row="1" column="0">
+ <widget class="QSplitter" name="splitter_2">
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <widget class="QSplitter" name="splitter" >
- <property name="orientation" >
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <widget class="QGroupBox" name="groupBox" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="title" >
+ <property name="title">
<string>File list</string>
</property>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>9</number>
+ </property>
<item>
- <widget class="QTableWidget" name="FileList" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
+ <widget class="QTableWidget" name="FileList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>5</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<column>
- <property name="text" >
+ <property name="text">
<string>Type</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>File Name</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Size</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Date</string>
</property>
</column>
</item>
</layout>
</widget>
- <widget class="QGroupBox" name="groupBox_2" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="title" >
+ <property name="title">
<string>File revisions</string>
</property>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>9</number>
+ </property>
<item>
- <widget class="QTableWidget" name="FileRevisions" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
+ <widget class="QTableWidget" name="FileRevisions">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<column>
- <property name="text" >
+ <property name="text">
<string>InChanger</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Volume</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>JobId</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Size</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Date</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Chksum</string>
</property>
</column>
</layout>
</widget>
</widget>
- <widget class="QWidget" name="layoutWidget_2" >
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
+ <widget class="QWidget" name="layoutWidget_2">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>0</number>
+ </property>
<item>
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>0</number>
+ </property>
<item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Restore items list</span></p></body></html></string>
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Restore items list</span></p></body></html></string>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</spacer>
</item>
<item>
- <widget class="QPushButton" name="pushButton" >
- <property name="text" >
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="pushButton_2" >
- <property name="text" >
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="text">
<string>Estimate</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="pushButton_3" >
- <property name="text" >
+ <widget class="QPushButton" name="pushButton_3">
+ <property name="text">
<string>Restore</string>
</property>
</widget>
</layout>
</item>
<item>
- <widget class="QTableWidget" name="RestoreList" >
- <property name="acceptDrops" >
+ <widget class="QTableWidget" name="RestoreList">
+ <property name="acceptDrops">
<bool>true</bool>
</property>
<column>
- <property name="text" >
+ <property name="text">
<string>Type</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>FileName</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>JobId</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>FileIndex</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Nb Files</string>
</property>
</column>
<column>
- <property name="text" >
+ <property name="text">
<string>Size</string>
</property>
</column>
</widget>
</widget>
</item>
- <item row="0" column="0" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>0</number>
+ </property>
<item>
- <widget class="QComboBox" name="ClientList" />
+ <widget class="QComboBox" name="ClientList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QComboBox" name="JobList" >
- <property name="enabled" >
+ <widget class="QComboBox" name="JobList">
+ <property name="enabled">
<bool>false</bool>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType" >
+ <property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</spacer>
</item>
<item>
- <widget class="QPushButton" name="pushButton_4" >
- <property name="text" >
+ <widget class="QPushButton" name="LocationBp">
+ <property name="text">
<string>Location</string>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="lineEdit" />
+ <widget class="QLineEdit" name="LocationEntry"/>
</item>
</layout>
</item>