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

tfry at users.sf.net tfry at users.sf.net
Fri Feb 1 17:13:01 UTC 2013


Revision: 4520
          http://sourceforge.net/p/rkward/code/4520
Author:   tfry
Date:     2013-02-01 17:12:58 +0000 (Fri, 01 Feb 2013)
Log Message:
-----------
Add 'priority'-attribute to pluginmaps, and shown 'about' and dependencies on plugin help pages.

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp
    trunk/rkward/rkward/plugin/rkcomponentmap.h
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R
    trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp
    trunk/rkward/rkward/settings/rksettingsmoduleplugins.h
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2013-01-31 12:16:58 UTC (rev 4519)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2013-02-01 17:12:58 UTC (rev 4520)
@@ -571,6 +571,12 @@
 	return (ret + (*it));
 }
 
+QString RKComponentHandle::getPluginmapFilename () {
+	RK_TRACE (PLUGIN);
+
+	return RKComponentMap::getMap ()->pluginmapfiles.key (plugin_map);
+}
+
 ///########################### END RKComponentHandle ###############################
 
 #include "rkcomponentmap.moc"

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.h	2013-01-31 12:16:58 UTC (rev 4519)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.h	2013-02-01 17:12:58 UTC (rev 4520)
@@ -63,13 +63,13 @@
 	Q_OBJECT
 public:
 	RKComponentHandle (RKPluginMapFile *pluginmap, const QString &rel_filename, const QString &label, RKComponentType type);
-
 	virtual ~RKComponentHandle ();
 
 	QString getFilename () { return plugin_map->makeFileName (filename); };
 	QString getLabel () { return label; };
 	RKComponentType getType () { return type; };
 	bool isPlugin ();
+	QString getPluginmapFilename ();
 
 	RKStandardComponent *invoke (RKComponent *parent_component, QWidget *parent_widget);
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R	2013-01-31 12:16:58 UTC (rev 4519)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R	2013-02-01 17:12:58 UTC (rev 4520)
@@ -108,8 +108,8 @@
 #' @param pluginmap.files a character vector of file names to add. This may be left empty,
 #'                        if the only desired effect is to reload all active pluginmaps.
 #' @param force.add logical. Whether the pluginmap files should also be added, if they had
-#'                  been previously de-selected in the settings menu. In scripted usage, this
-#'                  should generally be set to FALSE.
+#'                  been previously de-selected in the settings menu, and regardless of their
+#'                  priority setting. In scripted usage, this should generally be set to FALSE.
 #' @param force.reload logical. By default the active pluginmaps are reloaded, only if any new ones
 #'                     were added. If set to TRUE, pluginmaps are reloaded in any case. In
 #'                     scripted usage, this should generally be set to FALSE. NOTE: Since

Modified: trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp	2013-01-31 12:16:58 UTC (rev 4519)
+++ trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp	2013-02-01 17:12:58 UTC (rev 4520)
@@ -167,6 +167,7 @@
 		ppmg.writeEntry ("Quirky", inf.quirky_in_this_version);
 		ppmg.writeEntry ("timestamp", inf.last_modified);
 		ppmg.writeEntry ("id", inf.id);
+		ppmg.writeEntry ("priority", inf.priority);
 		all_known_maps.append (inf.filename);
 	}
 	// NOTE: The group list is always sorted alphabetically, which is why we need a separate list setting for saving info on order.
@@ -202,6 +203,7 @@
 			inf.quirky_in_this_version = ppmg.readEntry ("Quirky", false) && !RKSettingsModuleGeneral::rkwardVersionChanged ();
 			inf.last_modified = ppmg.readEntry ("timestamp", QDateTime ());
 			inf.id = ppmg.readEntry ("id");
+			inf.priority = ppmg.readEntry ("priority", (int) PriorityMedium);
 			known_plugin_maps.append (inf);
 		}
 	}
