From: Dirk H Bartley Date: Mon, 4 Jun 2007 15:11:18 +0000 (+0000) Subject: New interface. The intent is to work towards a window which allows the user to X-Git-Tag: Release-7.0.0~6167 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe4cb99b19f44c8b545b507c091911c9b0c3a441;p=bacula%2Fbacula New interface. The intent is to work towards a window which allows the user to Browse the files in the catalog and see what versions exist for each file, then be able to mark directories, files and versions for restore. To this point it is just good at browsing. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4978 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index 5135732811..ad45ffcfd7 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -35,6 +35,7 @@ FORMS += relabel/relabel.ui FORMS += mount/mount.ui FORMS += console/console.ui FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui +FORMS += restore/restoretree.ui FORMS += run/run.ui run/runcmd.ui run/estimate.ui run/prune.ui FORMS += select/select.ui FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui @@ -109,6 +110,11 @@ SOURCES += joblog/joblog.cpp HEADERS += jobs/jobs.h SOURCES += jobs/jobs.cpp +## RestoreTree +HEADERS += restore/restoretree.h +SOURCES += restore/restoretree.cpp + + # Help dialog HEADERS += help/help.h SOURCES += help/help.cpp diff --git a/bacula/src/qt-console/images/browse.png b/bacula/src/qt-console/images/browse.png new file mode 100644 index 0000000000..fa1b8776b6 Binary files /dev/null and b/bacula/src/qt-console/images/browse.png differ diff --git a/bacula/src/qt-console/images/browse.svg b/bacula/src/qt-console/images/browse.svg new file mode 100644 index 0000000000..f56c565d54 --- /dev/null +++ b/bacula/src/qt-console/images/browse.svg @@ -0,0 +1,620 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Folder Icon + + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + folder + directory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/qt-console/images/folder.png b/bacula/src/qt-console/images/folder.png new file mode 100644 index 0000000000..6a0be93839 Binary files /dev/null and b/bacula/src/qt-console/images/folder.png differ diff --git a/bacula/src/qt-console/main.qrc b/bacula/src/qt-console/main.qrc index b54c494bd5..fee1c35f52 100644 --- a/bacula/src/qt-console/main.qrc +++ b/bacula/src/qt-console/main.qrc @@ -4,6 +4,7 @@ images/bat.png images/bat_icon.png images/big-server.png + images/browse.png images/cartridge-edit.svg images/cartridge.svg images/check.png @@ -15,6 +16,7 @@ images/edit-delete.svg images/emblem-system.svg images/estimate-job.svg + images/folder.png images/folder.svg images/help-browser.svg images/home.png diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index 4c1704ec70..42775e7703 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -141,6 +141,7 @@ + @@ -545,6 +546,14 @@ bat &Help + + + :/images/browse.png + + + Browse + + diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index cfa939c090..9cb7aad079 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -46,6 +46,7 @@ #include "medialist/medialist.h" #include "joblist/joblist.h" #include "clients/clients.h" +#include "restore/restoretree.h" #include "help/help.h" #include "jobs/jobs.h" @@ -142,6 +143,7 @@ void MainWin::createPages() createPageJobList("", "", "", "", NULL); new MediaList(); new Storage(); + new restoreTree(); treeWidget->expandItem(topItem); stackedWidget->setCurrentWidget(m_currentConsole); @@ -224,6 +226,7 @@ void MainWin::createConnections() connect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked())); connect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked())); connect(actionEstimate, SIGNAL(triggered()), this, SLOT(estimateButtonClicked())); + connect(actionBrowse, SIGNAL(triggered()), this, SLOT(browseButtonClicked())); connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked())); connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton())); connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow())); @@ -405,6 +408,11 @@ void MainWin::estimateButtonClicked() new estimatePage(); } +void MainWin::browseButtonClicked() +{ + new restoreTree(); +} + void MainWin::restoreButtonClicked() { new prerestorePage(); diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index c278242a1b..e42553ffc0 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -93,6 +93,7 @@ public slots: void labelButtonClicked(); void runButtonClicked(); void estimateButtonClicked(); + void browseButtonClicked(); void restoreButtonClicked(); void undockWindowButton(); void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); @@ -108,6 +109,7 @@ protected: private: void createConnections(); + void connectConsole(); void createPages(); private: diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index d55ca4dac2..5a4c461c38 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -268,6 +268,7 @@ void restorePage::directoryItemChanged(QTreeWidgetItem *currentitem, void restorePage::okButtonPushed() { + printf("In restorePage::okButtonPushed\n"); this->hide(); m_console->write("done"); m_console->notify(true); diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp new file mode 100644 index 0000000000..0c125cc716 --- /dev/null +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -0,0 +1,460 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2007 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. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + 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 + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +/* + * Version $Id: restore.cpp 4945 2007-05-31 01:24:28Z bartleyd2 $ + * + * Restore Class + * + * Kern Sibbald, February MMVII + * + */ + +#include "bat.h" +#include "restoretree.h" +#include "pages.h" + +restoreTree::restoreTree() +{ + setupUi(this); + m_name = "Version Browser"; + pgInitialize(); + QTreeWidgetItem* thisitem = mainWin->getFromHash(this); + thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/browse.png"))); + + m_closeable = true; + m_populated = false; + + readSettings(); + dockPage(); + m_winregex.setPattern("^/[a-z]:/$"); + m_slashregex.setPattern("/"); +} + +restoreTree::~restoreTree() +{ + writeSettings(); +} + +/* + * Called from the constructor to set up the page widgets and connections. + */ +void restoreTree::setupPage() +{ + connect(refreshButton, SIGNAL(pressed()), this, SLOT(refreshButtonPushed())); + connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(jobComboChanged(int))); + connect(directoryTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), + this, SLOT(directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); + connect(fileTable, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), + this, SLOT(fileItemChanged(QTableWidgetItem *, QTableWidgetItem *))); + connect(directoryTree, SIGNAL(itemExpanded(QTreeWidgetItem *)), + this, SLOT(directoryItemExpanded(QTreeWidgetItem *))); + + QStringList titles; + titles << "Directories"; + directoryTree->setHeaderLabels(titles); + clientCombo->addItems(m_console->client_list); + fileSetCombo->addItem("Any"); + fileSetCombo->addItems(m_console->fileset_list); + jobCombo->addItems(m_console->job_list); +} + +/* + * When refresh button is pushed, perform a query getting the directories and + * use parseDirectory and addDirectory to populate the directory tree with items. + */ +void restoreTree::populateDirectoryTree() +{ + m_slashTrap = false; + m_winTrap = false; + m_isWin = false; + m_dirPaths.clear(); + directoryTree->clear(); + fileTable->clear(); + versionTable->clear(); + QString cmd = + "SELECT DISTINCT Path.Path FROM Path" + " LEFT OUTER JOIN File ON (File.PathId=Path.PathId)" + " LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)" + " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)" + " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId) WHERE"; + m_condition = " Job.name = '" + jobCombo->itemText(jobCombo->currentIndex()) + "'"; + int clientIndex = clientCombo->currentIndex(); + if ((clientIndex >= 0) && (clientCombo->itemText(clientIndex) != "Any")) { + m_condition.append(" AND Client.Name='" + clientCombo->itemText(clientIndex) + "'"); + } + int fileSetIndex = fileSetCombo->currentIndex(); + if ((fileSetIndex >= 0) && (fileSetCombo->itemText(fileSetIndex) != "Any")) { + m_condition.append(" AND FileSet.FileSet='" + fileSetCombo->itemText(fileSetIndex) + "'"); + } + cmd += m_condition; + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Query cmd : %s\n",cmd.toUtf8().data()); + } + QStringList directories; + if (m_console->sql_cmd(cmd, directories)) { + if (mainWin->m_miscDebug) { + Pmsg1(000, "Done with query %i directories\n", directories.count()); + } + foreach(QString directory, directories) { + parseDirectory(directory); + } + } +} + +/* + * Function to parse a directory into all possible subdirectories, then add to + * The tree. + */ +void restoreTree::parseDirectory(QString &dir_in) +{ + /* Clean up the directory string remove some funny char after last '/' */ + QRegExp rgx("[^/]$"); + int lastslash = rgx.indexIn(dir_in); + dir_in.replace(lastslash, dir_in.length()-lastslash, ""); + if (mainWin->m_miscDebug) Pmsg1(000, "parsing %s\n", dir_in.toUtf8().data()); + + /* split and add if not in yet */ + QString direct, path; + int index; + bool done = false; + QStringList pathAfter, dirAfter; + /* start from the end, turn /etc/somedir/subdir/ into /etc/somedir and subdir/ + * if not added into tree, then try /etc/ and somedir/ if not added, then try + * / and etc/ . That should succeed, then add the ones that failed in reverse */ + while (((index = m_slashregex.lastIndexIn(dir_in, -2)) != -1) && (!done)) { + direct = path = dir_in; + path.replace(index+1,dir_in.length()-index-1,""); + direct.replace(0,index+1,""); +/* if (mainWin->m_miscDebug) + printf("length = %i index = %i Adding %s %s\n", + dir_in.length(), index, + path.toUtf8().data(), direct.toUtf8().data()); */ + if (addDirectory(path, direct)) done = true; + else { + if (mainWin->m_miscDebug) Pmsg0(000, "Saving for later\n"); + pathAfter.prepend(path); + dirAfter.prepend(direct); + } + dir_in = path; + } + for (int k=0; km_miscDebug) + Pmsg2(000, "Adding After %s %s\n", pathAfter[k].toUtf8().data(), dirAfter[k].toUtf8().data()); + else + if (mainWin->m_miscDebug) + Pmsg2(000, "Error Adding %s %s\n", pathAfter[k].toUtf8().data(), dirAfter[k].toUtf8().data()); + } +} + +/* + * Function called from fill directory when a directory is found to see if this + * directory exists in the directory pane and then add it to the directory pane + */ +bool restoreTree::addDirectory(QString &m_cwd, QString &newdirr) +{ + QString newdir = newdirr; + QString fullpath = m_cwd + newdirr; + bool ok = true, added = false; + bool windrive = false; + + if (mainWin->m_miscDebug) { + QString msg = QString("In addDirectory cwd \"%1\" newdir \"%2\"\n") + .arg(m_cwd) + .arg(newdir); + Pmsg0(000, msg.toUtf8().data()); + } + + if (!m_slashTrap) { + /* add unix '/' directory first */ + if (m_dirPaths.empty() && (m_winregex.indexIn(fullpath,0) == -1)) { + m_slashTrap = true; + QTreeWidgetItem *item = new QTreeWidgetItem(directoryTree); + item->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png"))); + + QString text("/"); + item->setText(0, text.toUtf8().data()); + item->setData(0, Qt::UserRole, QVariant(text)); + if (mainWin->m_miscDebug) { + Pmsg1(000, "Pre Inserting %s\n",text.toUtf8().data()); + } + m_dirPaths.insert(text, item); + } + } + + if (!m_winTrap) { + m_winTrap = true; + if (m_winregex.indexIn(fullpath,0) == 0) { + m_isWin = true; + /* this is a windows drive */ + if (mainWin->m_miscDebug) { + Pmsg0(000, "Need to do windows \"letter\":/\n"); + } + } + } + if (m_isWin) { + fullpath.replace(0,1,""); + windrive = true; + } + + /* is it already existent ?? */ + if (!m_dirPaths.contains(fullpath)) { + QTreeWidgetItem *item = NULL; + if (windrive) { + /* this is the base widget */ + item = new QTreeWidgetItem(directoryTree); + item->setText(0, fullpath.toUtf8().data()); + item->setData(0, Qt::UserRole, QVariant(fullpath)); + } else { + QTreeWidgetItem *parent = m_dirPaths.value(m_cwd); + if (parent) { + /* new directories to add */ + item = new QTreeWidgetItem(parent); + item->setText(0, newdir.toUtf8().data()); + item->setData(0, Qt::UserRole, QVariant(fullpath)); + } else { + ok = false; + if (mainWin->m_miscDebug) { + QString msg = QString("In else of if parent cwd \"%1\" newdir \"%2\"\n") + .arg(m_cwd) + .arg(newdir); + Pmsg0(000, msg.toUtf8().data()); + } + } + } + /* insert into hash */ + if (ok) { + if (mainWin->m_miscDebug) { + Pmsg1(000, "Inserting %s\n",fullpath.toUtf8().data()); + } + m_dirPaths.insert(fullpath, item); + added = true; + } + } + return added; +} + +/* + * Virtual function which is called when this page is visible on the stack + */ +void restoreTree::currentStackItem() +{ + if(!m_populated) { + if (!m_console->preventInUseConnect()) + return; + setupPage(); + m_populated=true; + } +} + +/* + * Populate the tree when refresh button pushed. + */ +void restoreTree::refreshButtonPushed() +{ + populateDirectoryTree(); +} + +/* + * Set the values of non-job combo boxes to the job defaults + */ +void restoreTree::jobComboChanged(int) +{ + job_defaults job_defs; + + (void)index; + job_defs.job_name = jobCombo->currentText(); + if (m_console->get_job_defaults(job_defs)) { + fileSetCombo->setCurrentIndex(fileSetCombo->findText(job_defs.fileset_name, Qt::MatchExactly)); + clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); + } +} + +/* + * Function to populate the file list table + */ +void restoreTree::directoryItemChanged(QTreeWidgetItem *item, QTreeWidgetItem *) +{ + if (item == NULL) + return; + QBrush blackBrush(Qt::black); + QString directory = item->data(0,Qt::UserRole).toString(); + directoryLabel->setText("Present Working Directory : " + directory); + QString cmd = + "SELECT DISTINCT FileName.Name" + " FROM File LEFT OUTER JOIN Filename on (FileName.FileNameId=File.FileNameId)" + " LEFT OUTER JOIN Path ON (Path.PathId=File.PathId)" + " LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)" + " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)" + " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)"; + cmd += " WHERE Path.Path='" + directory + "' AND FileName.Name!='' AND " + m_condition; + + QStringList headerlist = (QStringList() << "File Name"); + fileTable->clear(); + /* Also clear the version table here */ + versionTable->clear(); + versionTable->setRowCount(0); + versionTable->setColumnCount(0); + fileTable->setColumnCount(headerlist.size()); + fileTable->setHorizontalHeaderLabels(headerlist); + + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Query cmd : %s\n",cmd.toUtf8().data()); + } + QStringList results; + if (m_console->sql_cmd(cmd, results)) { + m_resultCount = results.count(); + + QTableWidgetItem* tableItem; + QString field; + QStringList fieldlist; + fileTable->setRowCount(results.size()); + + int row = 0; + /* Iterate through the record returned from the query */ + foreach (QString resultline, results) { + /* Iterate through fields in the record */ + int column = 0; + fieldlist = resultline.split("\t"); + foreach (field, fieldlist) { + field = field.trimmed(); /* strip leading & trailing spaces */ + tableItem = new QTableWidgetItem(field,1); + tableItem->setFlags(0); + tableItem->setForeground(blackBrush); + tableItem->setData(Qt::UserRole,QVariant(directory)); + fileTable->setItem(row, column, tableItem); + column++; + } + row++; + } + fileTable->setRowCount(row); + } + fileTable->resizeColumnsToContents(); + fileTable->resizeRowsToContents(); + fileTable->verticalHeader()->hide(); +} + +/* + * Function to populate the version table + */ +void restoreTree::fileItemChanged(QTableWidgetItem *fileTableItem, QTableWidgetItem *) +{ + if (fileTableItem == NULL) + return; + QString file = fileTableItem->text(); + QString directory = fileTableItem->data(Qt::UserRole).toString(); + + QBrush blackBrush(Qt::black); + QString cmd = + "SELECT File.FileId, Job.JobId, Job.EndTime, File.Md5 " + " FROM File" + " LEFT OUTER JOIN Filename on (FileName.FileNameId=File.FileNameId)" + " LEFT OUTER JOIN Path ON (Path.PathId=File.PathId)" + " LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)" + " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)" + " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)"; + cmd += " WHERE FileName.Name='" + file + "' AND Path.Path='" + directory + "' AND " + m_condition; + + QStringList headerlist = (QStringList() << "File Id" << "Job Id" << "End Time" << "Md5"); + versionTable->clear(); + versionTable->setColumnCount(headerlist.size()); + versionTable->setHorizontalHeaderLabels(headerlist); + + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Query cmd : %s\n",cmd.toUtf8().data()); + } + QStringList results; + if (m_console->sql_cmd(cmd, results)) { + m_resultCount = results.count(); + + QTableWidgetItem* tableItem; + QString field; + QStringList fieldlist; + versionTable->setRowCount(results.size()); + + int row = 0; + /* Iterate through the record returned from the query */ + foreach (QString resultline, results) { + fieldlist = resultline.split("\t"); + int column = 0; + /* remove directory */ + if (fieldlist[0].trimmed() != "") { + /* Iterate through fields in the record */ + foreach (field, fieldlist) { + field = field.trimmed(); /* strip leading & trailing spaces */ + tableItem = new QTableWidgetItem(field,1); + tableItem->setFlags(0); + tableItem->setForeground(blackBrush); + tableItem->setData(Qt::UserRole,QVariant(directory)); + versionTable->setItem(row, column, tableItem); + column++; + } + row++; + } + } + } + versionTable->resizeColumnsToContents(); + versionTable->resizeRowsToContents(); + versionTable->verticalHeader()->hide(); +} + +/* + * Save user settings associated with this page + */ +void restoreTree::writeSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("RestoreTree"); + settings.setValue("splitterSizes", splitter->saveState()); + settings.endGroup(); +} + +/* + * Read and restore user settings associated with this page + */ +void restoreTree::readSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("RestoreTree"); + splitter->restoreState(settings.value("splitterSizes").toByteArray()); + settings.endGroup(); +} + +/* + * This is a funcion to accomplish the one thing I struggled to figure out what + * was taking so long. It add the icons, but after the tree is made. + */ +void restoreTree::directoryItemExpanded(QTreeWidgetItem *item) +{ + int childCount = item->childCount(); + for (int i=0; ichild(i); + child->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png"))); + } +} diff --git a/bacula/src/qt-console/restore/restoretree.h b/bacula/src/qt-console/restore/restoretree.h new file mode 100644 index 0000000000..43a08e92c0 --- /dev/null +++ b/bacula/src/qt-console/restore/restoretree.h @@ -0,0 +1,79 @@ +#ifndef _RESTORETREE_H_ +#define _RESTORETREE_H_ + +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2007 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. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + 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 + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Version $Id: restore.h 4945 2007-05-31 01:24:28Z bartleyd2 $ + * + * Kern Sibbald, February 2007 + */ + +#include +#include "pages.h" +#include "ui_restoretree.h" + +/* + * A restore tree to view files in the catalog + */ +class restoreTree : public Pages, public Ui::restoreTreeForm +{ + Q_OBJECT + +public: + restoreTree(); + ~restoreTree(); + virtual void currentStackItem(); + +private slots: + void refreshButtonPushed(); + void jobComboChanged(int); + void directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); + void fileItemChanged(QTableWidgetItem *,QTableWidgetItem *); + void directoryItemExpanded(QTreeWidgetItem *); + +private: + void populateDirectoryTree(); + void parseDirectory(QString &dir_in); + bool addDirectory(QString &, QString &); + void setupPage(); + void writeSettings(); + void readSettings(); + bool m_populated; + QRegExp m_winregex; + QRegExp m_slashregex; + bool m_slashTrap; + bool m_winTrap; + bool m_isWin; + //QString m_jobCondition; + QHash m_dirPaths; + QString m_condition; + int m_resultCount; +}; + +#endif /* _RESTORETREE_H_ */ diff --git a/bacula/src/qt-console/restore/restoretree.ui b/bacula/src/qt-console/restore/restoretree.ui new file mode 100644 index 0000000000..8a01cff03f --- /dev/null +++ b/bacula/src/qt-console/restore/restoretree.ui @@ -0,0 +1,157 @@ + + restoreTreeForm + + + + 0 + 0 + 515 + 333 + + + + Form + + + + 9 + + + 6 + + + + + + 7 + 7 + 0 + 0 + + + + Qt::Horizontal + + + + + + 0 + + + 6 + + + + + + + + Files + + + Qt::AlignCenter + + + + + + + + + 0 + + + 6 + + + + + + + + Versions + + + Qt::AlignCenter + + + + + + + + + + + 0 + + + 6 + + + + + + 5 + 0 + 0 + 0 + + + + Directory + + + + + + + 0 + + + 6 + + + + + Refresh + + + :/images/view-refresh.svg + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + +