X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fqt-console%2Frestore%2Frestore.cpp;h=8b3dad760a83bd4fb0f682cf954c94ec85c78e68;hb=2a7fda9473a7ac2669f59e9ff0dec1cba8b12ef1;hp=e7eeb59c8efac4f25cd6176be62bd8a3471e09b3;hpb=dc443201e51ef49f51d58206a665137e569ae219;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index e7eeb59c8e..8b3dad760a 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -1,12 +1,12 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2008 Free Software Foundation Europe e.V. + Copyright (C) 2007-2010 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 + modify it under the terms of version three of the GNU Affero General Public License as published by the Free Software Foundation and included in the file LICENSE. @@ -15,7 +15,7 @@ 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 + You should have received a copy of the GNU Affero 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. @@ -27,8 +27,6 @@ */ /* - * Version $Id$ - * * Restore Class * * Kern Sibbald, February MMVII @@ -42,7 +40,7 @@ static const int dbglvl = 100; restorePage::restorePage(int conn) { - Pmsg1(dbglvl, "Construcing restorePage Instance connection %i\n", conn); + Dmsg1(dbglvl, "Construcing restorePage Instance connection %i\n", conn); m_conn = conn; QStringList titles; @@ -53,7 +51,6 @@ restorePage::restorePage(int conn) thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png"))); m_console->notify(m_conn, false); /* this should already be off */ - m_closeable = true; connect(fileWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(fileDoubleClicked(QTreeWidgetItem *, int))); @@ -82,10 +79,14 @@ restorePage::restorePage(int conn) get_cwd(); readSettings(); + /* wait was entered from pre-restore + * will exit, but will reenter in fillDirectory */ + mainWin->waitExit(); fillDirectory(); dockPage(); setCurrent(); this->show(); + if (mainWin->m_miscDebug) Pmsg0(000, "Leave restorePage\n"); } restorePage::~restorePage() @@ -98,6 +99,7 @@ restorePage::~restorePage() */ void restorePage::fillDirectory() { + mainWin->waitEnter(); char modes[20], user[20], group[20], size[20], date[30]; char marked[10]; int pnl, fnl; @@ -105,15 +107,19 @@ void restorePage::fillDirectory() POOLMEM *path = get_pool_memory(PM_FNAME); fileWidget->clear(); - m_console->write_dir(m_conn, "dir"); + m_console->write_dir(m_conn, "dir", false); QList treeItemList; QStringList item; + m_rx.setPattern("has no children\\.$"); + bool first = true; while (m_console->read(m_conn) > 0) { char *p = m_console->msg(m_conn); char *l; strip_trailing_junk(p); - if (*p == '$' || !*p) { - continue; + if (*p == '$' || !*p) { continue; } + if (first) { + if (m_rx.indexIn(QString(p)) != -1) { continue; } + first = false; } l = p; skip_nonspaces(&p); /* permissions */ @@ -176,6 +182,7 @@ void restorePage::fillDirectory() free_pool_memory(file); free_pool_memory(path); + mainWin->waitExit(); } /* @@ -283,7 +290,7 @@ void restorePage::directoryItemChanged(QTreeWidgetItem *currentitem, { QString fullpath = m_dirTreeItems.value(currentitem); statusLine->setText(""); - if (fullpath != ""){ + if (fullpath != "") { cwd(fullpath.toUtf8().data()); fillDirectory(); } @@ -291,7 +298,6 @@ void restorePage::directoryItemChanged(QTreeWidgetItem *currentitem, void restorePage::okButtonPushed() { -// printf("In restorePage::okButtonPushed\n"); this->hide(); m_console->write(m_conn, "done"); m_console->notify(m_conn, true); @@ -317,6 +323,7 @@ void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column) char cmd[1000]; statusLine->setText(""); if (column == 0) { /* mark/unmark */ + mainWin->waitEnter(); if (item->data(0, Qt::UserRole).toBool()) { bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data()); item->setIcon(0, QIcon(QString::fromUtf8(":images/unchecked.png"))); @@ -326,12 +333,13 @@ void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column) item->setIcon(0, QIcon(QString::fromUtf8(":images/check.png"))); item->setData(0, Qt::UserRole, true); } - m_console->write_dir(m_conn, cmd); + m_console->write_dir(m_conn, cmd, false); if (m_console->read(m_conn) > 0) { strip_trailing_junk(m_console->msg(m_conn)); statusLine->setText(m_console->msg(m_conn)); } m_console->displayToPrompt(m_conn); + mainWin->waitExit(); return; } /* @@ -371,6 +379,7 @@ void restorePage::upButtonPushed() */ void restorePage::markButtonPushed() { + mainWin->waitEnter(); QList treeItemList = fileWidget->selectedItems(); QTreeWidgetItem *item; char cmd[1000]; @@ -380,7 +389,7 @@ void restorePage::markButtonPushed() count++; bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data()); item->setIcon(0, QIcon(QString::fromUtf8(":images/check.png"))); - m_console->write_dir(m_conn, cmd); + m_console->write_dir(m_conn, cmd, false); if (m_console->read(m_conn) > 0) { strip_trailing_junk(m_console->msg(m_conn)); statusLine->setText(m_console->msg(m_conn)); @@ -392,7 +401,7 @@ void restorePage::markButtonPushed() mainWin->set_status("Nothing selected, nothing done"); statusLine->setText("Nothing selected, nothing done"); } - + mainWin->waitExit(); } /* @@ -400,6 +409,7 @@ void restorePage::markButtonPushed() */ void restorePage::unmarkButtonPushed() { + mainWin->waitEnter(); QList treeItemList = fileWidget->selectedItems(); QTreeWidgetItem *item; char cmd[1000]; @@ -409,7 +419,7 @@ void restorePage::unmarkButtonPushed() count++; bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data()); item->setIcon(0, QIcon(QString::fromUtf8(":images/unchecked.png"))); - m_console->write_dir(m_conn, cmd); + m_console->write_dir(m_conn, cmd, false); if (m_console->read(m_conn) > 0) { strip_trailing_junk(m_console->msg(m_conn)); statusLine->setText(m_console->msg(m_conn)); @@ -421,7 +431,7 @@ void restorePage::unmarkButtonPushed() mainWin->set_status(tr("Nothing selected, nothing done")); statusLine->setText(tr("Nothing selected, nothing done")); } - + mainWin->waitExit(); } /* @@ -432,10 +442,11 @@ bool restorePage::cwd(const char *dir) int stat; char cd_cmd[MAXSTRING]; + mainWin->waitEnter(); statusLine->setText(""); bsnprintf(cd_cmd, sizeof(cd_cmd), "cd \"%s\"", dir); Dmsg2(dbglvl, "dir=%s cmd=%s\n", dir, cd_cmd); - m_console->write_dir(m_conn, cd_cmd); + m_console->write_dir(m_conn, cd_cmd, false); lineEdit->clear(); if ((stat = m_console->read(m_conn)) > 0) { m_cwd = m_console->msg(m_conn); @@ -446,6 +457,7 @@ bool restorePage::cwd(const char *dir) QMessageBox::critical(this, "Error", tr("cd command failed"), QMessageBox::Ok); } m_console->discardToPrompt(m_conn); + mainWin->waitExit(); return true; /* ***FIXME*** return real status */ } @@ -455,7 +467,8 @@ bool restorePage::cwd(const char *dir) char *restorePage::get_cwd() { int stat; - m_console->write_dir(m_conn, ".pwd"); + mainWin->waitEnter(); + m_console->write_dir(m_conn, ".pwd", false); Dmsg0(dbglvl, "send: .pwd\n"); if ((stat = m_console->read(m_conn)) > 0) { m_cwd = m_console->msg(m_conn); @@ -465,6 +478,7 @@ char *restorePage::get_cwd() QMessageBox::critical(this, "Error", tr(".pwd command failed"), QMessageBox::Ok); } m_console->discardToPrompt(m_conn); + mainWin->waitExit(); return m_cwd.toUtf8().data(); } @@ -475,7 +489,7 @@ void restorePage::writeSettings() { QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("RestorePage"); - settings.setValue("splitterSizes", splitter->saveState()); + settings.setValue(m_splitText, splitter->saveState()); settings.endGroup(); } @@ -484,8 +498,11 @@ void restorePage::writeSettings() */ void restorePage::readSettings() { + m_splitText = "splitterSizes_2"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("RestorePage"); - splitter->restoreState(settings.value("splitterSizes").toByteArray()); + if (settings.contains(m_splitText)) { + splitter->restoreState(settings.value(m_splitText).toByteArray()); + } settings.endGroup(); }