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: medialist.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);
72 void JobLog::populateText()
74 QString heading("<A href=\"#top\">Log records for job ");
75 heading += m_jobId + "</A>\n";
76 textEdit->insertHtml(heading);
78 /* display_text("<A href=\"#top\">Log records for job ");
79 display_text(m_jobId);
80 display_text("</A>\n");*/
82 query = "SELECT Time, LogText FROM Log WHERE JobId='" + m_jobId + "'";
85 if (m_console->sql_cmd(query, results)) {
87 QStringList fieldlist;
89 /* Iterate through the lines of results. */
90 foreach (QString resultline, results) {
91 fieldlist = resultline.split("\t");
94 /* Iterate through fields in the record */
95 foreach (field, fieldlist) {
97 if (column <= 1) display_text("\n");
100 } /* foreach resultline */
101 } /* if results from query */
102 textEdit->scrollToAnchor("top");
106 * Put text into the joblog window
108 void JobLog::display_text(const QString buf)
110 m_cursor->movePosition(QTextCursor::End);
111 m_cursor->insertText(buf);
114 void JobLog::display_text(const char *buf)
116 m_cursor->movePosition(QTextCursor::End);
117 m_cursor->insertText(buf);