HelpBrowser Class Reference

#include <helpbrowser.h>

Inheritance diagram for HelpBrowser:
VidaliaWindow

List of all members.

Public Slots

void showWindow (QString topic=QString())

Public Member Functions

 HelpBrowser (QWidget *parent=0)

Private Slots

void findNext ()
void findPrev ()
void search ()
void contentsItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev)
void searchItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev)

Private Member Functions

QString language ()
void loadContentsFromXml (QString xmlFile)
bool loadContents (const QDomDocument *document, QString &errorString)
void parseHelpTopic (const QDomElement &element, QTreeWidgetItem *parent)
bool isValidTopicElement (const QDomElement &topicElement)
QString getResourcePath (const QDomElement &topicElement)
void find (bool forward)
QTreeWidgetItem * createTopicTreeItem (const QDomElement &topicElement, QTreeWidgetItem *parent)
void currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev)
QTreeWidgetItem * findTopicItem (QTreeWidgetItem *startItem, QString topic)
void showTopic (QString topic)

Private Attributes

QList< QDomElement > _elementList
QString _lastFind
QString _lastSearch
bool _foundBefore
Ui::HelpBrowser ui

Detailed Description

Definition at line 32 of file helpbrowser.h.


Constructor & Destructor Documentation

HelpBrowser::HelpBrowser ( QWidget *  parent = 0  ) 

Default constructor

Constuctor. This will probably do more later

Definition at line 42 of file helpbrowser.cpp.

References contentsItemChanged(), Vidalia::createShortcut(), currentItemChanged(), findNext(), findPrev(), language(), LEFT_PANE_INDEX, loadContentsFromXml(), MINIMUM_PANE_SIZE, NO_STRETCH, search(), searchItemChanged(), and ui.


Member Function Documentation

void HelpBrowser::contentsItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
) [private, slot]

Called when the user selects a different item in the contents tree

Called when the user selects a different item in the content topic tree

Definition at line 210 of file helpbrowser.cpp.

References currentItemChanged(), and ui.

Referenced by HelpBrowser().

QTreeWidgetItem * HelpBrowser::createTopicTreeItem ( const QDomElement &  topicElement,
QTreeWidgetItem *  parent 
) [private]

Creates a new item to be placed in the topic tree.

Creates a new element to be inserted into the topic tree.

Definition at line 198 of file helpbrowser.cpp.

References ATTRIBUTE_TOPIC_ID, ATTRIBUTE_TOPIC_NAME, getResourcePath(), ROLE_TOPIC_ID, and ROLE_TOPIC_QRC_PATH.

Referenced by loadContents(), parseHelpTopic(), and search().

void HelpBrowser::currentItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
) [private]

Called when the user selects a different item in the tree.

Definition at line 244 of file helpbrowser.cpp.

References _foundBefore, ROLE_TOPIC_QRC_PATH, and ui.

Referenced by contentsItemChanged(), HelpBrowser(), searchItemChanged(), and showTopic().

void HelpBrowser::find ( bool  forward  )  [private]

Searches the current page for the phrase in the Find box

Searches the current page for the phrase in the Find box. Highlights the first instance found in the document

Parameters:
forward true search forward if true, backward if false

Definition at line 325 of file helpbrowser.cpp.

References _foundBefore, _lastFind, and ui.

Referenced by findNext(), and findPrev().

void HelpBrowser::findNext (  )  [private, slot]

Called when the user clicks "Find Next"

Called when the user clicks "Find Next".

Definition at line 308 of file helpbrowser.cpp.

References find().

Referenced by HelpBrowser().

void HelpBrowser::findPrev (  )  [private, slot]

Called when the user clicks "Find Previous"

Called when the user clicks "Find Previous".

Definition at line 315 of file helpbrowser.cpp.

References find().

Referenced by HelpBrowser().

QTreeWidgetItem * HelpBrowser::findTopicItem ( QTreeWidgetItem *  startItem,
QString  topic 
) [private]

Finds a topic in the topic tree.

Searches for a topic in the topic tree. Returns a pointer to that topics item in the topic tree if it is found, 0 otherwise.

Definition at line 257 of file helpbrowser.cpp.

References i(), ROLE_TOPIC_ID, and ui.

Referenced by showTopic().

QString HelpBrowser::getResourcePath ( const QDomElement &  topicElement  )  [private]

Builds a resource path to an html file associated with a help topic.

