From: Kern Sibbald Date: Sat, 26 May 2007 13:15:53 +0000 (+0000) Subject: Implement Help Browser window for bat. X-Git-Tag: Release-7.0.0~6237 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=30b1e3ec4ef7b4136a6868fd2bf48b21042e99c5;p=bacula%2Fbacula Implement Help Browser window for bat. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4908 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index 1076b65f57..7b0edb3e1d 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -40,6 +40,7 @@ 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 +FORMS += help/help.ui HEADERS += mainwin.h bat.h bat_conf.h qstd.h SOURCES += main.cpp bat_conf.cpp mainwin.cpp qstd.cpp @@ -104,6 +105,10 @@ SOURCES += fileset/fileset.cpp HEADERS += joblog/joblog.h SOURCES += joblog/joblog.cpp +# Help dialog +HEADERS += help/help.h +SOURCES += help/help.cpp + INSTALLS += bins INSTALLS += confs diff --git a/bacula/src/qt-console/console/authenticate.cpp b/bacula/src/qt-console/console/authenticate.cpp index e934e6e73b..a1e69c0bd8 100644 --- a/bacula/src/qt-console/console/authenticate.cpp +++ b/bacula/src/qt-console/console/authenticate.cpp @@ -95,7 +95,7 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, tls_ctx = director->tls_ctx; } /* Timeout Hello after 15 secs */ - btimer_t *tid = start_bsock_timer(dir, 15); + dir->start_timer(15); dir->fsend(hello, bashed_name); /* respond to Dir challenge */ @@ -138,14 +138,14 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, Dmsg1(6, ">dird: %s", dir->msg); if (dir->recv() <= 0) { - stop_bsock_timer(tid); + dir->stop_timer(); bsnprintf(msg, msglen, _("Bad response to Hello command: ERR=%s\n" "The Director at \"%s:%d\" is probably not running.\n"), dir->bstrerror(), dir->host(), dir->port()); return false; } - stop_bsock_timer(tid); + dir->stop_timer(); Dmsg1(10, "msg); if (strncmp(dir->msg, OKhello, sizeof(OKhello)-1) != 0) { bsnprintf(msg, msglen, _("Director at \"%s:%d\" rejected Hello command\n"), @@ -157,7 +157,7 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, return true; bail_out: - stop_bsock_timer(tid); + dir->stop_timer(); bsnprintf(msg, msglen, _("Authorization problem with Director at \"%s:%d\"\n" "Most likely the passwords do not agree.\n" "If you are using TLS, there may have been a certificate validation error during the TLS handshake.\n" diff --git a/bacula/src/qt-console/help/help.cpp b/bacula/src/qt-console/help/help.cpp new file mode 100644 index 0000000000..e714977750 --- /dev/null +++ b/bacula/src/qt-console/help/help.cpp @@ -0,0 +1,67 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-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. +*/ + +/* + * Help Window class + * + * Kern Sibbald, May MMVII + * + * $Id: $ + */ + +#include "bat.h" +#include "help.h" + +Help::Help(const QString &path, const QString &file, QWidget *parent) : + QWidget(parent) +{ + setAttribute(Qt::WA_DeleteOnClose); /* Make sure we go away */ + setAttribute(Qt::WA_GroupLeader); /* allow calling from modal dialog */ + + setupUi(this); /* create window */ + + textBrowser->setSearchPaths(QStringList() << path << ":/images"); + textBrowser->setSource(file); + + connect(textBrowser, SIGNAL(sourceChanged(const QUrl &)), this, SLOT(updateTitle())); + connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(homeButton, SIGNAL(clicked()), textBrowser, SLOT(home())); + connect(backButton, SIGNAL(clicked()), textBrowser, SLOT(backward())); + this->show(); +} + +void Help::updateTitle() +{ + setWindowTitle(tr("Help: %1").arg(textBrowser->documentTitle())); +} + +void Help::showFile(const QString &file) +{ + QString path = QApplication::applicationDirPath() + "/help"; + new Help(path, file); +} diff --git a/bacula/src/qt-console/help/help.h b/bacula/src/qt-console/help/help.h new file mode 100644 index 0000000000..1d35387c8e --- /dev/null +++ b/bacula/src/qt-console/help/help.h @@ -0,0 +1,60 @@ +#ifndef _HELP_H_ +#define _HELP_H_ + +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-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. +*/ + +/* + * Help Window class + * + * It reads an html file and displays it in a "browser" window. + * + * Kern Sibbald, May MMVII + * + * $Id: $ + */ + +#include "bat.h" +#include "ui_help.h" + +class Help : public QWidget, public Ui::helpForm +{ + Q_OBJECT + +public: + Help(const QString &path, const QString &file, QWidget *parent = NULL); + virtual ~Help() { }; + static void showFile(const QString &file); + +public slots: + void updateTitle(); + +private: +}; + +#endif /* _HELP_H_ */ diff --git a/bacula/src/qt-console/help/help.ui b/bacula/src/qt-console/help/help.ui new file mode 100644 index 0000000000..546b1f6c09 --- /dev/null +++ b/bacula/src/qt-console/help/help.ui @@ -0,0 +1,73 @@ + + helpForm + + + + 0 + 0 + 762 + 497 + + + + Form + + + + 9 + + + 6 + + + + + + + + 0 + + + 6 + + + + + &Home + + + + + + + &Back + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + + diff --git a/bacula/src/qt-console/help/index.html b/bacula/src/qt-console/help/index.html new file mode 100644 index 0000000000..1496deb700 --- /dev/null +++ b/bacula/src/qt-console/help/index.html @@ -0,0 +1,22 @@ + + + +Bat User's Guide + + + + + + + + +

Bat User's Guide

+
+Test Bacula Administration Tool (bat) User's guide. +
+ +
+Sorry no contents yet. Maybe someone would like to write this? + + + diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index c7650c0fb2..813686036b 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -74,12 +74,6 @@ 28 - - - &Help - - - &Edit @@ -103,6 +97,13 @@ + + + &Help + + + + @@ -497,6 +498,11 @@ Set Preferences + + + bat &Help + + diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 5382346a31..79f4710d04 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -46,6 +46,7 @@ #include "medialist/medialist.h" #include "joblist/joblist.h" #include "clients/clients.h" +#include "help/help.h" /* * Daemon message callback @@ -269,6 +270,7 @@ void MainWin::createConnections() /* Connect signals to slots */ connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line())); connect(actionAbout_bat, SIGNAL(triggered()), this, SLOT(about())); + connect(actionBat_Help, SIGNAL(triggered()), this, SLOT(help())); connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int))); connect(treeWidget, SIGNAL( @@ -490,6 +492,11 @@ void MainWin::about() " interface to the Director.")); } +void MainWin::help() +{ + Help::showFile("index.html"); +} + void MainWin::set_statusf(const char *fmt, ...) { va_list arg_ptr; diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index ff171fa3e0..f724536b98 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -86,6 +86,7 @@ public: public slots: void input_line(); void about(); + void help(); void treeItemClicked(QTreeWidgetItem *item, int column); void labelButtonClicked(); void runButtonClicked(); diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 51cf119b2a..504439aa90 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,7 @@ General: 26May07 +kes Implement Help Browser window for bat. kes Fix reload bug that reset StorageId to zero. 25May07 kes Fix TLS #ifdefing when TLS turned off.