]> git.sur5r.net Git - bacula/bacula/commitdiff
Addressed issue of long compiles. Simplify with Pages::setCurrent
authorDirk H Bartley <dbartley@schupan.com>
Fri, 4 May 2007 02:25:21 +0000 (02:25 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Fri, 4 May 2007 02:25:21 +0000 (02:25 +0000)
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

19 files changed:
bacula/src/qt-console/COMMANDS [new file with mode: 0644]
bacula/src/qt-console/PAGES [new file with mode: 0644]
bacula/src/qt-console/README
bacula/src/qt-console/TODO
bacula/src/qt-console/commands [deleted file]
bacula/src/qt-console/console/console.cpp
bacula/src/qt-console/console/console.h
bacula/src/qt-console/fileset/fileset.cpp
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/medialist/medialist.cpp
bacula/src/qt-console/pages.cpp
bacula/src/qt-console/pages.h
bacula/src/qt-console/restore/prerestore.cpp
bacula/src/qt-console/restore/prerestore.ui
bacula/src/qt-console/restore/restore.cpp
bacula/src/qt-console/restore/restore.h
bacula/src/qt-console/restore/restore.ui
bacula/src/qt-console/storage/storage.cpp

diff --git a/bacula/src/qt-console/COMMANDS b/bacula/src/qt-console/COMMANDS
new file mode 100644 (file)
index 0000000..c3272a8
--- /dev/null
@@ -0,0 +1,92 @@
+add [pool=<pool-name> storage=<storage>  jobid=<JobId>]
+These are done from config files
+
+autodisplay on/off
+could be done in the context of the console
+
+automount on/off
+could be done in the context of the console, because is for after a label
+command as opposed to a property of a storage device
+
+cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>]
+To be done in the context of a status dir graphical window.
+
+create [pool=<pool-name>]
+Done in a config file
+
+delete [volume=<vol-name> pool=<pool-name> job jobid=<id>]
+not done for pool yet
+
+disable job<job-name>     and     enable job<job-name>
+Could be done in the context of a jobs window which is not yet created
+
+estimate
+Could be a dialog in the context of a jobs window.
+
+help
+could be in the console window
+
+label
+Done by kern before I started
+
+list
+many are done or are reproduced by having windows
+
+llist
+same as list
+
+python
+not needed from bat??
+
+prune files|jobs|volume client=<client-name> volume=<volume-name>
+Should add as a dialog box from both client and medialist
+
+purge files jobid=<jobid>|job=<job-name>|client=<client-name>
+purge jobs client=<client-name> (of all jobs)
+purge volume|volume=<vol-name> (of all jobs)
+  this one is done from media
+
+relabel
+done
+
+release storage=<storage-name>
+Would need to explain what this does in bat with a dialog
+
+reload
+could be done in console or on director's page selector widget
+
+run
+done
+
+setdebug
+I'd say we could choose not to implement this in bat
+
+status
+done, want to implement graphically
+
+unmount storage=<storage-name> [ drive=\lt{}num\gt{} ]
+done
+unmount [ jobid=<id> | job=<job-name> ]
+Mmmmm
+
+update media, volume, pool, slots
+media/volume still has more work, they are the same after all
+
+use
+still need to make decisions about how to handle multiple catalogs
+
+var
+Mmmmmm
+
+version
+could be done in console as long as it is explicite about that it is the version
+of the director
+
+quit
+I'd like to have a disconnect graphical option.
+
+exit
+Not really needed
+
+wait
+Mmmmmmm
diff --git a/bacula/src/qt-console/PAGES b/bacula/src/qt-console/PAGES
new file mode 100644 (file)
index 0000000..51286c7
--- /dev/null
@@ -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();
+
index eb91670ffbe0acc3bcb96052235e84d0cc17fcf3..4b5371e7b9c8b97050a340bf0430bd6219f4eb90 100644 (file)
@@ -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
index a219844ec88ccd92a3af7d0c36e7d75a00df6f3c..897723c32a37e95797ea230d960b20d360061138 100644 (file)
@@ -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/commands b/bacula/src/qt-console/commands
deleted file mode 100644 (file)
index c3272a8..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-add [pool=<pool-name> storage=<storage>  jobid=<JobId>]
-These are done from config files
-
-autodisplay on/off
-could be done in the context of the console
-
-automount on/off
-could be done in the context of the console, because is for after a label
-command as opposed to a property of a storage device
-
-cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>]
-To be done in the context of a status dir graphical window.
-
-create [pool=<pool-name>]
-Done in a config file
-
-delete [volume=<vol-name> pool=<pool-name> job jobid=<id>]
-not done for pool yet
-
-disable job<job-name>     and     enable job<job-name>
-Could be done in the context of a jobs window which is not yet created
-
-estimate
-Could be a dialog in the context of a jobs window.
-
-help
-could be in the console window
-
-label
-Done by kern before I started
-
-list
-many are done or are reproduced by having windows
-
-llist
-same as list
-
-python
-not needed from bat??
-
-prune files|jobs|volume client=<client-name> volume=<volume-name>
-Should add as a dialog box from both client and medialist
-
-purge files jobid=<jobid>|job=<job-name>|client=<client-name>
-purge jobs client=<client-name> (of all jobs)
-purge volume|volume=<vol-name> (of all jobs)
-  this one is done from media
-
-relabel
-done
-
-release storage=<storage-name>
-Would need to explain what this does in bat with a dialog
-
-reload
-could be done in console or on director's page selector widget
-
-run
-done
-
-setdebug
-I'd say we could choose not to implement this in bat
-
-status
-done, want to implement graphically
-
-unmount storage=<storage-name> [ drive=\lt{}num\gt{} ]
-done
-unmount [ jobid=<id> | job=<job-name> ]
-Mmmmm
-
-update media, volume, pool, slots
-media/volume still has more work, they are the same after all
-
-use
-still need to make decisions about how to handle multiple catalogs
-
-var
-Mmmmmm
-
-version
-could be done in console as long as it is explicite about that it is the version
-of the director
-
-quit
-I'd like to have a disconnect graphical option.
-
-exit
-Not really needed
-
-wait
-Mmmmmmm
index 6d00ef71de6f9ae10166d33ccc8230db741a119f..a1d7b27afffff8dde77df95707fd2a45391d75c9 100644 (file)
@@ -37,6 +37,9 @@
 #include <QAbstractEventDispatcher>
 #include "bat.h"
 #include "console.h"