Builds a resource path to an html file associated with the given help topic. If the help topic needs an achor, the anchor will be formatted and appended.

Definition at line 187 of file helpbrowser.cpp.

References ATTRIBUTE_TOPIC_HTML, ATTRIBUTE_TOPIC_SECTION, and language().

Referenced by createTopicTreeItem(), and search().

bool HelpBrowser::isValidTopicElement ( const QDomElement &  topicElement  )  [private]

Returns true if the given Topic element has the necessary attributes.

Definition at line 176 of file helpbrowser.cpp.

References ATTRIBUTE_TOPIC_HTML, ATTRIBUTE_TOPIC_ID, and ATTRIBUTE_TOPIC_NAME.

Referenced by parseHelpTopic().

QString HelpBrowser::language (  )  [private]

Returns the language in which help topics should appear, or English ("en") if no translated help files exist for the current GUI language.

Definition at line 99 of file helpbrowser.cpp.

Referenced by getResourcePath(), and HelpBrowser().

bool HelpBrowser::loadContents ( const QDomDocument *  document,
QString &  errorString 
) [private]

Load the contents of the help topics tree from the given DOM document.

Definition at line 129 of file helpbrowser.cpp.

References _elementList, createTopicTreeItem(), ELEMENT_CONTENTS, ELEMENT_TOPIC, parseHelpTopic(), and ui.

Referenced by loadContentsFromXml().

void HelpBrowser::loadContentsFromXml ( QString  xmlFile  )  [private]

Load the contents of the help topics tree from the specified XML file.

Definition at line 109 of file helpbrowser.cpp.

References loadContents(), and ui.

Referenced by HelpBrowser().

void HelpBrowser::parseHelpTopic ( const QDomElement &  topicElement,
QTreeWidgetItem *  parent 
) [private]

Parse a Topic element and handle all its children.

Parse a Topic element and handle all its children recursively.

Definition at line 154 of file helpbrowser.cpp.

References _elementList, createTopicTreeItem(), ELEMENT_TOPIC, and isValidTopicElement().

Referenced by loadContents().

void HelpBrowser::search (  )  [private, slot]

Called when the user starts a search

Searches all help pages for the phrase the Search box. Fills treeSearch with documents containing matches and sets the status bar text appropriately.

Definition at line 394 of file helpbrowser.cpp.

References _elementList, _lastSearch, createTopicTreeItem(), getResourcePath(), i(), HelpTextBrowser::setSource(), and ui.

Referenced by HelpBrowser().

void HelpBrowser::searchItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
) [private, slot]

Called when the user selects a different item in the search tree

Called when the user selects a different item in the content topic tree

Definition at line 222 of file helpbrowser.cpp.

References _lastSearch, currentItemChanged(), and ui.

Referenced by HelpBrowser().

void HelpBrowser::showTopic ( QString  topic  )  [private]

Shows the help browser and finds a specific a topic in the browser.

Shows the help browser. If a sepcified topic was given, the search for that topic's ID (e.g., "log.basic") and display the appropriate page.

Definition at line 287 of file helpbrowser.cpp.

References currentItemChanged(), findTopicItem(), and ui.

Referenced by showWindow().

void HelpBrowser::showWindow ( QString  topic = QString()  )  [slot]

Overrides the default QWidget::show()

Overrides the default show method

Definition at line 431 of file helpbrowser.cpp.

References showTopic(), and VidaliaWindow::showWindow().

Referenced by MainWindow::showHelpDialog().


Member Data Documentation

QList<QDomElement> HelpBrowser::_elementList [private]

List of DOM elements representing topics.

Definition at line 83 of file helpbrowser.h.

Referenced by loadContents(), parseHelpTopic(), and search().

bool HelpBrowser::_foundBefore [private]

Indicates if phrase was previously found on current page

Definition at line 89 of file helpbrowser.h.

Referenced by currentItemChanged(), and find().

QString HelpBrowser::_lastFind [private]

Last phrase used for 'Find'

Definition at line 85 of file helpbrowser.h.

Referenced by find().

QString HelpBrowser::_lastSearch [private]

Last phrase searched on

Definition at line 87 of file helpbrowser.h.

Referenced by search(), and searchItemChanged().

Ui::HelpBrowser HelpBrowser::ui [private]

The documentation for this class was generated from the following files:

Generated on 22 Feb 2010 for Vidalia by  doxygen 1.6.1