[rkward-cvs] SF.net SVN: rkward: [1091] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 8 13:56:37 UTC 2007


Revision: 1091
          http://svn.sourceforge.net/rkward/?rev=1091&view=rev
Author:   tfry
Date:     2007-01-08 05:56:36 -0800 (Mon, 08 Jan 2007)

Log Message:
-----------
More work on help, and install some test pages

Modified Paths:
--------------
    trunk/rkward/rkward/misc/xmlhelper.cpp
    trunk/rkward/rkward/misc/xmlhelper.h
    trunk/rkward/rkward/plugins/Makefile.am
    trunk/rkward/rkward/plugins/makemakefileam.php
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h
    trunk/rkward/rkward/rkwardui.rc
    trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp
    trunk/rkward/rkward/settings/rksettingsmodulegeneral.h
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp
    trunk/rkward/rkward/windows/rkhtmlwindow.h

Added Paths:
-----------
    trunk/rkward/rkward/pages/
    trunk/rkward/rkward/pages/Makefile.am
    trunk/rkward/rkward/pages/rkward_welcome.rkh

Modified: trunk/rkward/rkward/misc/xmlhelper.cpp
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.cpp	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/misc/xmlhelper.cpp	2007-01-08 13:56:36 UTC (rev 1091)
@@ -109,7 +109,7 @@
 	XMLChildList list = getChildElements (parent, QString (), debug_level);
 	for (XMLChildList::const_iterator it = list.constBegin (); it != list.constEnd (); ++it) {
 		if ((*it).hasAttribute (attribute_name)) {
-			if (((*it).attribute (attribute_name)) == attribute_value) {
+			if (attribute_value.isNull () || ((*it).attribute (attribute_name) == attribute_value)) {
 				return (*it);
 			}
 		}
@@ -123,7 +123,29 @@
 	return dummy;
 }
 
+XMLChildList XMLHelper::findElementsWithAttribute (const QDomElement &parent, const QString &attribute_name, const QString &attribute_value, bool recursive, int debug_level) {
+	RK_TRACE (XML);
 
+	XMLChildList ret;
+	XMLChildList list = getChildElements (parent, QString (), debug_level);
+	for (XMLChildList::const_iterator it = list.constBegin (); it != list.constEnd (); ++it) {
+		if ((*it).hasAttribute (attribute_name)) {
+			if (attribute_value.isNull () || ((*it).attribute (attribute_name) == attribute_value)) {
+				ret.append (*it);
+			}
+		}
+		if (recursive) {
+			XMLChildList subret = findElementsWithAttribute (*it, attribute_name, attribute_value, true, debug_level);
+			for (XMLChildList::const_iterator it = subret.constBegin (); it != subret.constEnd (); ++it) {
+				ret.append (*it);
+			}
+		}
+	}
+
+	return ret;
+}
+
+
 QString XMLHelper::getStringAttribute (const QDomElement &element, const QString &name, const QString &def, int debug_level) {
 	RK_TRACE (XML);
 

Modified: trunk/rkward/rkward/misc/xmlhelper.h
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.h	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/misc/xmlhelper.h	2007-01-08 13:56:36 UTC (rev 1091)
@@ -67,12 +67,21 @@
 /** find the first child element of parent, that has a certain attribute
 @param parent the element whose children to search
 @param attribute_name the attribute name of the attribute to search for
- at param attribute_value the attribute value of the attribute to search for
+ at param attribute_value the attribute value of the attribute to search for. If this a null string, each element containing the attribute qualifies
 @param recursive do a recursive search? If false, only direct children will be looked at
 @param debug_level level of debug message to generate in case of failure
 @returns the element found */
 	QDomElement findElementWithAttribute (const QDomElement &parent, const QString &attribute_name, const QString &attribute_value, bool recursive, int debug_level);
 
+/** like findElementWithAttribute, but returns all such elements
+ at param parent the element whose children to search
+ at param attribute_name the attribute name of the attribute to search for
+ at param attribute_value the attribute value of the attribute to search for. If this a null string, each element containing the attribute qualifies
+ at param recursive do a recursive search? If false, only direct children will be looked at
+ at param debug_level level of debug message to generate in case of failure
+ at returns the element found */
+	XMLChildList findElementsWithAttribute (const QDomElement &parent, const QString &attribute_name, const QString &attribute_value, bool recursive, int debug_level);
+
 /** returns the value of a string attribute (Note: most get...Attribute functions use this function internally)
 @param element the element whose attributes to search
 @param name the name of the attribute to read

Added: trunk/rkward/rkward/pages/Makefile.am
===================================================================
--- trunk/rkward/rkward/pages/Makefile.am	                        (rev 0)
+++ trunk/rkward/rkward/pages/Makefile.am	2007-01-08 13:56:36 UTC (rev 1091)
@@ -0,0 +1,4 @@
+pagesdir = $(kde_datadir)/rkward/
+dist_pages_DATA = \
+	rkward_welcome.rkh
+

Added: trunk/rkward/rkward/pages/rkward_welcome.rkh
===================================================================
--- trunk/rkward/rkward/pages/rkward_welcome.rkh	                        (rev 0)
+++ trunk/rkward/rkward/pages/rkward_welcome.rkh	2007-01-08 13:56:36 UTC (rev 1091)
@@ -0,0 +1,16 @@
+<!DOCTYPE rkhelp>
+<document>
+	<title>Welcome to RKWard</title>
+
+	<summary>
+	This help page gives a rough overview over the most important parts of RKWard.
+
+	By default, this page is shown each time RKWard is started. You can disable / re-enable this behavior under Settings->Configure RKWard->General.
+	</summary>
+
+	<section title="Introduction to RKWard">
+	</section>
+
+	<section title="Getting Started">
+	</section>
+</document>

Modified: trunk/rkward/rkward/plugins/Makefile.am
===================================================================
--- trunk/rkward/rkward/plugins/Makefile.am	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/plugins/Makefile.am	2007-01-08 13:56:36 UTC (rev 1091)
@@ -198,7 +198,8 @@
 	descriptive/descriptive_statistics.php \
 	descriptive/descriptive_statistics.xml \
 	descriptive/skewness_kurtosis_test.xml \
-	descriptive/skewness_kurtosis_test.php
+	descriptive/skewness_kurtosis_test.php \
+	descriptive/descriptive_statistics.rkh
 
 pluginsXx11devicedir = $(kde_datadir)/rkward/x11device
 dist_pluginsXx11device_DATA = \

Modified: trunk/rkward/rkward/plugins/makemakefileam.php
===================================================================
--- trunk/rkward/rkward/plugins/makemakefileam.php	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/plugins/makemakefileam.php	2007-01-08 13:56:36 UTC (rev 1091)
@@ -1,11 +1,17 @@
 #!/usr/bin/php
 <?
 
-# filthy script to generate a Makefile.am for the plugins-directory, installing all plugins as found.
+# filthy script to generate a Makefile.am for the plugins, and pages directories, installing all plugins and help pages as found.
 # usage: (in plugins dir)
 # ./makemakefileam.php > Makefile.am
+# usage: (in pages dir)
+# ../plugins/makemakefileam.php pages > Makefile.am
 
-readsubs ("", "plugins");
+if ($argc < 2) {
+	readsubs ("", "plugins");
+} else {
+	readsubs ("", $argv[1]);
+}
 
 function readsubs ($dir, $prefix) {
 	if ($dir == "") {
@@ -22,7 +28,7 @@
 	
 	while (false !== ($file = readdir($thisdir))) {
 		if (!is_dir ($ndir . $file)) {
-			if ((substr ($file, -4) == ".xml") || (substr ($file, -4) == ".php") || (substr ($file, -10) == ".pluginmap")) {
+			if ((substr ($file, -4) == ".xml") || (substr ($file, -4) == ".php") || (substr ($file, -10) == ".pluginmap") || (substr ($file, -4) == ".rkh")) {
 				if ($file != "makemakefileam.php") {
 					array_push ($files, $file);
 				}

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/rkward.cpp	2007-01-08 13:56:36 UTC (rev 1091)
@@ -227,6 +227,10 @@
 		RKWorkplace::mainWorkplace ()->restoreWorkplace (RKSettingsModuleGeneral::getSavedWorkplace (kapp->config ()));
 	}
 
+	if (RKSettingsModuleGeneral::showHelpOnStartup ()) {
+		showRKWardHelp ();
+	}
+
 	setCaption (QString::null);	// our version of setCaption takes care of creating a correct caption, so we do not need to provide it here
 }
 
@@ -330,6 +334,7 @@
 void RKWardMainWindow::makeRKWardHelpMenu (QWidget *for_window, KActionCollection *ac) {
 	KAction *help_invoke_r_help = new KAction (i18n ("Help on R"), 0, 0, this, SLOT (invokeRHelp ()), ac, "invoke_r_help");
 	KAction *show_help_search = new KAction (i18n ("Search R Help"), 0, 0, this, SLOT (showHelpSearch ()), ac, "show_help_search");
+	KAction *show_rkward_help = new KAction (i18n ("Help on RKWard"), 0, 0, this, SLOT (showRKWardHelp ()), ac, "rkward_help");
 
 	KStdAction::helpContents (this, SLOT (appHelpActivated ()), ac);
 	KStdAction::aboutApp (this, SLOT (showAboutApplication ()), ac);
@@ -338,6 +343,7 @@
 
 	help_invoke_r_help->setStatusText (i18n ("Shows the R help index"));
 	show_help_search->setStatusText (i18n ("Shows/raises the R Help Search window"));
+	show_rkward_help->setStatusText (i18n ("Show help on RKWard"));
 }
 
 void RKWardMainWindow::partAdded (KParts::Part *part) {
@@ -560,6 +566,13 @@
 	search_help_view->wrapperWidget ()->topLevelWidget ()->raise ();
 }
 
+void RKWardMainWindow::showRKWardHelp () {
+	RK_TRACE (APP);
+
+	RKWorkplace::mainWorkplace ()->openHelpWindow ("rkward://page/rkward_welcome");
+	topLevelWidget ()->raise ();
+}
+
 void RKWardMainWindow::slotNewDataFrame () {
 	RK_TRACE (APP);
 	bool ok;

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/rkward.h	2007-01-08 13:56:36 UTC (rev 1091)
@@ -128,6 +128,8 @@
 public slots:
 	/** Raise the help search window */
 	void showHelpSearch ();
+	/** Show the starting page of RKWard help */
+	void showRKWardHelp ();
 	/** Invokes R help (help.start ()) */
 	void invokeRHelp ();
 	/** show instructions on reporting bugs in rkward */

Modified: trunk/rkward/rkward/rkwardui.rc
===================================================================
--- trunk/rkward/rkward/rkwardui.rc	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/rkwardui.rc	2007-01-08 13:56:36 UTC (rev 1091)
@@ -46,6 +46,7 @@
 	</Menu>
 
 	<Menu name="help"><text>&Help</text>
+		<Action name="rkward_help"/>
 		<Action name="invoke_r_help"/>
 		<Action name="show_help_search"/>
 		<Merge/>

Modified: trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp	2007-01-08 13:56:36 UTC (rev 1091)
@@ -2,7 +2,7 @@
                           rksettingsmodulegeneral  -  description
                              -------------------
     begin                : Fri Jul 30 2004
-    copyright            : (C) 2004 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -25,6 +25,7 @@
 #include <qlabel.h>
 #include <qdir.h>
 #include <qcombobox.h>
+#include <qcheckbox.h>
 #include <qbuttongroup.h>
 #include <qradiobutton.h>
 
@@ -37,6 +38,7 @@
 QString RKSettingsModuleGeneral::new_files_path;
 StartupDialog::Result RKSettingsModuleGeneral::startup_action;
 RKSettingsModuleGeneral::WorkplaceSaveMode RKSettingsModuleGeneral::workplace_save_mode;
+bool RKSettingsModuleGeneral::show_help_on_startup;
 
 RKSettingsModuleGeneral::RKSettingsModuleGeneral (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
 	RK_TRACE (SETTINGS);
@@ -60,6 +62,11 @@
 	connect (startup_action_choser, SIGNAL (activated (int)), this, SLOT (boxChanged (int)));
 	main_vbox->addWidget (startup_action_choser);
 
+	show_help_on_startup_box = new QCheckBox (i18n ("Show RKWard Help on Startup"), this);
+	show_help_on_startup_box->setChecked (show_help_on_startup);
+	connect (show_help_on_startup_box, SIGNAL (stateChanged (int)), this, SLOT (boxChanged (int)));
+	main_vbox->addWidget (show_help_on_startup_box);
+
 	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
 
 	label = new QLabel (i18n ("The workplace layout (i.e. which script-, data-, help-windows are open) may be saved (and loaded) per R workspace, or independent of the R workspace. Which do you prefer?"), this);
@@ -109,6 +116,7 @@
 	RK_TRACE (SETTINGS);
 	new_files_path = files_choser->getLocation ();
 	startup_action = static_cast<StartupDialog::Result> (startup_action_choser->currentItem ());
+	show_help_on_startup = show_help_on_startup_box->isChecked ();
 #if QT_VERSION < 0x030200
 	workplace_save_mode = static_cast<WorkplaceSaveMode> (workplace_save_chooser->id (workplace_save_chooser->selected ()));
 #else
@@ -129,6 +137,7 @@
 
 	config->setGroup ("General");
 	config->writeEntry ("startup action", (int) startup_action);
+	config->writeEntry ("show help on startup", show_help_on_startup);
 
 	config->setGroup ("Workplace");
 	config->writeEntry ("save mode", (int) workplace_save_mode);
@@ -142,6 +151,7 @@
 
 	config->setGroup ("General");
 	startup_action = (StartupDialog::Result) config->readNumEntry ("startup action", StartupDialog::NoSavedSetting);
+	show_help_on_startup = config->readBoolEntry ("show help on startup", true);
 
 	config->setGroup ("Workplace");
 	workplace_save_mode = (WorkplaceSaveMode) config->readNumEntry ("save mode", SaveWorkplaceWithWorkspace);

Modified: trunk/rkward/rkward/settings/rksettingsmodulegeneral.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegeneral.h	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/settings/rksettingsmodulegeneral.h	2007-01-08 13:56:36 UTC (rev 1091)
@@ -2,7 +2,7 @@
                           rksettingsmodulegeneral  -  description
                              -------------------
     begin                : Fri Jul 30 2004
-    copyright            : (C) 2004 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -22,6 +22,7 @@
 
 class GetFileNameWidget;
 class QComboBox;
+class QCheckBox;
 class QButtonGroup;
 
 /**
@@ -52,6 +53,7 @@
 /// returns the directory-name where the logfiles should reside
 	static QString &filesPath () { return files_path; };
 	static StartupDialog::Result startupAction () { return startup_action; };
+	static bool showHelpOnStartup () { return show_help_on_startup; };
 	static void setStartupAction (StartupDialog::Result action) { startup_action = action; };
 	static WorkplaceSaveMode workplaceSaveMode () { return workplace_save_mode; };
 /** retrieve the saved workplace description. Meaningful only is workplaceSaveMode () == SaveWorkplaceWithSession */
@@ -65,12 +67,14 @@
 	GetFileNameWidget *files_choser;
 	QComboBox *startup_action_choser;
 	QButtonGroup *workplace_save_chooser;
+	QCheckBox *show_help_on_startup_box;
 
 	static StartupDialog::Result startup_action;
 	static QString files_path;
 /** since changing the files_path can not easily be done while in an active session, the setting should only take effect on the next start. This string stores a changed setting, while keeping the old one intact as long as RKWard is running */
 	static QString new_files_path;
 	static WorkplaceSaveMode workplace_save_mode;
+	static bool show_help_on_startup;
 };
 
 #endif

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2007-01-08 13:56:36 UTC (rev 1091)
@@ -24,6 +24,7 @@
 #include <kmessagebox.h>
 #include <krun.h>
 #include <kparts/partmanager.h>
+#include <kstandarddirs.h>
 
 #include <qfileinfo.h>
 #include <qwidget.h>
@@ -394,48 +395,89 @@
 		return (false);
 	}
 
-	qDebug ("here2 %s", url.path ().latin1 ());
-	if (url.host () == "component") {
-		bool success = false;
-		XMLHelper *component_xml = new XMLHelper ();
-		XMLHelper *help_xml = new XMLHelper ();
+	bool for_component = false;		// is this a help page for a component, or a top-level help page?
+	if (url.host () == "component") for_component = true;
 
-		while (true) {		// dirty hack to streamline exit code: breaking from this while, before success is set to true will cause the XMLHelpers to be deleted, and false returned.
-			RKComponentHandle *chandle = componentPathToHandle (url.path ());
+	bool success = false;
+	XMLHelper *component_xml = new XMLHelper ();
+	XMLHelper *help_xml = new XMLHelper ();
+
+	while (true) {		// dirty hack to streamline exit code: breaking from this while, before success is set to true will cause the XMLHelpers to be deleted, and false returned.
+		RKComponentHandle *chandle = 0;
+		QString help_file_name;
+		QDomElement element;
+		QDomElement component_doc_element;
+		QString help_base_dir;
+
+		// determine help file, and prepare
+		if (for_component) {
+			chandle = componentPathToHandle (url.path ());
 			if (!chandle) break;
 
-			qDebug ("here3");
-			QDomElement component_doc_element = component_xml->openXMLFile (chandle->getFilename (), DL_ERROR);
+			component_doc_element = component_xml->openXMLFile (chandle->getFilename (), DL_ERROR);
 			if (component_doc_element.isNull ()) break;
-			QDomElement element = component_xml->getChildElement (component_doc_element, "help", DL_ERROR);
+			element = component_xml->getChildElement (component_doc_element, "help", DL_ERROR);
 			if (element.isNull ()) break;
-			QString help_file_name = component_xml->getStringAttribute (element, "file", QString::null, DL_ERROR);
+			help_file_name = component_xml->getStringAttribute (element, "file", QString::null, DL_ERROR);
 			if (help_file_name.isNull ()) break;
 			help_file_name = QFileInfo (chandle->getFilename ()).dir (true).filePath (help_file_name);
-	
-			qDebug ("here4");
-			QDomElement help_doc_element = help_xml->openXMLFile (help_file_name, DL_ERROR);
-			if (help_doc_element.isNull ()) break;
+		} else {
+			help_base_dir = KGlobal::dirs()->findResourceDir ("pages", "rkward/pages/rkward_welcome.rkh");
+			help_base_dir.append ("rkward/pages");
 
-			khtmlpart->begin (url);
-			khtmlpart->write ("<html><head><title>" + chandle->getLabel () + "</title></head>\n<body>\n<h1>" + chandle->getLabel () + "</h1>\n");
+			help_file_name = help_base_dir + url.path () + ".rkh";
+		}
+		qDebug ("%s", help_file_name.latin1 ());
 
-			qDebug ("here5");
-			element = help_xml->getChildElement (help_doc_element, "summary", DL_WARNING);
+		// open help file
+		QDomElement help_doc_element = help_xml->openXMLFile (help_file_name, DL_ERROR);
+		if (help_doc_element.isNull ()) break;
+
+		// initialize output, and set title
+		khtmlpart->begin (url);
+		QString page_title (i18n ("No Title"));
+		if (for_component) {
+			page_title = chandle->getLabel ();
+		} else {
+			element = help_xml->getChildElement (help_doc_element, "title", DL_WARNING);
 			if (!element.isNull ()) {
-				khtmlpart->write ("<h2>" + i18n ("Summary") + "</h2>\n");
-				khtmlpart->write (renderHelpFragment (element));
+				page_title = element.text ();
 			}
+		}
+		khtmlpart->write ("<html><head><title>" + page_title + "</title></head>\n<body>\n<h1>" + page_title + "</h1>\n");
 
-			element = help_xml->getChildElement (help_doc_element, "usage", DL_WARNING);
-			if (!element.isNull ()) {
-				khtmlpart->write ("<h2>" + i18n ("Usage") + "</h2>\n");
-				khtmlpart->write (renderHelpFragment (element));
+		// fix all elements containing an "src" attribute
+		QDir base_path (QFileInfo (help_file_name).dirPath (true));
+		XMLChildList src_elements = help_xml->findElementsWithAttribute (help_doc_element, "src", QString (), true, DL_DEBUG);
+		for (XMLChildList::iterator it = src_elements.begin (); it != src_elements.end (); ++it) {
+			QString src = (*it).attribute ("src");
+			if (KURL::isRelativeURL (src)) {
+				src = QDir::cleanDirPath (base_path.filePath (src));
+				(*it).setAttribute ("src", src);
 			}
+		}
 
-			// TODO: handle some generic sections
+		// render the sections
+		element = help_xml->getChildElement (help_doc_element, "summary", DL_INFO);
+		if (!element.isNull ()) {
+			khtmlpart->write ("<h2>" + i18n ("Summary") + "</h2>\n");
+			khtmlpart->write (renderHelpFragment (element));
+		}
 
-			element = help_xml->getChildElement (help_doc_element, "settings", DL_WARNING);
+		element = help_xml->getChildElement (help_doc_element, "usage", DL_INFO);
+		if (!element.isNull ()) {
+			khtmlpart->write ("<h2>" + i18n ("Usage") + "</h2>\n");
+			khtmlpart->write (renderHelpFragment (element));
+		}
+
+		XMLChildList section_elements = help_xml->getChildElements (help_doc_element, "section", DL_INFO);
+		for (XMLChildList::iterator it = section_elements.begin (); it != section_elements.end (); ++it) {
+			khtmlpart->write ("<h2>" + help_xml->getStringAttribute (*it, "title", QString (), DL_WARNING) + "</h2>\n");
+			khtmlpart->write (renderHelpFragment (*it));
+		}
+
+		if (for_component) {
+			element = help_xml->getChildElement (help_doc_element, "settings", DL_INFO);
 			if (!element.isNull ()) {
 				khtmlpart->write ("<h2>" + i18n ("GUI settings") + "</h2>\n");
 				XMLChildList setting_elements = help_xml->getChildElements (element, QString (), DL_WARNING);
@@ -460,29 +502,29 @@
 					}
 				}
 			}
+		}
 
-			element = help_xml->getChildElement (help_doc_element, "related", DL_WARNING);
-			if (!element.isNull ()) {
-				khtmlpart->write ("<h2>" + i18n ("Related functions and pages") + "</h2>\n");
-				khtmlpart->write (renderHelpFragment (element));
-			}
-
-			khtmlpart->end ();
-			success = true;
-			break;
+		element = help_xml->getChildElement (help_doc_element, "related", DL_INFO);
+		if (!element.isNull ()) {
+			khtmlpart->write ("<h2>" + i18n ("Related functions and pages") + "</h2>\n");
+			khtmlpart->write (renderHelpFragment (element));
 		}
 
-		delete (component_xml);
-		delete (help_xml);
-		return (success);
+		khtmlpart->write ("</body></html>\n");
+		khtmlpart->end ();
+		success = true;
+		break;
 	}
 
-	return false;
+	delete (component_xml);
+	delete (help_xml);
+	return (success);
 }
 
 QString RKHelpWindow::renderHelpFragment (QDomElement &fragment) {
 	RK_TRACE (APP);
 
+	// prepare all internal links
 	QDomNodeList link_nodes = fragment.elementsByTagName ("link");
 	for (int i=link_nodes.count (); i >= 0; --i) {
 		QDomElement element = link_nodes.item (i).toElement ();
@@ -491,6 +533,7 @@
 		prepareHelpLink (&element);
 	}
 
+	// render to string
 	QString ret;
 	QTextOStream stream (&ret);
 	for (QDomNode node = fragment.firstChild (); !node.isNull (); node = node.nextSibling ()) {

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.h	2007-01-08 12:09:40 UTC (rev 1090)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.h	2007-01-08 13:56:36 UTC (rev 1091)
@@ -139,6 +139,7 @@
 
 class QDomElement;
 class RKComponentHandle;
+class XMLHelper;
 
 /**
 	\brief Show html help files.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list