]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/medialist/medialist.cpp
Only use the svg files for the generation of the png files.
[bacula/bacula] / bacula / src / qt-console / medialist / medialist.cpp
index e8d248bc90c5862ad8aa80307aa725a244e8b554..b7b3367213a98bb22213730abee103bbb28e3ac4 100644 (file)
@@ -7,8 +7,8 @@
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,7 +27,7 @@
 */
  
 /*
- *   Version $Id: medialist.cpp 4230 2007-02-21 20:07:37Z kerns $
+ *   Version $Id$
  *
  *  MediaList Class
  *
@@ -50,7 +50,7 @@ MediaList::MediaList()
    m_name = "Media";
    pgInitialize();
    QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
-   thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge.svg")));
+   thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge.png")));
 
    /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
    m_populated = false;
@@ -59,6 +59,7 @@ MediaList::MediaList()
    /* add context sensitive menu items specific to this classto the page
     * selector tree. m_contextActions is QList of QActions */
    m_contextActions.append(actionRefreshMediaList);
+   dockPage();
 }
 
 MediaList::~MediaList()
@@ -180,9 +181,8 @@ void MediaList::editVolume()
  */
 void MediaList::showJobs()
 {
-   QString emptyclient("");
    QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
-   mainWin->createPageJobList(m_currentVolumeName, emptyclient, parentItem);
+   mainWin->createPageJobList(m_currentVolumeName, "", "", "", parentItem);
 }
 
 /*
@@ -208,17 +208,14 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
    if (m_checkcurwidget) {
       /* The Previous item */
       if (previouswidgetitem) { /* avoid a segfault if first time */
-         mp_treeWidget->removeAction(actionEditVolume);
-         mp_treeWidget->removeAction(actionListJobsOnVolume);
-         mp_treeWidget->removeAction(actionDeleteVolume);
-         mp_treeWidget->removeAction(actionPruneVolume);
-         mp_treeWidget->removeAction(actionPurgeVolume);
-          mp_treeWidget->removeAction(actionRelabelVolume);
-         mp_treeWidget->removeAction(actionAllVolumesFromPool);
+         foreach(QAction* mediaAction, mp_treeWidget->actions()) {
+            mp_treeWidget->removeAction(mediaAction);
+         }
       }
 
       int treedepth = currentwidgetitem->data(0, Qt::UserRole).toInt();
       m_currentVolumeName=currentwidgetitem->text(0);
+      mp_treeWidget->addAction(actionRefreshMediaList);
       if (treedepth == 2){
          m_currentVolumeId=currentwidgetitem->text(1);
          mp_treeWidget->addAction(actionEditVolume);
@@ -227,12 +224,9 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
          mp_treeWidget->addAction(actionPruneVolume);
          mp_treeWidget->addAction(actionPurgeVolume);
          mp_treeWidget->addAction(actionRelabelVolume);
+         mp_treeWidget->addAction(actionVolumeFromPool);
       } else if (treedepth == 1) {
-/*  *******FIXME******
- *  I can't seem to get "All volumes from pool" or "Volume from pool" to work
- *  in one sentence command.   Works when you do it one step at a time vi console
          mp_treeWidget->addAction(actionAllVolumesFromPool);
-*/
       }
    }
 }
@@ -245,7 +239,6 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
 void MediaList::createContextMenu()
 {
    mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
-   mp_treeWidget->addAction(actionRefreshMediaList);
    connect(actionEditVolume, SIGNAL(triggered()), this, SLOT(editVolume()));
    connect(actionListJobsOnVolume, SIGNAL(triggered()), this, SLOT(showJobs()));
    connect(actionDeleteVolume, SIGNAL(triggered()), this, SLOT(deleteVolume()));
@@ -259,6 +252,7 @@ void MediaList::createContextMenu()
    connect(actionRefreshMediaList, SIGNAL(triggered()), this,
                 SLOT(populateTree()));
    connect(actionAllVolumesFromPool, SIGNAL(triggered()), this, SLOT(allVolumesFromPool()));
+   connect(actionVolumeFromPool, SIGNAL(triggered()), this, SLOT(volumeFromPool()));
 }
 
 /*
@@ -341,8 +335,21 @@ void MediaList::relabelVolume()
  */
 void MediaList::allVolumesFromPool()
 {
-   QString cmd("update pool=");
-   cmd += m_currentVolumeName + " All Volumes From Pool";
+   QString cmd = "update volume AllFromPool=" + m_currentVolumeName;
+   consoleCommand(cmd);
+   populateTree();
+}
+
+/*
+ * Called from the signal of the context sensitive menu to purge!
+ */
+void MediaList::volumeFromPool()
+{
+   QTreeWidgetItem *currentItem = mp_treeWidget->currentItem();
+   QTreeWidgetItem *parent = currentItem->parent();
+   QString pool = parent->text(0);
+   QString cmd;
+   cmd = "update volume=" + m_currentVolumeName + " frompool=" + pool;
    consoleCommand(cmd);
    populateTree();
 }