Fixed crash when starting the help browser from friend details the second time.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5305 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-07-15 22:24:03 +00:00
parent 15c032468a
commit 9389849e53
4 changed files with 27 additions and 20 deletions

View File

@ -1380,10 +1380,7 @@ void MainWindow::showHelpDialog()
/**< Shows the help browser and displays the given help <b>topic</b>. */
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()

View File

@ -462,8 +462,5 @@ void ConfCertDialog::showHelpDialog()
/**< Shows the help browser and displays the given help <b>topic</b>. */
void ConfCertDialog::showHelpDialog(const QString &topic)
{
static HelpBrowser *helpBrowser = 0;
if (!helpBrowser)
helpBrowser = new HelpBrowser(this);
helpBrowser->showWindow(topic);
HelpBrowser::showWindow(topic);
}

View File

@ -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);
}
}

View File

@ -45,13 +45,14 @@ class HelpBrowser : public RWindow
{
Q_OBJECT
public:
protected:
/** Default constructor **/
HelpBrowser(QWidget *parent = 0);
virtual ~HelpBrowser();
public slots:
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" */