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)

Protected Member Functions

virtual void retranslateUi ()

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 33 of file HelpBrowser.h.


Constructor & Destructor Documentation

HelpBrowser::HelpBrowser ( QWidget *  parent = 0  ) 

Default constructor

Constuctor. This will probably do more later

Definition at line 41 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 225 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 209 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 259 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 342 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 325 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 332 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 272 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 198 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 187 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 110 of file HelpBrowser.cpp.

Referenced by getResourcePath(), HelpBrowser(), and retranslateUi().

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 140 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 120 of file HelpBrowser.cpp.

References loadContents(), and ui.

Referenced by HelpBrowser(), and retranslateUi().

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 165 of file HelpBrowser.cpp.

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

Referenced by loadContents().

void HelpBrowser::retranslateUi (  )  [protected, virtual]

Called when the user changes the UI translation.

Reimplemented from VidaliaWindow.

Definition at line 97 of file HelpBrowser.cpp.

References language(), loadContentsFromXml(), and ui.

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 411 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 237 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, then search for that topic's ID (e.g., "log.basic") and display the appropriate page.

Definition at line 302 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 448 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 88 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 94 of file HelpBrowser.h.

Referenced by currentItemChanged(), and find().

QString HelpBrowser::_lastFind [private]

Last phrase used for 'Find'

Definition at line 90 of file HelpBrowser.h.

Referenced by find().

QString HelpBrowser::_lastSearch [private]

Last phrase searched on

Definition at line 92 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 31 Mar 2010 for Vidalia by  doxygen 1.6.1