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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 8 10:41:39 UTC 2007


Revision: 1088
          http://svn.sourceforge.net/rkward/?rev=1088&view=rev
Author:   tfry
Date:     2007-01-08 02:41:38 -0800 (Mon, 08 Jan 2007)

Log Message:
-----------
Some more on help framework, and some updated copyrights

Modified Paths:
--------------
    trunk/rkward/rkward/misc/rkcommonfunctions.cpp
    trunk/rkward/rkward/misc/rkcommonfunctions.h
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp
    trunk/rkward/rkward/plugin/rkcomponentmap.h
    trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
    trunk/rkward/rkward/plugin/rkstandardcomponent.h
    trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
    trunk/rkward/rkward/plugin/rkstandardcomponentgui.h
    trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp
    trunk/rkward/rkward/windows/rkhtmlwindow.h

Modified: trunk/rkward/rkward/misc/rkcommonfunctions.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkcommonfunctions.cpp	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/misc/rkcommonfunctions.cpp	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkcommonfunctions  -  description
                              -------------------
     begin                : Mon Oct 17 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/misc/rkcommonfunctions.h
===================================================================
--- trunk/rkward/rkward/misc/rkcommonfunctions.h	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/misc/rkcommonfunctions.h	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkcommonfunctions  -  description
                              -------------------
     begin                : Mon Oct 17 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkcomponentmap.cpp  -  description
                              -------------------
     begin                : Thu May 12 2005
-    copyright            : (C) 2005, 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.h	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.h	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkcomponentmap.h  -  description
                              -------------------
     begin                : Thu May 12 2005
-    copyright            : (C) 2005, 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkstandardcomponent  -  description
                              -------------------
     begin                : Sun Feb 19 2006
-    copyright            : (C) 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.h	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.h	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkstandardcomponent  -  description
                              -------------------
     begin                : Sun Feb 19 2006
-    copyright            : (C) 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkstandardcomponentgui  -  description
                              -------------------
     begin                : Sun Mar 19 2006
-    copyright            : (C) 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -166,7 +166,7 @@
 	QString id = RKComponentMap::getComponentId (component->getHandle ());
 
 	QString path = QStringList::split ("::", id).join ("/");
-	RKWorkplace::mainWorkplace ()->openHelpWindow (KURL ("rkcomponent:///" + path));
+	RKWorkplace::mainWorkplace ()->openHelpWindow (KURL ("rkward://component/" + path));
 }
 
 void RKStandardComponentGUI::closeEvent (QCloseEvent *e) {

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.h
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.h	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.h	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkstandardcomponentgui  -  description
                              -------------------
     begin                : Sun Mar 19 2006
-    copyright            : (C) 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 

Modified: trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh
===================================================================
--- trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh	2007-01-08 10:41:38 UTC (rev 1088)
@@ -7,7 +7,7 @@
 		Compute the most common descriptive statistics for one or more numeric vectors
 	</summary>
 	<usage>
-		If there are general usage instruction, not tied to an option, specify them here (see <link href="rkcomponent:///basic_statistics">testtitle</link>)
+		If there are general usage instruction, not tied to an option, specify them here (see <link href="rkward://component/basic_statistics">testtitle</link>, and <link href="rkward://component/basic_statistics"/>, and <link href="rkward://rhelp/print"/>, and <link href="rkward://page/basic_functions"/>)
 
 		Next paragraph
 		Same paragraph
@@ -15,11 +15,13 @@
 	<settings>
 		<setting id="x">Select one or more numeric vectors to analyse</setting>
 		<setting id="mean">Should the mean value be computed?</setting>
-		<setting id="trim">Trim of the mean. See <link href="rhelp:///mean"/></setting>
+		<setting id="trim">Trim of the mean. See <link href="rkward://rhelp/mean"/></setting>
 	</settings>
 	<related>
-		<link href="rhelp:///mean"/>
-		<link href="rkcomponent:///basic_statistics"/>
-		<link href="rkhelp:///basic_functions"/>
+		<ul>
+			<li><link href="rkward://rhelp/mean"/></li>
+			<li><link href="rkward://component/basic_statistics"/></li>
+			<li><link href="rkward://page/basic_functions"/></li>
+		</ul>
 	</related>
 </document>

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkhtmlwindow  -  description
                              -------------------
     begin                : Wed Oct 12 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -362,43 +362,46 @@
 	// TODO: real error handling
 	bool ok = true;
 	qDebug ("here1 %s", url.prettyURL ().latin1 ());
-	if (url.protocol () == "rkcomponent") {
-		ok = renderRKHelp (url);
-	} else if (url.protocol () == "rhelp") {
-		// TODO: find a nice solution to render this in the current window
-		RKGlobals::helpDialog ()->getFunctionHelp (url.path ());
-	} else if (url.protocol () == "rkhelp") {
-		ok = renderRKHelp (url);
+	if (url.protocol () == "rkward") {
+		if (url.host () == "component") {
+			ok = renderRKHelp (url);
+		} else if (url.host () == "rhelp") {
+			// TODO: find a nice solution to render this in the current window
+			RKGlobals::helpDialog ()->getFunctionHelp (url.path ().mid (1));
+			return true;
+		} else if (url.host () == "page") {
+			ok = renderRKHelp (url);
+		}
+
+		if (!ok) {
+			khtmlpart->begin (url);
+			khtmlpart->write ("<html><body><h1>" + i18n ("Page does not exist or is broken") + "</h1></body></html>");
+			khtmlpart->end ();
+		}
+	
+		changeURL (url);
+		return ok;
 	} else {
 		return (RKHTMLWindow::openURL (url));
 	}
-
-	if (!ok) {
-		khtmlpart->begin (url);
-		khtmlpart->write ("<html><body><h1>" + i18n ("Page does not exist or is broken") + "</h1></body></html>");
-		khtmlpart->end ();
-	}
-
-	changeURL (url);
-	return ok;
 }
 
 bool RKHelpWindow::renderRKHelp (const KURL &url) {
 	RK_TRACE (APP);
 
+	if (url.protocol () != "rkward") {
+		RK_ASSERT (false);
+		return (false);
+	}
+
 	qDebug ("here2 %s", url.path ().latin1 ());
-	if (url.protocol () == "rkcomponent") {
+	if (url.host () == "component") {
 		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.
-			QStringList path_segments = QStringList::split ('/', url.path ());
-			if (path_segments.count () > 2) break;
-			if (path_segments.count () < 1) break;
-			if (path_segments.count () == 1) path_segments.push_front ("rkward");
-			RK_ASSERT (path_segments.count () == 2);
-			RKComponentHandle *chandle = RKComponentMap::getComponentHandle (path_segments.join ("::"));
+			RKComponentHandle *chandle = componentPathToHandle (url.path ());
 			if (!chandle) break;
 
 			qDebug ("here3");
@@ -434,6 +437,11 @@
 
 			// TODO: handle settings section
 
+			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));
+			}
 			// TODO: handle related section
 
 			khtmlpart->end ();
@@ -468,7 +476,9 @@
 	ret.prepend ("<p>");
 	ret.append ("</p>");
 	ret.replace ("\n\n", "</p>\n<p>");
+	// TOOD: prettification: the fragment's old tag (e.g. <summary> is still present inthe output)
 
+	qDebug ("%s", ret.latin1 ());
 	return ret;
 }
 