@@ -298,16 +300,24 @@
 		if (map.isEmpty ()) continue;
 		int index = findKnownPluginMap (map, known_plugin_maps);
 		if (index >= 0) {
+			if (known_plugin_maps[index].active) continue;
 			if (!force_add) continue;
 		} else {	// not found
 			PluginMapStoredInfo inf (map);
 			known_plugin_maps.append (inf);
 			index = known_plugin_maps.size () - 1;
 		}
+		added.append (map);
+	}
+	fixPluginMapLists ();
 
-		if (!known_plugin_maps[index].active) {
-			known_plugin_maps[index].active = true;
-			added.append (map);
+	// activate added (or forced) pluginmaps, *after* the list has been fixed (and info on priority has been read)
+	for (int i = 0; i < known_plugin_maps.size (); ++i) {
+		PluginMapStoredInfo &inf = known_plugin_maps[i];
+		int index = added.indexOf (inf.filename);
+		if (index >= 0) {
+			if (force_add || (inf.priority >= PriorityMedium)) inf.active = true;
+			else (added.removeAt (index));
 		}
 	}
 
@@ -342,7 +352,9 @@
 		}
 
 		if (inf.id.isEmpty ()) {
-			inf.id = RKPluginMapFile::parseId (XMLHelper::getStaticHelper ()->openXMLFile (inf.filename, DL_WARNING));
+			QDomElement de = XMLHelper::getStaticHelper ()->openXMLFile (inf.filename, DL_WARNING);
+			inf.id = RKPluginMapFile::parseId (de);
+			inf.priority = XMLHelper::getStaticHelper ()->getMultiChoiceAttribute (de, "priority", "hidden;low;medium;high", (int) PriorityMedium, DL_WARNING);
 		}
 	}
 

Modified: trunk/rkward/rkward/settings/rksettingsmoduleplugins.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleplugins.h	2013-01-31 12:16:58 UTC (rev 4519)
+++ trunk/rkward/rkward/settings/rksettingsmoduleplugins.h	2013-02-01 17:12:58 UTC (rev 4520)
@@ -75,6 +75,7 @@
 		bool active;
 		bool broken_in_this_version;
 		bool quirky_in_this_version;
+		int priority;
 		QString id;
 		QDateTime last_modified;
 	};
@@ -82,7 +83,9 @@
 public slots:
 	void settingChanged ();
 private:
- 	RKMultiStringSelectorV2 *map_choser;
+	enum PluginMapPriority { PriorityHidden = 0, PriorityLow, PriorityMedium, PriorityHigh };
+
+	RKMultiStringSelectorV2 *map_choser;
 	RKSettingsModulePluginsModel *map_model;
 	QButtonGroup *button_group;
 	QCheckBox *show_code_box;

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2013-01-31 12:16:58 UTC (rev 4519)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2013-02-01 17:12:58 UTC (rev 4520)
@@ -2,7 +2,7 @@
                           rkhtmlwindow  -  description
                              -------------------
     begin                : Wed Oct 12 2005
-    copyright            : (C) 2005, 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2005-2013 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -487,169 +487,181 @@
 	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;
 
-	bool success = false;
-	XMLHelper *component_xml = new XMLHelper ();
-	XMLHelper *help_xml = new XMLHelper ();
+	XMLHelper component_xml;
+	XMLHelper help_xml;
 	QStringList anchors, anchornames;
 
-	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 = RKCommonFunctions::getRKWardDataDir () + "pages/";
-		QString css_filename = QUrl::fromLocalFile (help_base_dir + "rkward_help.css").toString ();
+	RKComponentHandle *chandle = 0;
+	QString help_file_name;
+	QDomElement element;
+	QDomElement component_doc_element;
+	QString help_base_dir = RKCommonFunctions::getRKWardDataDir () + "pages/";
+	QString css_filename = QUrl::fromLocalFile (help_base_dir + "rkward_help.css").toString ();
 
