]> git.sur5r.net Git - bacula/bacula/commitdiff
connect button callback
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 11 Aug 2009 09:36:25 +0000 (11:36 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 11 Aug 2009 09:36:25 +0000 (11:36 +0200)
bacula/src/qt-console/storage/content.cpp
bacula/src/qt-console/storage/content.h
bacula/src/qt-console/storage/content.ui

index 8c42aedd488d39d5b765d79afc17fa7d9e6f4362..6b8c1a40d528805d52811ef86aa194e1c585d44f 100644 (file)
@@ -48,10 +48,68 @@ Content::Content(QString storage)
    m_closeable = true;
    m_currentStorage = storage;
 
+   connect(pbUpdate, SIGNAL(clicked()), this,
+           SLOT(consoleUpdateSlots()));
+
+   connect(pbLabel, SIGNAL(clicked()), this,
+           SLOT(consoleLabelStorage()));
+
+   connect(pbMount, SIGNAL(clicked()), this,
+           SLOT(consoleMountStorage()));
+
+   connect(pbUnmount, SIGNAL(clicked()), this,
+           SLOT(consoleUnMountStorage()));
+
+   connect(pbStatus, SIGNAL(clicked()), this,
+           SLOT(statusStorageWindow()));
+
+   connect(pbRelease, SIGNAL(clicked()), this,
+           SLOT(consoleRelease()));
+
    dockPage();
    setCurrent();
 }
 
+/* Label Media populating current storage by default */
+void Content::consoleLabelStorage()
+{
+   new labelPage(m_currentStorage);
+}
+
+/* Mount currently selected storage */
+void Content::consoleMountStorage()
+{
+   setConsoleCurrent();
+   /* if this storage is an autochanger, lets ask for the slot */
+   new mountDialog(m_console, m_currentStorage);
+}
+
+/* Unmount Currently selected storage */
+void Content::consoleUnMountStorage()
+{
+   QString cmd("umount storage=");
+   cmd += m_currentStorage;
+   consoleCommand(cmd);
+}
+
+void Content::statusStorageWindow()
+{
+   /* if one exists, then just set it current */
+   bool found = false;
+   foreach(Pages *page, mainWin->m_pagehash) {
+      if (mainWin->currentConsole() == page->console()) {
+         if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) {
+            found = true;
+            page->setCurrent();
+         }
+      }
+   }
+   if (!found) {
+      QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
+      new StorStat(m_currentStorage, parentItem);
+   }
+}
+
 /*
  * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
@@ -158,68 +216,20 @@ void Content::currentStackItem()
    }
 }
 
-/*
- *  Functions to respond to local context sensitive menu sending console
- *  commands If I could figure out how to make these one function passing a
- *  string, Yaaaaaa
- */
-void Content::consoleStatusStorage()
-{
-   QString cmd("status storage=");
-   cmd += m_currentStorage;
-   consoleCommand(cmd);
-}
-
-/* Label Media populating current storage by default */
-void Content::consoleLabelStorage()
-{
-   new labelPage(m_currentStorage);
-}
-
 void Content::treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)
 {
 
 }
 
-/* Mount currently selected storage */
-void Content::consoleMountStorage()
-{
-   if (m_currentAutoChanger == 0){
-      /* no autochanger, just execute the command in the console */
-      QString cmd("mount storage=");
-      cmd += m_currentStorage;
-      consoleCommand(cmd);
-   } else {
-      setConsoleCurrent();
-      /* if this storage is an autochanger, lets ask for the slot */
-      new mountDialog(m_console, m_currentStorage);
-   }
-}
-
-/* Unmount Currently selected storage */
-void Content::consoleUnMountStorage()
-{
-   QString cmd("umount storage=");
-   cmd += m_currentStorage;
-   consoleCommand(cmd);
-}
-
 /* Update Slots */
 void Content::consoleUpdateSlots()
 {
+   // TODO: get selected slots
    QString cmd("update slots storage=");
    cmd += m_currentStorage;
    consoleCommand(cmd);
 }
 
-/* Update Slots Scan*/
-void Content::consoleUpdateSlotsScan()
-{
-   QString cmd("update slots scan storage=");
-   cmd += m_currentStorage;
-   consoleCommand(cmd);
-}
-
 /* Release a tape in the drive */
 void Content::consoleRelease()
 {
@@ -227,24 +237,3 @@ void Content::consoleRelease()
    cmd += m_currentStorage;
    consoleCommand(cmd);
 }
-
-/*
- *  Open a status storage window
- */
-void Content::statusStorageWindow()
-{
-   /* if one exists, then just set it current */
-   bool found = false;
-   foreach(Pages *page, mainWin->m_pagehash) {
-      if (mainWin->currentConsole() == page->console()) {
-         if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) {
-            found = true;
-            page->setCurrent();
-         }
-      }
-   }
-   if (!found) {
-      QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-      new StorStat(m_currentStorage, parentItem);
-   }
-}
index a4abad4953fc33551470c0e2a910c1af313351d3..b4cf68bc7593dc88e3b47f1072f6f01643da4b82 100644 (file)
@@ -41,17 +41,16 @@ public:
    Content(QString storage);
 //   virtual void PgSeltreeWidgetClicked();
    virtual void currentStackItem();
-   void consoleUnMountStorage();
+
+public slots:
+   void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
+
+   void consoleRelease();
    void consoleUpdateSlots();
-   void consoleUpdateSlotsScan();
    void consoleLabelStorage();
-   void consoleStatusStorage();
    void consoleMountStorage();
    void statusStorageWindow();
-   void consoleRelease();
-
-public slots:
-   void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
+   void consoleUnMountStorage();
 
 private slots:
    void populateContent();
index ad6c540f3275c111109af11f7d47ca00694b78e3..db53fe4834365d33bb3bc9d8d3db7b5a3987109c 100644 (file)
@@ -36,7 +36,7 @@
         <item row="0" column="0" >
          <widget class="QPushButton" name="pbUpdate" >
           <property name="text" >
-           <string>Update</string>
+           <string>Update slots</string>
           </property>
           <property name="icon" >
            <iconset resource="../main.qrc" >:/images/view-refresh.png</iconset>
@@ -55,6 +55,9 @@
         </item>
         <item row="1" column="0" >
          <widget class="QPushButton" name="pbMoveToTray" >
+          <property name="enabled" >
+           <bool>false</bool>
+          </property>
           <property name="text" >
            <string>Move to tray</string>
           </property>
@@ -65,6 +68,9 @@
         </item>
         <item row="1" column="1" >
          <widget class="QPushButton" name="pbEmptyTray" >
+          <property name="enabled" >
+           <bool>false</bool>
+          </property>
           <property name="text" >
            <string>Empty tray</string>
           </property>
          </widget>
         </item>
         <item row="2" column="0" >
-         <widget class="QPushButton" name="pushButton" >
+         <widget class="QPushButton" name="pbMount" >
           <property name="text" >
            <string>Mount</string>
           </property>
          </widget>
         </item>
         <item row="2" column="1" >
-         <widget class="QPushButton" name="pushButton_2" >
+         <widget class="QPushButton" name="pbUnmount" >
           <property name="text" >
            <string>Unmount</string>
           </property>
          </widget>
         </item>
+        <item row="3" column="0" >
+         <widget class="QPushButton" name="pbStatus" >
+          <property name="text" >
+           <string>Status</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1" >
+         <widget class="QPushButton" name="pbRelease" >
+          <property name="text" >
+           <string>Release</string>
+          </property>
+         </widget>
+        </item>
        </layout>
       </widget>
      </item>