+#include "restore.h"
+#include "select.h"
+#include "run/run.h"
 
 Console::Console(QStackedWidget *parent)
 {
index 77299982d6650b60fca9892f4850d7cfaf6ffdfa..f49767a4a1e24a54871d9c877e873daa139ae497 100644 (file)
@@ -36,8 +36,6 @@
 #include <QtGui>
 #include "pages.h"
 #include "ui_console.h"
-#include "restore.h"
-#include "select.h"
 
 #ifndef MAX_NAME_LENGTH
 #define MAX_NAME_LENGTH 128
index 66d8cb2abb1878208aa13e283e9290412799fb6a..b2c66674d5c0040d229f913b8e0cdecf2edf3bfa 100644 (file)
@@ -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));
 }
 
 /*
index 6659c6004721554a149fdd97c64b7827e5509223..a11c38a5d371e67ae04321eb4143d786fd82a93f 100644 (file)
 #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();
+}
index b568711c4d0833502b513e26ffe1a87f665f9663..6a659ffc9fae4bf927e3743c9f027286c318456b 100644 (file)
 #include <QtGui>
 #include <QList>
 #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);
index 06b9d625e714b5ec98b1b60fb909c1e00572dcad..aca288728ee15af57d3365aa562b14ab4b0cdd77 100644 (file)
@@ -263,6 +263,6 @@ void MediaList::purgeVolume()
  */
 void MediaList::relabelVolume()
 {
-   placeConsoleOnTop();
+   setConsoleCurrent();
    new relabelDialog(m_console, m_currentVolumeName);
 }
index 3bb4dc7999d239da1e2440d22a5522fff3a6e081..b6bd5d2f99b152374b695c34794c5407d059e8a6 100644 (file)
@@ -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));
+}
index 2294af580cddf05965b1b01d33593e91a2f2c780..857ed706353b7f287c02a77802129ae2e07ea797 100644 (file)
@@ -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;
index e366da7a4c6a0e4e22873cbbc76816005f8a0a9a..b6cd0839a1d5352d8d0fa36df844aec4968cff83 100644 (file)
 #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;
 
index a506a251d4c50bedae1d144de2352fc55c7f45d5..98218744abc94a49ce199ed0369e250c7147cc30 100644 (file)
@@ -1,37 +1,77 @@
 <ui version="4.0" >
  <class>prerestoreForm</class>
- <widget class="QDialog" name="prerestoreForm" >
-  <property name="windowModality" >
-   <enum>Qt::WindowModal</enum>
-  </property>
+ <widget class="QWidget" name="prerestoreForm" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>366</width>
-    <height>299</height>
+    <width>561</width>
+    <height>408</height>
    </rect>
   </property>
-  <property name="maximumSize" >
-   <size>
-    <width>500</width>
-    <height>500</height>
-   </size>
-  </property>
-  <property name="focusPolicy" >
-   <enum>Qt::StrongFocus</enum>
-  </property>
   <property name="windowTitle" >
-   <string>Restore Files</string>
+   <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" >
+  <layout class="QGridLayout" >
    <property name="margin" >
     <number>9</number>
    </property>
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item>
+   <item row="3" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="1" >
     <layout class="QGridLayout" >
      <property name="margin" >
       <number>8</number>
      </item>
     </layout>
    </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox" >
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
+   <item row="2" column="1" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
      </property>