-		// determine help file, and prepare
-		if (for_component) {
-			chandle = componentPathToHandle (url.path ());
-			if (!chandle) break;
+	// determine help file, and prepare
+	if (for_component) {
+		chandle = componentPathToHandle (url.path ());
+		if (!chandle) return false;
 
-			component_doc_element = component_xml->openXMLFile (chandle->getFilename (), DL_ERROR);
-			if (component_doc_element.isNull ()) break;
-			element = component_xml->getChildElement (component_doc_element, "help", DL_ERROR);
-			if (!element.isNull ()) {
-				help_file_name = component_xml->getStringAttribute (element, "file", QString::null, DL_ERROR);
-				if (!help_file_name.isEmpty ()) help_file_name = QFileInfo (chandle->getFilename ()).absoluteDir ().filePath (help_file_name);
-			}
-		} else {
-			help_file_name = help_base_dir + url.path () + ".rkh";
+		component_doc_element = component_xml.openXMLFile (chandle->getFilename (), DL_ERROR);
+		if (component_doc_element.isNull ()) return false;
+		element = component_xml.getChildElement (component_doc_element, "help", DL_ERROR);
+		if (!element.isNull ()) {
+			help_file_name = component_xml.getStringAttribute (element, "file", QString::null, DL_ERROR);
+			if (!help_file_name.isEmpty ()) help_file_name = QFileInfo (chandle->getFilename ()).absoluteDir ().filePath (help_file_name);
 		}
-		RK_DEBUG (APP, DL_DEBUG, "rendering help page for local file %s", help_file_name.toLatin1().data());
+	} else {
+		help_file_name = help_base_dir + url.path () + ".rkh";
+	}
+	RK_DEBUG (APP, DL_DEBUG, "rendering help page for local file %s", help_file_name.toLatin1().data());
 
-		// open help file
-		QDomElement help_doc_element = help_xml->openXMLFile (help_file_name, DL_ERROR);
-		if (help_doc_element.isNull () && (!for_component)) break;
+	// open help file
+	QDomElement help_doc_element = help_xml.openXMLFile (help_file_name, DL_ERROR);
+	if (help_doc_element.isNull () && (!for_component)) return false;
 
-		// 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 ()) {
-				page_title = element.text ();
-			}
+	// 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 ()) {
+			page_title = element.text ();
 		}
-		khtmlpart->write ("<html><head><title>" + page_title + "</title><link rel=\"stylesheet\" type=\"text/css\" href=\"" + css_filename + "\"></head>\n<body><div id=\"main\">\n<h1>" + page_title + "</h1>\n");
+	}
+	khtmlpart->write ("<html><head><title>" + page_title + "</title><link rel=\"stylesheet\" type=\"text/css\" href=\"" + css_filename + "\"></head>\n<body><div id=\"main\">\n<h1>" + page_title + "</h1>\n");
 
-		if (help_doc_element.isNull ()) {
-			RK_ASSERT (for_component);
-			khtmlpart->write (i18n ("<h1>Help page missing</h1>\n<p>The help page for this component has not yet been written (or is broken). Please consider contributing it.</p>\n"));
-		}
-		if (for_component) {
-			QString component_id = componentPathToId (url.path());
-			RKComponentHandle *handle = componentPathToHandle (url.path());
-			if (handle && handle->isAccessible ()) khtmlpart->write ("<a href=\"rkward://runplugin/" + component_id + "/\">" + i18n ("Use %1 now", page_title) + "</a>");
-		}
+	if (help_doc_element.isNull ()) {
+		RK_ASSERT (for_component);
+		khtmlpart->write (i18n ("<h1>Help page missing</h1>\n<p>The help page for this component has not yet been written (or is broken). Please consider contributing it.</p>\n"));
+	}
+	if (for_component) {
+		QString component_id = componentPathToId (url.path());
+		RKComponentHandle *handle = componentPathToHandle (url.path());
+		if (handle && handle->isAccessible ()) khtmlpart->write ("<a href=\"rkward://runplugin/" + component_id + "/\">" + i18n ("Use %1 now", page_title) + "</a>");
+	}
 
