From 1a405755d822d1dde1ab8cdf8db72c16fede334a Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Fri, 4 May 2007 02:25:21 +0000 Subject: [PATCH] Addressed issue of long compiles. Simplify with Pages::setCurrent Restore dialogs are now stacked pages. updated TODO added PAGES git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4690 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/{commands => COMMANDS} | 0 bacula/src/qt-console/PAGES | 21 ++ bacula/src/qt-console/README | 2 +- bacula/src/qt-console/TODO | 25 +- bacula/src/qt-console/console/console.cpp | 3 + bacula/src/qt-console/console/console.h | 2 - bacula/src/qt-console/fileset/fileset.cpp | 4 - bacula/src/qt-console/mainwin.cpp | 36 ++- bacula/src/qt-console/mainwin.h | 14 +- bacula/src/qt-console/medialist/medialist.cpp | 2 +- bacula/src/qt-console/pages.cpp | 17 +- bacula/src/qt-console/pages.h | 3 +- bacula/src/qt-console/restore/prerestore.cpp | 36 ++- bacula/src/qt-console/restore/prerestore.ui | 152 +++++---- bacula/src/qt-console/restore/restore.cpp | 96 ++++-- bacula/src/qt-console/restore/restore.h | 19 +- bacula/src/qt-console/restore/restore.ui | 304 +++++++----------- bacula/src/qt-console/storage/storage.cpp | 9 +- 18 files changed, 416 insertions(+), 329 deletions(-) rename bacula/src/qt-console/{commands => COMMANDS} (100%) create mode 100644 bacula/src/qt-console/PAGES diff --git a/bacula/src/qt-console/commands b/bacula/src/qt-console/COMMANDS similarity index 100% rename from bacula/src/qt-console/commands rename to bacula/src/qt-console/COMMANDS diff --git a/bacula/src/qt-console/PAGES b/bacula/src/qt-console/PAGES new file mode 100644 index 0000000000..51286c774f --- /dev/null +++ b/bacula/src/qt-console/PAGES @@ -0,0 +1,21 @@ +Each page should have the following in the constructor +/* this is the text identifying the page in the tree widget */ +m_name = "Restore"; + +/* this sets values for the class based on the extern mainWin-> it sets + m_parent (the stacked widget), + m_console (from current console) + creates the page selector tree widget and sets it's name and inserts + itself in the double direction hashes */ +pgInitialize(parentwidgetitem); or +pgInitialize(); which will have the director as parent in page selector + +/* is this window always present or can the user remove it */ +m_closeable = true; + +/* put the page in the stack widget */ +dockPage(); +/* bring the page to the top of the widget by "selecting" the tree widget + item in the page selector */ +setCurrent(); + diff --git a/bacula/src/qt-console/README b/bacula/src/qt-console/README index eb91670ffb..4b5371e7b9 100644 --- a/bacula/src/qt-console/README +++ b/bacula/src/qt-console/README @@ -16,7 +16,7 @@ then to execute it ./bat The qmake command needs to be entered only if you add a new file, in -which case, you should edit bat.pro and add the new filename +which case, you should edit bat.pro.in and add the new filename in the appropriate place. In running qmake, it will build a new Makefile, and there after, you simply use "make". In fact, providing you edit bat.pro, doing a "make" will automatically call qmake to diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index a219844ec8..897723c32a 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -1,10 +1,21 @@ dhb ==================================================== +Resolve issue of connection during restore selection. Could go with preempt + +Add option to LIMIT the number of jobs shown in all jobs page for users with +multiple hundreds to thousands of jobs. + +Where and bootstrap are confused in runjobs of restore. + +User preferences. With log to stdout options. + Test restore and get anything not working, working. + partially done. Get restore into stack. + Should the jobs dialog be turned into a page as well?? -Play with includes to Make these compiles shorter. +Update README describe bat.conf.example to bat.conf Create list of what does not work. From what I can tell, just the restore window on the left. @@ -18,6 +29,7 @@ status dir on page select director item All items with jobid= that I thought could work from joblist are done. As well as many more update slots scan +see COMMANDS file preempt all connections to console with if (!is_connectedGui()) @@ -29,6 +41,14 @@ and about not populating until the tree widget is clicked etc... LOW priority items: +User configuration dialog. Include options for debugging output to stdout. + +Is there a way to query the director/database for whether a storage is currently +mounted so I am not presenting both mount and unmount to the user?? + +Is there a way to identify a slot as having a cleaning tape??? +(Kern says more work needs to be done in bacula with autochangers) + Get rid of "Warning: name layoutWidget is already used" when make uic's restore.ui move behavior of: @@ -82,6 +102,9 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Play with includes to Make these compiles shorter. + moved includes of of includes and into files only console.h should be long + relabel storage=DDS3 oldvolume=ddsvol003 volume=dds3vol003 slot=3 pool=dds3_hope in label slot spinner, limit the upper to the value of slots for that storage. diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 6d00ef71de..a1d7b27aff 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -37,6 +37,9 @@ #include #include "bat.h" #include "console.h" +#include "restore.h" +#include "select.h" +#include "run/run.h" Console::Console(QStackedWidget *parent) { diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 77299982d6..f49767a4a1 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -36,8 +36,6 @@ #include #include "pages.h" #include "ui_console.h" -#include "restore.h" -#include "select.h" #ifndef MAX_NAME_LENGTH #define MAX_NAME_LENGTH 128 diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index 66d8cb2abb..b2c66674d5 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -196,10 +196,6 @@ void FileSet::consoleStatusFileSet() QString cmd("status fileset="); cmd += m_currentlyselected; consoleCommand(cmd); -// m_console->write_dir(cmd.toUtf8().data()); -// m_console->displayToPrompt(); - /* Bring this directors console to the front of the stack */ -// mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(m_console)); } /* diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 6659c60047..a11c38a5d3 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -39,6 +39,13 @@ #include "joblist/joblist.h" #include "storage/storage.h" #include "fileset/fileset.h" +#include "label/label.h" +#include "run/run.h" +#include "pages.h" +#include "restore/restore.h" +#include "medialist/medialist.h" +#include "joblist/joblist.h" +#include "clients/clients.h" MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { @@ -64,7 +71,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) console->connect(); } m_currentConsole = (Console*)getFromHash(m_firstItem); - treeWidget->setCurrentItem(getFromHash(m_currentConsole)); + m_currentConsole->setCurrent(); /* FIXME * I'd like to turn this into a debug item * DIRRES* dirres = m_currentConsole->getDirRes(); @@ -149,7 +156,7 @@ void MainWin::createPageMediaList() void MainWin::createPageJobList(QString &media, QString &client, QTreeWidgetItem *parentTreeWidgetItem) { - QTreeWidgetItem *item, *holdItem; + QTreeWidgetItem *holdItem; /* save current tree widget item in case query produces no results */ holdItem = treeWidget->currentItem(); @@ -157,8 +164,7 @@ void MainWin::createPageJobList(QString &media, QString &client, joblist->dockPage(); /* If this is a query of jobs on a specific media */ if ((media != "") || (client != "")) { - item = getFromHash(joblist); - treeWidget->setCurrentItem(item); + joblist->setCurrent(); /* did query produce results, if not close window and set back to hold */ if (joblist->m_resultCount == 0) { joblist->closeStackPage(); @@ -261,7 +267,7 @@ void MainWin::createConnections() connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows())); connect(actionLabel, SIGNAL(triggered()), this, SLOT(labelDialogClicked())); connect(actionRun, SIGNAL(triggered()), this, SLOT(runDialogClicked())); - connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreDialogClicked())); + connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked())); connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton())); connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow())); connect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage())); @@ -435,9 +441,9 @@ void MainWin::runDialogClicked() new runDialog(m_currentConsole); } -void MainWin::restoreDialogClicked() +void MainWin::restoreButtonClicked() { - new prerestoreDialog(m_currentConsole); + new prerestorePage(m_currentConsole); } /* @@ -455,9 +461,8 @@ void MainWin::input_line() } m_cmd_history.append(cmdStr); m_cmd_last = -1; - if (treeWidget->currentItem() != getFromHash(m_currentConsole)){ - treeWidget->setCurrentItem(getFromHash(m_currentConsole)); - } + if (treeWidget->currentItem() != getFromHash(m_currentConsole)) + m_currentConsole->setCurrent(); } @@ -660,3 +665,14 @@ void MainWin::closePage() } } } + +/* Quick function to return the current console */ +Console *MainWin::currentConsole() +{ + return m_currentConsole; +} +/* Quick function to return the tree item for the director */ +QTreeWidgetItem *MainWin::currentTopItem() +{ + return m_currentConsole->directorTreeItem(); +} diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index b568711c4d..6a659ffc9f 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -39,15 +39,9 @@ #include #include #include "ui_main.h" -#include "label/label.h" -#include "run/run.h" -#include "pages.h" -#include "restore/restore.h" -#include "medialist/medialist.h" -#include "joblist/joblist.h" -#include "clients/clients.h" class Console; +class Pages; class MainWin : public QMainWindow, public Ui::MainForm { @@ -68,8 +62,8 @@ public: void hashInsert(QTreeWidgetItem *, Pages *); void hashRemove(Pages *); void hashRemove(QTreeWidgetItem *, Pages *); - QTreeWidgetItem *currentTopItem() { return m_currentConsole->directorTreeItem(); }; - Console *currentConsole() { return m_currentConsole; }; + Console *currentConsole(); + QTreeWidgetItem *currentTopItem(); Pages* getFromHash(QTreeWidgetItem *); QTreeWidgetItem* getFromHash(Pages *); /* This hash is to get the page when the page selector widget is known */ @@ -86,7 +80,7 @@ public slots: void treeItemClicked(QTreeWidgetItem *item, int column); void labelDialogClicked(); void runDialogClicked(); - void restoreDialogClicked(); + void restoreButtonClicked(); void undockWindowButton(); void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); void stackItemChanged(int); diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 06b9d625e7..aca288728e 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -263,6 +263,6 @@ void MediaList::purgeVolume() */ void MediaList::relabelVolume() { - placeConsoleOnTop(); + setConsoleCurrent(); new relabelDialog(m_console, m_currentVolumeName); } diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 3bb4dc7999..b6bd5d2f99 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -135,8 +135,7 @@ void Pages::closeEvent(QCloseEvent* event) /* Set the current tree widget item in the Page Selector window to the item * which represents "this" */ - QTreeWidgetItem *item= mainWin->getFromHash(this); - mainWin->treeWidget->setCurrentItem(item); + setCurrent(); } /* @@ -216,7 +215,7 @@ void Pages::consoleCommand(QString &command) if (!m_console->is_connectedGui()) return; /* Bring this directors console to the front of the stack */ - placeConsoleOnTop(); + setConsoleCurrent(); m_console->display_text("Context sensitive command :\n\n"); m_console->display_text("**** "); m_console->display_text(command + " ****\n"); @@ -234,7 +233,7 @@ void Pages::consoleCommand(QString &command) void Pages::changeEvent(QEvent *event) { if ((event->type() == QEvent::ActivationChange) && (isActiveWindow())) { - mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(this)); + setCurrent(); } } @@ -255,7 +254,15 @@ void Pages::setTitle() /* * Bring the current directors console window to the top of the stack. */ -void Pages::placeConsoleOnTop() +void Pages::setConsoleCurrent() { mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(m_console)); } + +/* + * Bring this window to the top of the stack. + */ +void Pages::setCurrent() +{ + mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(this)); +} diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index 2294af580c..857ed70635 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -66,6 +66,7 @@ public: virtual void currentStackItem(); void closeStackPage(); Console *console() { return m_console; }; + void setCurrent(); public slots: /* closeEvent is a virtual function inherited from QWidget */ @@ -77,7 +78,7 @@ protected: void consoleCommand(QString &); virtual void treeWidgetName(QString &); virtual void changeEvent(QEvent *event); - void placeConsoleOnTop(); + void setConsoleCurrent(); void setTitle(); bool m_closeable; bool m_docked; diff --git a/bacula/src/qt-console/restore/prerestore.cpp b/bacula/src/qt-console/restore/prerestore.cpp index e366da7a4c..b6cd0839a1 100644 --- a/bacula/src/qt-console/restore/prerestore.cpp +++ b/bacula/src/qt-console/restore/prerestore.cpp @@ -39,23 +39,39 @@ #include "restore.h" -prerestoreDialog::prerestoreDialog(Console *console) +prerestorePage::prerestorePage(Console *console) { - m_console = console; /* keep compiler quiet */ - m_console->notify(false); + console->notify(false); + m_name = "Pre-Restore"; setupUi(this); + QTreeWidgetItem *parent = mainWin->getFromHash(console); + if (!parent) { + /* ***FIXME*** */ + printf("Error retrieving tree widget."); + return; + } + pgInitialize(parent); + m_closeable = true; + jobCombo->addItems(console->job_list); filesetCombo->addItems(console->fileset_list); clientCombo->addItems(console->client_list); poolCombo->addItems(console->pool_list); storageCombo->addItems(console->storage_list); + //beforeDateTime->setDate(QDateTime::currentDateTime().toUTC().date()); + beforeDateTime->setDateTime(QDateTime::currentDateTime()); + beforeDateTime->setEnabled(false); job_name_change(0); connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int))); + connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed())); + connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed())); + dockPage(); + setCurrent(); this->show(); } -void prerestoreDialog::accept() +void prerestorePage::okButtonPushed() { QString cmd; @@ -69,24 +85,26 @@ void prerestoreDialog::accept() .arg(poolCombo->currentText()) .arg(storageCombo->currentText()); + /* ***FIXME*** */ + printf("preRestore command \"%s\"\n", cmd.toUtf8().data()); m_console->write(cmd); m_console->display_text(cmd); /* Note, do not turn notifier back on here ... */ - new restoreDialog(m_console); - delete this; + new restorePage(m_console); + closeStackPage(); } -void prerestoreDialog::reject() +void prerestorePage::cancelButtonPushed() { mainWin->set_status("Canceled"); this->hide(); m_console->notify(true); - delete this; + closeStackPage(); } -void prerestoreDialog::job_name_change(int index) +void prerestorePage::job_name_change(int index) { job_defaults job_defs; diff --git a/bacula/src/qt-console/restore/prerestore.ui b/bacula/src/qt-console/restore/prerestore.ui index a506a251d4..98218744ab 100644 --- a/bacula/src/qt-console/restore/prerestore.ui +++ b/bacula/src/qt-console/restore/prerestore.ui @@ -1,37 +1,77 @@ prerestoreForm - - - Qt::WindowModal - + 0 0 - 366 - 299 + 561 + 408 - - - 500 - 500 - - - - Qt::StrongFocus - - Restore Files + Form - + 9 6 - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + 8 @@ -148,51 +188,45 @@ - - - - Qt::Horizontal + + + + 0 - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + 6 - + + + + Qt::Horizontal + + + + 171 + 20 + + + + + + + + OK + + + + + + + Cancel + + + + - - - buttonBox - accepted() - prerestoreForm - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - prerestoreForm - reject() - - - 316 - 260 - - - 286 - 274 - - - - + diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 928efdd6cd..4cdb7470fe 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -38,14 +38,22 @@ #include "bat.h" #include "restore.h" -restoreDialog::restoreDialog(Console *console ) +restorePage::restorePage(Console *console) { QStringList titles; - m_console = console; + setupUi(this); + QTreeWidgetItem *parent = mainWin->getFromHash(console); + if (!parent) { + /* Make this a user configurable stdout msg *** FIXME ****/ + printf("Error retrieving tree widget."); + return; + } + m_name = "Restore"; + pgInitialize(parent); m_console->notify(false); /* this should already be off */ + m_closeable = true; - setupUi(this); connect(fileWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(fileDoubleClicked(QTreeWidgetItem *, int))); connect(directoryWidget, SIGNAL( @@ -54,22 +62,28 @@ restoreDialog::restoreDialog(Console *console ) connect(upButton, SIGNAL(pressed()), this, SLOT(upButtonPushed())); connect(markButton, SIGNAL(pressed()), this, SLOT(markButtonPushed())); connect(unmarkButton, SIGNAL(pressed()), this, SLOT(unmarkButtonPushed())); + connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed())); + connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed())); setFont(m_console->get_font()); m_console->displayToPrompt(); - titles << "Mark" << "File" << "Mode" << "User" << "Group" << "Size" << "Date"; fileWidget->setHeaderLabels(titles); get_cwd(); + + //QString root(""); + //addDirectory(root); fillDirectory(); + dockPage(); + setCurrent(); this->show(); } /* * Fill the fileWidget box with the contents of the current directory */ -void restoreDialog::fillDirectory() +void restorePage::fillDirectory() { char modes[20], user[20], group[20], size[20], date[30]; char marked[10]; @@ -148,23 +162,39 @@ void restoreDialog::fillDirectory() * 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 */ -void restoreDialog::addDirectory(QString &newdir) +void restorePage::addDirectory(QString &newdirr) { - QString fullpath ; + QString newdir = newdirr; + QString fullpath = m_cwd + newdirr; + QRegExp regex("^/[a-z]:/$"); + bool ok=true; - /* if this is the base dir, strip off the leading "/" */ - if (m_cwd == "/"){ - fullpath = newdir; - } else { - fullpath = m_cwd + newdir; + //printf("In addDirectory cwd \"%s\" newdir \"%s\"\n", m_cwd.toUtf8().data(), + //newdir.toUtf8().data()); + + /* add unix '/' directory first */ + if (m_dirPaths.empty() && (regex.indexIn(fullpath,0) == -1)) { + QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget); + QString text("/"); + item->setText(0, text.toUtf8().data()); + //printf("Pre Inserting %s\n",text.toUtf8().data()); + m_dirPaths.insert(text, item); + m_dirTreeItems.insert(item, text); + } + + if (regex.indexIn(fullpath,0) == 0) { + /* this is a windows drive */ + //printf("Need to do windows c:/\n"); + fullpath.replace(0,1,""); } + /* is it already existent ?? */ if (!m_dirPaths.contains(fullpath)) { QTreeWidgetItem *item = NULL; if (m_dirPaths.empty()) { /* this is the base widget */ item = new QTreeWidgetItem(directoryWidget); - item->setText(0, newdir.toUtf8().data()); + item->setText(0, fullpath.toUtf8().data()); } else { QTreeWidgetItem *parent = m_dirPaths.value(m_cwd); if (parent) { @@ -172,11 +202,18 @@ void restoreDialog::addDirectory(QString &newdir) item = new QTreeWidgetItem(parent); item->setText(0, newdir.toUtf8().data()); directoryWidget->expandItem(parent); + } else { + ok=false; + //printf("In else of if parent cwd \"%s\" newdir \"%s\"\n", + //m_cwd.toUtf8().data() ,newdir.toUtf8().data()); } } /* insert into both forward and reverse hash */ - m_dirPaths.insert(fullpath, item); - m_dirTreeItems.insert(item, fullpath); + if (ok) { + //printf("Inserting %s\n",fullpath.toUtf8().data()); + m_dirPaths.insert(fullpath, item); + m_dirTreeItems.insert(item, fullpath); + } } } @@ -184,7 +221,7 @@ void restoreDialog::addDirectory(QString &newdir) * Executed when the tree item in the directory pane is changed. This will * allow us to populate the file pane and make this the cwd. */ -void restoreDialog::directoryItemChanged(QTreeWidgetItem *currentitem, +void restorePage::directoryItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem * /*previousitem*/) { QString fullpath = m_dirTreeItems.value(currentitem); @@ -194,27 +231,27 @@ void restoreDialog::directoryItemChanged(QTreeWidgetItem *currentitem, } } -void restoreDialog::accept() +void restorePage::okButtonPushed() { this->hide(); m_console->write("done"); m_console->notify(true); - delete this; + closeStackPage(); mainWin->resetFocus(); } -void restoreDialog::reject() +void restorePage::cancelButtonPushed() { this->hide(); m_console->write("quit"); mainWin->set_status("Canceled"); - delete this; + closeStackPage(); m_console->notify(true); mainWin->resetFocus(); } -void restoreDialog::fileDoubleClicked(QTreeWidgetItem *item, int column) +void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column) { char cmd[1000]; if (column == 0) { /* mark/unmark */ @@ -239,9 +276,16 @@ void restoreDialog::fileDoubleClicked(QTreeWidgetItem *item, int column) */ if (item->text(1).endsWith("/")) { QString fullpath = m_cwd + item->text(1); + /* check for fullpath = "/c:/" */ + QRegExp regex("^/[a-z]:/"); + if (regex.indexIn(fullpath,0) == 0) /* remove leading '/' */ + fullpath.replace(0,1,""); QTreeWidgetItem *item = m_dirPaths.value(fullpath); if (item) { directoryWidget->setCurrentItem(item); + } else { + /* FIXME ***** Create an error log */ + //printf("DoubleClick else of item column %i fullpath %s\n", column, fullpath.toUtf8().data()); } } } @@ -250,7 +294,7 @@ void restoreDialog::fileDoubleClicked(QTreeWidgetItem *item, int column) * If up button pushed, making the parent tree widget current will call fill * directory. */ -void restoreDialog::upButtonPushed() +void restorePage::upButtonPushed() { cwd(".."); QTreeWidgetItem *item = m_dirPaths.value(m_cwd); @@ -262,7 +306,7 @@ void restoreDialog::upButtonPushed() /* * Mark selected items */ -void restoreDialog::markButtonPushed() +void restorePage::markButtonPushed() { QList treeItemList = fileWidget->selectedItems(); QTreeWidgetItem *item; @@ -283,7 +327,7 @@ void restoreDialog::markButtonPushed() /* * Unmark selected items */ -void restoreDialog::unmarkButtonPushed() +void restorePage::unmarkButtonPushed() { QList treeItemList = fileWidget->selectedItems(); QTreeWidgetItem *item; @@ -304,7 +348,7 @@ void restoreDialog::unmarkButtonPushed() /* * Change current working directory */ -bool restoreDialog::cwd(const char *dir) +bool restorePage::cwd(const char *dir) { int stat; char cd_cmd[MAXSTRING]; @@ -328,7 +372,7 @@ bool restoreDialog::cwd(const char *dir) /* * Return cwd when in tree restore mode */ -char *restoreDialog::get_cwd() +char *restorePage::get_cwd() { int stat; m_console->write_dir(".pwd"); diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index 98305b2d74..1eab7e45b4 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -46,21 +46,19 @@ class Console; * The pre-restore dialog selects the Job/Client to be restored * It really could use considerable enhancement. */ -class prerestoreDialog : public QDialog, public Ui::prerestoreForm +class prerestorePage : public Pages, public Ui::prerestoreForm { Q_OBJECT public: - prerestoreDialog(Console *parent); + prerestorePage(Console *parent); private slots: - void accept(); - void reject(); + void okButtonPushed(); + void cancelButtonPushed(); void job_name_change(int index); private: - Console *m_console; - }; /* @@ -68,19 +66,19 @@ private: * restore tree routines. It handles putting up a GUI tree * representation of the files to be restored. */ -class restoreDialog : public QDialog, public Ui::restoreForm +class restorePage : public Pages, public Ui::restoreForm { Q_OBJECT public: - restoreDialog(Console *parent); + restorePage(Console *parent); void fillDirectory(); char *get_cwd(); bool cwd(const char *); private slots: - void accept(); - void reject(); + void okButtonPushed(); + void cancelButtonPushed(); void fileDoubleClicked(QTreeWidgetItem *item, int column); void directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); void upButtonPushed(); @@ -89,7 +87,6 @@ private slots: void addDirectory(QString &); private: - Console *m_console; QString m_cwd; QHash m_dirPaths; QHash m_dirTreeItems; diff --git a/bacula/src/qt-console/restore/restore.ui b/bacula/src/qt-console/restore/restore.ui index 322ecf2c00..27682cd971 100644 --- a/bacula/src/qt-console/restore/restore.ui +++ b/bacula/src/qt-console/restore/restore.ui @@ -1,19 +1,16 @@ restoreForm - - - Qt::WindowModal - + 0 0 - 1285 - 759 + 824 + 660 - Restore File Selection + Form @@ -23,11 +20,119 @@ 6 + + + 0 + + + 6 + + + + + + 0 + 5 + 0 + 0 + + + + Current Dir: + + + lineEdit + + + + + + + + 100 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 32 + + + + + + + + Cancel + + + + + + + OK + + + + + + + + + 0 + + + 6 + + + + + + 0 + 0 + 0 + 0 + + + + Status: + + + + + + + + 5 + 0 + 0 + 0 + + + + + + + + + + Qt::Horizontal - + 0 @@ -133,7 +238,7 @@ - + 0 @@ -281,7 +386,7 @@ - 261 + 100 30 @@ -367,185 +472,8 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 16 - - - - - - - - 0 - - - 6 - - - - - - 0 - 5 - 0 - 0 - - - - Current Dir: - - - lineEdit - - - - - - - - 100 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 30 - 20 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - - - - - - - 0 - - - 6 - - - - - - 0 - 0 - 0 - 0 - - - - Status: - - - - - - - - 5 - 0 - 0 - 0 - - - - - - - - - - - - :images/up.png - - - Up - - - - - :images/mark.png - - - Mark - - - - - :images/unmark.png - - - Unmark - - - - - buttonBox - accepted() - restoreForm - accept() - - - 955 - 719 - - - 157 - 274 - - - - - buttonBox - rejected() - restoreForm - reject() - - - 1023 - 719 - - - 286 - 274 - - - - + diff --git a/bacula/src/qt-console/storage/storage.cpp b/bacula/src/qt-console/storage/storage.cpp index 6b8549cbed..b3eee6d8dc 100644 --- a/bacula/src/qt-console/storage/storage.cpp +++ b/bacula/src/qt-console/storage/storage.cpp @@ -39,6 +39,7 @@ #include #include "bat.h" #include "storage.h" +#include "label/label.h" #include "../mount/mount.h" Storage::Storage() @@ -235,10 +236,14 @@ void Storage::consoleStatusStorage() cmd += m_currentStorage; consoleCommand(cmd); } + +/* Label Media populating current storage by default */ void Storage::consoleLabelStorage() { new labelDialog(m_console, m_currentStorage); } + +/* Mount currently selected storage */ void Storage::consoleMountStorage() { if (m_currentAutoChanger == 0){ @@ -247,11 +252,13 @@ void Storage::consoleMountStorage() cmd += m_currentStorage; consoleCommand(cmd); } else { - placeConsoleOnTop(); + setConsoleCurrent(); /* if this storage is an autochanger, lets ask for the slot */ new mountDialog(m_console, m_currentStorage); } } + +/* Unmount Currently selected storage */ void Storage::consoleUnMountStorage() { QString cmd("umount storage="); -- 2.39.5