/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*/
/*
- * Version $Id: medialist.cpp 4230 2007-02-21 20:07:37Z kerns $
+ * Version $Id$
*
* MediaList Class
*
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;
" Media.Enabled AS enabled, Pol.Name AS RecyclePool,"
" Media.LastWritten AS LastWritten"
" FROM Media"
- " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)"
- " LEFT OUTER JOIN Pool AS Pol ON (Media.recyclepoolid=Pol.PoolId)"
+ " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
+ " LEFT OUTER JOIN Pool AS Pol ON (Media.RecyclePoolId=Pol.PoolId)"
" WHERE";
query += " Pool.Name='" + pool_listItem + "'";
query += " ORDER BY Media";
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);
- mp_treeWidget->removeAction(actionVolumeFromPool);
+ 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);
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);
-*/
}
}
}
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()));
/* connect to the action specific to this pages class */
connect(actionRefreshMediaList, SIGNAL(triggered()), this,
SLOT(populateTree()));
+ connect(actionAllVolumes, SIGNAL(triggered()), this, SLOT(allVolumes()));
connect(actionAllVolumesFromPool, SIGNAL(triggered()), this, SLOT(allVolumesFromPool()));
connect(actionVolumeFromPool, SIGNAL(triggered()), this, SLOT(volumeFromPool()));
}
*/
void MediaList::allVolumesFromPool()
{
- QString cmd("update pool=");
- cmd += m_currentVolumeName + " All Volumes From Pool";
+ QString cmd = "update volume AllFromPool=" + m_currentVolumeName;
+ consoleCommand(cmd);
+ populateTree();
+}
+
+void MediaList::allVolumes()
+{
+ QString cmd = "update volume allfrompools";
consoleCommand(cmd);
populateTree();
}