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 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 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.
34 * Dirk Bartley, March 2007
41 JobLog::JobLog(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem)
46 pgInitialize(parentTreeWidgetItem);
47 QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
48 thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/joblog.png")));
49 m_cursor = new QTextCursor(textEdit->document());
59 void JobLog::getFont()
61 QFont font = textEdit->font();
64 m_console->getDirResName(dirname);
65 QSettings settings(dirname, "bat");
66 settings.beginGroup("Console");
67 font.setFamily(settings.value("consoleFont", "Courier").value<QString>());
68 font.setPointSize(settings.value("consolePointSize", 10).toInt());
69 font.setFixedPitch(settings.value("consoleFixedPitch", true).toBool());
71 textEdit->setFont(font);
75 * Populate the text in the window
77 void JobLog::populateText()
79 QString heading("<A href=\"#top\">Log records for job ");
80 heading += m_jobId + "</A>\n";
81 textEdit->insertHtml(heading);
83 if (!m_console->preventInUseConnect())
87 query = "SELECT Time, LogText FROM Log WHERE JobId='" + m_jobId + "'";
90 if (m_console->sql_cmd(query, results)) {
92 QStringList fieldlist;
95 /* Iterate through the lines of results. */
96 foreach (QString resultline, results) {
97 fieldlist = resultline.split("\t");
100 /* Iterate through fields in the record */
101 foreach (field, fieldlist) {
103 if (column <= 1) display_text("\n");
105 } /* foreach field */
107 } /* foreach resultline */
108 if (resultcount == 0) {
109 /* show a message about configuration item */
110 QMessageBox::warning(this, tr("Bat"),
111 tr("There were no results ?? !!!.\n"
112 "It is possible you may need to add \"catalog = all\" to the Messages stanza"
113 " for this job.\n"), QMessageBox::Ok);
115 } /* if results from query */
116 textEdit->scrollToAnchor("top");
120 * Put text into the joblog window with an overload
122 void JobLog::display_text(const QString buf)
124 m_cursor->movePosition(QTextCursor::End);
125 m_cursor->insertText(buf);
128 void JobLog::display_text(const char *buf)
130 m_cursor->movePosition(QTextCursor::End);
131 m_cursor->insertText(buf);