HelpBrowser Class Reference

#include <helpbrowser.h>

Inheritance diagram for HelpBrowser:

VidaliaWindow List of all members.

Public Slots

void show (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

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 43 of file helpbrowser.h.


Constructor & Destructor Documentation

HelpBrowser::HelpBrowser ( QWidget *  parent = 0  ) 

Default constructor

Definition at line 53 of file helpbrowser.cpp.

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


Member Function Documentation

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

Overrides the default QWidget::show()

Definition at line 424 of file helpbrowser.cpp.

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

Referenced by Vidalia::help().

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

Called when the user clicks "Find Next"

Definition at line 301 of file helpbrowser.cpp.

References find().

Referenced by HelpBrowser().

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

Called when the user clicks "Find Previous"

Definition at line 308 of file helpbrowser.cpp.

References find().

Referenced by HelpBrowser().

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

Called when the user starts a search

Definition at line 387 of file helpbrowser.cpp.

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

Referenced by HelpBrowser().

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

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

Definition at line 207 of file helpbrowser.cpp.

References currentItemChanged(), 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

Definition at line 219 of file helpbrowser.cpp.

References _lastSearch, currentItemChanged(), and ui.

Referenced by HelpBrowser().

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

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

Definition at line 106 of file helpbrowser.cpp.

References loadContents(), and ui.

Referenced by 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 126 of file helpbrowser.cpp.

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

Referenced by loadContentsFromXml().

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

Parse a Topic element and handle all its children.

Definition at line 151 of file helpbrowser.cpp.

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

Referenced by loadContents().

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

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

Definition at line 173 of file helpbrowser.cpp.

References ATTRIBUTE_TOPIC_HTML, ATTRIBUTE_TOPIC_ID, and ATTRIBUTE_TOPIC_NAME.

Referenced by parseHelpTopic().

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

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

Definition at line 184 of file helpbrowser.cpp.

References ATTRIBUTE_TOPIC_HTML, ATTRIBUTE_TOPIC_SECTION, and Vidalia::language().

Referenced by createTopicTreeItem(), and search().

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

Searches the current page for the phrase in the Find box

Definition at line 318 of file helpbrowser.cpp.

References _foundBefore, _lastFind, and ui.

Referenced by findNext(), and findPrev().

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

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

Definition at line 195 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 241 of file helpbrowser.cpp.

References _foundBefore, ROLE_TOPIC_QRC_PATH, and ui.

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

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

Finds a topic in the topic tree.

Definition at line 254 of file helpbrowser.cpp.

References i(), ROLE_TOPIC_ID, and ui.

Referenced by showTopic().

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

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

Definition at line 280 of file helpbrowser.cpp.

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

Referenced by show().


Member Data Documentation

QList<QDomElement> HelpBrowser::_elementList [private]

List of DOM elements representing topics.

Definition at line 91 of file helpbrowser.h.

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

QString HelpBrowser::_lastFind [private]

Last phrase used for 'Find'

Definition at line 93 of file helpbrowser.h.

Referenced by find().

QString HelpBrowser::_lastSearch [private]

Last phrase searched on

Definition at line 95 of file helpbrowser.h.

Referenced by search(), and searchItemChanged().

bool HelpBrowser::_foundBefore [private]

Indicates if phrase was previously found on current page

Definition at line 97 of file helpbrowser.h.

Referenced by currentItemChanged(), and find().

Ui::HelpBrowser HelpBrowser::ui [private]

Qt Designer generated QObject

Definition at line 100 of file helpbrowser.h.

Referenced by contentsItemChanged(), currentItemChanged(), find(), findTopicItem(), HelpBrowser(), loadContents(), loadContentsFromXml(), search(), searchItemChanged(), and showTopic().


The documentation for this class was generated from the following files:
Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0