]> git.sur5r.net Git - bacula/bacula/commitdiff
Add a feature to have a menu item to allow a user to repopulate the lists
authorDirk H Bartley <dbartley@schupan.com>
Sat, 28 Mar 2009 17:47:42 +0000 (17:47 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sat, 28 Mar 2009 17:47:42 +0000 (17:47 +0000)
of the console class.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8630 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/console/console.cpp
bacula/src/qt-console/console/console.h
bacula/src/qt-console/main.ui
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h

index 0efe90544786e746ec1cf7f9c8465c0abfe2cde7..facaba9e4c82330547209ca0dca6e11ea73b5133 100644 (file)
@@ -105,7 +105,8 @@ void Console::poll_messages()
 }
 
 /*
- * Connect to Director. 
+ * Connect to Director.  This does not connect to the director, dircomm does.
+ * This creates the first and possibly 2nd dircomm instance
  */
 void Console::connect_dir()
 {
@@ -123,41 +124,57 @@ void Console::connect_dir()
          Pmsg0(000, "DirComm 0 Seems to have Connected\n");
       beginNewCommand(0);
    }
+   populateLists(true);
+   mainWin->set_status(_("Connected"));
    
-   int ndc;
-   if (newDirComm(ndc)) {
-      if (mainWin->m_connDebug)
-         Pmsg1(000, "DirComm %i Seems to have Connected\n", ndc);
-      dircomm = m_dircommHash.value(ndc);
-      job_list.clear();
-      client_list.clear();
-      fileset_list.clear();
-      fileset_list.clear();
-      messages_list.clear();
-      pool_list.clear();
-      storage_list.clear();
-      type_list.clear();
-      level_list.clear();
-      dir_cmd(ndc, ".jobs", job_list);
-      dir_cmd(ndc, ".clients", client_list);
-      dir_cmd(ndc, ".filesets", fileset_list);  
-      dir_cmd(ndc, ".msgs", messages_list);
-      dir_cmd(ndc, ".pools", pool_list);
-      dir_cmd(ndc, ".storage", storage_list);
-      dir_cmd(ndc, ".types", type_list);
-      dir_cmd(ndc, ".levels", level_list);
-
-      if (mainWin->m_connDebug) {
-         QString dbgmsg = QString("jobs=%1 clients=%2 filesets=%3 msgs=%4 pools=%5 storage=%6 types=%7 levels=%8\n")
-           .arg(job_list.count()).arg(client_list.count()).arg(fileset_list.count()).arg(messages_list.count())
-           .arg(pool_list.count()).arg(storage_list.count()).arg(type_list.count()).arg(level_list.count());
-         Pmsg1(000, "%s\n", dbgmsg.toUtf8().data());
-      } else
-         if (mainWin->m_connDebug)
-            Pmsg0(000, "DirComm 1 Seems to Failed\n");
-   
-      mainWin->set_status(_("Connected"));
-      startTimer();                      /* start message timer */
+   startTimer();                      /* start message timer */
+}
+
+/*
+ * A function created to separate out the population of the lists
+ * from the Console::connect_dir function
+ */
+void Console::populateLists(bool forcenew)
+{
+   int conn;
+   if (forcenew)
+      if (!newDirComm(conn)) {
+         Pmsg0(000, "newDirComm Seems to Failed to create a connection for populateLists\n");
+         return;
+      }
+   else
+      if(!availableDirComm(conn)) {
+         Pmsg0(000, "availableDirComm Seems to Failed to find a connection for populateLists\n");
+         return;
+      }
+  populateLists(conn);
+}
+
+void Console::populateLists(int conn)
+{
+   job_list.clear();
+   client_list.clear();
+   fileset_list.clear();
+   fileset_list.clear();
+   messages_list.clear();
+   pool_list.clear();
+   storage_list.clear();
+   type_list.clear();
+   level_list.clear();
+   dir_cmd(conn, ".jobs", job_list);
+   dir_cmd(conn, ".clients", client_list);
+   dir_cmd(conn, ".filesets", fileset_list);  
+   dir_cmd(conn, ".msgs", messages_list);
+   dir_cmd(conn, ".pools", pool_list);
+   dir_cmd(conn, ".storage", storage_list);
+   dir_cmd(conn, ".types", type_list);
+   dir_cmd(conn, ".levels", level_list);
+
+   if (mainWin->m_connDebug) {
+      QString dbgmsg = QString("jobs=%1 clients=%2 filesets=%3 msgs=%4 pools=%5 storage=%6 types=%7 levels=%8\n")
+        .arg(job_list.count()).arg(client_list.count()).arg(fileset_list.count()).arg(messages_list.count())
+        .arg(pool_list.count()).arg(storage_list.count()).arg(type_list.count()).arg(level_list.count());
+      Pmsg1(000, "%s\n", dbgmsg.toUtf8().data());
    }
 }
 
