diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp
index fce800c5c..98b95a182 100644
--- a/retroshare-gui/src/gui/MainWindow.cpp
+++ b/retroshare-gui/src/gui/MainWindow.cpp
@@ -1380,10 +1380,7 @@ void MainWindow::showHelpDialog()
/**< Shows the help browser and displays the given help topic. */
void MainWindow::showHelpDialog(const QString &topic)
{
- static HelpBrowser *helpBrowser = 0;
- if (!helpBrowser)
- helpBrowser = new HelpBrowser(this);
- helpBrowser->showWindow(topic);
+ HelpBrowser::showWindow(topic);
}
void MainWindow::on_actionQuick_Start_Wizard_activated()
diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp
index 94aecdaeb..7e6a588e1 100644
--- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp
+++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp
@@ -462,8 +462,5 @@ void ConfCertDialog::showHelpDialog()
/**< Shows the help browser and displays the given help topic. */
void ConfCertDialog::showHelpDialog(const QString &topic)
{
- static HelpBrowser *helpBrowser = 0;
- if (!helpBrowser)
- helpBrowser = new HelpBrowser(this);
- helpBrowser->showWindow(topic);
+ HelpBrowser::showWindow(topic);
}
diff --git a/retroshare-gui/src/gui/help/browser/helpbrowser.cpp b/retroshare-gui/src/gui/help/browser/helpbrowser.cpp
index 1c3e24b2d..32613c623 100644
--- a/retroshare-gui/src/gui/help/browser/helpbrowser.cpp
+++ b/retroshare-gui/src/gui/help/browser/helpbrowser.cpp
@@ -50,6 +50,7 @@
#define ROLE_TOPIC_ID Qt::UserRole
#define ROLE_TOPIC_QRC_PATH (Qt::UserRole+1)
+static HelpBrowser *helpBrowser = NULL;
/** Constuctor. This will probably do more later */
HelpBrowser::HelpBrowser(QWidget *parent)
@@ -64,6 +65,10 @@ HelpBrowser::HelpBrowser(QWidget *parent)
ui.actionClose->setShortcut(QString("Ctrl+W"));
#endif
+ helpBrowser = this;
+
+ setAttribute(Qt::WA_DeleteOnClose, true);
+
/* Hide Search frame */
ui.frmFind->setHidden(true);
@@ -103,6 +108,11 @@ HelpBrowser::HelpBrowser(QWidget *parent)
ui.treeContents->setItemExpanded(ui.treeContents->topLevelItem(0), true);
}
+HelpBrowser::~HelpBrowser()
+{
+ helpBrowser = NULL;
+}
+
/** Returns the language in which help topics should appear, or English
* ("en") if no translated help files exist for the current GUI language. */
QString
@@ -438,15 +448,17 @@ HelpBrowser::search()
/** Overrides the default show method */
void
-HelpBrowser::showWindow(QString topic)
+HelpBrowser::showWindow(const QString &topic)
{
-
/* Bring the window to the top */
- RWindow::showWindow();
+ if (helpBrowser == NULL) {
+ /*helpBrowser = */new HelpBrowser();
+ }
+ helpBrowser->show();
/* If a topic was specified, then go ahead and display it. */
if (!topic.isEmpty()) {
- showTopic(topic);
+ helpBrowser->showTopic(topic);
}
}
diff --git a/retroshare-gui/src/gui/help/browser/helpbrowser.h b/retroshare-gui/src/gui/help/browser/helpbrowser.h
index 97ccc0c08..589a37d0c 100644
--- a/retroshare-gui/src/gui/help/browser/helpbrowser.h
+++ b/retroshare-gui/src/gui/help/browser/helpbrowser.h
@@ -1,7 +1,7 @@
/****************************************************************
- * This file is distributed under the following license:
- *
- * Copyright (c) 2008, defnax
+ * This file is distributed under the following license:
+ *
+ * Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
@@ -45,14 +45,15 @@ class HelpBrowser : public RWindow
{
Q_OBJECT
-public:
+protected:
/** Default constructor **/
HelpBrowser(QWidget *parent = 0);
-
-public slots:
+ virtual ~HelpBrowser();
+
+public:
/** Overrides the default QWidget::show() */
- void showWindow(QString topic = QString());
-
+ static void showWindow(const QString &topic);
+
private slots:
/** Called when the user clicks "Find Next" */
void findNext();