2 This patch should clean up two problems with bat:
3 1. Eliminate print error output concerning job plotting
4 2. Eliminate the error messages where bat complains about being busy.
5 It also backports some new trunk code.
6 Apply it to Bacula version 2.4.2 with:
9 patch -p0 <2.4.2-bat.patch
10 ./configure <your-options>
16 Index: src/qt-console/mainwin.h
17 ===================================================================
18 --- src/qt-console/mainwin.h (.../tags/Release-2.4.2/bacula) (revision 7468)
19 +++ src/qt-console/mainwin.h (.../branches/Branch-2.4/bacula) (revision 7468)
21 void runButtonClicked();
22 void estimateButtonClicked();
23 void browseButtonClicked();
25 void jobPlotButtonClicked();
27 void restoreButtonClicked();
28 void undockWindowButton();
29 void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
30 Index: src/qt-console/fileset/fileset.h
31 ===================================================================
32 --- src/qt-console/fileset/fileset.h (.../tags/Release-2.4.2/bacula) (revision 7468)
33 +++ src/qt-console/fileset/fileset.h (.../branches/Branch-2.4/bacula) (revision 7468)
35 void createContextMenu();
36 QString m_currentlyselected;
39 bool m_checkcurwidget;
42 Index: src/qt-console/fileset/fileset.cpp
43 ===================================================================
44 --- src/qt-console/fileset/fileset.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
45 +++ src/qt-console/fileset/fileset.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
48 /* mp_treeWidget, FileSet Tree Tree Widget inherited from ui_fileset.h */
50 + m_populating = false;
51 m_checkcurwidget = true;
56 void FileSet::populateTree()
60 + m_populating = true;
62 QTreeWidgetItem *filesetItem, *topItem;
64 if (!m_console->preventInUseConnect())
68 query += " FileSet='" + filesetName + "'";
69 - query += " ORDER BY FileSet";
70 + query += " ORDER BY CreateTime DESC LIMIT 1";
73 if (mainWin->m_sqlDebug) {
75 for (int cnter=0; cnter<headerlist.size(); cnter++) {
76 mp_treeWidget->resizeColumnToContents(cnter);
79 + m_populating = false;
83 Index: src/qt-console/clients/clients.cpp
84 ===================================================================
85 --- src/qt-console/clients/clients.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
86 +++ src/qt-console/clients/clients.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
89 /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */
91 + m_populating = false;
92 m_checkcurwidget = true;
94 /* add context sensitive menu items specific to this classto the page
97 void Clients::populateTree()
101 + m_populating = true;
102 QTreeWidgetItem *clientItem, *topItem;
104 if (!m_console->preventInUseConnect())
106 for(int cnter=0; cnter<headerlist.size(); cnter++) {
107 mp_treeWidget->resizeColumnToContents(cnter);
109 + m_populating = false;
113 Index: src/qt-console/clients/clients.h
114 ===================================================================
115 --- src/qt-console/clients/clients.h (.../tags/Release-2.4.2/bacula) (revision 7468)
116 +++ src/qt-console/clients/clients.h (.../branches/Branch-2.4/bacula) (revision 7468)
118 void createContextMenu();
119 QString m_currentlyselected;
122 bool m_checkcurwidget;
125 Index: src/qt-console/storage/storage.cpp
126 ===================================================================
127 --- src/qt-console/storage/storage.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
128 +++ src/qt-console/storage/storage.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
131 /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_storage.h */
133 + m_populating = false;
134 m_checkcurwidget = true;
136 m_currentStorage = "";
139 void Storage::populateTree()
143 + m_populating = true;
144 QTreeWidgetItem *storageItem, *topItem;
146 if (!m_console->preventInUseConnect())
148 for(int cnter=0; cnter<headerlist.size(); cnter++) {
149 mp_treeWidget->resizeColumnToContents(cnter);
151 + m_populating = false;
155 Index: src/qt-console/storage/storage.h
156 ===================================================================
157 --- src/qt-console/storage/storage.h (.../tags/Release-2.4.2/bacula) (revision 7468)
158 +++ src/qt-console/storage/storage.h (.../branches/Branch-2.4/bacula) (revision 7468)
160 QString m_currentStorage;
161 int m_currentAutoChanger;
164 bool m_checkcurwidget;
167 Index: src/qt-console/medialist/medialist.h
168 ===================================================================
169 --- src/qt-console/medialist/medialist.h (.../tags/Release-2.4.2/bacula) (revision 7468)
170 +++ src/qt-console/medialist/medialist.h (.../branches/Branch-2.4/bacula) (revision 7468)
173 void createContextMenu();
174 void setStatusColor(QTreeWidgetItem *, QString &, int &);
175 + void writeExpandedSettings();
176 QString m_currentVolumeName;
177 QString m_currentVolumeId;
180 bool m_checkcurwidget;
181 + QTreeWidgetItem *m_topItem;
184 #endif /* _MEDIALIST_H_ */
185 Index: src/qt-console/medialist/medialist.cpp
186 ===================================================================
187 --- src/qt-console/medialist/medialist.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
188 +++ src/qt-console/medialist/medialist.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
191 /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
193 + m_populating = false;
194 m_checkcurwidget = true;
196 /* add context sensitive menu items specific to this classto the page
199 MediaList::~MediaList()
202 + writeExpandedSettings();
208 void MediaList::populateTree()
210 - QTreeWidgetItem *mediatreeitem, *pooltreeitem, *topItem;
211 + QTreeWidgetItem *mediatreeitem, *pooltreeitem;
214 + m_populating = true;
216 if (!m_console->preventInUseConnect())
219 int statusIndex = headerlist.indexOf("Status");
221 m_checkcurwidget = false;
223 + writeExpandedSettings();
224 mp_treeWidget->clear();
225 m_checkcurwidget = true;
226 mp_treeWidget->setColumnCount(headerlist.count());
227 - topItem = new QTreeWidgetItem(mp_treeWidget);
228 - topItem->setText(0, "Pools");
229 - topItem->setData(0, Qt::UserRole, 0);
230 - topItem->setExpanded(true);
231 + m_topItem = new QTreeWidgetItem(mp_treeWidget);
232 + m_topItem->setText(0, "Pools");
233 + m_topItem->setData(0, Qt::UserRole, 0);
234 + m_topItem->setExpanded(true);
236 mp_treeWidget->setHeaderLabels(headerlist);
238 + QSettings settings(m_console->m_dir->name(), "bat");
239 + settings.beginGroup("MediaListTreeExpanded");
242 foreach (QString pool_listItem, m_console->pool_list) {
243 - pooltreeitem = new QTreeWidgetItem(topItem);
244 + pooltreeitem = new QTreeWidgetItem(m_topItem);
245 pooltreeitem->setText(0, pool_listItem);
246 pooltreeitem->setData(0, Qt::UserRole, 1);
247 - pooltreeitem->setExpanded(true);
248 + if(settings.contains(pool_listItem)) {
249 + pooltreeitem->setExpanded(settings.value(pool_listItem).toBool());
251 + pooltreeitem->setExpanded(true);
254 query = "SELECT Media.VolumeName AS Media, "
255 " Media.MediaId AS Id, Media.VolStatus AS VolStatus,"
256 @@ -151,10 +165,12 @@
257 } /* foreach resultline */
258 } /* if results from query */
259 } /* foreach pool_listItem */
260 + settings.endGroup();
261 /* Resize the columns */
262 for(int cnter=0; cnter<headerlist.count(); cnter++) {
263 mp_treeWidget->resizeColumnToContents(cnter);
265 + m_populating = false;
268 void MediaList::setStatusColor(QTreeWidgetItem *item, QString &field, int &index)
275 + * Write settings to save expanded states of the pools
277 +void MediaList::writeExpandedSettings()
279 + QSettings settings(m_console->m_dir->name(), "bat");
280 + settings.beginGroup("MediaListTreeExpanded");
281 + int childcount = m_topItem->childCount();
282 + for (int cnt=0; cnt<childcount; cnt++) {
283 + QTreeWidgetItem *poolitem = m_topItem->child(cnt);
284 + settings.setValue(poolitem->text(0), poolitem->isExpanded());
286 + settings.endGroup();
288 Index: src/qt-console/mainwin.cpp
289 ===================================================================
290 --- src/qt-console/mainwin.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
291 +++ src/qt-console/mainwin.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
292 @@ -441,14 +441,14 @@
293 new prerestorePage();
297 void MainWin::jobPlotButtonClicked()
302 new JobPlot(NULL, pass);
308 * The user just finished typing a line in the command line edit box
309 Index: src/qt-console/jobs/jobs.h
310 ===================================================================
311 --- src/qt-console/jobs/jobs.h (.../tags/Release-2.4.2/bacula) (revision 7468)
312 +++ src/qt-console/jobs/jobs.h (.../branches/Branch-2.4/bacula) (revision 7468)
314 void createContextMenu();
315 QString m_currentlyselected;
318 bool m_checkcurwidget;
321 Index: src/qt-console/jobs/jobs.cpp
322 ===================================================================
323 --- src/qt-console/jobs/jobs.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
324 +++ src/qt-console/jobs/jobs.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
327 /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */
329 + m_populating = false;
330 m_checkcurwidget = true;
332 /* add context sensitive menu items specific to this classto the page
335 void Jobs::populateTree()
339 + m_populating = true;
340 QTreeWidgetItem *jobsItem, *topItem;
342 if (!m_console->preventInUseConnect())
343 Index: src/qt-console/joblist/joblist.cpp
344 ===================================================================
345 --- src/qt-console/joblist/joblist.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
346 +++ src/qt-console/joblist/joblist.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
351 + m_populating = false;
353 if ((m_mediaName != "") || (m_clientName != "") || (m_jobName != "") || (m_filesetName != ""))
357 void JobList::populateTable()
361 + m_populating = true;
365 QBrush blackBrush(Qt::black);
367 tr("The Jobs query returned no results.\n"
368 "Press OK to continue?"), QMessageBox::Ok );
370 + m_populating = false;
373 void JobList::setStatusColor(QTableWidgetItem *item, QString &field)
379 void JobList::graphTable()
383 pass.recordLimitCheck = limitCheckBox->checkState();
384 pass.daysLimitCheck = daysCheckBox->checkState();
387 QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
388 new JobPlot(pageSelectorTreeWidgetItem, pass);
394 * Save user settings associated with this page
395 Index: src/qt-console/joblist/joblist.h
396 ===================================================================
397 --- src/qt-console/joblist/joblist.h (.../tags/Release-2.4.2/bacula) (revision 7468)
398 +++ src/qt-console/joblist/joblist.h (.../branches/Branch-2.4/bacula) (revision 7468)
400 void preRestoreFromTime();
401 void showLogForJob();
402 void consoleCancelJob();
408 void createConnections();
410 QString m_filesetName;
411 QString m_currentJob;
414 bool m_checkCurrentWidget;