index 5d86d86c8477c5d25e5dd0e7f01555d81360cb1c..949689702c7fbc1f945b324ba526f87de25618e1 100644 (file)
@@ -111,6 +111,7 @@ public:
    bool get_job_defaults(int &conn, struct job_defaults &);
    const QFont get_font();
    void beginNewCommand(int conn);
+   void populateLists(bool forcenew);
 
 private:
    bool get_job_defaults(int &conn, struct job_defaults &, bool donotify);
@@ -118,6 +119,7 @@ private:
    void stopTimer();
    bool is_connectedGui();
    bool newDirComm(int &conn);
+   void populateLists(int conn);
 
 public:
    QStringList job_list;
index 1e9a4113aa367557c86b229ab13230419ef9e073..cfb309d958f30e90adea03ca80df3ef0413da7c5 100644 (file)
   </property>
   <widget class="QWidget" name="centralwidget" >
    <layout class="QGridLayout" >
-    <property name="margin" >
+    <property name="leftMargin" >
      <number>9</number>
     </property>
-    <property name="spacing" >
+    <property name="topMargin" >
+     <number>9</number>
+    </property>
+    <property name="rightMargin" >
+     <number>9</number>
+    </property>
+    <property name="bottomMargin" >
+     <number>9</number>
+    </property>
+    <property name="horizontalSpacing" >
+     <number>6</number>
+    </property>
+    <property name="verticalSpacing" >
      <number>6</number>
     </property>
     <item row="0" column="0" >
      <widget class="QStackedWidget" name="stackedWidget" >
       <property name="sizePolicy" >
-       <sizepolicy>
-        <hsizetype>7</hsizetype>
-        <vsizetype>7</vsizetype>
+       <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
         <horstretch>1</horstretch>
         <verstretch>0</verstretch>
        </sizepolicy>
@@ -71,7 +81,7 @@
      <x>0</x>
      <y>0</y>
      <width>882</width>
-     <height>28</height>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuEdit" >
     <addaction name="actionPrint" />
     <addaction name="actionSave" />
     <addaction name="actionQuit" />
+    <addaction name="actionRepopLists" />
    </widget>
    <addaction name="menuFile" />
    <addaction name="menuEdit" />
     <enum>Qt::Horizontal</enum>
    </property>
    <attribute name="toolBarArea" >
-    <number>4</number>
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak" >
+    <bool>false</bool>
    </attribute>
    <addaction name="actionConnect" />
    <addaction name="actionStatusDir" />
   </widget>
   <widget class="QDockWidget" name="dockWidget" >
    <property name="sizePolicy" >
-    <sizepolicy>
-     <hsizetype>5</hsizetype>
-     <vsizetype>7</vsizetype>
+    <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
      <horstretch>0</horstretch>
      <verstretch>1</verstretch>
     </sizepolicy>
    </attribute>
    <widget class="QWidget" name="dockWidgetContents" >
     <layout class="QGridLayout" >
-     <property name="margin" >
+     <property name="leftMargin" >
       <number>9</number>
      </property>
-     <property name="spacing" >
+     <property name="topMargin" >
+      <number>9</number>
+     </property>
+     <property name="rightMargin" >
+      <number>9</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>9</number>
+     </property>
+     <property name="horizontalSpacing" >
+      <number>6</number>
+     </property>
+     <property name="verticalSpacing" >
       <number>6</number>
      </property>
      <item row="0" column="0" >
       <widget class="QTreeWidget" name="treeWidget" >
        <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>5</hsizetype>
-         <vsizetype>7</vsizetype>
+        <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
          <horstretch>1</horstretch>
          <verstretch>1</verstretch>
         </sizepolicy>
        <property name="autoFillBackground" >
         <bool>true</bool>
        </property>
