]> git.sur5r.net Git - bacula/bacula/commitdiff
Implement Help Browser window for bat.
authorKern Sibbald <kern@sibbald.com>
Sat, 26 May 2007 13:15:53 +0000 (13:15 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 26 May 2007 13:15:53 +0000 (13:15 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4908 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/bat.pro.in
bacula/src/qt-console/console/authenticate.cpp
bacula/src/qt-console/help/help.cpp [new file with mode: 0644]
bacula/src/qt-console/help/help.h [new file with mode: 0644]
bacula/src/qt-console/help/help.ui [new file with mode: 0644]
bacula/src/qt-console/help/index.html [new file with mode: 0644]
bacula/src/qt-console/main.ui
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/technotes-2.1

index 1076b65f5773707a7747a13fe2b58f491ce9a116..7b0edb3e1d2e421495420e7b73ca77c3b29dedeb 100644 (file)
@@ -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
 
index e934e6e73b98799a90af4681caa1324add5ebd3a..a1e69c0bd89252af3c948799ef8c160c88b462d0 100644 (file)
@@ -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, "<dird: %s", dir->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 (file)
index 0000000..e714977
--- /dev/null
@@ -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 (file)
index 0000000..1d35387
--- /dev/null
@@ -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 (file)
index 0000000..546b1f6
--- /dev/null
@@ -0,0 +1,73 @@
+<ui version="4.0" >
+ <class>helpForm</class>
+ <widget class="QWidget" name="helpForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>762</width>
+    <height>497</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="1" column="0" >
+    <widget class="QTextBrowser" name="textBrowser" />
+   </item>
+   <item row="0" column="0" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="homeButton" >
+       <property name="text" >
+        <string>&amp;Home</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="backButton" >
+       <property name="text" >
+        <string>&amp;Back</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closeButton" >
+       <property name="text" >
+        <string>Close</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/bacula/src/qt-console/help/index.html b/bacula/src/qt-console/help/index.html
new file mode 100644 (file)
index 0000000..1496deb
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML>
+<HEAD>
+<TITLE>Bat User's Guide</TITLE>
+<META NAME="description" CONTENT="Bat User's Guide">
+<META NAME="keywords" CONTENT="bacula">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+</HEAD>
+
+<BODY>
+<h1 align="center">Bat User's Guide</h1>
+<br>
+Test Bacula Administration Tool (bat) User's guide.
+<br>
+
+<br>
+Sorry no contents yet. Maybe someone would like to write this?
+
+</BODY>
+</HTML>
index c7650c0fb2511b2aa79ca9dbb83466e945bbfcd3..813686036b6cad672ef36956d566578d21d35b1f 100644 (file)
      <height>28</height>
     </rect>
    </property>
-   <widget class="QMenu" name="menuHelp" >
-    <property name="title" >
-     <string>&amp;Help</string>
-    </property>
-    <addaction name="actionAbout_bat" />
-   </widget>
    <widget class="QMenu" name="menuEdit" >
     <property name="title" >
      <string>&amp;Edit</string>
     <addaction name="actionPreferences" />
     <addaction name="actionSelectFont" />
    </widget>
+   <widget class="QMenu" name="menuHelp" >
+    <property name="title" >
+     <string>&amp;Help</string>
+    </property>
+    <addaction name="actionBat_Help" />
+    <addaction name="actionAbout_bat" />
+   </widget>
    <addaction name="menuFile" />
    <addaction name="menuEdit" />
    <addaction name="menuSettings" />
     <string>Set Preferences</string>
    </property>
   </action>
+  <action name="actionBat_Help" >
+   <property name="text" >
+    <string>bat &amp;Help</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="main.qrc" />
index 5382346a3120d2a38b4681e1953bd51874019a5d..79f4710d0470e3e7f25ac01bc0bab7b0de6eb0c7 100644 (file)
@@ -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;
index ff171fa3e045e714b92eb4b5ad63ee5f02ab3f3a..f724536b9844515f12bfb9fa7be5d3c188059a35 100644 (file)
@@ -86,6 +86,7 @@ public:
 public slots:
    void input_line();
    void about();
+   void help();
    void treeItemClicked(QTreeWidgetItem *item, int column);
    void labelButtonClicked();
    void runButtonClicked();
index 51cf119b2a6088475460bf294ca493187f8eee37..504439aa901d06b42288bf709f5643d76a8862f0 100644 (file)
@@ -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.