2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
32 * bRestore Class (Eric's brestore)
34 * Kern Sibbald, January MMVII
43 m_name = tr("bRestore");
47 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
48 thisitem->setIcon(0, QIcon(QString::fromUtf8(":images/browse.png")));
53 void bRestore::setClient()
55 Pmsg0(000, "Repopulating client table\n");
56 // Select the same client, don't touch
57 if (m_client == ClientList->currentText()) {
60 m_client = ClientList->currentText();
61 FileList->clearContents();
62 FileRevisions->clearContents();
64 JobList->setEnabled(true);
65 LocationEntry->clear();
67 if (ClientList->currentIndex() < 1) {
71 JobList->addItem("Job list for " + m_client);
74 "SELECT Job.Jobid AS JobId, Job.StartTime AS StartTime,"
75 " Job.Level AS Level,"
77 " FROM Job JOIN Client USING (ClientId)"
79 " Job.JobStatus IN ('T','W') AND Job.Type='B' AND"
80 " Client.Name='" + m_client + "' ORDER BY StartTime DESC" ;
84 if (m_console->sql_cmd(jobQuery, results)) {
86 QStringList fieldlist;
88 /* Iterate through the record returned from the query */
89 foreach (QString resultline, results) {
90 fieldlist = resultline.split("\t");
91 job = fieldlist[1] + " " + fieldlist[3] + "(" + fieldlist[2] + ")";
92 JobList->addItem(job, QVariant(fieldlist[0]));
98 void bRestore::setJob()
100 if (JobList->currentIndex() < 1) {
104 QVariant tmp = JobList->itemData(JobList->currentIndex(), Qt::UserRole);
105 m_jobids = tmp.toString();
106 QString cmd = ".bvfs_update jobid=" + m_jobids;
107 m_console->dir_cmd(cmd, results);
109 Pmsg0(000, "update done\n");
112 void bRestore::displayFiles(uint64_t pathid)
117 void bRestore::displayFiles(QString path)
119 QString q = ".bvfs_lsdir jobid=" + m_jobids + " path=" + path;
121 if (m_console->dir_cmd(q, results)) {
123 QStringList fieldlist;
125 foreach (QString resultline, results) {
126 fieldlist = resultline.split("\t");
131 void bRestore::PgSeltreeWidgetClicked()
136 if (!isOnceDocked()) {
141 void bRestore::setupPage()
143 Pmsg0(000, "Setup page\n");
144 ClientList->addItem("Client list");
145 ClientList->addItems(m_console->client_list);
146 connect(ClientList, SIGNAL(currentIndexChanged(int)), this, SLOT(setClient()));
147 connect(JobList, SIGNAL(currentIndexChanged(int)), this, SLOT(setJob()));
151 bRestore::~bRestore()