2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2007 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 plus additions
11 that are listed in the file LICENSE.
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 John Walker.
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 * Version $Id: joblog.cpp 4230 2007-02-21 20:07:37Z kerns $
34 * Dirk Bartley, March 2007
41 JobLog::JobLog(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem)
46 pgInitialize(parentTreeWidgetItem);
47 m_cursor = new QTextCursor(textEdit->document());
57 void JobLog::getFont()
59 QFont font = textEdit->font();
62 m_console->getDirResName(dirname);
63 QSettings settings(dirname, "bat");
64 settings.beginGroup("Console");
65 font.setFamily(settings.value("consoleFont", "Courier").value<QString>());
66 font.setPointSize(settings.value("consolePointSize", 10).toInt());
67 font.setFixedPitch(settings.value("consoleFixedPitch", true).toBool());
69 textEdit->setFont(font);
73 * Populate the text in the window
75 void JobLog::populateText()
77 QString heading("<A href=\"#top\">Log records for job ");
78 heading += m_jobId + "</A>\n";
79 textEdit->insertHtml(heading);
82 query = "SELECT Time, LogText FROM Log WHERE JobId='" + m_jobId + "'";
85 if (m_console->sql_cmd(query, results)) {
87 QStringList fieldlist;
90 /* Iterate through the lines of results. */
91 foreach (QString resultline, results) {
92 fieldlist = resultline.split("\t");
95 /* Iterate through fields in the record */
96 foreach (field, fieldlist) {
98 if (column <= 1) display_text("\n");
100 } /* foreach field */
102 } /* foreach resultline */
103 if (resultcount == 0) {
104 /* show a message about configuration item */
105 QMessageBox::warning(this, tr("Bat"),
106 tr("There were no results ?? !!!.\n"
107 "It is possible you may need to add \"catalog = all\" to the Messages stanza"
108 " for this job.\n"), QMessageBox::Ok);
110 } /* if results from query */
111 textEdit->scrollToAnchor("top");
115 * Put text into the joblog window with an overload
117 void JobLog::display_text(const QString buf)
119 m_cursor->movePosition(QTextCursor::End);
120 m_cursor->insertText(buf);
123 void JobLog::display_text(const char *buf)
125 m_cursor->movePosition(QTextCursor::End);
126 m_cursor->insertText(buf);