setTitle() for setting the title of a window that will display when undocked.
setCurrent() for making the page and tree widget item of an object selected and
in the front of the stack.
+
+Closing
+Use the function closeDockPage() to close from within the class. Otherwise, if
+there are pointers which need to be deleted, use a destructor. The m_closeable
+page member will determine whether the option to close will appear in context
+menu of page selector.
dhb
====================================================
-Create class to display messages from a specific job. Want the ability to
-create an instance of that class from joblist.
+Get status codes in dropdown for joblist select.
Need to figure out the functionality and inteligence that the last restore
window should have and give it to it. Right now it shows drop downs with no
options.
+See if it would be possible to have user provided console text show up in a
+color
+
Test left pane of restore with 2 windows drives in one backup job.
User preferences. With log to stdout options.
============================================================
DONE:
============================================================
+Create class to display messages from a specific job. Want the ability to
+create an instance of that class from joblist.
+
Color code termination code in joblist. I also want a table to convert
termination code into human readable text.
FORMS += select/select.ui
FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui
FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui
+FORMS += joblog/joblog.ui
HEADERS += mainwin.h bat.h bat_conf.h qstd.h
SOURCES += main.cpp bat_conf.cpp mainwin.cpp qstd.cpp
HEADERS += fileset/fileset.h
SOURCES += fileset/fileset.cpp
+## Fileset
+HEADERS += joblog/joblog.h
+SOURCES += joblog/joblog.cpp
+
INSTALLS += bins
INSTALLS += confs
#include "bat.h"
#include "joblist.h"
#include "restore.h"
+#include "joblog/joblog.h"
/*
* Constructor for the class
mp_tableWidget->addAction(actionPurgeFiles);
mp_tableWidget->addAction(actionRestoreFromJob);
mp_tableWidget->addAction(actionRestoreFromTime);
+ mp_tableWidget->addAction(actionShowLogForJob);
/* Make Connections */
connect(actionLongListJob, SIGNAL(triggered()), this,
SLOT(preRestoreFromJob()));
connect(actionRestoreFromTime, SIGNAL(triggered()), this,
SLOT(preRestoreFromTime()));
+ connect(actionShowLogForJob, SIGNAL(triggered()), this,
+ SLOT(showLogForJob()));
}
/*
{
new prerestorePage(m_currentJob, R_JOBDATETIME);
}
+
+/*
+ * Subroutine to call class to show the log in the database from that job
+ */
+void JobList::showLogForJob()
+{
+ QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
+ new JobLog(m_currentJob, pageSelectorTreeWidgetItem);
+}
void consolePurgeFiles();
void preRestoreFromJob();
void preRestoreFromTime();
+ void showLogForJob();
private:
void createConnections();
<string>Restore From Time</string>
</property>
</action>
+ <action name="actionShowLogForJob" >
+ <property name="icon" >
+ <iconset>../images/unmark.png</iconset>
+ </property>
+ <property name="text" >
+ <string>Show Log for Job</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
--- /dev/null
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+
+/*
+ * Version $Id: medialist.cpp 4230 2007-02-21 20:07:37Z kerns $
+ *
+ * JobLog Class
+ *
+ * Dirk Bartley, March 2007
+ *
+ */
+
+#include "bat.h"
+#include "joblog.h"
+
+JobLog::JobLog(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem)
+{
+ setupUi(this);
+ m_name = "JobLog";
+ m_closeable = true;
+ pgInitialize(parentTreeWidgetItem);
+ m_cursor = new QTextCursor(textEdit->document());
+
+ m_jobId = jobId;
+ getFont();
+ populateText();
+
+ dockPage();
+ setCurrent();
+}
+
+void JobLog::getFont()
+{
+ QFont font = textEdit->font();
+
+ QString dirname;
+ m_console->getDirResName(dirname);
+ QSettings settings(dirname, "bat");
+ settings.beginGroup("Console");
+ font.setFamily(settings.value("consoleFont", "Courier").value<QString>());
+ font.setPointSize(settings.value("consolePointSize", 10).toInt());
+ font.setFixedPitch(settings.value("consoleFixedPitch", true).toBool());
+ settings.endGroup();
+ textEdit->setFont(font);
+}
+
+void JobLog::populateText()
+{
+ QString heading("<A href=\"#top\">Log records for job ");
+ heading += m_jobId + "</A>\n";
+ textEdit->insertHtml(heading);
+
+/* display_text("<A href=\"#top\">Log records for job ");
+ display_text(m_jobId);
+ display_text("</A>\n");*/
+ QString query("");
+ query = "SELECT Time, LogText FROM Log WHERE JobId='" + m_jobId + "'";
+
+ QStringList results;
+ if (m_console->sql_cmd(query, results)) {
+ QString field;
+ QStringList fieldlist;
+
+ /* Iterate through the lines of results. */
+ foreach (QString resultline, results) {
+ fieldlist = resultline.split("\t");
+
+ int column = 0;
+ /* Iterate through fields in the record */
+ foreach (field, fieldlist) {
+ display_text(field);
+ if (column <= 1) display_text("\n");
+ column += 1;
+ } /* foreach field */
+ } /* foreach resultline */
+ } /* if results from query */
+ textEdit->scrollToAnchor("top");
+}
+
+/*
+ * Put text into the joblog window
+ */
+void JobLog::display_text(const QString buf)
+{
+ m_cursor->movePosition(QTextCursor::End);
+ m_cursor->insertText(buf);
+}
+
+void JobLog::display_text(const char *buf)
+{
+ m_cursor->movePosition(QTextCursor::End);
+ m_cursor->insertText(buf);
+}
--- /dev/null
+#ifndef _JOBLOG_H_
+#define _JOBLOG_H_
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ * Version $Id: medialist.h 4230 2007-02-21 20:07:37Z kerns $
+ *
+ * Dirk Bartley, March 2007
+ */
+
+#include <QtGui>
+#include "ui_joblog.h"
+#include "console.h"
+
+class JobLog : public Pages, public Ui::JobLogForm
+{
+ Q_OBJECT
+
+public:
+ JobLog(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem);
+
+public slots:
+
+private slots:
+
+private:
+ void display_text(const char *buf);
+ void display_text(const QString buf);
+ void populateText();
+ void getFont();
+ QTextCursor *m_cursor;
+ QString m_jobId;
+};
+
+#endif /* _JOBLOG_H_ */
--- /dev/null
+<ui version="4.0" >
+ <class>JobLogForm</class>
+ <widget class="QWidget" name="JobLogForm" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>432</width>
+ <height>456</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Job Log</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <widget class="QTextEdit" name="textEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>200</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="sizeIncrement" >
+ <size>
+ <width>1</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy" >
+ <enum>Qt::StrongFocus</enum>
+ </property>
+ <property name="acceptDrops" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" >
+ <string comment="Joblog Window" />
+ </property>
+ <property name="statusTip" >
+ <string comment="Joblog Window" />
+ </property>
+ <property name="whatsThis" >
+ <string comment="Joblog Window" />
+ </property>
+ <property name="horizontalScrollBarPolicy" >
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="autoFormatting" >
+ <set>QTextEdit::AutoNone</set>
+ </property>
+ <property name="tabChangesFocus" >
+ <bool>false</bool>
+ </property>
+ <property name="documentTitle" >
+ <string comment="Joblog Window" />
+ </property>
+ <property name="lineWrapMode" >
+ <enum>QTextEdit::NoWrap</enum>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>