2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
30 #include <QAbstractEventDispatcher>
33 #include "mediaview.h"
34 #include "mediaedit/mediaedit.h"
35 #include "mediainfo/mediainfo.h"
36 #include "joblist/joblist.h"
37 #include "relabel/relabel.h"
39 #include "util/fmtwidgetitem.h"
41 MediaView::MediaView()
46 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
47 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge.png")));
49 /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
51 m_checkcurwidget = true;
55 MediaView::~MediaView()
60 * The main meat of the class!! The function that querries the director and
61 * creates the widgets with appropriate values.
63 void MediaView::populateTable()
67 Freeze frz(*m_tableMedia); /* disable updating*/
72 * Called from the signal of the context sensitive menu!
74 void MediaView::editVolume()
76 MediaEdit* edit = new MediaEdit(mainWin->getFromHash(this), m_currentVolumeId);
77 connect(edit, SIGNAL(destroyed()), this, SLOT(populateTable()));
81 * Called from the signal of the context sensitive menu!
83 void MediaView::showJobs()
85 QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
86 mainWin->createPageJobList(m_currentVolumeName, "", "", "", parentItem);
90 * Called from the signal of the context sensitive menu!
92 void MediaView::viewVolume()
94 QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
95 MediaInfo* view = new MediaInfo(parentItem, m_currentVolumeName);
96 connect(view, SIGNAL(destroyed()), this, SLOT(populateTable()));
101 * When the treeWidgetItem in the page selector tree is singleclicked, Make sure
102 * The tree has been populated.
104 void MediaView::PgSeltreeWidgetClicked()
113 * Virtual function which is called when this page is visible on the stack
115 void MediaView::currentStackItem()
123 * Called from the signal of the context sensitive menu to delete a volume!
125 void MediaView::deleteVolume()
127 if (QMessageBox::warning(this, "Bat",
128 tr("Are you sure you want to delete?? !!!.\n"
129 "This delete command is used to delete a Volume record and all associated catalog"
130 " records that were created. This command operates only on the Catalog"
131 " database and has no effect on the actual data written to a Volume. This"
132 " command can be dangerous and we strongly recommend that you do not use"
133 " it unless you know what you are doing. All Jobs and all associated"
134 " records (File and JobMedia) will be deleted from the catalog."
135 "Press OK to proceed with delete operation.?"),
136 QMessageBox::Ok | QMessageBox::Cancel)
137 == QMessageBox::Cancel) { return; }
139 QString cmd("delete volume=");
140 cmd += m_currentVolumeName;
145 * Called from the signal of the context sensitive menu to purge!
147 void MediaView::purgeVolume()
149 if (QMessageBox::warning(this, "Bat",
150 tr("Are you sure you want to purge ?? !!!.\n"
151 "The Purge command will delete associated Catalog database records from Jobs and"
152 " Volumes without considering the retention period. Purge works only on the"
153 " Catalog database and does not affect data written to Volumes. This command can"
154 " be dangerous because you can delete catalog records associated with current"
155 " backups of files, and we recommend that you do not use it unless you know what"
157 "Press OK to proceed with the purge operation?"),
158 QMessageBox::Ok | QMessageBox::Cancel)
159 == QMessageBox::Cancel) { return; }
161 QString cmd("purge volume=");
162 cmd += m_currentVolumeName;
168 * Called from the signal of the context sensitive menu to prune!
170 void MediaView::pruneVolume()
172 new prunePage(m_currentVolumeName, "");
176 // * Called from the signal of the context sensitive menu to relabel!
178 // void MediaView::relabelVolume()
180 // setConsoleCurrent();
181 // new relabelDialog(m_console, m_currentVolumeName);
185 // * Called from the signal of the context sensitive menu to purge!
187 // void MediaView::allVolumesFromPool()
189 // QString cmd = "update volume AllFromPool=" + m_currentVolumeName;
190 // consoleCommand(cmd);
194 // void MediaView::allVolumes()
196 // QString cmd = "update volume allfrompools";
197 // consoleCommand(cmd);
202 // * Called from the signal of the context sensitive menu to purge!
204 // void MediaView::volumeFromPool()
206 // QTreeWidgetItem *currentItem = mp_treeWidget->currentItem();
207 // QTreeWidgetItem *parent = currentItem->parent();
208 // QString pool = parent->text(0);
210 // cmd = "update volume=" + m_currentVolumeName + " frompool=" + pool;
211 // consoleCommand(cmd);