From: Kern Sibbald Date: Sat, 3 Mar 2007 21:11:24 +0000 (+0000) Subject: First cut fileWidget tree X-Git-Tag: Release-7.0.0~6793 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=533fdd6cff2b0589ff0e45950b3ae3c7df1fec53;p=bacula%2Fbacula First cut fileWidget tree git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4306 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 9addf96d30..d5dc381263 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -101,35 +101,44 @@ restoreDialog::restoreDialog(Console *console) { m_console = console; setupUi(this); - fillDirectory("/"); + fillDirectory("/home/kern/bacula/k"); this->show(); } /* * Fill the CList box with files at path */ -void restoreDialog::fillDirectory(const char *path) +void restoreDialog::fillDirectory(const char *dir) { char pathbuf[MAXSTRING]; char modes[20], user[20], group[20], size[20], date[30]; - char file[1000]; char marked[10]; int row = 0; + int pnl, fnl; + POOLMEM *file = get_pool_memory(PM_FNAME); + POOLMEM *path = get_pool_memory(PM_FNAME); m_console->setEnabled(false); - m_fname = path; + m_fname = dir; m_console->displayToPrompt(); - bsnprintf(pathbuf, sizeof(pathbuf), "cd %s", path); + bsnprintf(pathbuf, sizeof(pathbuf), "cd %s", dir); Dmsg1(100, "%s\n", pathbuf); + QStringList titles; + titles << "Mark" << "File" << "Mode" << "User" << "Group" << "Size" << "Date"; + fileWidget->setHeaderLabels(titles); + m_console->write(pathbuf); m_console->display_text(pathbuf); m_console->displayToPrompt(); m_console-> write_dir("dir"); m_console->display_text("dir"); + + QList items; + QStringList item; while (m_console->read() > 0) { char *p = m_console->msg(); char *l; @@ -137,7 +146,7 @@ void restoreDialog::fillDirectory(const char *path) if (*p == '$') { break; } - Dmsg1(200, "Got: %s\n", p); +// Dmsg1(000, "Got: %s\n", p); if (!*p) { continue; } @@ -177,18 +186,19 @@ void restoreDialog::fillDirectory(const char *path) } else { bstrncpy(marked, " ", sizeof(marked)); } -// split_path_and_filename(p, &restore->path, &restore->pnl, -// &restore->file, &restore->fnl); + split_path_and_filename(p, &path, &pnl, + &file, &fnl); -// Dmsg1(000, "restore->fname=%s\n", restore->fname); -// bstrncpy(file, restore->file, sizeof(file)); - printf("modes=%s user=%s group=%s size=%s date=%s file=%s\n", - modes, user, group, size, date, file); +// printf("modes=%s user=%s group=%s size=%s date=%s path=%s file=%s\n", +// modes, user, group, size, date, path, file); -// append to list + item.clear(); + item << "" << file << modes << user << group << size << date; + items.append(new QTreeWidgetItem((QTreeWidget *)0, item)); row++; } + fileWidget->insertTopLevelItems(0, items); - m_console->setEnabled(true); + m_console->setEnabled(true); } diff --git a/bacula/src/qt-console/restore/restore.ui b/bacula/src/qt-console/restore/restore.ui index 4f1136525a..56c99e0218 100644 --- a/bacula/src/qt-console/restore/restore.ui +++ b/bacula/src/qt-console/restore/restore.ui @@ -5,8 +5,8 @@ 0 0 - 1047 - 764 + 688 + 649 @@ -24,107 +24,217 @@ Qt::Horizontal - - - - 5 - 7 - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 0 - 0 - - - - true - - - 1 - - - - 1 - - - - - - - 7 - 5 - 188 - 1 - - - - - 400 - 0 - - - - - 0 - 0 - - - - true - - - 7 - - - - 1 - - - - - 1 - - - - - 2 + + + + 0 - - - - 3 - - - - - 4 + + 6 - - - - 5 + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <h2>Directories</h2> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 5 + 7 + 1 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 0 + 0 + + + + true + + + 1 + + + + 1 + + + + + + + + + + 0 - - - - 6 + + 6 - + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 61 + 20 + + + + + + + + <h2>Files</h2> + + + + + + + Qt::Horizontal + + + + 91 + 20 + + + + + + + + + + + 7 + 5 + 144 + 1 + + + + + 400 + 0 + + + + + 0 + 0 + + + + true + + + 7 + + + + 1 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + @@ -189,6 +299,26 @@ + + + + 0 + + + 6 + + + + + Status: + + + + + + + +