@@ -477,9 +487,32 @@
 	qDebug ("link");
 
 	link_element->setTagName ("a");
-	if (link_element->text ().isNull ()) {
-		link_element->appendChild (link_element->ownerDocument ().createTextNode ("TODO: determine link title"));
+	if (link_element->text ().isEmpty ()) {
+		QString text;
+		KURL url = link_element->attribute ("href");
+		if (url.protocol () == "rkward") {
+			if (url.host () == "component") {
+				RKComponentHandle *chandle = componentPathToHandle (url.path ());
+				chandle ? text = chandle->getLabel () : text = i18n ("BROKEN REFERENCE");
+			} else if (url.host () == "rhelp") {
+				text = i18n ("R Reference on '%1'").arg (url.path ().mid (1));
+			} else if (url.host () == "page") {
+				text = "TODO: some help page";
+			}
+			link_element->appendChild (link_element->ownerDocument ().createTextNode (text));
+		}
 	}
 }
 
+RKComponentHandle *RKHelpWindow::componentPathToHandle (QString path) {
+	RK_TRACE (APP);
+
+	QStringList path_segments = QStringList::split ('/', path);
+	if (path_segments.count () > 2) return 0;
+	if (path_segments.count () < 1) return 0;
+	if (path_segments.count () == 1) path_segments.push_front ("rkward");
+	RK_ASSERT (path_segments.count () == 2);
+	return (RKComponentMap::getComponentHandle (path_segments.join ("::")));
+}
+
 #include "rkhtmlwindow.moc"

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.h	2007-01-08 00:58:44 UTC (rev 1087)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.h	2007-01-08 10:41:38 UTC (rev 1088)
@@ -2,7 +2,7 @@
                           rkhtmlwindow  -  description
                              -------------------
     begin                : Wed Oct 12 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -138,6 +138,7 @@
 };
 
 class QDomElement;
+class RKComponentHandle;
 
 /**
 	\brief Show html help files.
@@ -161,6 +162,7 @@
 	bool renderRKHelp (const KURL &url);
 	QString renderHelpFragment (QDomElement &fragment);
 	void prepareHelpLink (QDomElement *link_element);
+	RKComponentHandle *componentPathToHandle (QString path);
 };
 
 #endif


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