+       <column>
+        <property name="text" >
+         <string>1</string>
+        </property>
+       </column>
       </widget>
      </item>
     </layout>
    </attribute>
    <widget class="QWidget" name="dockWidgetContents_2" >
     <layout class="QGridLayout" >
-     <property name="margin" >
+     <property name="leftMargin" >
       <number>9</number>
      </property>
-     <property name="spacing" >
+     <property name="topMargin" >
+      <number>9</number>
+     </property>
+     <property name="rightMargin" >
+      <number>9</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>9</number>
+     </property>
+     <property name="horizontalSpacing" >
+      <number>6</number>
+     </property>
+     <property name="verticalSpacing" >
       <number>6</number>
      </property>
      <item row="0" column="0" >
       <layout class="QHBoxLayout" >
-       <property name="margin" >
-        <number>0</number>
-       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
+       <property name="leftMargin" >
+        <number>0</number>
+       </property>
+       <property name="topMargin" >
+        <number>0</number>
+       </property>
+       <property name="rightMargin" >
+        <number>0</number>
+       </property>
+       <property name="bottomMargin" >
+        <number>0</number>
+       </property>
        <item>
         <widget class="QLabel" name="label" >
          <property name="text" >
     <string>Director Status Page</string>
    </property>
   </action>
+  <action name="actionRepopLists" >
+   <property name="icon" >
+    <iconset resource="main.qrc" >:/images/mark.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Repop Lists</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="main.qrc" />
index 5ab9e9569e27330f4a07ed3b75525b46272038db..7b7125a14a6cf1ae28f77c8c020d621d473c679d 100644 (file)
@@ -254,6 +254,7 @@ void MainWin::connectSignals()
    connect(actionToggleDock, SIGNAL(triggered()), this,  SLOT(toggleDockContextWindow()));
    connect(actionClosePage, SIGNAL(triggered()), this,  SLOT(closePage()));
    connect(actionPreferences, SIGNAL(triggered()), this,  SLOT(setPreferences()));
+   connect(actionRepopLists, SIGNAL(triggered()), this,  SLOT(repopLists()));
 }
 
 void MainWin::disconnectSignals()
@@ -279,6 +280,7 @@ void MainWin::disconnectSignals()
    disconnect(actionToggleDock, SIGNAL(triggered()), this,  SLOT(toggleDockContextWindow()));
    disconnect(actionClosePage, SIGNAL(triggered()), this,  SLOT(closePage()));
    disconnect(actionPreferences, SIGNAL(triggered()), this,  SLOT(setPreferences()));
+   disconnect(actionRepopLists, SIGNAL(triggered()), this,  SLOT(repopLists()));
 }
 
 /*
@@ -288,6 +290,7 @@ void MainWin::waitEnter()
 {
    app->setOverrideCursor(QCursor(Qt::WaitCursor));
    disconnectSignals();
+   disconnectConsoleSignals(m_currentConsole);
    m_waitTreeItem = treeWidget->currentItem();
 }
 
@@ -300,6 +303,7 @@ void MainWin::waitExit()
    if (m_waitTreeItem != treeWidget->currentItem())
       treeWidget->setCurrentItem(m_waitTreeItem);
    connectSignals();
+   connectConsoleSignals();
 }
 
 void MainWin::connectConsoleSignals()
@@ -318,6 +322,11 @@ void MainWin::disconnectConsoleSignals(Console *console)
    disconnect(actionSelectFont, SIGNAL(triggered()), console, SLOT(set_font()));
 }
 
+void MainWin::repopLists()
+{
+   m_currentConsole->populateLists(false);
+}
+
 /* 
  * Reimplementation of QWidget closeEvent virtual function   
  */
@@ -693,6 +702,7 @@ Console *MainWin::currentConsole()
 {
    return m_currentConsole;
 }
+
 /* Quick function to return the tree item for the director */
 QTreeWidgetItem *MainWin::currentTopItem()
 {
index 25809663fef3271b4f85270d457b0918e73e93da..1c984e167ec26fd23d0db8460e86d66218aa2279 100644 (file)
@@ -126,6 +126,7 @@ public slots:
    void readPreferences();
    void waitEnter();
    void waitExit();
+   void repopLists();
 
 protected:
    void closeEvent(QCloseEvent *event);