-		// fix all elements containing an "src" attribute
-		QDir base_path (QFileInfo (help_file_name).absolutePath());
-		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 = "file://" + QDir::cleanPath (base_path.filePath (src));
-				(*it).setAttribute ("src", src);
-			}
+	// fix all elements containing an "src" attribute
+	QDir base_path (QFileInfo (help_file_name).absolutePath());
+	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 = "file://" + QDir::cleanPath (base_path.filePath (src));
+			(*it).setAttribute ("src", src);
 		}
+	}
 
-		// render the sections
-		element = help_xml->getChildElement (help_doc_element, "summary", DL_INFO);
-		if (!element.isNull ()) {
-			khtmlpart->write (startSection ("summary", i18n ("Summary"), QString (), &anchors, &anchornames));
-			khtmlpart->write (renderHelpFragment (element));
-		}
+	// render the sections
+	element = help_xml.getChildElement (help_doc_element, "summary", DL_INFO);
+	if (!element.isNull ()) {
+		khtmlpart->write (startSection ("summary", i18n ("Summary"), QString (), &anchors, &anchornames));
+		khtmlpart->write (renderHelpFragment (element));
+	}
 
-		element = help_xml->getChildElement (help_doc_element, "usage", DL_INFO);
-		if (!element.isNull ()) {
-			khtmlpart->write (startSection ("usage", i18n ("Usage"), QString (), &anchors, &anchornames));
-			khtmlpart->write (renderHelpFragment (element));
-		}
+	element = help_xml.getChildElement (help_doc_element, "usage", DL_INFO);
+	if (!element.isNull ()) {
+		khtmlpart->write (startSection ("usage", i18n ("Usage"), QString (), &anchors, &anchornames));
+		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) {
-			QString title = help_xml->getStringAttribute (*it, "title", QString (), DL_WARNING);
-			QString shorttitle = help_xml->getStringAttribute (*it, "shorttitle", QString (), DL_DEBUG);
-			QString id = help_xml->getStringAttribute (*it, "id", QString (), DL_WARNING);
-			khtmlpart->write (startSection (id, title, shorttitle, &anchors, &anchornames));
-			khtmlpart->write (renderHelpFragment (*it));
-		}
+	XMLChildList section_elements = help_xml.getChildElements (help_doc_element, "section", DL_INFO);
+	for (XMLChildList::iterator it = section_elements.begin (); it != section_elements.end (); ++it) {
+		QString title = help_xml.getStringAttribute (*it, "title", QString (), DL_WARNING);
+		QString shorttitle = help_xml.getStringAttribute (*it, "shorttitle", QString (), DL_DEBUG);
+		QString id = help_xml.getStringAttribute (*it, "id", QString (), DL_WARNING);
+		khtmlpart->write (startSection (id, title, shorttitle, &anchors, &anchornames));
+		khtmlpart->write (renderHelpFragment (*it));
+	}
 