-     <property name="standardButtons" >
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     <property name="spacing" >
+      <number>6</number>
      </property>
-    </widget>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>171</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelButton" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>
  <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>prerestoreForm</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>prerestoreForm</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>
index 928efdd6cdcb9e375c6a7c54c28ab189dbbf40a1..4cdb7470fe4cb589338e69de53833263ab53ab0e 100644 (file)
 #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<QTreeWidgetItem *> treeItemList = fileWidget->selectedItems();
    QTreeWidgetItem *item;
@@ -283,7 +327,7 @@ void restoreDialog::markButtonPushed()
 /*
  * Unmark selected items
  */
-void restoreDialog::unmarkButtonPushed()
+void restorePage::unmarkButtonPushed()
 {
    QList<QTreeWidgetItem *> 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");
index 98305b2d74db3025f9f3aa400aa6888521ff8013..1eab7e45b41f028cff91815bfad730433cc115c4 100644 (file)
@@ -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<QString, QTreeWidgetItem *> m_dirPaths;
    QHash<QTreeWidgetItem *,QString> m_dirTreeItems;
index 322ecf2c002158b593d71221556d64a453bf0e94..27682cd971c234b17cb8e5a262649bfb85769d6b 100644 (file)
@@ -1,19 +1,16 @@
 <ui version="4.0" >
  <class>restoreForm</class>
- <widget class="QDialog" name="restoreForm" >
-  <property name="windowModality" >
-   <enum>Qt::WindowModal</enum>
-  </property>
+ <widget class="QWidget" name="restoreForm" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1285</width>
-    <height>759</height>
+    <width>824</width>
+    <height>660</height>
    </rect>
   </property>
   <property name="windowTitle" >
-   <string>Restore File Selection</string>
+   <string>Form</string>
   </property>
   <layout class="QGridLayout" >
    <property name="margin" >
     <number>6</number>
    </property>
    <item row="1" column="0" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="label" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>0</hsizetype>
+         <vsizetype>5</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text" >
+        <string>Current Dir:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>lineEdit</cstring>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="lineEdit" >
+       <property name="minimumSize" >
+        <size>
+         <width>100</width>
+         <height>0</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Fixed</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>30</width>
+         <height>32</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelButton" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okButton" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="label_4" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>0</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text" >
+        <string>Status:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="statusLine" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>5</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text" >
+        <string/>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="0" column="0" >
     <widget class="QSplitter" name="splitter" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
-     <widget class="QWidget" name="layoutWidget" >
+     <widget class="QWidget" name="layoutWidget_2" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="layoutWidget" >
+     <widget class="QWidget" name="layoutWidget_3" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
            </property>
            <property name="sizeHint" >
             <size>
-             <width>261</width>
+             <width>100</width>
              <height>30</height>
             </size>
            </property>
      </widget>
     </widget>
    </item>
-   <item row="0" column="0" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Fixed</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>20</width>
-       <height>16</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="2" column="0" >
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <item>
-      <widget class="QLabel" name="label" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>0</hsizetype>
-         <vsizetype>5</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="text" >
-        <string>Current Dir:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>lineEdit</cstring>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLineEdit" name="lineEdit" >
-       <property name="minimumSize" >
-        <size>
-         <width>100</width>
-         <height>0</height>
-        </size>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType" >
-        <enum>QSizePolicy::Fixed</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>30</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QDialogButtonBox" name="buttonBox" >
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="standardButtons" >
-        <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="3" column="0" >
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <item>
-      <widget class="QLabel" name="label_4" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>0</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="text" >
-        <string>Status:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="statusLine" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>5</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="text" >
-        <string/>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
   </layout>
-  <action name="actionUp" >
-   <property name="icon" >
-    <iconset>:images/up.png</iconset>
-   </property>
-   <property name="text" >
-    <string>Up</string>
-   </property>
-  </action>
-  <action name="actionMark" >
-   <property name="icon" >
-    <iconset>:images/mark.png</iconset>
-   </property>
-   <property name="text" >
-    <string>Mark</string>
-   </property>
-  </action>
-  <action name="actionUnmark" >
-   <property name="icon" >
-    <iconset>:images/unmark.png</iconset>
-   </property>
-   <property name="text" >
-    <string>Unmark</string>
-   </property>
-  </action>
  </widget>
  <resources/>
- <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>restoreForm</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>955</x>
-     <y>719</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>restoreForm</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>1023</x>
-     <y>719</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>
index 6b8549cbed052ffec7f5527994f7f6ca9353a51f..b3eee6d8dc788f77da2f2ee9c1d4a6f75dcaaf08 100644 (file)
@@ -39,6 +39,7 @@
 #include <QMenu>
 #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=");