-		// the section "settings" is the most complicated, as the labels of the individual GUI items has to be fetched from the component description. Of course it is only meaningful for component help, and not rendered for top level help pages.
-		if (for_component) {
-			element = help_xml->getChildElement (help_doc_element, "settings", DL_INFO);
-			if (!element.isNull ()) {
-				khtmlpart->write (startSection ("settings", i18n ("GUI settings"), QString (), &anchors, &anchornames));
-				XMLChildList setting_elements = help_xml->getChildElements (element, QString (), DL_WARNING);
-				for (XMLChildList::iterator it = setting_elements.begin (); it != setting_elements.end (); ++it) {
-					if ((*it).tagName () == "setting") {
-						QString id = help_xml->getStringAttribute (*it, "id", QString (), DL_WARNING);
-						QString title = help_xml->getStringAttribute (*it, "title", QString (), DL_INFO);
-						if (title.isEmpty ()) {
-							QDomElement source_element = component_xml->findElementWithAttribute (component_doc_element, "id", id, true, DL_WARNING);
-							if (source_element.isNull ()) RK_DEBUG (PLUGIN, DL_ERROR, "No such UI element: %s", qPrintable (id));
-							title = component_xml->getStringAttribute (source_element, "label", i18n ("Unnamed GUI element"), DL_WARNING);
-						}
-						khtmlpart->write ("<h4>" + title + "</h4>");
-						khtmlpart->write (renderHelpFragment (*it));
-					} else if ((*it).tagName () == "caption") {
-						QString id = help_xml->getStringAttribute (*it, "id", QString (), DL_WARNING);
-						QString title = help_xml->getStringAttribute (*it, "title", QString (), DL_INFO);
-						QDomElement source_element = component_xml->findElementWithAttribute (component_doc_element, "id", id, true, DL_WARNING);
+	// the section "settings" is the most complicated, as the labels of the individual GUI items has to be fetched from the component description. Of course it is only meaningful for component help, and not rendered for top level help pages.
+	if (for_component) {
+		element = help_xml.getChildElement (help_doc_element, "settings", DL_INFO);
+		if (!element.isNull ()) {
+			khtmlpart->write (startSection ("settings", i18n ("GUI settings"), QString (), &anchors, &anchornames));
+			XMLChildList setting_elements = help_xml.getChildElements (element, QString (), DL_WARNING);
+			for (XMLChildList::iterator it = setting_elements.begin (); it != setting_elements.end (); ++it) {
+				if ((*it).tagName () == "setting") {
+					QString id = help_xml.getStringAttribute (*it, "id", QString (), DL_WARNING);
+					QString title = help_xml.getStringAttribute (*it, "title", QString (), DL_INFO);
+					if (title.isEmpty ()) {
+						QDomElement source_element = component_xml.findElementWithAttribute (component_doc_element, "id", id, true, DL_WARNING);
 						if (source_element.isNull ()) RK_DEBUG (PLUGIN, DL_ERROR, "No such UI element: %s", qPrintable (id));
-						title = component_xml->getStringAttribute (source_element, "label", title, DL_WARNING);
-						khtmlpart->write ("<h3>" + title + "</h3>");
-					} else {
-						help_xml->displayError (&(*it), "Tag not allowed, here", DL_WARNING);
+						title = component_xml.getStringAttribute (source_element, "label", i18n ("Unnamed GUI element"), DL_WARNING);
 					}
+					khtmlpart->write ("<h4>" + title + "</h4>");
+					khtmlpart->write (renderHelpFragment (*it));
+				} else if ((*it).tagName () == "caption") {
+					QString id = help_xml.getStringAttribute (*it, "id", QString (), DL_WARNING);
+					QString title = help_xml.getStringAttribute (*it, "title", QString (), DL_INFO);
+					QDomElement source_element = component_xml.findElementWithAttribute (component_doc_element, "id", id, true, DL_WARNING);
+					if (source_element.isNull ()) RK_DEBUG (PLUGIN, DL_ERROR, "No such UI element: %s", qPrintable (id));
+					title = component_xml.getStringAttribute (source_element, "label", title, DL_WARNING);
+					khtmlpart->write ("<h3>" + title + "</h3>");
+				} else {
+					help_xml.displayError (&(*it), "Tag not allowed, here", DL_WARNING);
 				}
 			}
 		}
+	}
 
-		// "related" section
-		element = help_xml->getChildElement (help_doc_element, "related", DL_INFO);
-		if (!element.isNull ()) {
-			khtmlpart->write (startSection ("related", i18n ("Related functions and pages"), QString (), &anchors, &anchornames));
-			khtmlpart->write (renderHelpFragment (element));
-		}
+	// "related" section
+	element = help_xml.getChildElement (help_doc_element, "related", DL_INFO);
+	if (!element.isNull ()) {
+		khtmlpart->write (startSection ("related", i18n ("Related functions and pages"), QString (), &anchors, &anchornames));
+		khtmlpart->write (renderHelpFragment (element));
+	}
 
-		// "technical" section
-		element = help_xml->getChildElement (help_doc_element, "technical", DL_INFO);
-		if (!element.isNull ()) {
-			khtmlpart->write (startSection ("technical", i18n ("Technical details"), QString (), &anchors, &anchornames));
-			khtmlpart->write (renderHelpFragment (element));
-		}
+	// "technical" section
+	element = help_xml.getChildElement (help_doc_element, "technical", DL_INFO);
+	if (!element.isNull ()) {
+		khtmlpart->write (startSection ("technical", i18n ("Technical details"), QString (), &anchors, &anchornames));
+		khtmlpart->write (renderHelpFragment (element));
+	}
 
-		// create a navigation bar
-		KUrl url_copy = url;
-		QString navigation = i18n ("<h1>On this page:</h1>");
-		RK_ASSERT (anchornames.size () == anchors.size ());
-		for (int i = 0; i < anchors.size (); ++i) {
-			QString anchor = anchors[i];
-			QString anchorname = anchornames[i];
-			if (!(anchor.isEmpty () || anchorname.isEmpty ())) {
-				url_copy.setRef (anchor);
-				navigation.append ("<p><a href=\"" + url_copy.url () + "\">" + anchorname + "</a></p>\n");
-			}
-		}
-		khtmlpart->write ("</div><div id=\"navigation\">" + navigation + "</div>");
-		khtmlpart->write ("</body></html>\n");
-		khtmlpart->end ();
+	// "dependencies" section
+	QList<RKComponentDependency> deps = chandle->getDependencies ();
+	if (!deps.isEmpty ()) {
+		khtmlpart->write (startSection ("dependencies", i18n ("Dependencies"), QString (), &anchors, &anchornames));
+		khtmlpart->write (RKComponentDependency::depsToHtml (deps));
+	}
 
-		QString ref = url.ref ();
-		if (!ref.isEmpty ()) {
-			doGotoAnchor (ref);
+	// "about" section
+	element = help_xml.getChildElement (help_doc_element, "about", DL_INFO);
+	if (element.isNull ()) {
+		XMLHelper pluginmap_helper;
+		element = pluginmap_helper.openXMLFile (chandle->getPluginmapFilename (), DL_ERROR);
+		element = pluginmap_helper.getChildElement (element, "about", DL_INFO);
+	}
+	if (!element.isNull ()) {
+		RKComponentAboutData about (element);
+		khtmlpart->write (startSection ("about", i18n ("About"), QString (), &anchors, &anchornames));
+		khtmlpart->write (about.toHtml ());
+	}
+
+	// create a navigation bar
+	KUrl url_copy = url;
+	QString navigation = i18n ("<h1>On this page:</h1>");
+	RK_ASSERT (anchornames.size () == anchors.size ());
+	for (int i = 0; i < anchors.size (); ++i) {
+		QString anchor = anchors[i];
+		QString anchorname = anchornames[i];
+		if (!(anchor.isEmpty () || anchorname.isEmpty ())) {
+			url_copy.setRef (anchor);
+			navigation.append ("<p><a href=\"" + url_copy.url () + "\">" + anchorname + "</a></p>\n");
 		}
+	}
+	khtmlpart->write ("</div><div id=\"navigation\">" + navigation + "</div>");
+	khtmlpart->write ("</body></html>\n");
+	khtmlpart->end ();
 
-		success = true;
-		break;
+	QString ref = url.ref ();
+	if (!ref.isEmpty ()) {
+		doGotoAnchor (ref);
 	}
 
-	delete (component_xml);
-	delete (help_xml);
-	return (success);
+	return (true);
 }
 
 QString RKHTMLWindow::renderHelpFragment (QDomElement &fragment) {





More information about the rkward-tracker mailing list